PDA

View Full Version : Sound cancellation for key presses on the Kyocera?


wub
04-23-2002, 09:17 PM
Hi all,

I'm trying to get a tone to play for a game that requires frequent key strokes. Since BREW 1.0 only supports a single sound channel, when the user presses the key, it emits a sound, thereby cancelling the tone I was playing.

Is there a way to cancel the default sounds made by buttons and keys? Or do I have to catch interruption events via the callback function and play the remainder of the tone?

Thanks in advance,
- wub

Kevin
04-29-2002, 01:33 PM
case EVT_KEY:

ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SOUND, (void **)&pMe->m_pISound);

if(pMe->m_pISound)
{

ISOUND_RegistryNotify(pMe->m_pISound, &SoundCBFn, (void*)pMe);

switch(wParam)
{
case AVK_1:

toneData.eTone = AEE_TONE_RING_D4;
toneData.wDuration = PLAY_DURATION1;
ISOUND_PlayTone(pMe->m_pISound, toneData);
break;

case AVK_2:

toneData.eTone = AEE_TONE_RING_D4;
toneData.wDuration = PLAY_DURATION1;
ISOUND_PlayTone(pMe->m_pISound, toneData);
break;

default:
break;
}
}
return(TRUE);
// <SNIP> sound callback function "SoundCBFn" not included

This code plays the appropriate tones when 1 or 2 is pressed for the appropriate duration. Any key press will cancel the play, and any key other than 1 or 2 will play the default tones. Only one tone is playable at a time, but by playing tones on key press in Brew you are over ridding the default device tones.