Hi there is code of mine:
static Err audioCallbackFunc(void* UserDataP, SndStreamRef stream, void*
bufferP, UInt32 frameCount)
{
Err error;
Int16 *myBuffer=(Int16 *)bufferP;
Int16 *myBuffer2=(Int16 *)UserDataP;
UInt32 i;
for (i=0;i<frameCount;++i)
{
myBuffer[i]=myBuffer2[i];
}
error=errNone;
return error;
}
static UInt16 StartApplication (void)//check database, register base and check
system settings
{
Err error;
hRes2=DmGetResource('tbin',kRaw1000);
if (hRes2!=NULL)
{
snd=MemHandleLock(hRes2);
}
///audio
SndStreamRef streamP2;
error=SndStreamCreate(&streamP2,sndOutput,11025,sndInt16Little,sndMono/*sndStereo*/,&audioCallbackFunc,snd,8560/2,false);
//SndStreamCreateExtended (&streamP2,sndOutput,sndFormatPCM,22050, sndInt8,
sndMono,audioEXCallback, snd, 4096, false);
error=SndStreamStart(streamP2);
streamP=&streamP2;
return err;
}
static UInt16 StopApplication (void)//run when closeApp event occures
{
//FrmCloseAllForms();
//kill all resources
RemoveAllFromQueue();//delete all from queue
if (streamP!=NULL)
{
SndStreamStop(*streamP);
SndStreamDelete(*streamP);
}
if (systemSetup.pinVersion) {
PINSetInputAreaState(pinInputAreaOpen);
// StatShow();
}
if (snd!=NULL)
{
MemPtrUnlock(snd);
DmReleaseResource(hRes2);
}
return errNone;
}
On real device i have noticed that my sound is still running even if I stop my
sound and delete it :|
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/