dmSetAudioDefaults(3dm) dmSetAudioDefaults(3dm)
dmSetAudioDefaults, dmAudioFrameSize - parameters for digital-media audio
#include <dmedia/dm_audio.h>
DMstatus dmSetAudioDefaults [Toc] [Back]
( DMparams* params,
int width,
double rate,
int channels )
size_t dmAudioFrameSize( const DMparams* params )
dmSetAudioDefaults sets up a parameter list with all of the necessary
parameters to describe audio for the digital-media libraries. The
parameters that are set and their values are: DM_MEDIUM = DM_AUDIO,
DM_AUDIO_WIDTH = width, DM_AUDIO_FORMAT = DM_AUDIO_TWOS_COMPLEMENT,
DM_AUDIO_RATE = rate, DM_AUDIO_CHANNELS = channels, DM_AUDIO_COMPRESSION
= DM_AUDIO_UNCOMPRESSED.
dmSetAudioDefaults returns DM_SUCCESS if there was enough memory
available to set up the parameters, and DM_FAILURE if not.
dmAudioFrameSize takes an audio parameter list and returns the number of
bytes needed to store one frame (one sample from each channel).
DMparams* audioParams;
if ( dmParamsCreate( &audioParams ) != DM_SUCCESS ) {
printf( "Out of memory.\n" );
exit( 1 );
}
if ( dmSetAudioDefaults( audioParams,
16, /* width (in bits/sample) */
22050, /* sampling rate */
2 /* # channels (stereo) */
) != DM_SUCCESS ) {
printf( "Out of memory.\n" );
exit( 1 );
}
printf( "%d bytes per frame.\n",
dmAudioFrameSize( audioParams ) );
dmParamsDestroy( audioParams );
dmParams(3dm), dmSetAudioDefaults(3dm).
PPPPaaaaggggeeee 1111 [ Back ]
|