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.
You can construct, copy, and destruct objects of this class.
![]() |
public:
~IMMAudioBuffer()
Windows | OS/2 | AIX |
Yes | Yes | No |
![]() |
public:
IMMAudioBuffer(const IMMAudioBuffer& audioBuffer)
Windows | OS/2 | AIX |
Yes | Yes | No |
public:
IMMAudioBuffer(void* audioData, unsigned long dataLength)
You can construct an IMMAudioBuffer from the following:
Windows | OS/2 | AIX |
Yes | Yes | No |
public:
IMMAudioBuffer(unsigned long dataLength = 0)
You can construct an IMMAudioBuffer from the following:
Windows | OS/2 | AIX |
Yes | Yes | No |
![]() |
public:
IMMAudioBuffer& operator =( const IMMAudioBuffer& audioBuffer )
Copies the audio buffer information from the passed in audio buffer.
Windows | OS/2 | AIX |
Yes | Yes | No |
Use these members to query and set the audio attributes for the audio buffer.
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
unsigned long channels() const
Returns the number of audio channels set. For example, mono is 1; stereo is 2.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
IMMAudioBuffer& setChannels(unsigned long channels)
Sets the number of audio channels for playing and recording. Monaural is 1; stereo is 2.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
Use these members to query and set the buffer data and to query the length of the buffer.
![]() |
public:
IString data() const
Returns an IString that contains a copy of the data in the audio buffer.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
IString headerData() const
Returns an IString that contains the operating system specific header information.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
unsigned long length() const
Returns the size of the buffer.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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.
Windows | OS/2 | AIX |
No | Yes | No |
Use these members to set and query the quality of the audio content.
![]() |
public:
ContentType contentType() const
Returns the audio content type.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
IMMAudioBuffer& setContentType(ContentType contentType)
Sets the audio content type.
Windows | OS/2 | AIX |
No | Yes | No |
Use these members to set and query the format of the audio data.
![]() |
public:
Format format() const
Returns the interpretation of the audio format. This is what format the audio data is in.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
IMMAudioBuffer& setFormat(Format tag = pcm)
Sets the audio format to be used. This determines what format the audio data is in.
Windows | OS/2 | AIX |
No | Yes | No |
Use these members to query and set the type of media in the buffer.
![]() |
public:
unsigned long mediaType() const
Returns the type of multimedia data in the buffer.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
IMMAudioBuffer& setMediaType(unsigned long media = audio)
Sets the type of multimedia data in the buffer.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
public:
static const unsigned long audio
Represents audio data.
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
enum ContentType { Unknown, Voice, Music, HiFi=0x0004 }
Use this enumeration for determining the quality of the audio content. Valid values are the following:
Windows | OS/2 | AIX |
No | Yes | No |
![]() |
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:
Windows | OS/2 | AIX |
Yes | Yes | No |