Skip to content

Commit

Permalink
Merge pull request #4 from umjammer/0.0.5
Browse files Browse the repository at this point in the history
0.0.5
  • Loading branch information
umjammer authored Dec 2, 2024
2 parents 15845a7 + b36acf5 commit a4dd8c5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>vavi</groupId>
<artifactId>vavi-sound-dx7</artifactId>
<version>0.0.4</version>
<version>0.0.5</version>

<properties>
<vavi.test.volume>0.02</vavi.test.volume>
Expand Down
29 changes: 17 additions & 12 deletions src/test/java/vavi/sound/dx7/Dx7SynthesizerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ static boolean localPropertiesExists() {
return Files.exists(Paths.get("local.properties"));
}

static final float volume = Float.parseFloat(System.getProperty("vavi.test.volume.midi", "0.2"));
@Property(name = "vavi.test.volume.midi")
float midiVolume = 0.2f;

@Property(name = "vavi.test.volume")
double volume = 0.02;

@BeforeEach
void setup() throws IOException {
Expand All @@ -76,7 +80,6 @@ void setup() throws IOException {
}

@Property(name = "test.midi")
final
String midi = "src/test/resources/test.mid";

@Test
Expand All @@ -98,17 +101,17 @@ void test() throws Exception {

CountDownLatch countDownLatch = new CountDownLatch(1);
MetaEventListener mel = meta -> {
//System.err.println("META: " + meta.getType());
//Debug.println("META: " + meta.getType());
if (meta.getType() == 47) {
countDownLatch.countDown();
}
};
sequencer.setSequence(seq);
sequencer.addMetaEventListener(mel);
System.err.println("START");
Debug.println("START");
sequencer.start();

volume(receiver, volume); // gervill volume works!
volume(receiver, midiVolume); // gervill volume works!

if (!System.getProperty("vavi.test", "").equals("ide")) {
Thread.sleep(10 * 1000);
Expand All @@ -117,7 +120,7 @@ void test() throws Exception {
} else {
countDownLatch.await();
}
System.err.println("END");
Debug.println("END");
sequencer.removeMetaEventListener(mel);
sequencer.close();

Expand All @@ -130,7 +133,7 @@ void test2() throws Exception {
synthesizer.open();
Debug.println("synthesizer: " + synthesizer);

volume(synthesizer.getReceiver(), volume); // gervill volume works!
volume(synthesizer.getReceiver(), midiVolume); // gervill volume works!

MidiChannel channel = synthesizer.getChannels()[0];
for (int i = 0; i < 32; i++) {
Expand Down Expand Up @@ -188,7 +191,7 @@ void test3() throws Exception {
System.err.println("START");
sequencer.start();

volume(receiver, volume); // gervill volume works!
volume(receiver, midiVolume); // gervill volume works!

if (!System.getProperty("vavi.test", "").equals("ide")) {
Thread.sleep(10 * 1000);
Expand All @@ -207,11 +210,13 @@ void test3() throws Exception {

/** */
public static void main(String[] args) throws Exception {
t3(args);
Dx7SynthesizerTest app = new Dx7SynthesizerTest();
app.setup();
app.t3(args);
}

/** */
public static void t3(String[] args) throws Exception {
public void t3(String[] args) throws Exception {
final int nSamples = 20 * 1024;
final float sampleRate = 44100.0f;
Instrument instrument = new Dx7Soundbank().getInstrument(new ModelPatch(0, 0, true));
Expand Down Expand Up @@ -264,7 +269,7 @@ public static void t3(String[] args) throws Exception {
line.close();
}

public static void t2(String[] args) throws Exception {
public void t2(String[] args) throws Exception {
final int nSamples = 20 * 1024;
final float sampleRate = 44100.0f;
Instrument[] instruments = new Dx7Soundbank().getInstruments();
Expand Down Expand Up @@ -317,7 +322,7 @@ public static void t2(String[] args) throws Exception {
line.close();
}

public static void t1(String[] args) throws Exception {
public void t1(String[] args) throws Exception {
final int nSamples = 10 * 1024;
final float sampleRate = 44100.0f;

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/vavi/sound/dx7/FilerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void runfmbench() {

double elapsed = System.currentTimeMillis() - start;
double nsPerSample = 1e9 * elapsed / nBuf / niter;
Debug.printf("fm op kernel: %f ms/sample\n", nsPerSample);
Debug.printf("fm op kernel: %f ms/sample\n", nsPerSample);
}

@Test
Expand Down Expand Up @@ -212,7 +212,7 @@ void runSawBench() {

double elapsed = System.currentTimeMillis() - start;
double nsPerSample = 1e9 * elapsed / nBuf / niter;
Debug.printf("sawtooth %gHz: %f ms/sample\n", f, nsPerSample);
Debug.printf("sawtooth %gHz: %f ms/sample\n", f, nsPerSample);
}
}

Expand Down Expand Up @@ -250,7 +250,7 @@ void runLadderBench() {

double elapsed = System.currentTimeMillis() - start;
double nsPerSample = 1e9 * elapsed / nBuf / niter;
Debug.printf("ladder %s: %f ms/sample\n", nl != 0 ? "nonlinear" : "linear", nsPerSample);
Debug.printf("ladder %s: %f ms/sample\n", nl != 0 ? "nonlinear" : "linear", nsPerSample);
}
}
}
1 change: 0 additions & 1 deletion src/test/java/vavi/sound/dx7/SawtoothTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ static boolean localPropertiesExists() {
}

@Property(name = "vavi.test.volume")
final
double volume = 0.2;

@BeforeEach
Expand Down

0 comments on commit a4dd8c5

Please sign in to comment.