(Page 30 of 80 in this chapter)
adiModifyPlayGain
Description
- Sets the play gain for the duration of the active play operation.
Prototype
- DWORD adiModifyPlayGain( CTAHD ctahd,
int gain )
- ctahd Context handle returned by adiOpenPort.
- gain The gain (dB) applied to the data as it is playing (the valid range is -54 to +24).
Return Values
Events
- None.
Details
- This function alters the gain applied to voice data as it is being output. The gain remains set only for the current play operation instance. Values specified out of range will be limited by the range.
See Also
- adiStartPlaying, adiPlayFromMemory, adiPlayAsync, adiModifyPlaySpeed, adiStopPlaying
Example
int myPlaySmartly( CTAHD ctahd, unsigned encoding,
void *buffer, unsigned bufsize )
{
ADI_PLAY_PARMS playparms;
ADI_EVENT event;
int currentgain = 0;
int currentspeed = 100;
adiGetParms( ADI_COLLECT_PARMID, &playparms, sizeof playparms );
playparms.DTMFabort = 0x0; /* Don't abort on any DTMF */
if( adiPlayFromMemory( ctahd, encoding,
buffer, bufsize, &playparms ) != SUCCESS )
return MYFAILURE;
do
{
myGetEvent( &event ); /* see adiFetchAndProcess example */
switch( event.id )
{
case ADIEVN_DIGIT_BEGIN:
switch( (char)event.value )
{
case '1': /* slower */
currentspeed -= 20;
adiModifyPlaySpeed( ctahd, currentspeed );
break;
case '3': /* faster */
currentspeed += 20;
adiModifyPlaySpeed( ctahd, currentspeed );
break;
case '4': /* softer */
currentgain -= 3; /* decrement 3 dB */
adiModifyPlayGain( ctahd, currentgain );
break;
case '6': /* louder */
currentgain += 3; /* increment 3 dB */
adiModifyPlayGain( ctahd, currentgain );
break;
default: /* ignore others */
break;
}
break;
case ADIEVN_DIGIT_END: /* ignore end of dtmf */
case 0: /* no event */
default:
break;
}
} while( event.id != ADIEVN_PLAY_DONE );
if( event.value != CTA_REASON_FINISHED )
return MYFAILURE;
return SUCCESS;
}
(Page 30 of 80 in this chapter)
Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights
reserved.