Groups > Borland > Borland Delphi multimedia > Re: TMediaPlayer and AutoLoop feature...?




Re: TMediaPlayer and AutoLoop feature...?

Re: TMediaPlayer and AutoLoop feature...?
Tue, 8 Jan 2008 23:44:21 -0800
"HAROUCHE, David" <metanil@hotmail.com> wrote in message
news:478421a5$1@newsgroups.borland.com...

> As far as I have seen, I cant remember for a property
> like AutoLoop:Boolean in TMediaPlayer...

TMediaPlayer does not natively support looping.  You have to implement that
yourself in your own code.  Before calling Play(), set the Notify property
to True.  When playing is finished, the OnNotify event will be triggered, at
which time you can call Play() again to start over.


Gambit

Post Reply
TMediaPlayer and AutoLoop feature...?
Wed, 9 Jan 2008 02:21:38 +0100
As far as I have seen, I cant remember for a property like AutoLoop:Boolean 
in TMediaPlayer...

Suggestions....?

DH 

Post Reply
Re: TMediaPlayer and AutoLoop feature...?
Wed, 9 Jan 2008 14:19:35 -0800
"HAROUCHE, David" <metanil@hotmail.com> wrote in message 
news:47854427@newsgroups.borland.com...

> What says Borland about the use of TMediaPlayer for portable 
> applications...

I doubt it would work.  TMediaPlayer (which uses MCI internally) is only 
available for Windows platforms, so you can't use it for Linux or any other 
non-Microsoft platform.  On the other hand, if by "portable" you meant

"mobile", then I do not know if TMediaPlayer can be used on Windows CE
or 
not.


Gambit 

Post Reply
Re: TMediaPlayer and AutoLoop feature...?
Wed, 9 Jan 2008 23:01:06 +0100
Okay...

Just another question (aint yo team B ?) : What says Borland about the use 
of TMediaPlayer for portable applications...

DH

(Used to work in Borland France, Localization off dBase for Windows - 
nickname JAH)....

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> a écrit dans le
message de news: 
47847b1c$1@newsgroups.borland.com...
>
> "HAROUCHE, David" <metanil@hotmail.com> wrote in message
> news:478421a5$1@newsgroups.borland.com...
>
>> As far as I have seen, I cant remember for a property
>> like AutoLoop:Boolean in TMediaPlayer...
>
> TMediaPlayer does not natively support looping.  You have to implement 
> that
> yourself in your own code.  Before calling Play(), set the Notify property
> to True.  When playing is finished, the OnNotify event will be triggered, 
> at
> which time you can call Play() again to start over.
>
>
> Gambit
>
> 

Post Reply
Re: TMediaPlayer and AutoLoop feature...?
Fri, 18 Jan 2008 17:32:13 +010
Question: why use TMediaPlayer at all just for an overlay sound? If you just 
want to play a WAV file, you can simply play the sound with
"sndPlaySound". 
That doesn't involve the media player UI overhead. (If it's not a WAV but an 
MP3 you might consider to convert it.)

The following function should play a WAV file. Since the file is played 
asychronously, you need a global variable to hold the data. The SND_LOOP 
parameter should repeat the audio file until you stop it.

var
   WAVData: TMemoryStream;

procedure PlayWAV(const filename: string);
begin
     if Filename = '' then
     begin
          sndPlaySound(nil, 0);
          FreeAndNil(WAVData);
     end
     else begin
          if WAVData = nil then WAVData := TMemorystream.create
          else sndPlaySound(nil, 0);

          WAVData.clear;
          WAVData.LoadFromFile(filename);
          WAVData.Seek(0,0);

          sndPlaySound(WAVData.Memory, SND_ASYNC or SND_LOOP or SND_MEMORY);
     end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
    PlayWAV(myfile); //creates WAVData, loads WAV file and plays it
end;

procedure TForm1.FormClose(Sender: TObject);
begin
    PlayWAV('');  //stops playing and frees WAVData
end;

-- 
Alexander Halser


"HAROUCHE, David" <metanil@hotmail.com> wrote in message 
news:478421a5$1@newsgroups.borland.com...
> As far as I have seen, I cant remember for a property like AutoLoop:Boolean

> in TMediaPlayer...
>
> Suggestions....?
>
> DH
> 

Post Reply
<< Previous 1 2 3 Next >>
( Page 1 of 3 )
about | contact