Hi guys, i have a little problem using sound at Qt
im creating music player with qt
right now, i'm using phonon each time i want to play the sound, for example:
void drumplayer:lay_snare()
{
snare = Phonon::CreatePlayer(Phonon::MusicCategory, Phonon::MediaSource(path));
snare->play();
}
with that code, every time i play the snare of the drum, there will be new object created (and will use the memory a lot for each play).
i have tried to make the initiation of snare separated like this:
void drumplayer::init_snare()
{
snare = Phonon::CreatePlayer(Phonon::MusicCategory, Phonon::MediaSource(path));
}
void drumplayer:lay_snare()
{
snare->play();
}
but i cant play the snare repeatedly. If i wan't to play the snare again, i have to put snare->stop(); before i can play again. I also try QSound, but QSound can't play multiple sound
Is there another way to play multiple sound repeatedly?
thx a lot for your help
Bookmarks