Hi,
Thanks for your attention!
I tried a very simple application that I want to play a 300Hz tone on the speaker every 400ms. Following is the code:
#include "adl_global.h"
#include "generated.h"
#include "adl_audio.h"
#include "adl_TimerHandler.h"
s32 handle;
void MyAudioEventHandler ( s32 audioHandle, adl_audioEvents_e Event )
{
switch ( Event)
{
case ADL_AUDIO_EVENT_NORMAL_STOP://ADL_AUDIO_EVENT_NORMAL_STOP is sent to the owner resource when a tone is stopped automatically at the end of the duration time.
TRACE (( 1, " Audio handle %d: stop ", audioHandle ));
// unsubscribe to the speaker
//adl_audioUnsubscribe ( handle );
break;
case ADL_AUDIO_EVENT_RESOURCE_RELEASED://automatically unsubscribed due to a prioritary use
break;
default: break;
}
return;
}
void Timerhdl(u8 ID, void *Context){
TRACE (( 1, "inside Timer handler" ));
adl_audioTonePlay( handle, 300, -10, 0, 0, 50 );
}
void main_task(void) {
handle = adl_audioSubscribe ( ADL_AUDIO_SPEAKER, MyAudioEventHandler,
ADL_AUDIO_RESOURCE_OPTION_FORBID_PREEMPTION );
adl_tmrSubscribe( TRUE, 4, ADL_TMR_TYPE_100MS, Timerhdl );
}
But I still could not get any sound from the speaker. (tested on FW7.53 and FW7.52).
Best,
Naichao