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

Author Topic: I need a way to manually destroy the audio device  (Read 32281 times)

0 Members and 2 Guests are viewing this topic.

s_p_oneil

  • Newbie
  • *
  • Posts: 7
    • View Profile
I need a way to manually destroy the audio device
« on: August 19, 2007, 02:45:05 am »
Right now you're using a static variable inside the static GetInstance() method to control creation/destruction of the sfAudioDevice. When SFML is used in a dynamically-loaded DLL, it will crash every time the DLL is unloaded because that object doesn't get destroyed until AFTER the DLL is unloaded.

Thanks,
Sean

EDIT: I meant to say AFTER the OpenAL DLL is unloaded.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
I need a way to manually destroy the audio device
« Reply #1 on: August 19, 2007, 11:32:38 am »
Ok, I see.

I'll fix this as soon as possible.
Laurent Gomila - SFML developer

s_p_oneil

  • Newbie
  • *
  • Posts: 7
    • View Profile
I need a way to manually destroy the audio device
« Reply #2 on: August 19, 2007, 11:55:37 pm »
Thanks. I made my own fix to use temporarily, but it's a cheap hack so I won't bother posting it. ;-)

I'm writing a Ruby extension to allow SFML to be used in Ruby (which doesn't have a good library for writing simple games). I already have all the audio, video, and input classes working. I left out the threading classes because Ruby doesn't support native OS threads. I also left out the networking classes because I believe most Ruby users would rather use Ruby's networking classes.

My next task is to clean up the class interfaces up to make it easier to use them in the "Ruby way". After that, I'd like to add some simple 2D primitive drawing methods (i.e. line, rectangle). My goal is to make it easy enough for my 8-year-old son to write his own simple games in Ruby.

You can have the source code for the extension if you'd like to add it to your project.

Here are my other projects in case you're interested:
http://sponeil.net/
http://g3d-ruby.rubyforge.org/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
I need a way to manually destroy the audio device
« Reply #3 on: August 20, 2007, 09:09:12 am »
Quote
I'm writing a Ruby extension to allow SFML to be used in Ruby

Great :)
I'd really like to see it (with source code) when it's finished, and I'll include it to the next SFML release.

Quote
Here are my other projects in case you're interested:
http://sponeil.net/
http://g3d-ruby.rubyforge.org/

Very interesting.
Laurent Gomila - SFML developer

s_p_oneil

  • Newbie
  • *
  • Posts: 7
    • View Profile
I need a way to manually destroy the audio device
« Reply #4 on: August 20, 2007, 03:46:55 pm »
Ok, I'll send you the source with a Ruby test file when I get it cleaned up.

I'll also add a README and perhaps a batch file or two for building/running it in Windows. (Building/running it in Linux should be even easier, but I doubt I'll have time to test it.) I'll also see what I can do about documenting the source code for the extension in case you ever need to maintain it, as well as the minor changes I've made to make it more Ruby-like. I can't promise documentation as nice as yours, but I'll try to come up with something. ;-)

It is entirely up to you, but I would recommend that you add a pre-built Ruby binary download for the Windows crowd. It requires a special build of Ruby, but only until the default Windows installer for Ruby upgrades to Visual Studio 2005 (they're still using Visual Studio 6.0, and the libraries don't play nicely together). It should be very easy for you to build, but most Windows Ruby programmers won't have Visual Studio installed.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
I need a way to manually destroy the audio device
« Reply #5 on: August 20, 2007, 03:53:03 pm »
Ok, no problem.

Thank you a lot :wink:
Laurent Gomila - SFML developer

mweb

  • Newbie
  • *
  • Posts: 13
    • View Profile
I need a way to manually destroy the audio device
« Reply #6 on: August 21, 2007, 07:28:41 am »
May I ask how you build the bindings to ruby? I started to write bindings to python with SWIG this could be used for ruby as well. Do you write the bindings by hand or also by using some bindings language like swig?