IMMAudioBuffer

The IMMAudioBuffer class provides a buffering mechanism that allows device classes to operate on a buffer as if it were a file. It is recommended that you set up the type and format of audio data that is to be recorded or playing. Using buffers improves the performance of multimedia applications that perform numerous file input and output operations when accessing media devices. You might want to use a buffer for applications that perform many input and output operations that are less than 4KB each. However, if your operations are larger than 4KB, then you might not want to use a buffer. In this situation, you will see little to no performance gain. You might have performance degradation, because your application will have to copy data in big blocks at a time.


IMMAudioBuffer - Member Functions and Data by Group

Constructors & Destructor

You can construct, copy, and destruct objects of this class.


[view class]
~IMMAudioBuffer
public:
~IMMAudioBuffer()

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
IMMAudioBuffer


Overload 1
public:
IMMAudioBuffer(const IMMAudioBuffer& audioBuffer)

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Overload 2
public:
IMMAudioBuffer(void* audioData, unsigned long dataLength)

You can construct an IMMAudioBuffer from the following:

audioData
Initialize the audio buffer with this.
dataLength
Initialize the size of the audio buffer to this.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Overload 3
public:
IMMAudioBuffer(unsigned long dataLength = 0)

You can construct an IMMAudioBuffer from the following:

dataLength
The size of the audio buffer to be created. It is initialized with all 0's.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


[view class]
operator =
public:
IMMAudioBuffer& operator =( const IMMAudioBuffer& audioBuffer )

Copies the audio buffer information from the passed in audio buffer.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


Audio Attributes

Use these members to query and set the audio attributes for the audio buffer.


[view class]
bitsPerSample
public:
unsigned long bitsPerSample() const

Returns the number of bits-per-sample. This is the number of bits of data used to represent each sample of each channel. The standard values are 4, 8, and 16.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
blockAlignment
public:
unsigned long blockAlignment() const

Returns the block alignment of data in bytes. The system processes a multiple of block-aligned bytes of data at a time. For example, if you have a 24-byte buffer, then you can only set a block alignment of 2, 3, 4, 6, 8, or 12.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
bytesPerSecond
public:
unsigned long bytesPerSecond() const

Returns the average number of bytes-per-second played or recorded. This is the rate the data is transferred to the hardware.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
channels
public:
unsigned long channels() const

Returns the number of audio channels set. For example, mono is 1; stereo is 2.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
samplesPerSecond
public:
unsigned long samplesPerSecond() const

Returns the number of samples-per-second played or recorded. This is the sampling rate, in kilohertz, which each channel should use. Standard values are 11025, 22050, and 44100.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setBitsPerSample
public:
IMMAudioBuffer& setBitsPerSample( unsigned long bitsPerSample )

Sets the bits-per-sample to be played or recorded. This is the number of bits of data used to represent each sample of each channel. The standard values are 4, 8, and 16.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setBlockAlignment
public:
IMMAudioBuffer& setBlockAlignment(unsigned long alignment)

Sets the block alignment of the data. The system processes a multiple of block-aligned bytes of data at a time. For example, if you have a 24-byte buffer, then you can only set a block alignment of 2, 3, 4, 6, 8, or 12.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setBytesPerSecond
public:
IMMAudioBuffer& setBytesPerSecond( unsigned long averageBytes )

Sets the average bytes per second to be played or recorded. This is the rate the data is transferred to the hardware.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setChannels
public:
IMMAudioBuffer& setChannels(unsigned long channels)

Sets the number of audio channels for playing and recording. Monaural is 1; stereo is 2.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setSamplesPerSecond
public:
IMMAudioBuffer& setSamplesPerSecond( unsigned long samplesPerSecond )

Sets the sampling rate for playing and recording. This is the sampling rate, in kilohertz, which each channel should use. Standard values are 11025, 22050, and 44100.

Supported Platforms

Windows OS/2 AIX
No Yes No


