Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TMediaType
Inherited By:
None.
Purpose:
Specifies a format for audio data. It consists of four things:
- An audio format (represented by a TToken), such as linear, offset binary, mu-law, or A-law.
- A sample rate, measured in samples per second.
- A sample width, measured in bits per sample.
- A unique TToken value designating the audio data format type.
Format tokens are predefined for linear, offset binary, mu-law and A-law data. You may need to add new formats for compressed data, etc. To add a new type of audio to the Sound system you must also choose a unique name for the typeName parameter by prepending your company name to the string.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
Derive TAudioType only if you need to add a new data field in addition to format, rate, sample width. Your derived class must guarantee valid values for format, rate, sample width, and must provide a unique name for the typeName parameter by prepending your company name to the string.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
Member Function: TAudioType::GetLinear16Bit44KHz
static const TAudioType & GetLinear16Bit44KHz ()
Interface Category:
API.
Purpose:
Returns a const reference to the CommonPoint standard type CD Quality, 16-bit linear, 44,100 Hz audio.
Calling Context:
Call directly to pass this type as a parameter in a Sound system member function. Used by TSound, by AudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
const TAudioType& -The CommonPoint standard audio type.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetLinear8bit22KHz
static const TAudioType & GetLinear8bit22KHz ()
Interface Category:
API.
Purpose:
Returns a const reference to the CommonPoint standard type for medium quality, 8-bit linear, 22,050 Hz audio.
Calling Context:
Call directly to pass this type as a parameter in a Sound system member function. Used by TSound, by AudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
const TAudioType& -The CommonPoint standard audio type.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetOffsetBinary8bit22KHz
static const TAudioType & GetOffsetBinary8bit22KHz ()
Interface Category:
API.
Purpose:
Returns a const reference to the CommonPoint standard type for medium quality, 8-bit offset binary, 22,050 Hz audio.
Calling Context:
Call directly to pass this type as a parameter in a Sound system member function. Used by TSound, by AudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
const TAudioType& -The CommonPoint standard audio type.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetMuLaw8KHz
static const TAudioType & GetMuLaw8KHz ()
Interface Category:
API.
Purpose:
Returns a const reference to the CommonPoint standard type for telephone quality, 8-bit mu-law, 8,000 Hz audio.
Calling Context:
Call directly to pass this type as a parameter in a Sound system member function.
Parameters:
Return Value:
const TAudioType& -The CommonPoint standard audio type.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetALaw8KHz
static const TAudioType & GetALaw8KHz ()
Interface Category:
API.
Purpose:
Returns a const reference to the CommonPoint standard type for telephone quality, 8-bit a-law, 8,000 Hz audio.
Calling Context:
Call directly to pass this type as a parameter in a Sound system member function.
Parameters:
Return Value:
const TAudioType& -The CommonPoint standard audio type.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
- TAudioType ()
- TAudioType (const TAudioType &)
- TAudioType (const TToken & typeName, const TToken & format, const SampleWidth sampleWidth, const SampleRate sampleRate)
Interface Category:
API.
Purpose:
- Default constructor. Undefined values.
- Copy constructor.
- Creates a TAudioType, allowing all values to be specified.
Calling Context:
- Call directly to create an undefined object that will immediately be assigned to or streamed into.
- Call directly to copy an object.
- Call directly to create a fully specified audio type. Normally, you call GetLinear16Bit44KHz, GetLinear8bit22KHz, GetMuLaw8KHz, or GetALaw8KHz to create a stock type.
Parameters:
- Takes no parameters.
- const TAudioType & -The audio type you want to copy.
- const TToken & typeName -A unique TToken value designating the audio data type.
- const TToken & format -An audio format. Use GetLinear, GetOffsetBinary, GetMuLaw, GetALaw, or pass in your own.
- const SampleWidth sampleWidth -The bits per sample. Typically 8 or 16.
- const SampleRate sampleRate -The sample rate, in samples per second.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TAudioType ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Call by Runtime to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::operator=
TAudioType & operator =(const TAudioType &)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call directly when an object is assigned to another compatible object.
Parameters:
- const TAudioType & -The source object for the assignment.
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetDataType
TToken GetDataType () const
Interface Category:
API.
Purpose:
Returns a TToken that identifies the audio data type with a unique name. Predefined type names are used by GetLinear16Bit44KHz, GetLinear8bit22KHz, GetMuLaw8KHz, or GetALaw8KHz.
Calling Context:
Call directly to see what the name of an audio data type is.
Parameters:
Return Value:
TToken -A token with the type name in it.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetFormat
TToken GetFormat () const
Interface Category:
API.
Purpose:
Returns a TToken that specifies the audio format of this audio type.
Calling Context:
Call directly to see what the format of an audio type is. Used by TSound, by TAudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
TToken -A token with the format in it.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
See GetLinear, GetOffsetBinary, GetMuLaw, GetALaw, which return audio formats.
Member Function: TAudioType::SetFormat
void SetFormat (const TToken &)
Interface Category:
API.
Purpose:
Sets the audio format of this audio type.
Calling Context:
Call directly to change the format of an existing audio type.
Parameters:
- const TToken & -The audio format.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
See GetLinear, GetOffsetBinary, GetMuLaw, GetALaw, which return audio formats.
Member Function: TAudioType::GetSampleWidth
SampleWidth GetSampleWidth () const
Interface Category:
API.
Purpose:
Returns the sample width, in bits per sample, for this audio type.
Calling Context:
Call directly to see what the sample width of an audio type is. Used by TSound, by TAudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
TAudioType::SampleWidth -The sample width of this audio type. Typically 8 or 16.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::SetSampleWidth
void SetSampleWidth (SampleWidth)
Interface Category:
API.
Purpose:
Sets the sample width, in bits per sample, of an audio type.
Calling Context:
Call directly to change the sample width of an existing audio type.
Parameters:
- SampleWidth -The sample width, in bits per sample, of an audio type.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetSampleRate
SampleRate GetSampleRate () const
Interface Category:
API.
Purpose:
Returns the sample rate, in samples per second, for this audio type.
Calling Context:
Call directly to see what the sample rate of an audio type is. Used by TAudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
TAudioType::SampleRate -The sample rate of the audio type.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::SetSampleRate
void SetSampleRate (SampleRate)
Interface Category:
API.
Purpose:
Sets the sample rate, in samples per second, of an audio type.
Calling Context:
Call directly to change the sample rate of an existing audio type. Used by TAudioSequence derived classes
Parameters:
- SampleRate -The new sample rate, in samples per second.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetLinear
static const TToken & GetLinear ()
Interface Category:
API.
Purpose:
Returns a token specifying linear (2's complement) samples.
Calling Context:
Call directly to specify linear audio when creating an audio type. Used by TSound, by TAudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
const TToken& -A token specifying linear (2's complement) samples.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetOffsetBinary
static const TToken & GetOffsetBinary ()
Interface Category:
API.
Purpose:
Returns a token specifying offset binary samples. Offset binary samples have a minimum value of 0, a median value of 128, and a maximum value of 255.
Calling Context:
Call directly to specify offset binary audio when creating an audio type. Used by TSound, by TAudioSequence derived classes and by SoundServer.
Parameters:
Return Value:
const TToken& -A token specifying offset binary samples.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetMuLaw
static const TToken & GetMuLaw ()
Interface Category:
API.
Purpose:
Returns a token specifying mu-law samples. Telephone systems in North America use mu-law audio.
Calling Context:
Call directly to specify mu-law audio when creating an audio type.
Parameters:
Return Value:
const TToken& -A token specifying mu-law samples.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::GetALaw
static const TToken & GetALaw ()
Interface Category:
API.
Purpose:
Returns a token specifying a-law samples. A-law audio is found on telephone systems in Europe.
Calling Context:
Call directly to specify a-law audio when creating an audio type.
Parameters:
Return Value:
const TToken& -A token specifying a-law samples.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::operator<<=
virtual TStream & operator <<= (TStream & fromWhere)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Call directly to stream in data.
Parameters:
- TStream & fromWhere -The stream the object streams itself in from.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws TInvalidVersionError if the versions don't match.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::operator>>=
virtual TStream & operator >>=(TStream & toWhere) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Call directly to stream out the object.
Parameters:
- TStream & toWhere -The stream the object streams itself out to.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TAudioType::Hash
virtual long Hash () const
Interface Category:
API.
Purpose:
Generates a hash value.
Calling Context:
Called by collection classes.
Parameters:
Return Value:
The hash value.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.