Feature Request

kungfoomasta

21-02-2007 04:08:49

Can we add the function

Ogre::String OgreAL::Sound::getFilename();

or equivalent?

Reason being is that I have a scene creator, and users will set the background song, which needs to get saved to xml file (the filename and other properties, that is)

Thanks!

KungFooMasta

CaseyB

21-02-2007 04:57:15

It's in SVN now! ;)

kungfoomasta

21-02-2007 18:01:53

When playing Warcraft III (old game, I know) and looking at the game options, you can set the background music at a different level than the sound effects. This isn't too hard to do, since there is only 1 background music at a time (right? lol). What I'm wondering is, would there be any instances where we have 3 or more separate categories of sounds that we want to control?

Maybe sounds can have a Category field, so that the sound manager can manipulate all sounds by category?

Something like..

Sound* s1 = mSoundManager->createSound(...);
s1->setCategory("BackgroundMusic");

Sound* s2 = mSoundManager->createSound(...);
s2->setCategory("SoundEffects");

Sound* s3 = mSoundManager->createSound(...);
s3->setCategory("Speech");

...

mListener->setGain(1.0,"Speech");
mListener->setGain(0.5,"BackgroundMusic");
...

You could have a "Default" category assigned to Sounds be default.

Just a thought I wanted to toss out here.. I'm not at this point yet, but soon I'll be having options for users to set their preferences. Wondering if this sounds like a good idea to others. :)

KungFooMasta

CaseyB

21-02-2007 18:25:06

That seems like something that would be app specific, so I don't really think it belongs in OgreAL, it would be simple enough to do outside though. All you would need is a few std::vector<OgreAL::Sound*>'s.

t0tAl_mElTd0wN

21-02-2007 19:23:41

Well, I dunno. I think it would be a valuable feature, though I would implement it differently. Perhaps have a Category Manager, create a category and bind sounds to it in a similar fashion to Nodes, and then allow you to set the gain of the category, which will add/subtract gain from each individual sound.

Just an idea. I've got a bit too much working at the moment to implement it, but it could be neat, especially if you want to, say, have a multi-room stereo system. Link each room's sound emitter with the "stereo" category, then by simply adjusting the gain of that category, the volume of the stereo goes down, but other sounds stay normal.

There'd be plenty of uses for it, but I think it's one of those "We'll put it in later" features.

kungfoomasta

21-02-2007 23:13:12

Alright, it doesn't seem hard to do outside OgreAL like you say, just wanted to see other's opinions on this.

I actually did come up with some needed categories, which may possibly be common with other games as well:

1. Background Music
2. Interaction Sounds (talking to NPC's, opening chests, pulling levers, etc.)
3. Collision Sounds (walking over grass or through bushes, walking over ground, etc.)
4. Battle Effects ( weapons hitting/skills/etc )

With my current implementation these are easy enough to organize.

KungFooMasta

kungfoomasta

22-02-2007 05:27:10

Grabbed SVN and saw the new function getFileName, thanks!

Not to be picky or anything, but can we add a bool to it?

Ogre::String OgreAL::Sound::getFileName( bool FullPath = false );

Sorry, hehe. I can live without it, just thought it might be useful since sounds are tied into the resource system, and we don't need the full path as far as I know.

Thanks,

KungFooMasta

CaseyB

22-02-2007 05:55:01

Sounds are not tied into the Resource System yet. Ogre knows where they live and that's how you can give the SoundManager just the file name, but it automatically prefixes the path. Once we integrate the Ogre::ResourceManager, then this may be an option.

kinggori

26-02-2007 06:12:48

love this feature!

can someone please explain how can i use
Ogre::String OgreAL::Sound::getFilename();

where exactly do i put the filename?

CaseyB

26-02-2007 07:19:31

When you create a sound you pass in the name (how you want to refer to the sound later) and a fileName (which file on disk should be read in to create the sound) and Sound::getFileName() will return a string that is the entire path of the sound file on disk, for example, if you were to callbgSound->getFileName()in the the frameStarted loop of the basic demo you would get"../../Media/Audio/Zero Factor - Untitled.ogg"

kinggori

26-02-2007 07:33:17

sorry I didn't get it

right now I am using:

OgreAL::SoundManager *soundManager;
soundManager = new OgreAL::SoundManager();
OgreAL::Sound *bgSound = soundManager->createSound("FinalDuel", "mario.wav", true);
bgSound->setRelativeToListener(true);
bgSound->play();



let's say that I want to save the name mario.wav in an external fle (text or xml) so that anyone with no programmings skills can change the background music file name, how do i change the code above to add the getFileName() function

sorry for asking many questions

btw. I have release 59

CaseyB

26-02-2007 07:53:27

Oh, ok, that's not really how it works. In your example it would be like thisOgreAL::SoundManager *soundManager;
soundManager = new OgreAL::SoundManager();
OgreAL::Sound *bgSound = soundManager->createSound("FinalDuel", "mario.wav", true);
bgSound->setRelativeToListener(true);
bgSound->play();

std::cout << bgSound->getFileName();

And this would cause ../../Media/Audio/mario.wav to be printed out. If you want to load sounds from an XML file then you should have a look at the DotScene loader and TinyXML. It's not that hard to do once you get the hang of it.