Link to home
Start Free TrialLog in
Avatar of luiaard
luiaard

asked on

Delphi Programming question

I want to play the same wav file over and over again,
without accessing the hard disk over and over again.
The length of this file is 1/400 minute, and I want
to play it 400 times a minute without reloading it
from HD. Time is critical here.

Someone said I should use streams: far to complex
to find out on my own.

Can someone give a working example.

1) must run under delphi 2.0
2) the start of the repeating playing must be controlled
(be started) by pressing a Tbutton
3) same for the end
4) the speed (that is when the next repeation is starting
must be variable
5) It must not be a component, but code which can be
inserted in the mainform

Thanks
Avatar of Zonnald
Zonnald

luiaard,

the media player can loop if you make the notify event start the player again but this seems to cause a delay.
You really need to somehow build a data structure that contains the wave I will play with it when I can - interesting idea though

Zonnald

this example can help you

var m : TMemoryStream;
begin
  m := TMemoryStream.Create;
  m.LoadFromFile( 'D:\TEST.WAV' );
  sndPlaySound( m.Memory, SND_MEMORY );
  m.Free;
end;
Avatar of luiaard

ASKER

Thanks Mirek, but I reject your answer because I get:

Undeclared identifier sndPlaySound
Undeclared identifier SND_MEMORY
Could not compile TEST.PAS

What am I doing wrong?
uses
  MMSystem;
Avatar of luiaard

ASKER

Mirek, it works.
Send in your last comment again please, but make
 it an answer.  Then I will grade it as excellent.

With regards,
Luiaard
ASKER CERTIFIED SOLUTION
Avatar of mirek071497
mirek071497

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial