[Implemented] PlaySound Modification

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
hypervox
User
User
Posts: 48
Joined: Mon Apr 28, 2003 10:02 am
Location: UK
Contact:

[Implemented] PlaySound Modification

Post by hypervox »

Greetings to one and all.

Playsound is wonderful, but seems to have some limitations that have been discussed before. If the same playsound command is called quickly and repeatedly, the sound does not have a chance to play.

I know the windows API version of playsound has more options, and it would be nice to see those echoed in the PB version. I would especially like to see is an option where playsound will return if the sound it is playing is still in progrss from a previous playsound call. This would be especially useful for games where we use fast loops with input, and playsound may be called repeatedly.

(Yes, i know we've got the windows API, but it would be a nice feature, especially if it was multi platform....)

My apologies if this has already been mentioned. :wink:
PC 1:AMD Athlon XP 2000,Geforce 2 MX400 64Mb, Windows 2000 :D
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000 :)
Registered Purebasic User :D

PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Yes

Post by LJ »

Well spoken hypervox.

Perhaps the channel can be set by adding a variable to the PlaySound command such as:

sndphaser = PlaySound(#phaser)

Which plays the .wav sound stored in #phaser; then used in the context that hypervox has spoken of in the main game loop:

Code: Select all

if sndphaser = 0
    sndphaser = PlaySound(#phaser)
endif
Another way could be: a PlaySound(file name, [channel #])
So that:
PlaySound (#phaser,1)

Would begin playing the sound #phaser on channel 1.

Then another command needs to be added to see if a channel is busy.
A ChannelBusy(channel #) command. Then used in the context hypervox spoke of:

Code: Select all

if ChannelBusy(1) = 0
     playsound (#phaser,1)
endif
Post Reply