Spring.PlaySoundFile not always audible

Spring.PlaySoundFile not always audible

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
LEDZ
Posts: 66
Joined: 27 Jun 2011, 13:43

Spring.PlaySoundFile not always audible

Post 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?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Spring.PlaySoundFile not always audible

Post by knorke »

try if it helps to specify a channel:
http://springrts.com/wiki/Lua_UnsyncedCtrl#Sounds
LEDZ
Posts: 66
Joined: 27 Jun 2011, 13:43

Re: Spring.PlaySoundFile not always audible

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Spring.PlaySoundFile not always audible

Post 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..
LEDZ
Posts: 66
Joined: 27 Jun 2011, 13:43

Re: Spring.PlaySoundFile not always audible

Post 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
LEDZ
Posts: 66
Joined: 27 Jun 2011, 13:43

Re: Spring.PlaySoundFile not always audible

Post 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
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Spring.PlaySoundFile not always audible

Post by Forboding Angel »

Try using mono. In this case it shouldn't matter at all, but humor me.

Edit: Derp, they are mono.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Spring.PlaySoundFile not always audible

Post 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 :|
LEDZ
Posts: 66
Joined: 27 Jun 2011, 13:43

Re: Spring.PlaySoundFile not always audible

Post by LEDZ »

again Einstein was right :|
So what would Einstein suggest can be done about this problem?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Spring.PlaySoundFile not always audible

Post 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
LEDZ
Posts: 66
Joined: 27 Jun 2011, 13:43

Re: Spring.PlaySoundFile not always audible

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Spring.PlaySoundFile not always audible

Post 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.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Spring.PlaySoundFile not always audible

Post 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?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Spring.PlaySoundFile not always audible

Post 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 :-)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Spring.PlaySoundFile not always audible

Post 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
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Spring.PlaySoundFile not always audible

Post 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?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Spring.PlaySoundFile not always audible

Post by jK »

Spring.PlaySoundFile("sounds/xxx.wav") IS a sound item
Post Reply

Return to “Game Development”