Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Sound in linux (Lack of standards in Linux is a problem but there are some near-standards)
Sound in linux [message #44031] Tue, 16 December 2014 10:51 Go to previous message
rainbowsally is currently offline  rainbowsally
Messages: 29
Registered: December 2014
Promising Member
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.

Here's what I have for uppsrc/Core/Util.cpp for the linux sounds.

---------
#ifdef PLATFORM_POSIX
static void LinuxBeep(const char *fn)
{
//	return;
//	// This is not the right way to do that... (causes zombies, 
// ignores Gnome settings)
	char hb[100];
	char* h = hb; // so we can see the string in the debugger
	sprintf(h, "play -q /usr/share/sounds/freedesktop/stereo/dialog-%s.oga 2>/dev/null &", fn);
//	strcat(h, fn);
//#ifdef CPU_BLACKFIN
//	if(vfork()) return;
//#else
//	if(fork()) return;
//#endif
//	IGNORE_RESULT(
		0 == system(h);
//	);
//	_exit(EXIT_SUCCESS);
}
#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 BeepQuestion()
{
#ifdef PLATFORM_WIN32
	MessageBeep(MB_ICONQUESTION);
#else
	LinuxBeep("information");
//	write(1, "\a", 1); //??
#endif
}

---------------

UPP is so cool it hurts. Smile Thank you.

 
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: Sun Apr 28 09:48:56 CEST 2024

Total time taken to generate the page: 0.02366 seconds