Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - devlin

Pages: [1]
1
SFML website / New section desirable?
« on: March 15, 2011, 07:21:05 pm »
I've noticed a lot recently the type of questions posted are either compiler related or newbie related (not talking SFML in particular - but with for instance c++ in general - i.e. why does my compiler shout at me).
I'm not using the word newbie in any derogatory way, as everyone's a newbie when first starting out.

Wouldn't it make sense to create a "For Beginners" forum where such questions could be posted and answered by other forum users; in order for us to help you get (slightly) more free time to focus on SFML2? :)

2
Audio / Audio causes hang within FreeLibrary.
« on: January 29, 2011, 08:12:25 pm »
Greetings!

I'm having problems with Audio when playing sound via a DLL plugin.

Basically, my current project loads game views from DLLs as a plugin system. If I load and play any sound/music from within that DLL - the application will hang upon FreeLibrary of that DLL and the music will stutter (no doubt due to the hang/deadlock).

I can get rid of the stutter by sleeping a few milliseconds after the Music.Stop() - before I unload the plugin via FreeLibrary. However, the application will still hang upon FreeLibrary.

I've tried to not allocate anything regarding music from within the DLL itself (rather letting the main-process load and play stuff) but that does not help. FreeLibrary seem to run in a recursive loop upon calling FreeLibrary.

Pseudocode (as a minimal example would involve 2 different projects etc - can provide if needed):

DLL:
Code: [Select]
plugin::init()
{
  sf::Music myMusic;
  myMusic.LoadFromFile("snd.ogg");  // if I comment out this and the line below - FreeLibrary doesn't hang.
  myMusic.Play();
}

plugin::deinit()
{
  myMusic.Stop();                   // seems to call a wait internally? But if I don't add a Sleep here, the sound will stutter when I try to unload the plugin.
}


Main program:
Code: [Select]
Plugin p = LoadPlugin("name.dll"); // creates a view internally
game.AddView(p);                   // adds the view to the game, calls init on plugin
game.MainLoop();                   // calls deinit on the plugin when done, does not unload the plugin but deletes the internal view.
p.Unload();                        // tries to unload the plugin via freelibrary - hangs upon the call to FreeLibrary.


Any idea whatsoever what might cause this? Is there anything allocated internally

Pages: [1]