Jump to content
  • Advertisement
Sign in to follow this  
ICUP

SDL_Mixer Channels

This topic is 3622 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

Hello, I'm having troubles with getting sound to properly work. Initially everything seems to work fine but my sounds or one of my sounds no longer plays. Here is what happens: 1. The user can click any of the menu buttons (new game, options, quit) which plays a "click" sound when they do. 2.(For tic-tac-toe) When starting a new game the user will click where they want there X's or O's and when they do it, it makes a "plop" sound. 3. When coming back to the menu, the menu button click sounds no longer play. I'm thinking it's a channel problem. I have allocated several channels with Mix_AllocateChannels. If I set the channel to -1 for each chunk shouldn't it use the next available channel? I've tried setting one sound to channel 0, while the other one to channel 1 but doesn't work. Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
I'd recommend adding some diagnostic debugging code to get an idea of what's actually going on. SDL_mixer has some callback and query functions that should allow you to determine what channels are playing, what the volumes are, when a channel finishes playing, and so forth. By printing some debug output to the console (or wherever), you should be able to get a better idea of what's happening (e.g. the volume has been set to zero, your channels never finish playing and so no new sounds can play, etc.). Also, I think the 'play sound' function returns an error value if it can't play, so be sure to check that as well. (Some of these things you can probably just check using the debugger.)

Share this post


Link to post
Share on other sites
Yeah, I did go through a debug before but it just pointed to the function Mixer_PlayChannel and said something about an unhandled exception. Any idea what that exception might be?

Share this post


Link to post
Share on other sites
oh, I'm an idiot. I placed Mix_AllocateChannels( 0 ) inside a destructor. Why I did that no idea.

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!