forked from libpd/libpd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tentative allowing variable ticks per buffer
This is a tentative implementation of variable ticks per buffer. It's currently for evaluation only and may or may not be folded back into the main branch.
- Loading branch information
1 parent
1b13c02
commit 311aef1
Showing
13 changed files
with
107 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
/** | ||
* | ||
* Some tests for messaging and MIDI support in libpd. Basically, this class tests everything except | ||
* the parts of libpd that matter. If you have any idea how to write tests for the signal processing | ||
* the parts of libpd that matter. If you have any idea how to write real tests for the signal processing | ||
* part, please let me know. | ||
* | ||
* @author Peter Brinkmann ([email protected]) | ||
|
@@ -39,8 +39,10 @@ public class PdBaseTest { | |
|
||
@BeforeClass | ||
public static void loadPatch() throws IOException { | ||
PdBase.openAudio(2, 3, 44100); | ||
PdBase.subscribe("eggs"); | ||
patch = PdBase.openPatch("javatests/org/puredata/core/test_java.pd"); | ||
PdBase.computeAudio(true); | ||
} | ||
|
||
@AfterClass | ||
|
@@ -60,6 +62,25 @@ public void setUp() { | |
public void tearDown() { | ||
// Do nothing; just here for symmetry. | ||
} | ||
|
||
@Test | ||
public void testAudio() { | ||
float in[] = new float[256]; | ||
float out[] = new float[768]; | ||
for (int i = 0; i < 256; i++) { | ||
in[i] = i; | ||
} | ||
int err = PdBase.process(2, in, out); | ||
assertEquals(0, err); | ||
for (int i = 0; i < 128; i++) { | ||
assertEquals(2 * i, out[3 * i], 0.0001); | ||
assertEquals(-6 * i, out[3 * i + 1], 0.0001); | ||
assertEquals(Math.cos(2 * Math.PI * 440 / 44100 * i), out[3 * i + 2], 0.0001); | ||
} | ||
for (int i = 384; i < 768; i++) { | ||
assertEquals(0, out[i], 0); | ||
} | ||
} | ||
|
||
@Test | ||
public void testBlockSize() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.