Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
New Developer
MedNez
Posts: 66
Registered: ‎11-24-2008
Accepted Solution

Best Practices for playing multiple sounds - one MediaPlayer or many?

Hello!

 

I am using the MediaPlayer object in QML. 

 

Problem: If I have 10 objects, and when you tap an object a sound plays... then with ONE MediaPlayer, the sound that is playing has to finish before another sound can start. (Or you can write the code to 'stop the existing sound and play another one'). Either way, you can't have a musical flurry when you tap each object.

 

Current Solution: Add a MediaPlayer component to each object, so when you tap that object, it plays its own MediaPlayer. Sounds amazing because the sounds overlap. In a game, if you are hitting objects quicker than their sound can play, this sounds great as the dings/boops/pings are nicely overlapping as they sound.

 

However I feel that this might be taking up unnecessary memory? For example if I had 100 objects, I don't think I'd want 100 MediaPlayer components attached?

 

Is there a better way to do concurrent sound in QML?

Please use plain text.
Developer
Dredvard
Posts: 154
Registered: ‎01-27-2012
My Carrier: Rogers

Re: Best Practices for playing multiple sounds - one MediaPlayer or many?

[ Edited ]

Check this.   They used multiple simultaneous sounds with only one soundmanger.

 

https://github.com/blackberry/Presentations/tree/master/2012-BlackBerryJam-Americas/JAM09/BaDumTss

---
If you find my post helpful please "like" it and "accept as a solution"
Please use plain text.
New Developer
MedNez
Posts: 66
Registered: ‎11-24-2008

Re: Best Practices for playing multiple sounds - one MediaPlayer or many?

Awesome. Thanks. I have implemented this. 

 

I have a question about the destructor and app cleanup, but I've started a new (more relevant) thread for that:

 

http://supportforums.blackberry.com/t5/Cascades-Development/C-App-Destructor-causes-build-error/td-p...

Please use plain text.