Table of Contents Index NMS Glossary Previous Page Next Page (Page 20 of 69 in this chapter) Version


adiModifyPlayGain

Description

Sets the play gain for the duration of the active play operation.

Prototype

DWORD adiModifyPlayGain ( CTAHD ctahd,
int gain )

ctahd CTA context handle returned by ctaCreateContext.

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;
        CTA_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 ctaWaitEvent 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;
}



Table of Contents Index NMS Glossary Previous Page Next Page (Page 20 of 69 in this chapter) Version


Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2000, Natural MicroSystems, Inc. All rights reserved.