?
Solved

16 Bit (Delphi 1) Sound Code

Posted on 1998-09-06
6
Medium Priority
?
174 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Accepted Solution

by:
EmmDieh earned 200 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 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