Difference between revisions of "Multimedia Programming"

From Lazarus wiki
Jump to navigationJump to search
Line 69: Line 69:
  
 
=Playing Sounds=
 
=Playing Sounds=
 
section under construction...
 
  
 
==Using the Audio Component Suite==
 
==Using the Audio Component Suite==
  
 
Read the page about the [[ACS|Audio Component Suite]]
 
Read the page about the [[ACS|Audio Component Suite]]
 
http://www.lazarus.freepascal.org/index.php/topic,7014.msg32938/topicseen.html#msg32938
 
  
 
==Using the OpenAL Library==
 
==Using the OpenAL Library==
Line 84: Line 80:
 
==BASS==
 
==BASS==
  
http://www.lazarus.freepascal.org/index.php/topic,7828.0.html
+
The BASS library can be downloaded from: http://www.un4seen.com/ and http://www.un4seen.com/forum/?topic=8682.0
  
http://www.lazarus.freepascal.org/index.php/topic,2125.0.html
+
There is a DJ application, for Windows and Linux, written with Lazarus and using Bass lib:
 +
http://members.lycos.co.uk/mixk/
  
http://www.lazarus.freepascal.org/index.php/topic,8927.0.html
+
==Audiere Library==
  
http://www.lazarus.freepascal.org/index.php/topic,7749.0.html
+
Has bindings for Delphi, but they don't work with FPC:
  
==Audiere Library==
+
* http://www.casteng.com/whypascal.shtml
 +
* http://www.afterwarp.net/resources/soundlib
 +
* http://code.google.com/p/audiere-bind-delphi/
 +
 
 +
==Audorra Library==
 +
 
 +
Works fine with Lazarus:
 +
 
 +
http://sourceforge.net/projects/audorra/
 +
 
 +
==OMEGA Engine==
 +
 
 +
The OMAGE Engine is a full game engine in single Omega.dll file which is just 50kb. It can successfully play FLAC,OGG,MP3,MP2,AMR and WMA files. It searches and uses installed audio codecs from the system.
 +
 
 +
http://sourceforge.net/projects/omega-engine/files/
 +
 
 +
The project is dead, but is very easy to use:
 +
 
 +
<delphi>
 +
Media_Play('Music.mp3', TRUE);
 +
</delphi>
 +
 
 +
==SDL + SDL_mixes==
 +
 
 +
==FMOD==
 +
 
 +
Is a closed source solution.
 +
 
 +
==Squall sound==
 +
 
 +
Squall sound works fine with FPC. It has 3D audio and EAX effects, but just supports MP3, OGG and WAV formats.
  
http://www.lazarus.freepascal.org/index.php/topic,9864.0.html
+
http://www.afterwarp.net/resources/soundlib

Revision as of 13:45, 29 August 2010

Playing Videos

Starting a player application

Once you know the command line and parameters you can use TProcessUTF8 to start the player:

<Delphi> uses

 Classes, ..., LCLProc, UTF8Process;

...

implementation

procedure TMainForm.Button1Click(Sender: TObject); var

 Player: TProcessUTF8;

begin

 Player:=TProcessUTF8.Create(nil);
 try
   Player.CommandLine:=PathToPlayer+' '+ParametersAndMediaFile;
   Player.Execute;
 finally
   Player.Free;
 end;

end; </Delphi>

For example to start under Linux the mplayer to play a video use:

<Delphi> uses

 Classes, ..., FileUtil, LCLProc, UTF8Process;

...

implementation

procedure TMainForm.Button1Click(Sender: TObject); var

 Player: TProcessUTF8;
 Filename: String;
 PlayerPath: String;
 PlayerParams: String;

begin

 Filename:='/home/username/video.mpg';
 PlayerPath:=FindDefaultExecutablePath('mplayer');
 PlayerParams:='"'+Filename+'"';
 Player:=TProcessUTF8.Create(nil);
 try
   Player.CommandLine:=PlayerPath+' '+PlayerParams;
   Player.Execute;
 finally
   Player.Free;
 end;

end; </Delphi>

VFW - Video for Windows

Capturing and playing video streams from TV cards and webcams under Windows the VFW API can be used with SysRec.

MPlayer for Linux gtk2/X

mplayer is an open source and free movie player. There is a LCL control embedding the mplayer, so you can built your own movie players or just play a video in your application. You can download it here:

svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/mplayer mplayer

Playing Sounds

Using the Audio Component Suite

Read the page about the Audio Component Suite

Using the OpenAL Library

A tutorial for Delphi can be found here: [1]

BASS

The BASS library can be downloaded from: http://www.un4seen.com/ and http://www.un4seen.com/forum/?topic=8682.0

There is a DJ application, for Windows and Linux, written with Lazarus and using Bass lib: http://members.lycos.co.uk/mixk/

Audiere Library

Has bindings for Delphi, but they don't work with FPC:

Audorra Library

Works fine with Lazarus:

http://sourceforge.net/projects/audorra/

OMEGA Engine

The OMAGE Engine is a full game engine in single Omega.dll file which is just 50kb. It can successfully play FLAC,OGG,MP3,MP2,AMR and WMA files. It searches and uses installed audio codecs from the system.

http://sourceforge.net/projects/omega-engine/files/

The project is dead, but is very easy to use:

<delphi> Media_Play('Music.mp3', TRUE); </delphi>

SDL + SDL_mixes

FMOD

Is a closed source solution.

Squall sound

Squall sound works fine with FPC. It has 3D audio and EAX effects, but just supports MP3, OGG and WAV formats.

http://www.afterwarp.net/resources/soundlib