The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: keito940 on July 07, 2018, 06:26:41 AM

Title: [120.3r8054] Sound Effect Button Alway Mute
Post by: keito940 on July 07, 2018, 06:26:41 AM
Hello. I am keito 940.
Actually, at 120.2, a sound effect appeared, but if you update to 120.3 it will not produce a sound effect for some reason. I thought that it was a bug in pak128, but there are sound effects even if you look at the sound folder ....
I noticed that the sound effect mute button was locked.
Is this a bug?
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: prissi on July 07, 2018, 01:47:35 PM
There will be no sound, when there is no noise for the cash sound. When using nosound, then upon reload sounds are not loaded. You could delete your settings.xml to have sound again or use the -r 8540 and up
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: keito940 on July 08, 2018, 07:50:59 AM

Quote from: prissi on July 07, 2018, 01:47:35 PM
You could delete your settings.xml to have

ok. My Simutrans File Not Have settings.xml
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: Ters on July 08, 2018, 08:16:51 AM
Quote from: keito940 on July 08, 2018, 07:50:59 AM
ok. My Simutrans File Not Have settings.xml

If you've run Simutrans, you have a settings.xml in your Simutrans user directory. Where that directory is depends on installation method and operating system.
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: keito940 on July 11, 2018, 08:45:42 AM
Quote from: Ters on July 08, 2018, 08:16:51 AM
you have a settings.xml in your Simutrans user directory.
ok. ...But even if setting.xml is deleted, no sound effects will come out.
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: ACarlotti on July 13, 2018, 04:10:58 AM
I'm confused about the intention of r8540. Does it change the meaning of the -nosound command line flag from "Don't load any sound files" to "Start the game with sound muted"? If so, then that change could have a severe impact on the memory requirements, and hence ability to play the game, for certain paksets.

For instance, pak128.britain currently has a size of around 600MB, of which about 300MB is sound. Since I am generally running close to the limits of my RAM+swap (2GB each), not loading those 300MB of sound assets is very important to me, particularly when I am frequently restarting the game during testing.
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: Ters on July 13, 2018, 05:07:54 AM
300 MB is between about 1/6 and 1/10 of the memory space available to Simutrans under normal conditions (nearly 2-3 GB).
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: ACarlotti on July 13, 2018, 05:38:11 AM
Quote from: Ters on July 13, 2018, 05:07:54 AM300 MB is between about 1/6 and 1/10 of the memory space available to Simutrans under normal conditions (nearly 2-3 GB).
You assume (incorrectly) that I make all of my memory available to Simutrans while playing. I don't. Usually I will have several other applications open, including a web browser; before I discovered the "-nosound" flag I generally needed to close the web browser to be able to run Simutrans properly.

In any case, not loading sound also reduces the startup time by a factor of two (only half as much data to read into memory).
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: Trenomor on July 13, 2018, 11:05:42 AM
Quote from: keito940 on July 07, 2018, 06:26:41 AM
Hello. I am keito 940.
Actually, at 120.2, a sound effect appeared, but if you update to 120.3 it will not produce a sound effect for some reason. I thought that it was a bug in pak128, but there are sound effects even if you look at the sound folder ....
I noticed that the sound effect mute button was locked.
Is this a bug?

I had the same problem, using Windows.
The GDI installer from the download section worked for me.
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: Ters on July 13, 2018, 02:16:35 PM
Quote from: ACarlotti on July 13, 2018, 05:38:11 AM
You assume (incorrectly) that I make all of my memory available to Simutrans while playing.

