Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Application gives no problem in playing sound ,but if sound code is used the application gives problem during exit(the device gets hang).

Can you please tell me what could be the reason for this perticular problem

for exmp.

#include "AEEModGen.h" // Module interface definitions
#include "AEEAppGen.h" // Applet interface definitions
#include "AEEShell.h" // Shell interface definitions
#include "AEEFile.h" // File interface definitions
#include "hello.bid"
#include "AEESound.h" // Sound Interface definitions
#include "AEESoundPlayer.h"
#include "AEEStdlib.h"

typedef struct _hello
{
AEEApplet a;
AEEDeviceInfo DeviceInfo;
IDisplay *pIDisplay; // give a standard way to access the Display interface
IShell *pIShell;
ISoundPlayer *sound_player;

}hello;
static boolean hello_HandleEvent(hello * pMe, AEEEvent eCode,
uint16 wParam, uint32 dwParam);
boolean hello_InitAppData(hello * pMe);
boolean hello_freeAppData(hello * pMe);
void playSound1(hello *pMe);
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
*ppObj = NULL;

if(ClsId == AEECLSID_HELLO){
if(AEEApplet_New(sizeof(hello), ClsId, pIShell,po,(IApplet**)ppObj,
(AEEHANDLER)hello_HandleEvent,(PFNFREEAPPDATA)hello_freeAppData))
{

if(hello_InitAppData((hello*)*ppObj))
{
return(AEE_SUCCESS);
}
else
{
IAPPLET_Release((IApplet*)*ppObj);
return EFAILED;
}
return (AEE_SUCCESS);
}
}
return (EFAILED);

static boolean hello_HandleEvent(hello * pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
switch (eCode)
{
case EVT_APP_START:
playSound1(pMe);

return(TRUE);
case EVT_APP_STOP:

return TRUE;
default:
break;
}
return FALSE;

boolean hello_InitAppData(hello * pMe)
{
pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);

pMe->pIDisplay=pMe->a.m_pIDisplay;
pMe->pIShell=pMe->a.m_pIShell;
return TRUE;

boolean hello_freeAppData(hello * pMe)
{
if(pMe->sound_player!=NULL)
{
ISOUNDPLAYER_Stop(pMe->sound_player);
ISOUNDPLAYER_Release(pMe->sound_player);
pMe->sound_player =NULL;
}
return TRUE;

void playSound1(hello *pMe)
{

if(pMe->sound_player!=NULL)
{
ISOUNDPLAYER_Stop(pMe->sound_player);
ISOUNDPLAYER_Pause(pMe->sound_player);
ISOUNDPLAYER_Release(pMe->sound_player);
pMe->sound_player =NULL;
}

if( (pMe->sound_player = ISHELL_LoadSound(pMe->pIShell,"Kick.mid"))==NULL)
{
return ;
}
else
{
if(pMe->sound_player!=NULL)
{
ISOUNDPLAYER_Play(pMe->sound_player);
}

}

}

attach file
Exp

1 apploger log file when problem during exit(the device gets hang).

2

when commented sound code . Application exit properly

w170 doesn't support IsoundPlayer API.

w170 doesn't support IsoundPlayer API.