Am Mittwoch, den 08.10.2008, 22:08 +0200 schrieb Thomas Treichl:
> Thomas Weber schrieb:
> >> Can you once again tell me why you see the 'ofsndplay' utility on Linux - 
> >> I 
> >> can't find the origin of that problem and why this happens? 
> > 
> > // PKG_ADD: global sound_play_utility="ofsndplay -";
> > from OFSndPlay.cc ends up in audio's PKG_ADD file. This sets the global
> > variable unconditionally.
> 
> Oh, oh. Thanks, I didn't notice that. Then what about a quick and dirty hack 
> like this for the moment
> 
>    // PKG_ADD: if (ismac ()), global sound_play_utility="ofsndplay -"; endif
> 
> would this already solve your problem?

How about the attached patch instead? No special case for any platform
and checks for the existence of the command as well.

        Thomas

Index: src/OFSndPlay.cc
===================================================================
--- src/OFSndPlay.cc	(Revision 5346)
+++ src/OFSndPlay.cc	(Arbeitskopie)
@@ -11,8 +11,6 @@
  *     Moved this file file from the MacOSX package to the audio package.
  */
 
-// PKG_ADD: global sound_play_utility="ofsndplay -";
-
 #import <Foundation/Foundation.h>
 #import <AppKit/AppKit.h>
 
Index: inst/sound.m
===================================================================
--- inst/sound.m	(Revision 5346)
+++ inst/sound.m	(Arbeitskopie)
@@ -84,8 +84,21 @@
     islocal = strcmp(tolower(host),tolower(display));
   endif
 
+  ## What do we use for playing?
+  if (exist("sound_play_utility", "var"))
+    ## The user is always right, so just declare the set variable as global
+    global sound_play_utility;
+  elseif  (file_in_path(EXEC_PATH, "ofsndplay"))
+    ## Mac
+    sound_play_utility = "ofsndplay -"
+  elseif (file_in_path(EXEC_PATH, "play"))
+    ## Linux (sox)
+    sound_play_utility = "play -t AU -";
+  else
+    error("sound.m: No command line utility found for sound playing");
+  endif
+
   ## If not running locally, then must use ssh to execute play command
-  global sound_play_utility="play -t AU -";
   if islocal
     fid=popen(sound_play_utility, "w");
   else
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to