No, I didn't. I was strictly speaking of the amount of virtual memory given to a 32-bit process, which Simutrans traditionally is. Even someone with infinite amount of RAM isn't much better off than you when it comes to memory available for the rest of Simutrans.
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: prissi on July 14, 2018, 02:59:07 PM
To elaborate on that: The sounds will sit in the page file but will not affect your performance (unless you have a very small harddisk).
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: Ters on July 14, 2018, 06:27:24 PM
Quote from: prissi on July 14, 2018, 02:59:07 PM
To elaborate on that: The sounds will sit in the page file but will not affect your performance (unless you have a very small harddisk).
There is still 300 MB of virtual address space (out of 2048 MB, which is 15%) that can not be used for images, the map or other game data. And ACarlotti has claimed only having 2 GB of swap file space, meaning that the sounds use up almost a 7.5% of the total allocatable memory on the whole system without being used. That is unless Simutrans memory maps the sound files, which I do not think is the case for any sound back-end.

Loading 300 MB into RAM only to write it back out to disk also takes time, at least on the kind of systems that tend(ed) to have 2 GB RAM.
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: Matthew on July 14, 2018, 08:18:45 PM
Quote from: keito940 on July 07, 2018, 06:26:41 AM
Hello. I am keito 940.

Welcome to the International Simutrans Forum, keito 940!
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: prissi on July 15, 2018, 02:35:30 PM
That is why the pak64 sounds are encoded as 8 bit 11 kHz mono, which saves a factor of 16 in space ...
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: An_dz on July 15, 2018, 02:54:00 PM
So the solution is to use crap sound? That doesn't 'sound' right.
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: prissi on July 16, 2018, 01:06:55 PM
These sounds are usually never playerd at full level (so 8 bit is ok). Also they have no direction, so mono is fine. These two are already 4x saving without imposing on quality in the game. The GDI version could also play mp3 coded wavs, but linux cannot (at least the last time when I tested, which might be already ten years ago ... )
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: TurfIt on August 09, 2018, 05:39:32 PM
Quote from: prissi on July 07, 2018, 01:47:35 PM
When using nosound, then upon reload sounds are not loaded. You could delete your settings.xml to have sound again or use the -r 8540 and up
What is this supposed to mean?  If using -nosound, pre 8540, sounds not being loaded is correct. If the game is subsequently loaded without -nosound, then the previous mute selection is retained. Deleting settings.xml is not required. All 8540 does is bloat memory usage when using -nosound, and more important mute the sounds every time you load!


Quote from: ACarlotti on July 13, 2018, 04:10:58 AM
I'm confused about the intention of r8540. Does it change the meaning of the -nosound command line flag from "Don't load any sound files" to "Start the game with sound muted"?
From what I see, even without -nosound specified, r8540 makes it "Start the game with sound muted". Not sure why that would be desired behaviour...


Quote from: prissi on July 15, 2018, 02:35:30 PM
That is why the pak64 sounds are encoded as 8 bit 11 kHz mono, which saves a factor of 16 in space ...
mono 8bit 11kHz only applies to the files on disk. Once loaded into memory, they are converted to mono 16bit 22kHz.


Anyway, it's possible the OP has ran into an issue with SDL2. If still around, can you clarify what version you were/are running?

On my Win10 system, SDL2 is coming back with F32 as the only available audio format. Since the sdl_sound backend is strangely insisting on S16, dr_init_sound is failing. And since the error messages have been mangled (dbg->important takes different params than dbg->warning et al.), you don't see that.
Allowing F32 since SDL2 can convert at play time (and Simutrans is converting upon wav loading anyway) allows sound to work again.

Attached proposed patch reverting 8540, adding sdl2_sound.cc that requests S16, but allows anything, and converts .wavs to the obtained device output format rather than S16 (eliminate double conversion).

Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: kierongreen on August 11, 2018, 03:53:19 PM
Perhaps add a new flag -mute which would set volume to zero at startup if that's what someone wanted, with -nosound reverting to previous behaviour of sound being completely disabled?
Title: Re: [120.3r8054] Sound Effect Button Alway Mute
Post by: prissi on August 21, 2018, 02:13:17 AM
The SDL2 sound in the patch does only includes SDL.h? Hmm. And on my computer I get SDL2 sound by just renaming the <SDL.h> to <SDL2.h> and leave everything the same.

And I think on should do a nosound and a mute flag, as it is in r8556.