Solved

16 Bit (Delphi 1) Sound Code

Posted on 1998-09-06
6
162 Views
Last Modified: 2010-04-06
I am looking for a method to play a wave on a button click and to include the wave in my program resources so I don't have to distribute it separately.  SndPlaySnd is Win32 bit so it does not work for my application.  It must be available in Delphi 1 as my client program must be 16bit.  Can anyone tell me how to play sound in Delphi 1?
0
Comment
Question by:DMM1956
6 Comments
 
LVL 1

Expert Comment

by:duke_n
ID: 1338804
I don;t know anynthing special,
but you can use TMediaPlayer from 'System' page of VCL
and make it unvisible.
0
 
LVL 1

Expert Comment

by:duke_n
ID: 1338805
Or jus use the fabulous
Beep()
function......
0
 

Author Comment

by:DMM1956
ID: 1338806
Not what I want.  I have seen 16 bit programs that do it and I want to add it to my programs.  Finding difference between Delphi 1 and 2 can be quite puzzling.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 1

Accepted Solution

by:
EmmDieh earned 50 total points
ID: 1338807
No, you are wrong: SndPlaySound is part of mmsystem.dll

I use(d) the following to play a sound from a resource:
var
  WavData: THandle;  { Handle auf Resource }
procedure StopMemWav;
begin
  UnlockResource(WavData);
  FreeResource(WavData);
end;
procedure PlayMemWav(ResName: PChar);
var
  ResInfo: THandle;
  P: PChar;
begin
    { Resource finden }
  ResInfo := FindResource(hInstance, ResName, RT_RCDATA);
  If ResInfo = 0 then Exit;  { Resource konnte nicht gefunden werden }
    { Resource in den Speicher laden }
  WavData := LoadResource(hInstance, ResInfo);
  If WavData = 0 then Exit;  { Resource konnte nicht geladen werden }
    { Resource sperren und Zeiger auf Wavedaten holen }
  P := LockResource(WavData);
    { Sound spielen }
      { Sound synchron spielen }
      { gerade gespielten Sound nicht unterbrechen }
      { P zeigt auf den Speicher und nicht auf den Filenamen }
  sndPlaySound(P, snd_Sync or snd_NoStop or snd_Memory);
  StopMemWav;
end;  { PlayMemWav }

0
 
LVL 2

Expert Comment

by:kjteng
ID: 1338808
0
 

Author Comment

by:DMM1956
ID: 1338809
Uh...thanks for the correction.  I never realised there was such a unit with Delphi 1.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

19 Experts available now in Live!

Get 1:1 Help Now