Page 1 of 1

Spring.PlaySoundFile not always audible

Posted: 24 Sep 2012, 23:04
by LEDZ
In the nukeTracker widget, I have some sounds played via

Code: Select all

sirenVolume = 100
Spring.PlaySoundFile("LuaUI/Sounds/enemyNukeLaunch.ogg",sirenVolume)
Sometimes the sound isn't heard. Is this because of the max simultaneous sounds setting in Spring settings and if so, is there a way to prioritise some sounds over others?

Re: Spring.PlaySoundFile not always audible

Posted: 27 Sep 2012, 01:16
by knorke
try if it helps to specify a channel:
http://springrts.com/wiki/Lua_UnsyncedCtrl#Sounds

Re: Spring.PlaySoundFile not always audible

Posted: 01 Oct 2012, 23:26
by LEDZ
This doesn't seem to have an effect.
I also tried making the layer of the widget = -100 to no avail.
I seem to remember a lower layer making the widget a higher priority or something similar.

Re: Spring.PlaySoundFile not always audible

Posted: 02 Oct 2012, 13:21
by knorke
hm if you can upload the sound+widget it will be easier to test...
Atm I lean more towards problems with the soundfile (try mono maybe) or widget rather than bug in engine, so moving it to "games & mods" for now..

Re: Spring.PlaySoundFile not always audible

Posted: 02 Oct 2012, 14:33
by LEDZ
Below are three examples of sounds from the widget. All sounds are affected equally it would seem and usually when there are other sounds playing (from fighting going on).

cabal_silo_online.ogg
duration: 2.581 s
sample rate: 44100 Hz
channels: 1
bitrate: 76 kbps
codec: vorbis
encoding: lossy

enemyNukeLaunch.ogg
duration: 5.27 s
sample rate: 44100 Hz
channels: 1
bitrate: 127 kbps
codec: vorbis
encoding: lossy

NuclearMissReady.wav
duration: 1.4 s
sample rate: 48000 Hz
channels: 1
bitrate: 768 kbps
codec: PCM
encoding: lossless

Re: Spring.PlaySoundFile not always audible

Posted: 02 Oct 2012, 15:56
by LEDZ
Here is a beta version of the widget with sounds included (note these sounds include game ripped files) just for examples of eventual functionality.
http://www.mediafire.com/?2o5uiidfs56ksqt

Re: Spring.PlaySoundFile not always audible

Posted: 08 Oct 2012, 03:44
by Forboding Angel
Try using mono. In this case it shouldn't matter at all, but humor me.

Edit: Derp, they are mono.

Re: Spring.PlaySoundFile not always audible

Posted: 08 Oct 2012, 03:48
by jK
LEDZ wrote:All sounds are affected equally it would seem and usually when there are other sounds playing (from fighting going on).
again Einstein was right :|

Re: Spring.PlaySoundFile not always audible

Posted: 08 Oct 2012, 12:34
by LEDZ
again Einstein was right :|
So what would Einstein suggest can be done about this problem?

Re: Spring.PlaySoundFile not always audible

Posted: 08 Oct 2012, 13:56
by jK
Einstein wrote:Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.


PS: sound channels are limited in contrast to stupidity.
PPS: in Spring sound items have a priority defined in sounds.lua

Re: Spring.PlaySoundFile not always audible

Posted: 08 Oct 2012, 18:14
by LEDZ
jK wrote:
Einstein wrote:Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.


PS: sound channels are limited in contrast to stupidity.
PPS: in Spring sound items have a priority defined in sounds.lua
I'll reply in kind.
Einstein wrote:"If A is a success in life, then A equals X plus Y plus Z. Work is X; Y is play; and Z is keeping your mouth shut."
Can you increase X by giving explaining how sounds played by widgets can override sound priorities so that we can all increase Y; otherwise you might as well maximise Z.

Re: Spring.PlaySoundFile not always audible

Posted: 08 Oct 2012, 19:33
by knorke
how sounds played by widgets can override sound priorities
Did not test but seems Spring.LoadSoundDef http://springrts.com/wiki/Lua_UnsyncedCtrl can create new sounddefs "on the fly" with new priority.

Re: Spring.PlaySoundFile not always audible

Posted: 21 Nov 2012, 14:56
by Jools
Is there any way to preload soundfiles if you play them using PlaySoundFile? What if you have about 300 files? Are they all loaded when running this call?

Re: Spring.PlaySoundFile not always audible

Posted: 22 Nov 2012, 04:02
by Forboding Angel
LEDZ wrote:Can you increase X by giving explaining how sounds played by widgets can override sound priorities so that we can all increase Y; otherwise you might as well maximise Z.
JK was joking, don't take it seriously :-)

Re: Spring.PlaySoundFile not always audible

Posted: 22 Nov 2012, 12:36
by jK
Jools wrote:Is there any way to preload soundfiles if you play them using PlaySoundFile? What if you have about 300 files? Are they all loaded when running this call?
jK wrote:PPS: in Spring sound items have a priority defined in sounds.lua

Re: Spring.PlaySoundFile not always audible

Posted: 22 Nov 2012, 12:58
by Jools
Yes, sound items, but does this also apply to sounds played by Spring.PlaySoundFile("sounds/xxx.wav")?

Aren't these just handled on the fly?

Re: Spring.PlaySoundFile not always audible

Posted: 22 Nov 2012, 18:07
by jK
Spring.PlaySoundFile("sounds/xxx.wav") IS a sound item