Hi
I want a list of ofSoundPlayers that I can refer to by name, so I have
// above class definition
typedef std::map<std::string, ofSoundPlayer> soundList;
// class .h
soundList sounds;
Then to load & play a sound I do
sounds["myname"].loadSound("pathtowav", false);
sounds["myname"].play();
It works, but this is probably really bad. How does the allocation work in this instance? What is the best practice?
Would this be the correct way to do it?
sounds.insert ( pair<std::string, ofSoundPlayer>("myname", ofSoundPlayer()) );
Thanks