FMOD example multiple sounds in 3d

can someone point me to an fmod example in open frameworks, where i have multiple sounds in 3d (surround). Am i right that i have to use a modified openframeworks sound class to address several channels in fmod? sry I’m kind of newbish but i have to dig into that asap… need it for my bachelor project.

kind regards, nixon

please :slight_smile: anyone?

i think the best example you can find inside the joshua book, programming interactivity: go to thr github repository https://github.com/joshuajnoble/Programming-Interactivity-Code/tree/master/ch10/1005

Cheers

Walter

Yeah thx, i have used that example as a start for my project. But how do I address multiple channels? When I startet playing around I created multiple instances of sound3d but then I realized that I created different sound engines with one sound file each. I need to address the different channels and positions in one engine. Well, at least that’s what I think now. :wink: I found an example that is based on joshua’s example, it looks like it’s exactly what I need but it is for cinder. I ll post the link later.

This is the code i meant: https://github.com/rogerpala/FMOD-Ex-Cinder-Block

I wonder how hard the cinder coder differs from a version for open frameworks.
Especially the FmodExMultipleDynamic3DSoundPlayer sample seems to be exactly what i need.

can someone move this to the advanced forum? Probably this question makes more sense there.

done.

mh seems i did it kind of right at the beginning, I will test some more. kind regards.

Hey guys, well i’m new but i really try to dig that :wink: but i know it’s not that great. Especially the naming for the pointers :slight_smile: every help is welcome. Perhaps you can tell me if that leads to the right way.

I want to create several sound objects in 3D. I use an xml document to read out their attributes including the location name for their soundfiles, name, their position as a vector etc. The reading of the xml document works quite well. I use Joshuas example for 3d sound with FMOD, as pointed above.

  
  
    soundobjekt* max=xmlparse.getsoundobjekte();  
    Sound3d* tach=0;  
    for (int i=0; i<xmlparse.soundnum; i++){  
        tach=new Sound3d();  
        tach->getsoundobjects(max[i].situation, max[i].ID, max[i].vol, max[i].r, max[i].loc, max[i].name, max[i].loop, max[i].atmo);  
          
        
        if (!tach->isLoaded()){  
          tach->loadSound(ofToDataPath(max[i].loc));  
          tach->setMultiPlay(true);  
       }  
          
            if(!tach->getIsPlaying())  
                tach->play();  
              
        tach->updateSound(max[i].position, max[i].velocity);  
        tach->updateListener(player.position, player.velocity, player.forward, player.hposition);  
        tach->update();  
          
        sounds.insert(sounds.end(), *tach);  
  
  

In the instance xmlparse (i want to get the class static but couldn’t archive it yet) I read out attributes for my soundobjects of an xml document. I set a pointer max to a struct soundobject where i save the data xmlparse reads out. I set a pointer called tach to Sound3d. I sweep every new instance of sound3d using soundnum which counts my soundobjects ()in the xml document (they can change). Every new instance gets their attributes from the struct soundobjekt. Well it seems to work ok, but i get errors at:

  
  
        if (!tach->isLoaded()){  
          tach->loadSound(ofToDataPath(max[i].loc));  
          tach->setMultiPlay(true);  
       }  
  

in the ofmodsoundplayer class

  
  
  
void ofFmodSoundPlayer::unloadSound(){  
	if (bLoadedOk){  
		stop();						// try to stop the sound  
		if(!isStreaming)FMOD_Sound_Release(sound);  
		bLoadedOk = false;  
	}  
}  
  

EXC_bad_access error at if(!isStreaming)FMOD_Sound_Release(sound);

i don’t know exactly how i set up fmod the best way, but the sound should be loaded once. Max[0].loc is 0000.wav as an string. I hope i can use sound3d the way I’m using it. I have another problem at play() but i think i need to understand first how i can handle each instance of sound3d. As i m playing around some things may not make a sense, i read out date for my objects but don’t use them intern at the moment.

Well, i am still at this problem, playing a stream works at this point but then i have other problems. I wonder if this has something to do with this: https://github.com/openframeworks/openFrameworks/issues/1694 and if i should give 73 a try?

For now i m out of ideas so i will try the new version, though i really think i am doing something wrong. Perhaps someone will stumble across my monolog here :slight_smile: Cheers

ahhhh help me i have to understand this…