Plans of Futura’s Soundmanager.

The sound manager for the game has been quite an annoyance since the development library has a bug concerning playing audio.
The development library we use for the game is SFML (Simple and Fast Multimedia Library) while simple it’s got its own sets of problems for game development.

The problem that I’m annoyed by is a bug that when the game gets turned off crashes the game because off a missing .dll that isn’t missing.

Image

While not finished because of the bug and also it’s in need of tweaking.

Fixing the bug:
While the bug is a annoyance it’s not game breaking or very serious since it only affects the game while shutting down and not while playing or starting up the game.
So to fix this bug I have to use another development library, Tommi recommended Fmod and BASS I’m not yet sure if I will replace the code or leave it as is.

The Classes:
The Manager has seven classes
SFMLSoundManager which sets the volume of the sound/song. PlaySound(std::string filename) it plays a single sound file such as a gunshot or a step, gets the duration of the sound and turns off the sound if one is playing.
PlaySong(std::string filename, bool looping) This class plays a song and checks if it should loop. (I’m planning on using .ogg files for the size of the music file.)
StopAllSounds() as you most likely can guess stops all the sounds if they are playing.
IsSoundPlaying() which checks if a sound is currently playing in the game.
IsSongPlaying() it does the same thing as the previous class but for music.

What could I have done better?:
Possibility 1: I could have avoided spending so much time on trying to fix the previously named bug which only makes the game crash while turning the game off and is not interfering with the game play in anyway.

Possibility 2:  I could have read up more on SFML and seen this problem coming up before making it.
That would have made me make the entire sound manager in Fmod or BASS which would maybe have taken a little while longer to make but would in turn work without a hitch.

Possibility 3: I could have used a small part of the SDL library to make the Sound manager and in turn it wouldn’t have taken as long as it did to actually get the sound manager to work properly and it wouldn’t be crashing when the game ended.

3 thoughts on “Plans of Futura’s Soundmanager.

  1. Well structured, it is clear what you did, how you did it and what you could have done better. The post can be valuable as an example of how to do it, I for one realized I should have done something closer to this. It also points out the annoying yet harmless bug in SFML’s sound functions which many might find helpful to know about. You also list a number of things you could have done to avoid the problem that will certainly help any who see the post before trying to use SFML’s sound functions in a program. I don’t really see any way in which the post could be improved, although I might just be missing something stupid and simple. If I need to criticise anything it would be the lack of images showing the code as the image provided only gives a part of the whole thing, maybe also a more detailed explanation on what everything does, it can at times be somewhat vague in this regard. Of course telling someone exactly what to do does not teach anything so there is a slight balance there. As I am a programmer as well I might be missing the obvious point where non programmers and novices might not quite understand the post but I digress.

  2. You talk about a bug and a missing dll file, but not what kind of bug or what dll file. Describe! More!!!
    It’s always nice to see examples of code, but I was missing a lot from the picture you put in the post, for example how you initiate the music manager.
    You are a bit unclear on what you mean by using Fmod and BASS. Are you using both or one of them? Who is this Tommi that you say recommended them? Why does his recommendation carry so much weight that you need to mention it? Explain! Elaborate!!!
    You say that you make seven classes, one for playing the music, one for volume control…
    Are you really making classes or methods for all this? If yes then why are you using separate classes for everything instead of separate methods in one class? I also wonder why the code picture shows methods with these names, if you simply did not mean methods rather than classes.
    If you actually meant to say seven different methods, then this is something you really need to watch out for when writing. It is not a question of simple typos here but actually a dangling participle.
    Those must be avoided at all costs!

    • I forgot to mention, if the screenshot really is from your code you should change your naming conventions as well. Starting a name with an underscore is often reserved by different libraries and programming languages, perhaps that is the source of your problems?

      I should also mention that, overall, it was pretty easy to follow what you did, so that I don’t give you nothing but crap.

      Cheers

Leave a comment