How do I set up system sound effects in wine?

Questions about Wine on Linux
Locked
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

How do I set up system sound effects in wine?

Post by Enderdude »

I went onto the sound section onto the faq on wine help, and it only gave me how to assign SystemExclamation, and Default, but that's it, I don't know what are the names to the other notification strings, to play Critical Stop, aka error and I tried this for a long time and wine doesn't seem to give out the rest of the string names to me easily. If somebody actually knows more names, please, type it as a reply!
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How do I set up system sound effects in wine?

Post by Bob Wya »

Enderdude wrote:I went onto the sound section onto the faq on wine help, and it only gave me how to assign SystemExclamation, and Default, but that's it, I don't know what are the names to the other notification strings, to play Critical Stop, aka error and I tried this for a long time and wine doesn't seem to give out the rest of the string names to me easily. If somebody actually knows more names, please, type it as a reply!
A quick look at the Wine Source code reveals all (as of Wine version 3.0-rc1):

Code: Select all

            static const WCHAR  wszSystemAsterisk[] = {'S','y','s','t','e','m','A','s','t','e','r','i','s','k',0};
            static const WCHAR  wszSystemDefault[] = {'S','y','s','t','e','m','D','e','f','a','u','l','t',0};
            static const WCHAR  wszSystemExclamation[] = {'S','y','s','t','e','m','E','x','c','l','a','m','a','t','i','o','n',0};
            static const WCHAR  wszSystemExit[] = {'S','y','s','t','e','m','E','x','i','t',0};
            static const WCHAR  wszSystemHand[] = {'S','y','s','t','e','m','H','a','n','d',0};
            static const WCHAR  wszSystemQuestion[] = {'S','y','s','t','e','m','Q','u','e','s','t','i','o','n',0};
            static const WCHAR  wszSystemStart[] = {'S','y','s','t','e','m','S','t','a','r','t',0};
            static const WCHAR  wszSystemWelcome[] = {'S','y','s','t','e','m','W','e','l','c','o','m','e',0};
Bob
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

Thank you!
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

The sound effects actually don't play when it plays on windows, even though that the sounds are set in win.ini! :x
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How do I set up system sound effects in wine?

Post by Bob Wya »

Enderdude wrote:The sound effects actually don't play when it plays on windows, even though that the sounds are set in win.ini! :x
Here's a simple C source code that you can build with winegcc to test your Wine system sounds are setup correctly:

Code: Select all

wine_system_sound_test.cpp

#include <windows.h>
#include <mmsystem.h>

int main(int argc, char* argv[]) {
	if (argc > 1)
		PlaySoundA((LPCSTR) argv[1], NULL, SND_ALIAS | SND_SYNC);
	else
	{
		PlaySoundA((LPCSTR) "SystemAsterisk", NULL, SND_ALIAS | SND_SYNC);
		PlaySoundA((LPCSTR) "SystemDefault", NULL, SND_ALIAS | SND_SYNC);
		PlaySoundA((LPCSTR) "SystemExclamation", NULL, SND_ALIAS | SND_SYNC);
		PlaySoundA((LPCSTR) "SystemExit", NULL, SND_ALIAS | SND_SYNC);
		PlaySoundA((LPCSTR) "SystemHand", NULL, SND_ALIAS | SND_SYNC);
		PlaySoundA((LPCSTR) "SystemQuestion", NULL, SND_ALIAS | SND_SYNC);
		PlaySoundA((LPCSTR) "SystemStart", NULL, SND_ALIAS | SND_SYNC);
		PlaySoundA((LPCSTR) "SystemWelcome", NULL, SND_ALIAS | SND_SYNC);
	}
}
Just build it with winegcc:

Code: Select all

winegcc winmm.dll.so -o wine_system_sound_test wine_system_sound_test.cpp
You might need to specify the full absolute path for the winmm.dll.so library...

Code: Select all

find /usr/ -name "winmm.dll.so"
The test just runs through all the system sounds and stops.
Or plays a single system sound - if one is specified as an command line argument.
E.g.:

Code: Select all

wine wine_system_sound_test.exe.so SystemDefault
Bob
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

Here's the output of find:

Code: Select all

find /usr/ -name "winmm.dll.so"
find: ‘/usr/share/doc/google-chrome-stable’: Permission denied
Then the application quits :?
(EDIT I found it in /opt/wine-staging/lib/wine/)
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

where can I get the include files?
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

Should I install wine-devel and remove wine-staging?
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How do I set up system sound effects in wine?

Post by Bob Wya »

Enderdude wrote:Should I install wine-devel and remove wine-staging?
Don't worry about it... It's apparently way more hassle than it's worth to setup winegcc on Ubuntu...

Mutters stuff about sticking to Gentoo... :wink:
Bob
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

Can you at least compile it so that I don't have to switch distros or get into confusion with configuring wine? Please?
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How do I set up system sound effects in wine?

Post by Bob Wya »

Enderdude wrote:Can you at least compile it so that I don't have to switch distros or get into confusion with configuring wine? Please?
I'll have a go - but that means building it with MinGW or Visual Studio - so it's a proper native PE Windows executable.
Which in my experience is a bit more fiddly!

Bob
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How do I set up system sound effects in wine?

Post by Bob Wya »

@Enderdude,

Attached is a VS2010 compilation of the utility as a native Windows PE executable.
Tested and working under Windows 7 and Wine 3.0-rc2.

Bob
Attachments
wine_system_sound_test.exe.gz
(414 Bytes) Downloaded 177 times
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

Ummm... a window pops up saying, "access denied"
here's a terminal log:

Code: Select all

test@test-thinkpad-t410:~$ wine '/home/test/winesfxtest/wine_system_sound_test.exe' 
fixme:winediag:start_process Wine Staging 2.4 is a testing version containing experimental patches.
fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.
fixme:ntoskrnl:KeInitializeEvent stub: 0x112998 1 0
fixme:ntoskrnl:KeInitializeEvent stub: 0x1129a8 1 1
fixme:ntoskrnl:PoSetPowerState (0x1 4 1124712) stub
wine: Unhandled page fault on read access to 0x40007600 at address 0x1126b0 (thread 0033), starting debugger...
wine: Bad EXE format for Z:\home\test\winesfxtest\wine_system_sound_test.exe.
test@test-thinkpad-t410:~$ 
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How do I set up system sound effects in wine?

Post by Bob Wya »

Enderdude wrote:Ummm... a window pops up saying, "access denied"
...
Arse, that was the winegcc version I attached (as I suspected that wasn't very portable)...
Sorry I've attached the VS2010 version this time!

Bob
Attachments
system_sound_test.exe.gz
system_sound_test.exe
(3.16 KiB) Downloaded 177 times
User avatar
Enderdude
Level 2
Level 2
Posts: 14
Joined: Wed Nov 22, 2017 2:11 pm

Re: How do I set up system sound effects in wine?

Post by Enderdude »

THANK YOU! It played the sounds when I opened the application :)
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How do I set up system sound effects in wine?

Post by Bob Wya »

np 8)
Locked