Sign in to follow this  

SDL_Mixer Channels

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

This topic is 3319 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this