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)
Re: Sound in linux [message #44105 is a reply to message #44103] Thu, 25 December 2014 13:56 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Mirek,

I think you should also protect the situation when player string is empty. It can leads to meaningless system call, that cost more resources than normal function call. The system needs to detect that invoking command is wrong.

Code:
if (!player.IsEmpty()) {
		String fn = "/usr/share/sounds/" + CurrentSoundTheme + "/stereo/dialog-" + name;
		// Call only if player is detected!!!
                IGNORE_RESULT(system(player + " -q " + fn +
	    	          (FileExists(fn + ".ogg") ? ".ogg" :
	        	       FileExists(fn + ".oga") ? ".oga" :
                	   FileExists(fn + ".wav") ? ".wav" :
                      ".*")
	              + " >/dev/null 2>/dev/null&"));
}


Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Thu, 25 December 2014 13:57]

Report message to a moderator

 
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: Sat May 11 21:00:21 CEST 2024

Total time taken to generate the page: 0.03115 seconds