You cant play more than one sound at the same time. I read that even HyperCard has a nice soundchannel thingy...
Using quicktime players is no solution for things like games or quick sound effects. I tried it with 4 invisible players and setting the currentTime to 0 when replaying the same sound. It makes a nasty visible lag in the animation loop (while repeating the same short sound time mulitple times).
Used some modified cross platform playsound function I came across (why would I even need to do that.. LiveCode should take care of something basic as playing sound x on channel y with volume z)
And while I'm at it.. the play command also is quit picky. Even on .wav files. It has to be 16 bit. Higher gives noise (too low playback rate).
Code: Select all
command playSound psound, pchannel, pvolume, ptype
local tpath
if pchannel is empty then
put "c1" into pchannel
end if
if pvolume is empty then
put 100 into pvolume
end if
if the environment is not "mobile" then
set the playLoudness of player pchannel to pvolume
if ptype is "looping" then
set the looping of player pchannel to true
else
set the looping of player pchannel to false
end if
put AppData & "/audio/" & psound into tpath
if the fileName of player pchannel is not tpath then
stop player pchannel
set the currentTime of player pchannel to 0
set the fileName of player pchannel to tpath
start player pchannel
else
set the currentTime of player pchannel to 0
start player pchannel
end if
return true
end if
if ptype is empty then
if mobileSoundChannelStatus(pchannel) is "playing" then
mobileStopPlayingOnChannel pchannel
end if
mobileSetSoundChannelVolume pchannel, pvolume
put "now" into ptype
end if
put AppData & "/audio/" & psound into tpath
mobilePlaySoundOnChannel tpath, pchannel, ptype
end playSound