/* WAVEAO.C */

// This file includes methods for:

// WAVEAO (subclass of ACTIVE)

#include <epoc.h>
#include <solipeg.g>

GLREF_D PR_APPMAN * const       w_am ;          // ptr to application manager



#pragma save, METHOD_CALL


/************************************/
/* Active Object Subclass Methods   */
/************************************/

// Simple REPLACEment for the AO_INIT method
METHOD VOID waveao_ao_init(PR_WAVEAO *self) {
    self->active.priority = PRIORITY_ACTIVE_VOICE ;
    // w_am is a ptr to the application manager
    p_send3(w_am, O_AM_ADD_TASK, self) ;
}

// Simple REPLACEment for the AO_CANCEL method
METHOD VOID waveao_ao_cancel(PR_WAVEAO *self) {
    p_playsoundcancel() ; // cancel any playing sound
    p_supersend2(self, O_AO_CANCEL) ; // let the regular method do its stuff
}

// ADDition of a WV_PLAY method
METHOD VOID waveao_wv_play( PR_WAVEAO * self,
                            TEXT *      name,
                            UINT        volume ) {
    if ( !self->active.isactive ) {
        p_playsounda(name, 0, volume, &self->active.stat) ; // start play
        self->active.isactive = TRUE ; // mark active
    }
}

