Playing a sound from a button

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Playing a sound from a button

Long Haired David
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Louis LaBrunda
Hi Dave,

Make sure you have WindowsPlatformFramework loaded.  In it you will find Platform Functions PlaySound and WaveOutSetVolume.  Use code something like this:

WaveOutSetVolume callWith: 0 with: volume.
PlaySound callWith: soundFile asPSZ with: nil with: (SndAsync | SndFilename).


to set the volume and play the sound.  You may want to fork this code with a background priority to keep other things running.  Good luck and have fun.

Lou



On Wednesday, June 13, 2018 at 7:25:26 AM UTC-4, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Long Haired David
In reply to this post by Long Haired David
Thanks Lou. I will give it a try. No need to fork. Nothing can happen until the loco hits the horn and then departs!

Here is what it looks like. I just cycle through the timetable and it tells me which train to run next.

Hardly rocket science but...

I then run the turnouts via a Java package called JMRI which can control them through my DCC controller. I can also set up routes so that a set of turnouts are set as required. What is nice is that when I talk about it all the old buffers on the newsgroups complain about it being over their heads, and I am older than them! Big grin.

Screen Shot 2018-06-07 at 14.40.43

David

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Long Haired David
In reply to this post by Long Haired David
Lou. Being a bit stupid in my old age, where will I find it?

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Louis LaBrunda
Hi Dave,

Don't feel bad, I sense that coming on too.  It is in WindowsPlatformFramework which is in PlatformFramework which can be loaded with the ENVY/Image Base configuration map.  You should also look at OSCall>playSound:hmod:fdwSound: and OSHwaveout>waveOutSetVolume: that make the platform calls.  You may need to play with the volume get it where you like it.

Lou


On Thursday, June 14, 2018 at 5:23:26 AM UTC-4, Totally Objects wrote:
Lou. Being a bit stupid in my old age, where will I find it?

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

David Pennington-2
Lou, I am on the 64 bit and I can't find any of this in the Envy/Image Base or even elsewhere. Can you give me a few more pointers?

On Thu, Jun 14, 2018 at 3:05 PM, Louis LaBrunda <[hidden email]> wrote:
Hi Dave,

Don't feel bad, I sense that coming on too.  It is in WindowsPlatformFramework which is in PlatformFramework which can be loaded with the ENVY/Image Base configuration map.  You should also look at OSCall>playSound:hmod:fdwSound: and OSHwaveout>waveOutSetVolume: that make the platform calls.  You may need to play with the volume get it where you like it.

Lou


On Thursday, June 14, 2018 at 5:23:26 AM UTC-4, Totally Objects wrote:
Lou. Being a bit stupid in my old age, where will I find it?

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Louis LaBrunda
Hi Dave,

Maybe it isn't in the 64 bit version?  Maybe someone at Instantiations can tell us for sure..  But in 32 bit v8.6.3 OSCall in PlatformInterface app, WindowsPlatformFunctions sub-app has #playSound:hmod:fdwSound: and OSHwaveout has #waveOutSetVolume:.

Lou

On Friday, June 29, 2018 at 3:40:06 PM UTC-4, Totally Objects wrote:
Lou, I am on the 64 bit and I can't find any of this in the Envy/Image Base or even elsewhere. Can you give me a few more pointers?

On Thu, Jun 14, 2018 at 3:05 PM, Louis LaBrunda <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="sUXBplYDCgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">L...@...> wrote:
Hi Dave,

Don't feel bad, I sense that coming on too.  It is in WindowsPlatformFramework which is in PlatformFramework which can be loaded with the ENVY/Image Base configuration map.  You should also look at OSCall>playSound:hmod:fdwSound: and OSHwaveout>waveOutSetVolume: that make the platform calls.  You may need to play with the volume get it where you like it.

Lou


On Thursday, June 14, 2018 at 5:23:26 AM UTC-4, Totally Objects wrote:
Lou. Being a bit stupid in my old age, where will I find it?

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe&#39;;return true;">https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="sUXBplYDCgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">va-smalltalk...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="sUXBplYDCgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">va-sma...@....
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Seth Berman
Hello,

Its there in 64-bit...none of that is removed.
OSCall>>playSound:hmod:fdwSound:

Just do a browse implementors with
playSound*

-- Seth

On Friday, June 29, 2018 at 4:03:42 PM UTC-4, Louis LaBrunda wrote:
Hi Dave,

Maybe it isn't in the 64 bit version?  Maybe someone at Instantiations can tell us for sure..  But in 32 bit v8.6.3 OSCall in PlatformInterface app, WindowsPlatformFunctions sub-app has #playSound:hmod:fdwSound: and OSHwaveout has #waveOutSetVolume:.

Lou

On Friday, June 29, 2018 at 3:40:06 PM UTC-4, Totally Objects wrote:
Lou, I am on the 64 bit and I can't find any of this in the Envy/Image Base or even elsewhere. Can you give me a few more pointers?

On Thu, Jun 14, 2018 at 3:05 PM, Louis LaBrunda <[hidden email]> wrote:
Hi Dave,

Don't feel bad, I sense that coming on too.  It is in WindowsPlatformFramework which is in PlatformFramework which can be loaded with the ENVY/Image Base configuration map.  You should also look at OSCall>playSound:hmod:fdwSound: and OSHwaveout>waveOutSetVolume: that make the platform calls.  You may need to play with the volume get it where you like it.

Lou


On Thursday, June 14, 2018 at 5:23:26 AM UTC-4, Totally Objects wrote:
Lou. Being a bit stupid in my old age, where will I find it?

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe&#39;;return true;">https://groups.google.com/d/topic/va-smalltalk/zV8Ary-cGrM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to va-smalltalk...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/va-smalltalk" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/va-smalltalk&#39;;return true;">https://groups.google.com/group/va-smalltalk.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Long Haired David
In reply to this post by Long Haired David
OSHwaveout new waveOutSetVolume: 1000.
OSCall new
playSound: '2tone.wav' asPSZ
hmod: nil
fdwSound: nil

That works fine. Many thanks Lou (plus Matt Sims and Seth) for the help. In spite of me using VAST since V3, I don't often get down and dirty like that!
David

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
David
Totally Objects
Doing Smalltalk since 1989
Reply | Threaded
Open this post in threaded view
|

Re: Playing a sound from a button

Louis LaBrunda
Hi Dave,

Now you need to post a video (with sound) of the choo-choo:)

Lou

On Thursday, July 5, 2018 at 10:37:10 AM UTC-4, Totally Objects wrote:
OSHwaveout new waveOutSetVolume: 1000.
OSCall new
playSound: '2tone.wav' asPSZ
hmod: nil
fdwSound: nil

That works fine. Many thanks Lou (plus Matt Sims and Seth) for the help. In spite of me using VAST since V3, I don't often get down and dirty like that!
David

On Wednesday, June 13, 2018 at 12:25:26 PM UTC+1, Totally Objects wrote:
Hi everyone.
I have written a program that manages the timetable for my Model railway. I would like to add a button to play a diesel loco horn sound. Does anyone have any code to do that please?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.