quicktime.sound
Class SPBDevice

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

public final class SPBDevice
extends QTObject
implements quicktime.jdirect.QuickTimeLib


Fields inherited from interface quicktime.jdirect.QuickTimeLib
JDirect_MacOSX, libraryInstance, name
 
Constructor Summary
SPBDevice(java.lang.String deviceName, int permission)
          The SPBOpenDevice function attempts to open a sound input device having the name indicated by the deviceName parameter.
 
Method Summary
 int bytesToMilliseconds(int bytes)
          Reports how many milliseconds are required to record the specified bytes amount of sound data, given the input deviceÕs current sample rate, sample size, number of channels, and compression factor.
static SPBDevice fromSoundChannel(SGSoundChannel sc)
          Get the Sound Input Driver

QuickTime::SGGetSoundInputDriver QuickTime::SGGetSoundInputDriver

 int[] getActiveLevels()
          Get the current signal level for each active channel.
 boolean getAutomaticGainControl()
          Get the state of the automatic gain control.
 int getChannelAvailable()
          Get the maximum number of channels this device can record.
 int[] getCompressionAvailable()
          Returns an integer (OSTypes) list containing the available compression types.
 int getCompressionType()
          Returns the current compression type.
static java.lang.String getIndexedDevice(int count)
          You can use the SPBGetIndexedDevice function to help generate a list of sound input devices.
 float getInputGain()
          Get the input gain level.
 int getInputSource()
          Get the input Source Index.
 java.lang.String[] getInputSourceNames()
          Get a list of the names of all the sound input sources supported by the sound input device
 int getLevelMeterLevel()
          Get the current level of the level meter.
 boolean getLevelMeterOnOff()
          Get the current state of the level meter.
 java.lang.String getName()
          Returns the name of this device.
 int getNumberChannels()
          Returns the number of channels that this device is to record.
 int getPlayThruOnOff()
          Get the PlayThru level, 0 means it's off.
 float getSampleRate()
          Gets the sample rate produced by this device.
 float[] getSampleRateAvailable()
          Returns a float list containing the sample rates available.
 int getSampleSize()
          Returns the number of bits per sample.
 int[] getSampleSizeAvailable()
          Returns an integer list containing the sample sizes available.
 float getStereoInputGainLeft()
          Returns the current gain setting for the left channel of a stereo device

QuickTime::SPBGetDeviceInfo

 float getStereoInputGainRight()
          Returns the current gain setting for the right channel of a stereo device

QuickTime::SPBGetDeviceInfo

 boolean hasOptionsDialog()
          Returns true if the current device supports an options dialog box and false if not.
 int millisecondsToBytes(int msecs)
          Reports how many bytes are required to store a recording of duration milliseconds, given the input deviceÕs current sample rate, sample size, number of channels, and compression factor.
 void setAutomaticGainControl(boolean flag)
          Set the state of the automatic gain control.
 void setCompressionType(int compType)
          Set the compression type.
 void setInputGain(float gain)
          Set the input gain level.
 void setInputSource(int source)
          sets the input Source to the passed in (index) source.
 void setLevelMeterOnOff(boolean flag)
          Set the current state of the level meter.
 void setNumberChannels(int channels)
          Sets the number of channels that this device is to record.
 void setPlayThruOnOff(int volume)
          Set the PlayThru level, 0 means it's off.
 void setSampleRate(float rate)
          Set the sample rate to be produced by this device.
 void setSampleSize(int sampleSize)
          Set the number of bits per sample.
 void setStereoInputGain(float leftChannel, float rightChannel)
          Set the the current stereo sound input gain.
 void showOptionsDialog()
          Shows the options dialog if available.
 java.lang.String toString()
          A String representation of the class.
 
Methods inherited from class quicktime.QTObject
disposeQTObject, equals, ID
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SPBDevice

public SPBDevice(java.lang.String deviceName,
                 int permission)
          throws SoundException
The SPBOpenDevice function attempts to open a sound input device having the name indicated by the deviceName parameter.

QuickTime::SPBOpenDevice

