123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|31|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Art and Sound -> Playing sound

Fri, 06 Feb 2009, 08:52
HoboBen
I never really understood the way sound playback was done in a language such as Blitz, with the whole separate sounds and channels thing.

Is there a limit on the number of channels you can have open?

Should I open a new channel each time I play a sound? Reuse a certain number of channels? Reserve one channel per sound effect?

If anyone knows of any tutorials or has a code sample handy that uses more than one sound, that would be a big help

Thanks!



-=-=-
blog | work | code | more code
Fri, 06 Feb 2009, 09:01
Jayenkai
I tend to ignore channels until necessary.
For 99% of usage, Playsound MySound does just fine.

For music, you'll want to stuff that into a channel..
BGMusic=PlayMusic("MyMod.mod"), that way you can control the volume, and pause/restart/change the music when necessary, by using the Channel commands, but in most cases, Blitz just pretty much deals with it, for you.

As far as I can tell, there's no limit.. But.. You know..
Probably best not to attempt to play 17,000 sounds in a single frame, just incase!

-=-=-
''Load, Next List!''
Fri, 06 Feb 2009, 09:49
HoboBen
I think it's starting to make slightly more sense... It seems that I can just have a separate channel variable for each sound, and not have to care much about what happens to them, so I assume stuff gets done behind-the-scenes.

The worst thing is, after staring at the word "sound" for so long, it doesn't even look like a real word anymore!

-=-=-
blog | work | code | more code
Fri, 06 Feb 2009, 09:56
Jayenkai
Hehe, I hate when that happens!

But, yeah, just ignore the channels unless you really need to.

Like I said, you needn't even bother assigning channels in most cases. Rather than Chan=PlaySound(MySound), just ignore it and PlaySound MySound, instead. (As you would DrawImage, or Text, or whatever else)

-=-=-
''Load, Next List!''