Solved

Sound

Posted on 1998-09-05
6
178 Views
Last Modified: 2010-04-06
Using both Delphi 1 and Delphi 2, I want to associate a sound to a click on a button.  I am stuck on my code, and since I never used sound before I am unfamiliar with that area.

Here is the scenario:
Sound file is called click.wav and is stored in directory f:/dmtb (the program directory)

I want to either use the wav file as part of my resources or have it load from file from the program directory.  THe sound would be played when certain buttons in the program are played.

My current code is in error.  What happens is the sound I have in the background will not clear so the wav file can be played.
0
Comment
Question by:DMM1956
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:Matvey
ID: 1338721
What do you mean "the sound I have in background"??? Of course you have to pause it. You could mix them, but that's hard.
0
 

Author Comment

by:DMM1956
ID: 1338722
If I have a sound like a Midi playing, the sound I associate with a button will not play.

Note:  the command I am looking for needs to be 16bit code (Delphi 1) as the client side of my DLL must be 16 bit.

Also trying to figure out how to include a wav file as part of the resources so I don't have to distribute the file with the program.

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1338723
Midi shouldn't interfear. Another wav would though. How are you playing it?

See this:

http://bes.trendline.co.il/torry/vcl/buttons/spledbtn.zip
"...play Wav files or system sound when clicked"
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:Matvey
ID: 1338724
-See sndPlaySound in Win32s.HLP

c u
0
 
LVL 1

Accepted Solution

by:
duke_n earned 50 total points
ID: 1338725
HEY!
Use
sndplaysound('click.wav',snd_nodefault);//windows will wait the //sound to end and then give the "turn" back to your program
or
sndplaysound('click.wav',snd_async);//if you want to do //something while windows plays the sound
0
 

Author Comment

by:DMM1956
ID: 1338726
Ooops...slipped accepting the last.  Here is the problem.  SndPlaySnd I believe is 32 BIT.  I need 16bit code to play sound when I click a button within a program.  WIN32 code will not work with what I have in mind.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question