Parameters:
deviceName - The name of the sound input device to open, or the empty string if the default sound input device is to be opened.
permission - A flag that indicates whether subsequent operations with that device are to be read/write or read-only.
Method Detail

getIndexedDevice

public static java.lang.String getIndexedDevice(int count)
                                         throws SoundException
You can use the SPBGetIndexedDevice function to help generate a list of sound input devices.
Parameters:
count - The index number of the sound input device you wish to obtain information about. 2return the name of the sound input device specified by the count parameter or null if there isn't a device at that index.

fromSoundChannel

public static SPBDevice fromSoundChannel(SGSoundChannel sc)
                                  throws StdQTException
Get the Sound Input Driver

QuickTime::SGGetSoundInputDriver QuickTime::SGGetSoundInputDriver

Returns:
the Sound Input driver in use by this channel.
See Also:
SGSoundChannel.getInputDriver()

millisecondsToBytes

public int millisecondsToBytes(int msecs)
                        throws SoundException
Reports how many bytes are required to store a recording of duration milliseconds, given the input deviceÕs current sample rate, sample size, number of channels, and compression factor.

QuickTime::SPBMillisecondsToBytes

Parameters:
msecs - how many milliseconds you wish to record
Returns:
how many bytes you would require to record the specifiec milliseconds.

bytesToMilliseconds

public int bytesToMilliseconds(int bytes)
                        throws SoundException
Reports how many milliseconds are required to record the specified bytes amount of sound data, given the input deviceÕs current sample rate, sample size, number of channels, and compression factor.

QuickTime::SPBBytesToMilliseconds

Parameters:
bytes - how many bytes you wish to record
Returns:
how many milliseconds.

setLevelMeterOnOff

public void setLevelMeterOnOff(boolean flag)
                        throws SoundException
Set the current state of the level meter.

QuickTime::SPBGetDeviceInfo

Parameters:
flag - set to true to turn the channel on, false to turn it off.

getLevelMeterOnOff

public boolean getLevelMeterOnOff()
                           throws SoundException
Get the current state of the level meter.

QuickTime::SPBGetDeviceInfo

Returns:
a boolean that determines whether the channel is on or off.

getLevelMeterLevel

public int getLevelMeterLevel()
                       throws SoundException
Get the current level of the level meter.

QuickTime::SPBGetDeviceInfo

Returns:
an integer that signals the current level of the channel.

setAutomaticGainControl

public void setAutomaticGainControl(boolean flag)
                             throws SoundException
Set the state of the automatic gain control.

QuickTime::SPBGetDeviceInfo

Parameters:
flag - set to true to turn automatic gain on, false to turn it off.

getAutomaticGainControl

public boolean getAutomaticGainControl()
                                throws SoundException
Get the state of the automatic gain control.

QuickTime::SPBGetDeviceInfo

Returns:
a boolean that determines whether automatic gain is on or off.

setInputGain

public void setInputGain(float gain)
                  throws SoundException
Set the input gain level.

QuickTime::SPBGetDeviceInfo

Parameters:
gain - a float (fixed value) to set the gain to.

getInputGain

public float getInputGain()
                   throws SoundException
Get the input gain level.

QuickTime::SPBGetDeviceInfo

Returns:
a float (fixed) of the current level on the input gain.

getInputSource

public int getInputSource()
                   throws SoundException
Get the input Source Index.

QuickTime::SPBGetDeviceInfo

Returns:
an integr which is the index of the current sound input source

setInputSource

public void setInputSource(int source)
                    throws SoundException
sets the input Source to the passed in (index) source.

QuickTime::SPBGetDeviceInfo


getInputSourceNames

public java.lang.String[] getInputSourceNames()
                                       throws SoundException
Get a list of the names of all the sound input sources supported by the sound input device

getChannelAvailable

public int getChannelAvailable()
                        throws SoundException
Get the maximum number of channels this device can record.

QuickTime::SPBGetDeviceInfo

Returns:
the maximum number of channels this device can record.

getNumberChannels

public int getNumberChannels()
                      throws SoundException
Returns the number of channels that this device is to record.

QuickTime::SPBGetDeviceInfo

Returns:
channels number of channels

