Solved

Sound

Posted on 1998-09-05
6
175 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

910 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

21 Experts available now in Live!

Get 1:1 Help Now