quicktime.sound
Class SndChannel

java.lang.Object
  |
  +--quicktime.QTObject
        |
        +--quicktime.sound.SndChannel
All Implemented Interfaces:
quicktime.jdirect.InterfaceLib, quicktime.jdirect.SharedLibrary, com.apple.jdirect.SharedLibrary, quicktime.jdirect.SoundLib

public final class SndChannel
extends QTObject
implements quicktime.jdirect.InterfaceLib, quicktime.jdirect.SoundLib

Sound Channels are used to playback sound.


Fields inherited from interface quicktime.jdirect.InterfaceLib
JDirect_MacOSX, libraryInstance
 
Fields inherited from interface quicktime.jdirect.SoundLib
JDirect_MacOSX, libraryInstance
 
Constructor Summary
SndChannel()
          Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.
SndChannel(int synth, int init)
          Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.
SndChannel(int synth, int init, SoundCallBack callback)
          Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.
SndChannel(SoundCallBack callback)
          Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.
 
Method Summary
 void doCommand(SndCommand cmd)
          The SndDoCommand function sends the sound command specified in the cmd parameter to the end of the command queue of the channel specified in the chan parameter.
 void doCommand(SndCommand cmd, boolean noWait)
          The SndDoCommand function sends the sound command specified in the cmd parameter to the end of the command queue of the channel specified in the chan parameter.
 void doImmediate(SndCommand cmd)
          The SndDoImmediate function operates much like SndDoCommand, except that it bypasses the existing command queue of the sound channel and sends the specified command directly to the Sound Manager for immediate processing.
 void enableClock(boolean flag)
          Returns the current clock of the SoundClock.
 LevelMeterInfo getActiveLevels()
          Gets the level values.
 Clock getClock()
          Returns the current clock of the SoundClock.
 MediaEQSpectrumBands getEQSpectrumBands(int count)
          Pass in the count of bands you expect to get back, it would return the the actual value of bands available with their frequncy limits.
 int[] getEQSpectrumLevels(int count)
          Gets the Equalizer Band Levels.
 int[] getEQToneControlGain()
          Gets the values of the bass and treble tone control gain values.
 boolean getEQToneControlOnOff()
          Returns true if the tone control (bass and treble) are enabled.
 boolean getLevelMeterOnOff()
          Gets Level Meter state.
 boolean isFinished()
          Returns true if the channel is both NOT busy and NOT paused - ie.
 boolean isPaused()
          Returns true if the channel is currently paused.
 boolean isQuietNow()
          Returns the current setting of the quietNow flag.
 void play(SndHandle sndHdl)
          Plays a sound asynchronously from memory.
 void setEQSpectrumBands(MediaEQSpectrumBands spectrumInfo)
          Set the array of fequencies that are used to calculate spectral information.
 void setEQToneControlGain(int bass, int treble)
          Sets the values of the bass and treble tone control gain values.
 void setEQToneControlOnOff(boolean flag)
          If true enables the tone control (bass and treble).
 void setLevelMeterOnOff(boolean enabled)
          Sets Level Meter state.
 void setQuietNow(boolean flag)
          This flag controls whether a sound channel is silent when it is disposed of.
 SCStatus status()
          The fields of the record returned by this call accurately describe the sound channel specified.
 
Methods inherited from class quicktime.QTObject
disposeQTObject, equals, ID, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SndChannel

public SndChannel()
           throws QTException
Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.

QuickTime::SndNewChannel


SndChannel

public SndChannel(int synth,
                  int init)
           throws QTException
Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.

QuickTime::SndNewChannel

Parameters:
synth - the sound data type you intend to play on this channel
init - the desired initialization parameters for the channel.

SndChannel

public SndChannel(SoundCallBack callback)
           throws QTException
Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.

QuickTime::SndNewChannel

Parameters:
synth - the sound data type you intend to play on this channel
init - the desired initialization parameters for the channel.
callback - the (optional) callback that can be called when a sound has completed.

SndChannel

public SndChannel(int synth,
                  int init,
                  SoundCallBack callback)
           throws QTException
Opens a new SndChannel and allocates memory to store the commands that will control the operation of the sound channel.

QuickTime::SndNewChannel

Parameters:
synth - the sound data type you intend to play on this channel
init - the desired initialization parameters for the channel.
callback - the (optional) callback that can be called when a sound has completed.
Method Detail

isQuietNow

public boolean isQuietNow()
Returns the current setting of the quietNow flag.

setQuietNow

