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 #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: 1117
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: Tue May 19 15:45:39 GMT+2 2026

Total time taken to generate the page: 0.00706 seconds