Board index » delphi » Use mciSendString with Resource File.

Use mciSendString with Resource File.


2004-04-24 05:37:16 AM
delphi249
How to use the code below with a *.wav file in a Resource file ?
uses MMSystem;
procedure SendMCICommand(Cmd: string);
var
RetVal: Integer;
ErrMsg: array[0..254] of char;
begin
RetVal := mciSendString(PChar(Cmd), nil, 0, 0);
if RetVal <>0 then begin
{get message for returned value}
mciGetErrorString(RetVal, ErrMsg, 255);
MessageDlg(StrPas(ErrMsg), mtError, [mbOK], 0);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMCICommand('open waveaudio shareable');
SendMCICommand('play "C:\xyz\BackgroundMusic.wav"');
SendMCICommand('play "C:\xyz\AnotherMusic.wav"');
SendMCICommand('close waveaudio');
end;
The PlaySound not is the solution because it stops the first sound and play
the second sound.
I don't want to save the *.wav in the HD before play it.
The sound must play simultaneous.
How I make loop in sound ?
Where I found mciSendString good Help with samples ?
Thank's
Ass.: Fabio Alves Francelino
 
 

Re:Use mciSendString with Resource File.

I don't know mci very well but I'd try multithread for get simultaneous
sounds. Read TThread component in Help.
Giorgio Padoan
<XXXX@XXXXX.COM>ha scritto nel messaggio
Quote
How to use the code below with a *.wav file in a Resource file ?

uses MMSystem;

procedure SendMCICommand(Cmd: string);
var
RetVal: Integer;
ErrMsg: array[0..254] of char;
begin
RetVal := mciSendString(PChar(Cmd), nil, 0, 0);
if RetVal <>0 then begin
{get message for returned value}
mciGetErrorString(RetVal, ErrMsg, 255);
MessageDlg(StrPas(ErrMsg), mtError, [mbOK], 0);
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
SendMCICommand('open waveaudio shareable');
SendMCICommand('play "C:\xyz\BackgroundMusic.wav"');
SendMCICommand('play "C:\xyz\AnotherMusic.wav"');
SendMCICommand('close waveaudio');
end;

The PlaySound not is the solution because it stops the first sound and
play
the second sound.

I don't want to save the *.wav in the HD before play it.

The sound must play simultaneous.

How I make loop in sound ?

Where I found mciSendString good Help with samples ?

Thank's

Ass.: Fabio Alves Francelino


 

Re:Use mciSendString with Resource File.

Excuse me, you said:
Quote
The PlaySound not is the solution because it stops the first sound and
play
the second sound.

I am not having luck with this. My sound is not being heard. I am
trying:
playsound(nil,0,0);
playsound(etc.); //this one to play my sound
what are you doing to get your sound playing?
dave
<XXXX@XXXXX.COM>writes
Quote
How to use the code below with a *.wav file in a Resource file ?