[Kde-games-devel] Correct useage of phonon?

Michael Thaler michael.thaler at physik.tu-muenchen.de
Sat May 10 23:46:22 CEST 2008


Hello,

(modified version of my post on kde-devel)

I am trying to port a game to KDE. Currently the game uses SDL_Mixer to play 
sounds. I want to replace it by phonon, but I am not sure about the correct 
way to use phonon. 

What I want to do is play sound a (e.g. a "bling") if a player does something 
and play sound b (e.g. a "whozz") if a player does something else. The game 
has twelve different sounds that get played when a player does something and 
an mp3 that gets played when the credits are shown. Most of the sounds are 
very short, about 5 KB, some are up to 50 KB. I guess 
loading the sounds from disk and playing them with

m_media->setCurrentSource(filename);
m_media->play();

would work, but I think it is quite ugly to load the files from disk each time 
they are played. My question is: is it reasonable to have thirteen
MediaObjects that are initialized in the constructor of the class or are 
MediaObjects to heavywight to do that. If so, is there any other way to 
preload the sound files?

Greetings,
Michael


More information about the kde-games-devel mailing list