I did discover one issue with the example given.

I get an error if I enter it this way:

    'winmm PlaySoundA>  i *c x i'&cd 'D:\13 Paganini_ Moto Perpetuo In C, Op. 
11.wav';0;0
|domain error: cd
|       'winmm PlaySoundA>  i *c x i'&cd'D:\13 Paganini_ Moto Perpetuo In C, 
Op. 
11.wav';0;0

But I do not get an error if I enter it this way, with a space between 
PlaySoundA and > :

    'winmm PlaySoundA >  i *c x i'&cd 'D:\13 Paganini_ Moto Perpetuo In C, Op. 
11.wav';0;0
1


On 2/10/2012 5:20, David Mitchell wrote:
> Bill's code works for ma on Win7 with JGTK32 and JGTK64.
>
> I did find one note in the MS documentation for PlaySoundA about the final
> parameter:
>
> Three flags in fdwSound (SND_ALIAS, SND_FILENAME, and SND_RESOURCE) determine
> whether the name is interpreted as an alias for a system event, a file name, 
> or
> a resource identifier. If none of these flags are specified, PlaySound 
> searches
> the registry or the WIN.INI file for an association with the specified sound
> name. If an association is found, the sound event is played. If no association
> is found in the registry, the name is interpreted as a file name.
>
> SND_FILENAME The pszSound parameter is a file name. If the file cannot be 
> found,
> the function plays the default sound unless the SND_NODEFAULT flag is set.
>
> #define SND_FILENAME    0x00020000L /* name is file name */
>
>      dfh '00020000'
> 131072
>
> So, one plausible alternative to Bill's suggestion that could work more 
> reliably
> on Vista or be less dependent on the registry could be to try this:
>
> 'winmm PlaySoundA>   i *c x i'&cd 'c:\j406\willie\01will.wav';0;131072
>
> David Mitchell
>
> On 2/9/2012 22:01, bill lam wrote:
>> The return value 1 indicated a success call. Perhaps there are some changes
>> in behavior in vista but I'm have no access ot any vista/win7 to test.
>>
>> Чтв, 09 Фев 2012, Linda Alvord писал(а):
>>> I turned on the speaker.  If I click on the .wav  in the "computer" listing 
>>> of files, the player opens the file and I can hear the sound.
>>>
>>> I included the  .dll in the same folder and also in Windows\system32 as 
>>> suggested.
>>>
>>> There appears to be no error when I run the J code you suggested and the 
>>> result is a  1
>>>
>>> I have used both  0  and  1  as the final digit.
>>>
>>> I'm not sure what else to try.
>>>
>>> Linda
>>>
>>> -----Original Message-----
>>> From: programming-boun...@jsoftware.com 
>>> [mailto:programming-boun...@jsoftware.com] On Behalf Of bill lam
>>> Sent: Thursday, February 09, 2012 9:30 AM
>>> To: Programming forum
>>> Subject: Re: [Jprogramming] What about wav's
>>>
>>> I tested this worked in my wine, change the last 0 to 1 for async playing.
>>>
>>> 'winmm PlaySoundA>   i *c x i'&cd 
>>> 'y:/jalgit/addons/math/tabula/warning.wav';0;0
>>>
>>> My question should be stupid, but did you turn on the speaker?
>>>
>>> Чтв, 09 Фев 2012, Linda Alvord писал(а):
>>>> I downloaded the winmm and unzipped it. If I go to files in "computer" and 
>>>> click on the  .wav  it will play. I have left the player open
>>>>
>>>> If I run the line you sent I get a  1  in the "Term" , but I do not hear 
>>>> the sound.
>>>>
>>>> Linda
>>>>
>>>> -----Original Message-----
>>>> From: programming-boun...@jsoftware.com 
>>>> [mailto:programming-boun...@jsoftware.com] On Behalf Of bill lam
>>>> Sent: Wednesday, February 08, 2012 10:56 PM
>>>> To: programming@jsoftware.com
>>>> Subject: Re: [Jprogramming] What about wav's
>>>>
>>>> gtk itself does not handle sound. you have to use platform dependent
>>>> solution. for window, try (untested)
>>>>
>>>> 'winmm PlaySoundA>   i *c x i'&cd 'c:\j406\willie\01will.wav';0;0
>>>>
>>>> or the unicode version
>>>> 'winmm PlaySoundW>   i *w x i'&cd (uucp 'c:\j406\willie\01will.wav)';0;0
>>>>
>>>> Срд, 08 Фев 2012, Linda Alvord писал(а):
>>>>> I have an application which calls ( or should call)  64 image and 64 sound
>>>>> files.  With your help I've gotten all the images working nicely in J7.
>>>>>
>>>>> Using J406 I made a folder with all the images and sound files plus
>>>>> mplayer2.exe.  The player will no longer play a  .wav  file in Microsoft
>>>>> Vista.
>>>>>
>>>>> Here's a sample of the code that used to work:
>>>>>
>>>>> wd'winexec"c:\j406\willie\mplayer2.exec:\j406\willie\01will.wav";'
>>>>>
>>>>> (It is impossible to insert the spaces in an e-mail. They should appear
>>>>> after wd , after winexec , and after .exe )
>>>>>
>>>>> Clicking on a button showed the image and then this code would play the
>>>>> .wav
>>>>>
>>>>> I have been unable to incorporate sound in an application since then.  
>>>>> Even
>>>>> using J406 the application no longer works because of Vista.
>>>>>
>>>>> Does anyone have a way to play  .wav  files in J701gtk ?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Linda
>>>>>
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>>> --
>>>> regards,
>>>> ====================================================
>>>> GPG key 1024D/4434BAB3 2008-08-24
>>>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>> --
>>> regards,
>>> ====================================================
>>> GPG key 1024D/4434BAB3 2008-08-24
>>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to