Class: TSamples

Declaration: Audio.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TTime

Inherited By:

None.

Purpose:

A TTime derived class used to represent time in samples. Samples are used for measuring position within a sound in units of audio samples instead of, say, seconds or milliseconds.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Not intended to be derived.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TSamples::TSamples

  1. TSamples ()
  2. TSamples (PositionDelta theSamples, TAudioType :: SampleRate theSampleRate)
  3. TSamples (const TTime & theTime, TAudioType :: SampleRate theSampleRate)
  4. TSamples (const TSamples & theTime)

Interface Category:

API.

Purpose:

  1. Default constructor. Creates a TSamples with an undefined time value and an undefined sample rate.
  2. Creates a TSamples given a number of samples and a sample rate
  3. Creates a TSamples given an existing TTime (or TTime derived class) and a sample rate. The number of samples in this case is the TTime value multiplied by the sample rate.
  4. Copy constructor.

Calling Context:

  1. Call directly to create an undefined object that will immediately be assigned to or streamed into.
  2. This is the most commonly used constructor. It is called to allow you to create a TSamples based upon a number of samples and a sample rate.
  3. Call directly if you have an existing TTime (or TTime derived class, such as TSeconds) and you want to create a TSamples from it.
  4. Call directly to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSamples::~TSamples

virtual ~ TSamples ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called 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: TSamples::operator=

  1. TSamples & operator =(const TSamples & theSamples)
  2. TSamples & operator =(const TTime & theTime)

Interface Category:

API.

Purpose:

  1. Assignment operator.
  2. Assigns a TTime to a TSamples.

Calling Context:

  1. Call directly when an object is assigned to another compatible object.
  2. Call directly when a TTime is assigned to this object.

Parameters:

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: TSamples::GetSamples

PositionDelta GetSamples () const

Interface Category:

API.

Purpose:

This commonly called member function returns the number of samples represented by a TSamples. This is how you extract the sample value from the TSamples object.

Calling Context:

Call directly to get the value of this object in units of samples.

Parameters:

Return Value:

TSamples::PositionDelta -A signed quantity representing the value of this time object in units of samples.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSamples::operator<<=

virtual TStream & operator <<= (TStream & fromWhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Call directly to stream in the object.

Parameters:

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: TSamples::operator>>=

virtual TStream & operator >>=(TStream & toWhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Call directly to stream out the object.

Parameters:

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: TSamples::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Generates the hash value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The hash value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSamples::GetSampleRate

TAudioType :: SampleRate GetSampleRate () const

Interface Category:

API.

Purpose:

Returns the value of the time in samples. This is a commonly called member function, as it is the only way to get the value of the time in samples.

Calling Context:

Call this function directly.

Parameters:

Return Value:

TAudioType::SampleRate -The sample rate.

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.