Topic: Picture and sound

Hello Dmitry

I'm coding an application with pictures and sounds.
For pictures and sounds, I use two available components  :

SaveImageInDatabase and SaveFileInDatabase.

It works fine.
With Arrows Up and Down, when I navigate in the grid, the picture
for every item of grid is well displayed.

Then, I would like to know if it is possible to launch sounds
corresponding (always when using Up and Down).

In summary, when arrows (Up or Down) stand on an item of the grid,
ii it possible to hear sound while viewing the image corresponding to the item of the grid ?

I've tried a PlaySound, but it seems that mmSystem is not implemented.
Nor with MediaPlayer := TMediaPlayer.Create(Application)

I had made the same application with Delphi 7 and all worked fine (even sounds).
But with Windows 8, Delphi 7 is out.
And I wanted made the same with MVD.

Thanks for your help

JB

Re: Picture and sound

Hello,


I added in the beta version 1.51 function PlaySound.
https://www.dropbox.com/s/vz1fmz5lrb6fw … 1.zip?dl=0


Just put wav file to project folder:

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    PlaySound('file.wav');
end;
Dmitry.

Re: Picture and sound

Hello Dmitry

Really effective as usual.
But one question :

How to do to retrieve the name of the file entered with a SaveFileInDatabase component
to play it with PlaySound ?

Otherwise, is there a way to store the sound for a picture without this component
(ie with  openDialog := TOpenDialog.Create(self); ?

Please see the screenshot joined.

Thanks again for your help

JB

Post's attachments

Attachment icon example.jpg 5.91 kb, 338 downloads since 2015-04-17 

Re: Picture and sound

jean.brezhonek
I see you have MP3 file, but function PlaySound can play only WAV files.

Dmitry.

Re: Picture and sound

Dmitry

Effectively, mp3 format is much lighter.
Eventually this application will store about 400 sounds.

Would it be possible to implement TMediaPlayer component in MVD ?
This one can read mp3 files. We could even play videos with it.
I used it in these intentions with Delphi7

For now, I shall transform mp3 into wav to use PlaySound.

Your instruction is : PlaySound('file.wav')

But I  store in the base this file wav via DBFile.

How retrieve the name of this file to hear it with a button which will execute PlaySound function.

Button1.OnClick := PlaySound('name of the file stored in DBFile.wav');

This is what I would like make
I don't know if I am clear. I can send my project if need.

Thanks again
JB

Re: Picture and sound

jean.brezhonek
I added object MediaPlayer, please download beta version again:
https://www.dropbox.com/s/vz1fmz5lrb6fw … 1.zip?dl=0



Example:

MediaPlayer.PlayFile('d:\03 - Muse - Hysteria.mp3'); 
MediaPlayer.Pause; 
MediaPlayer.Stop; 

What method you use for storing file in database?
DBFile.Type=StoreFile?
or
DBFile.Type=LinkFile?

Dmitry.

Re: Picture and sound

Hello Dmitry

I know why you asked me such a question about the way I store sounds.
In fact, I use as property DBFile.Type=LinkFile.

And result is different

I can't hear sound by this way of storing

I use this SQL :

Value1 := SQLExecute('SELECT chant from oiseaux WHERE id=' + IntToStr(Form1.Grid.dbItemID) );
I I code MediaPlayer (Value1) -> No result;

Passing through the backdoor, I choose to display Value in a Label.Caption := Value1 and I code

MediaPlayer(Form1.Label.Caption) -> No result.
 

Then what the right way to succed

Thanks

JB

Re: Picture and sound

Please, attach your project here (zip file, without exe and dll)
I'll try to help you.

Dmitry.

Re: Picture and sound

Hello Dmitry

Thanks for your answer
Please find in attachment my zipped project


To resume :

I would like that navigating in the grid, I display phtoto of the bird (this works fine) and I hear the song (this doesn't work).
This is this second part that worries me.

If I presse the button player Read, I get this message ('impossible to determine the type of device from the extension of the given filename').
Perhaps  an mp3 codec matter on myPC.

Besides that, does MVD use Double Buffer ?
I've tried Form1.DoubleBuffered to True but got an error.
This to prevent flicker when drawing onto the screen (only with keys down and up).
When I vanigate with mouse, display is smooth.

Again thanks for your help

JB

Post's attachments

Attachment icon birds_dmitry.zip 1.22 mb, 501 downloads since 2015-04-28 

Re: Picture and sound

jean.brezhonek

Fixed, project attached.
Also please download beta version (some bugs fixed)
https://www.dropbox.com/s/vz1fmz5lrb6fw … 1.zip?dl=0


DoubleBuffered works, example

procedure Form1_OnShow (Sender: string; Action: string);
begin
    Form1.DoubleBuffered := True;
end;
Post's attachments

Attachment icon birds_dmitry2.zip 722.29 kb, 534 downloads since 2015-04-28 

Dmitry.

Re: Picture and sound

Hello Dmitry

Thanks for your help.
Thanks also for implementing property DoubleBuffer.
All works fine

JB