Solved

16 Bit (Delphi 1) Sound Code

Posted on 1998-09-06
6
171 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
[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
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
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!

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

724 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