GLBasic forum

Feature request => music/sound => Topic started by: spacefractal on 2012-Jan-03

Title: Tiny Request: Playing a sampleloop (not musicloop)
Post by: spacefractal on 2012-Jan-03
PLAYSOUND(sfx, pan#, volume#, loop#) where loop is TRUE or FALSE. This would not break combatible at all, since loop# should only been a option of course.

Yes I are aware of SOUNDPLAYING(), but its cannot been used fora  looped sound because this require very careful timing as well. And its would also chop sometimes anyway and then cutter when lopped.

For stopping the sound, simply add a STOPSOUND(sfx) command.

Also changing panning and volume on a played sound while playing a sample would been nice, but not required.

PS. Yes you can do looped music which is very nice, the only reason is I need two looped samples (one music, and one sfx).
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: spicypixel on 2012-Jan-04
Dynamic Panning and Volume would make for a really nice gaming atmosphere :)
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: r0ber7 on 2012-Jan-04
Quote from: spicypixel on 2012-Jan-04
Dynamic Panning and Volume would make for a really nice gaming atmosphere :)

+1  :good:
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: erico on 2012-Jan-04
It sure would be nice to have our sound system improved on a few ways.
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: r0ber7 on 2012-Jan-06
Being able to adjust volume and panning while playing a sound would make me do a little dance of happy.
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: Gary on 2012-Jan-06
it would also remove the need to specify how many times to repeat the sample when loading it which I believe takes up 4 times the memory if you tell GLB to play the sample 4 times at the point of loading.

Is any of the above posts requests at all possible kitty?
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: Kitty Hello on 2012-Jan-08
I'll have a look. I wanted to either switch to SDL for windows anyway, or write my own mixer routines that would allow a lot of other messings. It's just a lot of additional work.
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: bigsofty on 2012-Jan-08
I would like to see openal used across all platforms. It would allow messing about at a lot lower level. I realise windows would need an extra DLL but it's a small price to pay for a much better API  IMHO.
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: Kitty Hello on 2012-Jan-09
Can I link OpenAL statically?
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: Albert on 2012-Jan-09
+1 for OpenAL
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: aonyn on 2012-Jan-09
Please, +1 for me also.

Thanks,
Dave
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: bigsofty on 2012-Jan-09
Quote from: Kitty Hello on 2012-Jan-09
Can I link OpenAL statically?

If its just Windows then:

Well I think, MINGW links to it statically( See http://www.nongnu.org/mingw-cross-env/#packages ), so it seems to be possible. I have not tried it, also a quick google brought up this post, http://permalink.gmane.org/gmane.comp.lib.openal/6355

Its a bit of a grey area though.

That being said, personally I don't mind making sure that the little the openal DLL is part of the final distro for my program.
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: spacefractal on 2012-Jan-09
For the tiny request I originally asked, possible to loop samples as well dymanic control volume and panning. That would works in most games really we create in this language really (including that game I create). I have a little sirene sound I want to been looped (and can been stopped at any time), but might allready have music played in background.

Its would been great to let to mix it to 22khz to save cpu as well, which could been wonderfull for those lesser powered Android devices or general. Example I use 22khz mono sound samples, so I have no need to mix to a 44khz output at all. I would do reduced very much cpu time here.

PS. OpenAL would been a great bonus for much more advanced control and could been using with new commands rather than replace them (and might limit support of devices, hence own commands here). Also if you ask me as others say, I would also not mind to include a dll file too at all. That even its should only been required for Windows 98 and XP. With OpenAL you should also been possible to support more than just PCM wav files.

Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: Nathan on 2012-Jan-10
For looping sounds (only), would this help at all?

http://www.glbasic.com/forum/index.php?topic=3917.0 (http://www.glbasic.com/forum/index.php?topic=3917.0)

As I also need to loop sounds, I'm going to have a go at implementing it tonight.
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: spacefractal on 2012-Jan-10
Yes are of that, but imperfect for multiplatform use, due framerate I set might variere. Etc its cannot allways checked just in time.

not sure it's can been done in a thread, but glbasic is not thread safe.
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: bigsofty on 2012-Jan-10
Oops, sorry Spacefractal, got a little OT there.  :-[
Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: spacefractal on 2012-Jan-10
hihi dont worry.

I also like to see OpenAL too (its a well spread standard too), and its could even been a nice separate product if you ask me. That due you might need to include a dll for older Windows systems, but people that use its should not mind that at all. I would even pay for a cool sound system like this. But its not for anyone, hence I guess better for a separate product mightbeen. This would also mean better format support, example like ADPCM wav i would like to see.

OpenAL might not work on older platforms (gp32 or such), but hence I dont normally call sound functions directly, but first called a function first to do some job first. So its easy to change what it needed for various platforms.

Those request was just requested because I dont think its should take long time to implements and for compatible. And its would tied nicely for the Music Commands.






Title: Re: Tiny Request: Playing a sampleloop (not musicloop)
Post by: r0ber7 on 2012-Jan-10
Quote from: Kitty Hello on 2012-Jan-08
I'll have a look. I wanted to either switch to SDL for windows anyway, or write my own mixer routines that would allow a lot of other messings. It's just a lot of additional work.

This would allow adjusting volume and panning during playback? If it's a lot of work i totally understand if it doesn't happen. I have many requests for in my game which sound awesome but not every idea is realistic considering time and effort and real life. However , if it does end up in glbasic i'll buy one of those sketchbooks. ;-)