U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » U++ Developers corner » Sound in linux (Lack of standards in Linux is a problem but there are some near-standards)
Re: Sound in linux [message #44038 is a reply to message #44031] Wed, 17 December 2014 11:30 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
rainbowsally wrote on Tue, 16 December 2014 10:51
These are freedesktop sounds but I don't know what installed them. They were in my suse 11.4 and my mint 15

/usr/share/sounds/freedesktop/stereo/dialog-error.oga
/usr/share/sounds/freedesktop/stereo/dialog-warning.oga
/usr/share/sounds/freedesktop/stereo/dialog-information.oga

Probably the most generic player with ability to suppress commandline noise is sox. It installs the
/usr/bin/play program.



Thanks, I have taken your code and started investigating; ended with something like this:

#ifdef PLATFORM_POSIX

String CurrentSoundTheme = "freedesktop";

static void LinuxBeep(const char *name)
{
	String fn = "/usr/share/sounds/" + CurrentSoundTheme + "/stereo/dialog-" + name;
	system("play -q  " + fn + (FileExists(fn + ".ogg") ? ".ogg" :
                               FileExists(fn + ".oga") ? ".oga" :
                               FileExists(fn + ".wav") ? ".wav" :
                               ".*")
	       + " >/dev/null 2>/dev/null&");
}

#endif

void BeepInformation()
{
#ifdef PLATFORM_WIN32
	MessageBeep(MB_ICONINFORMATION);
#else
	LinuxBeep("information");
#endif
}

void BeepExclamation()
{
#ifdef PLATFORM_WIN32
	MessageBeep(MB_ICONEXCLAMATION);
#else
	LinuxBeep("warning");
#endif
}

void BeepError()
{
#ifdef PLATFORM_WIN32
	MessageBeep(MB_ICONERROR);
#else
	LinuxBeep("error");
#endif
}

void BeepQuestion()
{
#ifdef PLATFORM_WIN32
	MessageBeep(MB_ICONQUESTION);
#else
	LinuxBeep("question");
#endif
}



then in ChGtk:

	CurrentSoundTheme = GtkStyleString("gtk-sound-theme-name");


seems to work fine, playing sounds from selected theme. So from now on, thanks to you, U++ finally started to beep in Linux Smile

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Raster::Line segfaults ... sometimes.
Next Topic: Adding network proxy support to U++
Goto Forum:
  


Current Time: Thu Sep 10 15:10:36 GMT+2 2026

Total time taken to generate the page: 0.00813 seconds