Package processing.sound
Class MultiChannel
java.lang.Object
processing.sound.MultiChannel
This class provides methods for querying the multi-channel output
capabilities of audio devices, and for providing fine-grained control for the
routing of sounds when outputting on a device with more than 2 channels.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
static int
activeChannel
(int channel) Controls which output channel sounds will be played back to.static int
static int
autoSelectDevice
(int minChannels) Finds the audio device (sound card) with the highest number of output channels, and selects it as the output device.
This method is just a convenient shorthand for what is probably the most frequent multi-channel device selection use case.static int
static int
availableChannels
(int deviceId) Gets the number of output channels available on a given devicestatic void
connectToOutput
(SoundObject o, int channel) Connects a SoundObject to the given output channel.static void
disconnectFromOutput
(SoundObject o, int channel) Disconnects a SoundObject from the given output channel.static ChannelOut[]
outputs()
Returns the JSynChannelOut
objects that are being played to by the synthesizerstatic boolean
Force using PortAudio instead of JavaSound.
-
Constructor Details
-
MultiChannel
public MultiChannel()
-
-
Method Details
-
autoSelectDevice
public static int autoSelectDevice(int minChannels) Finds the audio device (sound card) with the highest number of output channels, and selects it as the output device.
This method is just a convenient shorthand for what is probably the most frequent multi-channel device selection use case. You could implement the same (and even more precise) programmatic control over device selection in your own sketch usingSound.list()
,MultiChannel.availableChannels()
andSound.outputDevice()
.- See Also:
-
Sound.list()
Sound#outputDevice()
availableChannels()
-
autoSelectDevice
public static int autoSelectDevice() -
activeChannel
public static int activeChannel(int channel) Controls which output channel sounds will be played back to. After selecting a new output channel, all sounds that start `play()`ing will be sent to that channel.- Parameters:
channel
- the channel number to send sounds to- Returns:
- the channel number that sounds will be sent to
- See Also:
-
activeChannel
public static int activeChannel() -
connectToOutput
Connects a SoundObject to the given output channel. Use this only for SoundObjects that are already playing back on some channel, to have them play back on another channel at the same time. -
disconnectFromOutput
Disconnects a SoundObject from the given output channel. Only use on SoundObjects that were previously connected using connectToOutput()- See Also:
-
connectToOutput()
-
availableChannels
public static int availableChannels(int deviceId) Gets the number of output channels available on a given device- Parameters:
deviceId
- the id of the device whose number of output channels should be returned. If none is given, gets information about the current device.- Returns:
- the number of output channels available on the given device
- See Also:
-
availableChannels
public static int availableChannels() -
outputs
Returns the JSynChannelOut
objects that are being played to by the synthesizer- See Also:
-
usePortAudio
public static boolean usePortAudio()Force using PortAudio instead of JavaSound. Support for 24 bit audio interfaces on Windows requires using the native PortAudio bindings instead of the default JavaSound one. The Sound library will automatically check for and load PortAudio when it is necessary to do so. However, whenSound.list()
is called before selecting an output device, it might show an incorrect number of channels for multi-channel interfaces. By explicitly loading PortAudio ahead of time you can ensure thatSound.list()
will show accurate channel numbers from the start. Returnstrue
if PortAudio was successfully loaded.- See Also:
-