Solved

16 Bit (Delphi 1) Sound Code

Posted on 1998-09-06
6
163 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
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 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

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

930 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

11 Experts available now in Live!

Get 1:1 Help Now