-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the MultiChannelOutput and LowLevelEngine examples
- Loading branch information
1 parent
5a796d0
commit 781b0e7
Showing
3 changed files
with
41 additions
and
20 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 |
---|---|---|
@@ -1,25 +1,34 @@ | ||
import processing.sound.*; | ||
|
||
import com.jsyn.devices.*; | ||
import com.jsyn.Synthesizer; | ||
import com.jsyn.devices.jportaudio.JPortAudioDevice; | ||
|
||
void setup() { | ||
|
||
// get hardware device information | ||
// print audio device information to the console | ||
Sound.list(); | ||
|
||
AudioDeviceManager m = Sound.getAudioDeviceManager(); | ||
println("Audio device manager: " + m); | ||
if (m instanceof JPortAudioDevice) { | ||
println("Using the PortAudio device for 24 bit support on Windows"); | ||
} | ||
|
||
|
||
// get synthesis runtime information | ||
Synthesizer s = Sound.getSynthesizer(); | ||
// a lot of this information can be gleaned with one look by calling Sound.status(); | ||
println("Current CPU usage: " + s.getUsage()); | ||
// to improve support for USB audio interfaces on Windows, it is possible to | ||
// use the PortAudio library, which is however not enabled by default. The | ||
// listing above might therefore not have given accurate input/output channel | ||
// numbers. The library automatically loads PortAudio drivers when | ||
// Sound.outputDevice() is called on a device that it is unable to use | ||
// correctly with the default drivers, OR you can always load them explicitly | ||
// using MultiChannel.usePortAudio(). | ||
if (MultiChannel.usePortAudio()) { | ||
// if PortAudio was loaded successfully, the ids and names of the sound | ||
// devices (and possibly their number of input/output channels) will have | ||
// changed! | ||
Sound.list(); | ||
} | ||
|
||
// the Sound.status() method prints some general information about the current | ||
// memory and CPU usage of the library to the console | ||
Sound.status(); | ||
|
||
// to get programmatic access to the same information (and more), you can get | ||
// and inspect the JSyn Synthesizer class yourself: | ||
Synthesizer s = Sound.getSynthesizer(); | ||
println("Current CPU usage: " + s.getUsage()); | ||
|
||
} | ||
|
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