Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Where is the SoundManager constructor called?  (Read 2260 times)

Dannor

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 1
    • View Profile
Where is the SoundManager constructor called?
« on: December 14, 2005, 10:17:40 AM »

Hi,  I'm trying to integrate video playing with an FMOD sound system that is external to the Theora plugin.  Basically I just want to pass in the FMOD instance into the constructor for the SoundManager class in the example, but I cannot seem to trace through to where this constructor is called.  Any help would be appreciated, or advice on an alternative method if there is a better way of doing this.

Thanks,
Dan
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Where is the SoundManager constructor called?
« Reply #1 on: December 14, 2005, 10:27:48 AM »

Well, the Demo's SoundManager system uses a simple exported function called from the dll plugins getSoundSystem() which returns a SoundManager*. In the FmodSOundManagaer.cpp file:

Code: [Select]

//---------------------------------------------------------------//
extern "C" _FMOD_MOD_EXPORTS SoundManager* getSoundSystem(void)
{
return new FmodSoundManager();
}


That method creates the FmodInstance - which reminds me.. I have a memory leak I did not notice before, I need to destroy that pointer.

In your own app, you could modify the SoundManager to take an size_t* so that it can pass a custom pointer to the getSoundSystem() method. Or, since  Fmod is not created in that FmodSoundManager contructor (it is a seperate method - start() - you could cast (possibly with a dynamic_cast if you enable rtti) the SoundManager to the FmodSoundManager class and add a method to take an Fmod instance. Though, these decisions are really app specific to your situation.
Logged

M&M

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 30
    • View Profile
    • http://www.blueprintgames.com
Where is the SoundManager constructor called?
« Reply #2 on: December 14, 2005, 12:38:18 PM »

you don't really need a sound manager. All it does is create the audio clip and return a pointer which you could do from MovieLogic class.
Logged
url=http://www.blueprintgames.com/][/url]

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Where is the SoundManager constructor called?
« Reply #3 on: December 14, 2005, 12:48:54 PM »

Are you talking to me or Dannor?

The SoundManager also init's sound libraries. Though, I really do not recommend using the MovieLogic or SoundManager class as is.. They are just quick demos showing the simpleist way to get every feature of the plugin working. So, you are right that in your own app, you can just call your own audio class to create this clip, or combine the clip to your movie class if you want tight coupling. Though, abstraction is always better... In case you feel like changing sound lobs later (OpenAL, Fmod, etc).
Logged

Obliviere

  • Guest
Where is the SoundManager constructor called?
« Reply #4 on: December 19, 2005, 01:06:17 PM »

Sorry, but I was trying to find that line of code, and I cannot.  Neither in the FmodSoundModule.cpp (is that what you meant?  Not FmodSoundManager?), nor did a general search of all the folders turn anything up.  Would you mind clarifying?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Where is the SoundManager constructor called?
« Reply #5 on: December 19, 2005, 01:55:48 PM »

You will have to have a semi recent version of CVS for that FmodSoundModule.cpp to contain that line of code. In particular, that file has been moved to ogreaddons/videoplugin/CEGUI_TheoraDemo/src/SoundModules/FmodSoundModule.cpp line: 17, and OpenALSoundIO.cpp line 12.

Trust, me, that line is there :) - And, I also fixed up the Memory leak, and the plugins are deleted on shutdown. Though, as always, these plugins/demos are jsut examples, and are made to be simple and clear, the layout and organization is not really meant to be used as is - more, it is a guide for you to integrate with your existing framework.
Logged