Audio stopped while playing the game
BlitzMax Forums/BlitzMax Programming/Audio stopped while playing the game
| ||
Hi, we have game playing application which we have many modules. some of the modules having audio instructions. While playing the game after some time the audio was stopped. if we close the application and it works fine. Any one know the reason please reply. Thanks |
| ||
Hi Keith, you really need to provide some specifications. What audio module/s does the app use, what version of Max was it built with and what platform/s is it on? |
| ||
Agreed, without any hints, it could be just about anything. Maybe you are not releasing your channels and you are running out of them? |
| ||
Hi Keith, I am not a moderator and have no formal standing at BRL. Keith, in addition to what Mark said, you should provide either the source in full or the section of your program that you feel contains the cause of the problem. This will help you get an answer to your question more quickly. |
| ||
Wait a minute, who said anything about moderators? |
| ||
No one, I just didn't want him to think that I worked for BRL, or volunteered as an admin for them. |
| ||
No one, I just didn't want him to think that I worked for BRL, or volunteered as an admin for them. why would he think that? |
| ||
Maybe he's just a bit daft. :) |
| ||
I've heard of this on both PC and Mac with older versions of Bmax. Not sure if it's fixed yet. Some sound issues were fixed with V1.36 though. |
| ||
We are using following method every time once one level game is complete and once again starting the game but its stopping audio in one stage not regularly. ' ------------------------------------------- ' Disable Monitor ' ------------------------------------------- Method Disable() 'If mDebugMode = True Then .. 'Print "Monitor:Disable()" mEnabled = False mInitialized = False If ChannelPlaying(mSoundChannel) Then StopChannel(mSoundChannel) mSoundChannel = AllocChannel() EndIf If ChannelPlaying(mMetronomeChannel) Then StopChannel(mMetronomeChannel) mMetronomeChannel = AllocChannel() EndIf EndMethod |
| ||
Why do you use StopChannel and not PauseChannel? StopChannel is equivalent to KillChannel, maybe the process to create/delete causes your problem. |
| ||
Stopping the channel the reallocating works, I use it in my framework. |
| ||
Any other reason other than StopChannel which causes the auido to go off? |
| ||
Stopping the channel the reallocating works, I use it in my framework. I have a volume control for music and sound fx in my game. When I use stop channel and I restart it, the volume controll does not work. It auto resets to full volume and I can't adjust it. I have to use PauseChannel and that works fine. |
| ||
You just have to reapply the volume again to the new channel (the reference to the old channel will be invalid) when you start it and that will work (works for me). I don't immediately play the sound I use CueSound (I think that's the command), set the volume, the resume it. |
| ||
CueSound allows you to setup various audio channel states such as volume, pan, depth and rate before a sound actually starts playing. I commendted out the StopChannel(mMetronomeChannel) line still i am facing the same problem. It works fine for first few minutes (10-30) after that it automatically stops the audio. If I close the application and restart its works fine again! What may be the reason?? |
| ||
Any Other command or function which may cuase to stop the audio? While debugging the statement Print "PlaySound(mThreeSound, mMetronomeChannel) Executed" is print the message but audio was off. If ChannelPlaying(mMetronomeChannel) Then StopChannel(mMetronomeChannel) Print " StopChannel(mMetronomeChannel) Executed In Countdown Three" mMetronomeChannel = AllocChannel() SetChannelVolume mMetronomeChannel, 1 EndIf PlaySound(mThreeSound, mMetronomeChannel) Print "PlaySound(mThreeSound, mMetronomeChannel) Executed" |
| ||
Are you specifying the channel variables as being of type TChannel? I had similar problems in the BlitzMax RockOut sample (which are still there), and it eventually causes random silence or crashing. I only figured out about a year ago that this was the cause of my mystery crashes, ie. the channel objects weren't being garbage-collected and the channels weren't freed as a result. Doing this sort of thing to play each sound is what stopped the problems for me: ' Set up channel... play:TChannel = CueSound (beep) SetChannelVolume play, Game_Volume SetChannelPan play, pan ' Play sound... ResumeChannel play ' This is probably unnecessary, since assigning a new channel to play:TChannel via CueSound should free up the previous channel assigned to it... play = Null |
| ||
Good point. Always code with superstrict on to enforce stuff like that. |
| ||
I made some changes in the code, Dramatically it looks fixed now still testing is on. Thanks to all for valuable replies! |