Hi!
I’am having troubles with memory leaks the ofSoundplayer. My program loads different sounds into the same ofSoundPlayer instance over time. In my activity monitor (OSX) i can see the the memory increasing constantly.
The sounds witch are being loaded is mp3 from 500kb to 39mb. Does anyone know what is wrong?
I have pasted the code below.
Thanks for any help!
void poexTapeWiiRemote::updateSound(){
newSound = ptt->getSoundUnderPoint(wiiPoint);
soundPosition = ptt->getRelativeSoundPosition(wiiPoint);
if(newSound != NULL){
currentSound = newSound;
newSoundURL = newSound->soundURL;
}
else{
newSoundURL = "no sound";
}
if(!isThreadRunning()){
if(lock()){
startThread(true, false);
}
}
}
void poexTapeWiiRemote::threadedFunction(){
if(currentSound != NULL){
//if(soundPlayer.getURL() != newSoundURL){
soundPlayer.loadSound(newSoundURL, true);
//}
}
if(soundPlayer.getIsPlaying() != true && buttonPressed){
soundPlayer.play();
}
if(buttonPressed){
soundPlayer.setPosition(soundPosition);
}
if(currentSound == NULL || buttonPressed == false){
soundPlayer.stop();
}
ofSleepMillis(10);
stopThread(true);
unlock();
}