Jump to content
  • Advertisement
Sign in to follow this  
lordimmortal2

Game Sound

This topic is 2546 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been attempting to learn some way to implement sound and music in a game but I seem to not be getting anywhere.

So, what is the most recommended way to play sound and music inside a game? And if possible, are there any tutorials on it? Preferably for a beginner (it's hard for me to read complicated code and extract what it does).

Share this post


Link to post
Share on other sites
Advertisement
I've use SDL, FMOD, and SFML for audio. I would skip SDL all together. FMOD was easy to use, but, I found SFML was the best. Add to the fact SFML has great support for Video and Input, and it sits on top of OpenAL, I'd use SFML all the way.

In my most recent game, I used SFML, and I have spatial sound work, and it wasn't too difficult.

Share this post


Link to post
Share on other sites
I've use SDL, FMOD, and SFML for audio. I would skip SDL all together. FMOD was easy to use, but, I found SFML was the best. Add to the fact SFML has great support for Video and Input, and it sits on top of OpenAL, I'd use SFML all the way.

In my most recent game, I used SFML, and I have spatial sound work, and it wasn't too difficult.[/quote]

So would you recommend SFML over DirectX (which is what I'm using to handle graphics and input but I am always open to other methods)? And why would you not recommend SDL? Hard to use?

Share this post


Link to post
Share on other sites

I've use SDL, FMOD, and SFML for audio. I would skip SDL all together. FMOD was easy to use, but, I found SFML was the best. Add to the fact SFML has great support for Video and Input, and it sits on top of OpenAL, I'd use SFML all the way.

In my most recent game, I used SFML, and I have spatial sound work, and it wasn't too difficult.


So would you recommend SFML over DirectX (which is what I'm using to handle graphics and input but I am always open to other methods)? And why would you not recommend SDL? Hard to use?

[/quote]

Yes, I would suggest SFML over SDL and DX. SDL is easy to use, but it's doesn't have near the performance SFML does (SFML runs on OpenGL, SDL does software rendering), nor does it have the features SFML provides (just have a look at the SFML 2.0 release). Use SFML over DX for ease of use mainly, as I think SFML is much easier to use; it's also portable. SFML uses a C++ interface as well, which can make things easier too.

Share this post


Link to post
Share on other sites
Yes, I would suggest SFML over SDL and DX. SDL is easy to use, but it's doesn't have near the performance SFML does (SFML runs on OpenGL, SDL does software rendering), nor does it have the features SFML provides (just have a look at the SFML 2.0 release). Use SFML over DX for ease of use mainly, as I think SFML is much easier to use; it's also portable. SFML uses a C++ interface as well, which can make things easier too.[/quote]

I can see what you're saying about why you recommend SFML a lot. It does seem very user-friendly and simple to use. It suits my purposes quite well (wish I had known about it before I started using DX for my graphics, but meh).

I have a problem with it right now though. It's probably just my own ignorance but here it is: while trying to get a test for making game sounds working (just to get a feel of it), the game crashes when trying to reference 0x00000000. It seems to be trying to access some 64-bit code which is strange since there aren't any different library sets from SFML beyond different OSes, or so I can tell. I am on Windows XP 32-bit. Here is the code:

void LoadSound()
{
sf::SoundBuffer Buffer;
sf::Sound Sound;

if (!Buffer.LoadFromFile("Test.wav"))
{
// Error
return;
}

Sound.SetBuffer(Buffer);

Sound.SetLoop(true);
Sound.SetVolume(100);

Sound.Play();
}


I used a piece of music on my computer to test, it crashed that way, so I thought it might be long/big of a file (which was supported by the tutorial of music on SFML). I cut it down to about half a second and that didn't work, so I tried using a sound effect that came with the samples of SFML. That didn't work either.

The error:
whe3d0.jpg

As always, any help and replies are greatly appreciated.

Share this post


Link to post
Share on other sites
Post this on the sfml audio sub-forum. The author is very quick to help out and answer questions.

Yes, I would suggest SFML over SDL and DX. SDL is easy to use, but it's doesn't have near the performance SFML does (SFML runs on OpenGL, SDL does software rendering), nor does it have the features SFML provides (just have a look at the SFML 2.0 release). Use SFML over DX for ease of use mainly, as I think SFML is much easier to use; it's also portable. SFML uses a C++ interface as well, which can make things easier too.


I can see what you're saying about why you recommend SFML a lot. It does seem very user-friendly and simple to use. It suits my purposes quite well (wish I had known about it before I started using DX for my graphics, but meh).

I have a problem with it right now though. It's probably just my own ignorance but here it is: while trying to get a test for making game sounds working (just to get a feel of it), the game crashes when trying to reference 0x00000000. It seems to be trying to access some 64-bit code which is strange since there aren't any different library sets from SFML beyond different OSes, or so I can tell. I am on Windows XP 32-bit. Here is the code:

void LoadSound()
{
sf::SoundBuffer Buffer;
sf::Sound Sound;

if (!Buffer.LoadFromFile("Test.wav"))
{
// Error
return;
}

Sound.SetBuffer(Buffer);

Sound.SetLoop(true);
Sound.SetVolume(100);

Sound.Play();
}


I used a piece of music on my computer to test, it crashed that way, so I thought it might be long/big of a file (which was supported by the tutorial of music on SFML). I cut it down to about half a second and that didn't work, so I tried using a sound effect that came with the samples of SFML. That didn't work either.

The error:
whe3d0.jpg

As always, any help and replies are greatly appreciated.
[/quote]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!