quicktime.sound
Class SPB

java.lang.Object
  |
  +--quicktime.util.QTByteObject
        |
        +--quicktime.sound.SPB
All Implemented Interfaces:
quicktime.jdirect.InterfaceLib, quicktime.jdirect.PrimitivesLib, quicktime.jdirect.QuickTimeLib, java.io.Serializable, quicktime.jdirect.SharedLibrary, com.apple.jdirect.SharedLibrary

public final class SPB
extends QTByteObject
implements quicktime.jdirect.QuickTimeLib

The SPB class is used in conjunction with a SPBDevice to record sound. It contains fields that describe how much sound the device should record and a buffer of memory where the recorded sound is recorded.

See Also:
Serialized Form

Field Summary
static int kNativeSize
          This is the size (the number of bytes) that are required for this class
 
Fields inherited from interface quicktime.jdirect.QuickTimeLib
JDirect_MacOSX, libraryInstance, name
 
Constructor Summary
SPB(SPBDevice device, int count, int milliseconds, QTPointerRef buffer)
          Create a SPB.
 
Method Summary
 QTPointerRef getBuffer()
          Sets the buffer that the device will record into.
 int getBufferLength()
          Get the number of bytes that are or were recorded.
 int getCount()
          Get the number of bytes that are or were recorded.
 SPBDevice getDevice()
          Gets the device that is attached to this object.
 short getError()
          You can call this to check the value of the error code.
 int getMilliseconds()
          Get the the number of milliseconds that are or were recorded.
 boolean isRecording()
          The status of the recording.
 short meterLevel()
          The level of the meter.
 int numberOfMsecsRecorded()
          The total number of msecs recorded.
 int numberOfSamplesRecorded()
          The total number of samples recorded.
 void pauseRecording()
          Pause recording from a sound input device.
 void record(boolean flag)
          Record audio data into memory, either synchronously or asynchronously.
 void removeCompletionProc()
           
 void resumeRecording()
          Pause recording from a sound input device.
 void setBuffer(QTPointerRef buffer)
          Sets the buffer that the device will record into.
 void setCompletionProc(SICompletion comp)
           
 void setCount(int count)
          Sets the number of bytes that are to be recorded.
 void setMilliseconds(int msecs)
          Sets the the number of milliseconds that are to be recorded.
 void stopRecording()
          End a recording from a sound input device.
 int totalMsecsToRecord()
          The total number of msecs to record.
 int totalSamplesToRecord()
          The total number of samples to record.
 
Methods inherited from class quicktime.util.QTByteObject
equals, fromArray, getBytes, getSize, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kNativeSize

public static final int kNativeSize
This is the size (the number of bytes) that are required for this class
Constructor Detail

SPB

public SPB(SPBDevice device,
           int count,
           int milliseconds,
           QTPointerRef buffer)
Create a SPB.
Parameters:
device - the SPBDevice that is to be used for recording the sound
count - how many bytes of data to record
milliseconds - On input, the number of milliseconds to record. If this field indicates a longer recording time than the count field, then the count field is ignored.
buffer - A QTPointer to the buffer for the sampled-sound data. If this buffer length is too small to contain the amount of sampled-sound data specified in the count and milliseconds fields, then recording time is truncated so that the sampled-sound data fits in the buffer.
Method Detail

setCompletionProc

public void setCompletionProc(SICompletion comp)

removeCompletionProc

public void removeCompletionProc()

getCount

public int getCount()
Get the number of bytes that are or were recorded.
Returns:
number of bytes

setCount

public void setCount(int count)
Sets the number of bytes that are to be recorded.
Parameters:
count - number of bytes

getBufferLength

public int getBufferLength()
Get the number of bytes that are or were recorded.
Returns:
number of bytes

getMilliseconds

public int getMilliseconds()
Get the the number of milliseconds that are or were recorded.
Returns:
number of milliseconds

setMilliseconds

public void setMilliseconds(int msecs)
Sets the the number of milliseconds that are to be recorded.
Parameters:
msecs - milliseconds

getDevice

public SPBDevice getDevice()
Gets the device that is attached to this object.
Returns:
the SPBDevice

setBuffer

public void setBuffer(QTPointerRef buffer)
Sets the buffer that the device will record into.
Parameters:
buffer - the record buffer

getBuffer

public QTPointerRef getBuffer()
Sets the buffer that the device will record into.
Parameters:
buffer - the record buffer

getError

public short getError()
You can call this to check the value of the error code. An error code > 0 means that an Async recording is still occuring. An error code == 0 means no recording and no error. An error code < 0 means that an error has occured and recording is terminated.

record

public void record(boolean flag)
            throws SoundException
Record audio data into memory, either synchronously or asynchronously. The sound is recorded into the specified buffer. If it is recorded synchronously then the error code will be checked and an exception thrown if required. If recorded asynchronously then the application will need to check for errors after the recording has completed with the checkError code. After recording the buffer contains the recorded bytes, the count how many bytes were recorded, the milliseconds how many milliseconds of sound were recorded based on the current settings of the device.

QuickTime::SPBRecord

Parameters:
flag - if true record asynchronously, if false records synchronously.

pauseRecording

public void pauseRecording()
                    throws SoundException
Pause recording from a sound input device.

QuickTime::SPBPauseRecording


resumeRecording

public void resumeRecording()
                     throws SoundException
Pause recording from a sound input device.

QuickTime::SPBResumeRecording


stopRecording

public void stopRecording()
                   throws SoundException
End a recording from a sound input device. If you call the checkError instance method you will get an abortErr exception which indicates that the recording was stopped by calling this method.

QuickTime::SPBStopRecording


isRecording

public boolean isRecording()
                    throws SoundException
The status of the recording. While the input device is recording, this call returns true. When a recording terminates without an error, this call false. When an error occurs during recording or the recording has been terminated by a call to the SPBStopRecording function (abortErr), this call throws an exception.

QuickTime::SPBGetRecordingStatus


meterLevel

public short meterLevel()
                 throws SoundException
The level of the meter. While the input device is recording, this call returns the level.

QuickTime::SPBGetRecordingStatus

Returns:
the current meter level

totalSamplesToRecord

public int totalSamplesToRecord()
                         throws SoundException
The total number of samples to record.

QuickTime::SPBGetRecordingStatus

Returns:
the total number of samples to record

numberOfSamplesRecorded

public int numberOfSamplesRecorded()
                            throws SoundException
The total number of samples recorded.

QuickTime::SPBGetRecordingStatus

Returns:
the total number of samples recorded

totalMsecsToRecord

public int totalMsecsToRecord()
                       throws SoundException
The total number of msecs to record.

QuickTime::SPBGetRecordingStatus

Returns:
the total number of msecs to record

numberOfMsecsRecorded

public int numberOfMsecsRecorded()
                          throws SoundException
The total number of msecs recorded.

QuickTime::SPBGetRecordingStatus

Returns:
the total number of msecs recorded