Hi,
I’m trying to listen to the mic audio (raw pcm stream) using the Adl_Audio functions included in the OpenAT 4.20.
Using the following code I’ve correctly(?) subscribed to Irq and Audio Handler, but I don’t see any activities on trace 2 and 3…
Any suggestion?
Best regards
Pietro
Follows code extract:
s32 s_handle; // audio resource handle
static s32 s_IRQHandle; // irq handle
static void *s_StreamBuffer; // audio stream buffer
// Low level interruption handler
bool vocLowLevelIRQHandler(adl_irqID_e a_Source, adl_irqNotificationLevel_e a_NotificationLevel, adl_irqEventData_t *a_pData )
{
adl_audioStreamDataBuffer_u *pStream = s_StreamBuffer;
TRACE((2, "PCM received : %d, %d ", pStream->PCMData[0], pStream->PCMData[1]));
return TRUE;
}
// audio event call-back function
void vocAudioEventHandler ( s32 audioHandle, adl_audioEvents_e Event )
{
TRACE((3, "vocAudioEventHandler"));
}
void vocSubscribe(void)
{
s32 Ret;
s32 BufferSize;
// Subscribe to IRQ
s_IRQHandle = adl_irqSubscribe ( vocLowLevelIRQHandler, ADL_IRQ_NOTIFY_LOW_LEVEL, ADL_IRQ_PRIORITY_HIGH_LEVEL, ADL_IRQ_OPTION_AUTO_READ );
TRACE((1, "s_IRQHandle = 0x%08X\r\n", s_IRQHandle));
// Subscribe to the current microphone
s_handle = adl_audioSubscribe ( ADL_AUDIO_MICROPHONE, vocAudioEventHandler , ADL_AUDIO_RESOURCE_OPTION_FORBID_PREEMPTION );
TRACE((1, "s_handle = 0x%08X\r\n", s_handle));
// Memory allocation
Ret = adl_audioGetOption ( s_handle, ADL_AUDIO_PCM_8K_16B_MONO_BUFFER_SIZE, &BufferSize );
TRACE((1, "BufferSize = %d\r\n", BufferSize));
s_StreamBuffer = adl_memGet( BufferSize ); // release memory after audio stream listening
TRACE((1, "s_StreamBuffer = 0x%08X\r\n", (u32)s_StreamBuffer));
// Listen to audio PCM stream
Ret = adl_audioStreamListen(s_handle, ADL_AUDIO_PCM_MONO_8K_16B, s_IRQHandle, 0, s_StreamBuffer);
TRACE((1, "Ret = %d\r\n", Ret));
}