Class MultiChannel

java.lang.Object
processing.sound.MultiChannel

public abstract class MultiChannel extends Object
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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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 device
    static void
    connectToOutput(SoundObject o, int channel)
    Connects a SoundObject to the given output channel.
    static void
    Disconnects a SoundObject from the given output channel.
    static ChannelOut[]
    Returns the JSyn ChannelOut objects that are being played to by the synthesizer
    static boolean
    Force using PortAudio instead of JavaSound.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 using Sound.list(), MultiChannel.availableChannels() and Sound.outputDevice().
      See Also:
    • 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

      public static void connectToOutput(SoundObject o, int channel)
      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

      public static void disconnectFromOutput(SoundObject o, int channel)
      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

      public static ChannelOut[] outputs()
      Returns the JSyn ChannelOut 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, when Sound.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 that Sound.list() will show accurate channel numbers from the start. Returns true if PortAudio was successfully loaded.
      See Also: