Solved

Sound

Posted on 1998-09-05
6
174 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
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 3

Expert Comment

by:Matvey
Comment Utility
-See sndPlaySound in Win32s.HLP

c u
0
 
LVL 1

Accepted Solution

by:
duke_n earned 50 total points
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now