Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
06-26-2012 12:15 PM
Hey all, I used the cowbell sample as a base for getting sounds to work in my application and while that is fine, I was wondering how to stop a sound on command. My attempt to do this used the same framework as starting the sound, but replacing the alSourcePlay(source) command with alSourceStop(source), under the naive impression it could be that easy. Is there any good documentation for doing this or if anyone knows the solution that would be terrific.
I would have included my code but there are several snippets across different files and it is essentially the same as the way the alSourcePlay(source) was initiated just with that change. As always, look forward to a response.
Solved! Go to Solution.
06-28-2012 11:50 AM
I believe it IS as simple as calling alSourceStop(source) with a valid source ID
The best place to start with is OpenAL Spec which has all the information you would need.
Thanks for posting!
08-22-2012 12:55 AM
08-22-2012 03:58 PM
No, it requires C++ work, I modeled mine after the cowbell sample from here:
It was perfect for getting a grasp of incorporating wav sounds into my application. It only works with wav's however, there are other samples available that handle other types. Good luck!
08-27-2012 10:05 PM
vingilot, mind posting your functions that control the stop feature?
I tried essentially replicating the "play" function in the soundmanager.cpp except changing "alSourcePlay(source);" to "alSourceStop(source);" (as well as having the correct calls in the header file)... but no stopping the sound.
08-29-2012 07:11 PM - edited 08-29-2012 07:13 PM
Hmm, if I recall correctly I ran into the same problem as you, it seemed as though just using the stop command was failing and that is why I posted the thread in the first place. I tried a variety of things but found that using:
this stops a group of sources, of which there are 32 on the dev alpha and mSoundSources is the set of sources. Make sure that your stop command is telling it to stop the right source otherwise it won't work. I know the cowbell is built in to rotate through sources each time a note is played so that could cause it to not work. By using the above code, that ensures that all sources are stopped, which was good enough for me as my sounds run in a linear fashion, not concurrently.
It should be a catchall for your situation and tell me if it works. I am now working on another issue, if you get passed this problem I would appreciate discussing more about using openAL later on. Best of luck.