Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Stopping Sounds is crashing my engine.


lel
 Share

Recommended Posts

Anyone happen to know whats wrong with this area? 

Client side under General

```

Sub StopSound(soundindex As Long)
    FSOUND_StopSound Sounds(soundindex).ChannelEnd Sub 

```
Highlighting "FSOUND_StopSound Sounds(soundindex).Channel"

With Runtime error 9 subscript out of range like 90% of all the errors. 

I was trying to add an event that starts and stops a sound at random. While the sound is playing it seems everything is ok (I'm not 100% sure yet, as my client is crashing on me) 

I have tried a few things I.E. looking at other peoples code (most other working code is in BASS >.> ) and such. I guess I would be lying if I said I am not starting to go from loving FMOD to hating it.  

Any help would be appreciated.
Link to comment
Share on other sites

I think that "Subscript out of range" means that the variable given to the method is not valid in some sort (Too high probably). I don't know how eclipse manages sounds etc. but you should look out for how the sound playing is indexed and if that index is somehow changed or read in a different way which could cause that error.

If I knew the engine better I could help more, but I hope that this could give you a clue atleast.

Good luck,

-seal
Link to comment
Share on other sites

Edit: I forgot my version of FMOD doesn't play sounds under IDE or under source mode if you will.

Replacing  the (soundindex) with a  1 making it (1) instead of (soundindex) keeps the error from accruing. Now when sounds are set to play again from that event it will play the sound ;however, it freezes the client. No error message or anything.
Link to comment
Share on other sites

subscript out of range occurs when a value supplied to a function exceeds the limits of its range as declared.

Few different methods of approaching a fix.

run up the source and stop it like you have attempted to, when it errors hold the mouse over the function and examine each of the variable values to determine which variable has a value that is outside its standard range.

My suspicion is that whatever is supplying this sub with index values is supplying more values than there are soundindexs to stop.

```

Sub StopSound(soundindex As Long)
    FSOUND_StopSound Sounds(soundindex).ChannelEnd Sub
```
Link to comment
Share on other sites

My new problem is that playing a sound using events causes the sound to keep playing over and over every half a second (or less) this makes the game lag really badly. I think there is a little more detail to this than I know. I was able to make an event where someone gets attacked and a sound played once they got attacked, with no problems.) So I have some investigating to do. Thanks for your replys guys, you helped allot.
Link to comment
Share on other sites

> What do you mean you missed it? Do you have the same problem in your engine?

No no, in the original post end sub is on the end of same line as the channel as a single word at the end.

The end sub has to be seperate from the logic the same way you posted your fix.
```
Sub StopSound(soundindex As Long)

FSOUND_StopSound Sounds(1).Channel

End Sub
```Also, whoever decided dark purple on black was a good colour scheme has holes in their fricken head.
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...