[R-SIG-Mac] sound::setWavPlayer()

Simon Urbanek simon.urbanek at r-project.org
Wed Aug 27 17:06:39 CEST 2008

On Aug 27, 2008, at 10:52 , Hans-Jörg Bibiko wrote:

> On 27.08.2008, at 16:38, Simon Urbanek wrote:
>> FWIW the default should be to use "open" because that allows the  
>> user to map .wav to any applications they desire, you should not be  
>> hard-coding that in your code via -a.
> Yes of course. In my script I only check if the command begins with  
> 'open'.
>> On a similar note sound could do a better job of finding player  
>> since most users that deal with audio/video are likely to already  
>> have mplayer installed, so checking for mplayer and play may be a  
>> good idea.
> Yeap.
>> Finally, playing sound on OS X takes one line of code, so adding a  
>> player directly to the package would be trivial (or maybe creating  
>> a package that does the playing if desired..).
> setWavPlayer is doing this. It sets options()$wavplayer. It simply  
> contains the shell command.

That's my point - I was talking about native playback. When I said one  
line of code I meant Obj-C not shell, so you don't need any external  
application. To be precise to play an audio file all you do is
[[[NSSound initWithContentsOfFile:fileName byReference:YES]  
autorelease] play];
Thats' all :)


> The tricky thing is the chosen procedure of findWavPlayer. It tests  
> for hard-coded known applications for a given OS platform. But this  
> could be done better.
> The problem here was that the new Macs with Leopard are too fast ;)  
> I tried it out with my old Tiger ppc Mac (1.8GHz) and everthing  
> works fine, but on my new G5 with 8 cores 3GHz it doesn't work.
> But I'm just in contact with maintainer. Maybe we find a good  
> solution for it.
> Cheers,
> --Hans

More information about the R-SIG-Mac mailing list