Playing a sound from a button

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 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.