28package com.jogamp.openal.test.manual;
30import java.io.BufferedReader;
31import java.io.IOException;
32import java.io.InputStreamReader;
33import java.util.concurrent.TimeUnit;
35import com.jogamp.common.os.Clock;
36import com.jogamp.openal.ALFactory;
37import com.jogamp.openal.JoalVersion;
38import com.jogamp.openal.util.SimpleSineSynth;
55 public static float atof(
final String str,
final float def) {
57 return Float.parseFloat(str);
58 }
catch (
final Exception ex) {
65 final BufferedReader stdin =
new BufferedReader(
new InputStreamReader(System.in));
66 System.err.println(message);
68 final String s = stdin.readLine();
69 System.err.println(s);
71 }
catch (
final IOException e) { e.printStackTrace(); }
75 public static void main(
final String[] args) {
77 for(
int i=0; i<args.length; i++) {
78 if(args[i].equals(
"-f")) {
80 freq =
atof(args[i], freq);
88 System.err.println(
"o1 0: "+o1);
90 System.err.println(
"o1 1: "+o1);
95 System.err.println(
"o2 0: "+o2);
97 System.err.println(
"o2 1: "+o2);
101 final float min = 100, max = 10000, step = 30;
102 final long t0 = Clock.currentNanos();
103 for(
float f=min; f<max; f+=step) {
108 }
catch (
final InterruptedException e) { }
110 final long t1 = Clock.currentNanos();
111 final int exp = (int)( (max - min) / step ) * o1.
getLatency();
112 final int has = (int)TimeUnit.NANOSECONDS.toMillis(t1-t0);
113 final int diff = has - exp;
114 System.err.println(
"Loop "+has+
" / "+exp+
" [ms], diff "+diff+
" [ms], "+((
float)diff/(float)exp) * 100f+
"%");
116 System.err.println(
"o1: "+o1);
117 System.err.println(
"o2: "+o2);
This class provides factory methods for generating AL and ALC objects.
static ALC getALC()
Get the default ALC object.
static JoalVersion getInstance()
StringBuilder toString(final ALC alc, StringBuilder sb)
Return JogampVersion package information and AL informal strings.
Using two continuous simple off-thread mutable sine wave synthesizer.
static String enterValue(final String message)
static void main(final String[] args)
static float atof(final String str, final float def)
A continuous simple off-thread mutable sine wave synthesizer.
int getLatency()
Returns latency or frame-duration in milliseconds.
void setFreq(final float f)
void setAmplitude(final float a)
static final float MIDDLE_C