setNumberChannels

public void setNumberChannels(int channels)
                       throws SoundException
Sets the number of channels that this device is to record.

QuickTime::SPBGetDeviceInfo

Parameters:
channels - number of channels

getPlayThruOnOff

public int getPlayThruOnOff()
                     throws SoundException
Get the PlayThru level, 0 means it's off.

QuickTime::SPBGetDeviceInfo

Returns:
the current PlayThru level.

setPlayThruOnOff

public void setPlayThruOnOff(int volume)
                      throws SoundException
Set the PlayThru level, 0 means it's off.

QuickTime::SPBGetDeviceInfo


setSampleRate

public void setSampleRate(float rate)
                   throws SoundException
Set the sample rate to be produced by this device.

QuickTime::SPBGetDeviceInfo

Parameters:
rate - the rate of the device

getSampleRate

public float getSampleRate()
                    throws SoundException
Gets the sample rate produced by this device.

QuickTime::SPBGetDeviceInfo

Returns:
the rate of the device

getSampleRateAvailable

public float[] getSampleRateAvailable()
                               throws SoundException
Returns a float list containing the sample rates available.

QuickTime::SPBGetDeviceInfo

Returns:
a float array containing the list of sample rates.

setSampleSize

public void setSampleSize(int sampleSize)
                   throws SoundException
Set the number of bits per sample.

QuickTime::SPBGetDeviceInfo

Parameters:
sampleSize - is the number of bits in an individual sample.

getSampleSize

public int getSampleSize()
                  throws SoundException
Returns the number of bits per sample.

QuickTime::SPBGetDeviceInfo

Returns:
number of bits in a sample.

getSampleSizeAvailable

public int[] getSampleSizeAvailable()
                             throws SoundException
Returns an integer list containing the sample sizes available.

QuickTime::SPBGetDeviceInfo

Returns:
an integer array containing the list of samples.

setStereoInputGain

public void setStereoInputGain(float leftChannel,
                               float rightChannel)
                        throws SoundException
Set the the current stereo sound input gain.

QuickTime::SPBGetDeviceInfo

Parameters:
leftChannel - the gain for the left channel (range 0.5 to 1.5)
rightChannel - the gain for the right channel (range 0.5 to 1.5)

getStereoInputGainLeft

public float getStereoInputGainLeft()
                             throws SoundException
Returns the current gain setting for the left channel of a stereo device

QuickTime::SPBGetDeviceInfo

Returns:
the gain setting

getStereoInputGainRight

public float getStereoInputGainRight()
                              throws SoundException
Returns the current gain setting for the right channel of a stereo device

QuickTime::SPBGetDeviceInfo

Returns:
the gain setting

setCompressionType

public void setCompressionType(int compType)
                        throws SoundException
Set the compression type.

QuickTime::SPBGetDeviceInfo

Parameters:
compType - the compressor type.

getCompressionType

public int getCompressionType()
                       throws SoundException
Returns the current compression type.

QuickTime::SPBGetDeviceInfo

Returns:
the compression type

getCompressionAvailable

public int[] getCompressionAvailable()
                              throws SoundException
Returns an integer (OSTypes) list containing the available compression types.

QuickTime::SPBGetDeviceInfo

Returns:
an integer array containing the list of compression types.

hasOptionsDialog

public boolean hasOptionsDialog()
                         throws SoundException
Returns true if the current device supports an options dialog box and false if not.

QuickTime::SPBGetDeviceInfo

Returns:
a boolean

showOptionsDialog

public void showOptionsDialog()
                       throws SoundException
Shows the options dialog if available.

QuickTime::SPBGetDeviceInfo


getName

public java.lang.String getName()
                         throws SoundException
Returns the name of this device.

QuickTime::SPBGetDeviceInfo

Returns:
a String

getActiveLevels

public int[] getActiveLevels()
                      throws SoundException
Get the current signal level for each active channel.
Returns:
an short[] of the current signal level

toString

public java.lang.String toString()
Description copied from class: QTObject
A String representation of the class.
Overrides:
toString in class QTObject
Returns:
a String representation of this object.