public void setQuietNow(boolean flag)
This flag controls whether a sound channel is silent when it is disposed of. If this is false, then when the SndChannel is diposed, the disposal call becomes synchronous and waits until the the sound is actually finished. If this is true, the SndChannel's queue is flushed immediately, which may silent a sound if it is playing.
The default setting is to allow the sound to finish playing (the flag is set to false). If you wish to explicitly stop a sound when you dispose the channel then set this to true.

play

public void play(SndHandle sndHdl)
          throws SoundException
Plays a sound asynchronously from memory.

QuickTime::SndPlay QuickTime::SndPlay

Parameters:
chan - if supplied the sound is played asynchronously using this channel
sndHdl - the handle that has the sound data in it

isFinished

public boolean isFinished()
                   throws SoundException
Returns true if the channel is both NOT busy and NOT paused - ie. there are no commands to waiting to be processed for the channel and it is not paused.
Returns:
a boolean

isPaused

public boolean isPaused()
                 throws SoundException
Returns true if the channel is currently paused.
Returns:
a boolean

status

public SCStatus status()
                throws SoundException
The fields of the record returned by this call accurately describe the sound channel specified.
Returns:
SCStatus

doCommand

public void doCommand(SndCommand cmd)
               throws SoundException
The SndDoCommand function sends the sound command specified in the cmd parameter to the end of the command queue of the channel specified in the chan parameter. The noWait is set to true
Parameters:
cmd - A sound command to be sent to the channel

doCommand

public void doCommand(SndCommand cmd,
                      boolean noWait)
               throws SoundException
The SndDoCommand function sends the sound command specified in the cmd parameter to the end of the command queue of the channel specified in the chan parameter.
Parameters:
cmd - A sound command to be sent to the channel
noWait - noWait A flag indicating whether the Sound Manager should wait for a free space in a full queue (FALSE) or whether it should return immediately with a queueFull result code if the queue is full (TRUE).

doImmediate

public void doImmediate(SndCommand cmd)
                 throws SoundException
The SndDoImmediate function operates much like SndDoCommand, except that it bypasses the existing command queue of the sound channel and sends the specified command directly to the Sound Manager for immediate processing.
Parameters:
cmd - A sound command to be sent to the channel

getLevelMeterOnOff

public boolean getLevelMeterOnOff()
                           throws SoundException
Gets Level Meter state.
Returns:
the balance value

setLevelMeterOnOff

public void setLevelMeterOnOff(boolean enabled)
                        throws SoundException
Sets Level Meter state.
Parameters:
enabled - true if enabled

enableClock

public void enableClock(boolean flag)
                 throws SoundException
Returns the current clock of the SoundClock.
Returns:
the clock

getClock

public Clock getClock()
               throws SoundException
Returns the current clock of the SoundClock.
Returns:
the clock

getActiveLevels

public LevelMeterInfo getActiveLevels()
                               throws SoundException
Gets the level values.
Returns:
LevelMeterInfo object

getEQSpectrumBands

public MediaEQSpectrumBands getEQSpectrumBands(int count)
                                        throws SoundException
Pass in the count of bands you expect to get back, it would return the the actual value of bands available with their frequncy limits.
Returns:
MediaEQSpectrumBandsRecord object

setEQSpectrumBands

public void setEQSpectrumBands(MediaEQSpectrumBands spectrumInfo)
                        throws SoundException
Set the array of fequencies that are used to calculate spectral information. The frequencies are the upper limits for each band, thus the first frequency specified (say 100) will set that first band from 0 to 100Hz, the second value (say 200) sets the second band from 100 to 200Hz.
Parameters:
spectrumInfo - MediaEQSpectrumBandsRecord object

getEQSpectrumLevels

public int[] getEQSpectrumLevels(int count)
                          throws SoundException
Gets the Equalizer Band Levels. The levels are equal to supplied the bands count.
Returns:
bandLevels

getEQToneControlOnOff

public boolean getEQToneControlOnOff()
                              throws SoundException
Returns true if the tone control (bass and treble) are enabled.
Returns:
a boolean.

setEQToneControlOnOff

public void setEQToneControlOnOff(boolean flag)
                           throws SoundException
If true enables the tone control (bass and treble).
Parameters:
flag - a boolean.

setEQToneControlGain

public void setEQToneControlGain(int bass,
                                 int treble)
                          throws SoundException
Sets the values of the bass and treble tone control gain values. Range is 0 to 255 unity gain. You can overdrive these values...
Parameters:
bass - the sound bass
treble - the sound treble

getEQToneControlGain

public int[] getEQToneControlGain()
                           throws SoundException
Gets the values of the bass and treble tone control gain values. Range is 0 to 255 unity gain. You can overdrive these values...
Returns:
an array on length 2, containing 1st element as bass and 2nd element as treble.