Buffer Management

Use these members to query and set the buffer data and to query the length of the buffer.


[view class]
data
public:
IString data() const

Returns an IString that contains a copy of the data in the audio buffer.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
headerData
public:
IString headerData() const

Returns an IString that contains the operating system specific header information.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
length
public:
unsigned long length() const

Returns the size of the buffer.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setData
public:
IMMAudioBuffer& setData( const void* data, unsigned long dataLength )

Sets the contents and size of the audio buffer to those of the passed-in buffer.

Supported Platforms

Windows OS/2 AIX
No Yes No


Content Type

Use these members to set and query the quality of the audio content.


[view class]
contentType
public:
ContentType contentType() const

Returns the audio content type.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setContentType
public:
IMMAudioBuffer& setContentType(ContentType contentType)

Sets the audio content type.

Supported Platforms

Windows OS/2 AIX
No Yes No


Format

Use these members to set and query the format of the audio data.


[view class]
format
public:
Format format() const

Returns the interpretation of the audio format. This is what format the audio data is in.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setFormat
public:
IMMAudioBuffer& setFormat(Format tag = pcm)

Sets the audio format to be used. This determines what format the audio data is in.

Supported Platforms

Windows OS/2 AIX
No Yes No


Media Type

Use these members to query and set the type of media in the buffer.


[view class]
mediaType
public:
unsigned long mediaType() const

Returns the type of multimedia data in the buffer.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
setMediaType
public:
IMMAudioBuffer& setMediaType(unsigned long media = audio)

Sets the type of multimedia data in the buffer.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
audio
public:
static const unsigned long audio

Represents audio data.

Supported Platforms

Windows OS/2 AIX
No Yes No


IMMAudioBuffer - Enumerations


[view class]
ContentType
enum ContentType { Unknown, 
                   Voice, 
                   Music, 
                   HiFi=0x0004 }

Use this enumeration for determining the quality of the audio content. Valid values are the following:

unknown
Represents unknown audio quality.
voice
Represents voice (limited range) quality.
music
Represents FM radio or equivalent quality.
hifi
Represents high quality.

Supported Platforms

Windows OS/2 AIX
No Yes No


[view class]
Format
enum Format { pcm=0x0001, 
              adpcm, 
              ibmcvsd=0x0005, 
              alaw, 
              mulaw, 
              okiadpcm=0x0010, 
              dviadpcm, 
              digistd=0x0015, 
              digifix, 
              ibmmulaw=0x0101, 
              ibmalaw, 
              avcadpcm, 
              ctadpcm=0x0200 }

Use this enumeration for determining how audio information is stored and interpreted. The pcm format is the most commonly used format. Valid values are the following:

pcm
Represents pulse code modulation. This refers to a variation of a digital signal to represent audio amplitude. This method of assigning binary values to amplitude levels supports the conversion of analog signals to digital signals by sound cards.
adpcm
Represents adaptive differential pulse code modulation. This is a technique for compressing waveform samples. It can reduce the amount of data storage required by a factor of 16 to 1, but some price is paid in fidelity for the higher compression rates.
ibmcvsd
Represents the IBM Speech Viewer format.
alaw
Represents the CCITT A-Law format.
mulaw
Represents the CCITT MuLaw format.
okiadpcm
Represents the OKI adaptive pulse code modulation format.
dviadpcm
Represents the DVI adaptive pulse code modulation format.
digistd
Represents the IBM Digispeech standard format.
digifix
Represents the IBM Digispeech fixed format.
ibmmulaw
Represents the IBM MuLaw format.
ibmalaw
Represents the IBM A-Law format.
avcadpcm
Represents IBM AVC adaptive differential pulse code modulation format.
ctadpcm
Represents the Creative Labs adaptive differential pulse code modulation format.

Supported Platforms

Windows OS/2 AIX
Yes Yes No


IMMAudioBuffer - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data