Multimedia Programming/ja

From Lazarus wiki
Revision as of 15:32, 23 December 2013 by Yuichiro Takahashi (talk | contribs) (Created page with "{{Multimedia Programming}} {{Japanese Menu}} =動画の再生= ==再生用アプリケーションを起動させる== コマンドラインとパラメータを知って...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Deutsch (de) English (en) 日本語 (ja) 한국어 (ko) русский (ru) 中文(中国大陆)‎ (zh_CN)

日本語版メニュー
メインページ - Lazarus Documentation日本語版 - 翻訳ノート - 日本語障害情報

動画の再生

再生用アプリケーションを起動させる

コマンドラインとパラメータを知っていれば、以下のように TProcessUTF8 を使って再生用アプリを起動させられます。

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;

こちらは Linux 上で起動させる具体例です。動画再生アプリ mplayer を使用します。

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;

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(Linux gtk2/X 用)

mplayer はオープンソースでフリーな動画プレイヤーです。この mplayer を埋め込んだ LCL コントロールがあります。これを使えば、動画プレイヤーを構築してアプリケーションで動画を再生させることができます。以下よりダウンロードできます。

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

音の再生

Windows 限定:Windows API を使用する

wav ファイルなどであれば以下のように Windows API を使って再生できます。

...
uses MMSystem;
...
sndPlaySound('C:\sounds\test.wav', snd_Async or snd_NoDefault);

パスやファイル名に非 ASCII 文字が含まれていても正常に動作させるには以下のようにします。

sndPlaySound(pchar(UTF8ToSys('C:\sounds\test.wav')), snd_Async or snd_NoDefault);


当然ながら、これはクロスプラットフォームではありません。

オーディオコンポーネントスィートを使用する

オーディオコンポーネントスィートに関するページをお読みください。

OpenAL ライブラリを使用する

Delphi 用のチュートリアルでしたら、こちら [1] にあります。

Free Pascal comes with a unit for accessing OpenAL located in fpc/packages/openal as well as usage examples

BASS

BASS ライブラリは http://www.un4seen.com/ および http://www.un4seen.com/forum/?topic=8682.0 よりダウンロードできます。

There is a DJ application, for Windows, Linux and Mac OSX, written with Lazarus and using Bass lib: https://sites.google.com/site/fiensprototyping/

Audiere ライブラリ

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

Audorra ライブラリ

Lazarus で問題なく動作します。

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

OMEGA Engine

The OMEGA 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/

このプロジェクトは現在活動していませんが、とても簡単に使えるライブラリです。

Media_Play('Music.mp3', TRUE);

PortAudio

Various bindings for PortAudio, a cross-platform, open source library for audio playback and recording are available. See [[2]] for some versions. Forum user FredvS has written a Pascal unit that dynamically loads PortAudio: [3]

SDL + SDL_mixer

基本となる SDL ライブラリにあるサウンドシステムは、とても簡素なものです。通常は、より扱いやすい多くのサウンド API が実装されている SDL mixer を併せて使用します。

FMOD

Is a closed source solution. It is free for use for non-comercial software, but requires the payment of licenses for commercial software.

Squall sound

Squall sound は FPC で正常に動作しません。また、立体音響と EAX の音響効果が使えますが、MP3、OGG、WAV フォーマットしかサポートしていません。

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

FPSound

FPSound is a new library being developed in the mold of fpspreadsheet and fpvectorial: it has independent modules to read, write and play sound files and also an intermediary representation for editing. See FPSound

UOS (United OpenLib of Sound)

UOS : United OpenLib of Sound. UOS unifies the best open-source audio libraries.

UOS で以下のことができます。

  • Listen to mp3, ogg, wav, flac,... audio files.
  • With 16, 32 or float 32 bit resolution.
  • Record all types of input into file.
  • Add DSP effects and filters, however many you want and record it.
  • Listen to multiple inputs and outputs.

UOS はオーディオライブラリに PortAudio、SndFile、mpg123 を使用しています。

パッケージには以下のものが含まれています。

  • 使い方のサンプル
  • Linux 32/64、Windows 32/64、Mac OSX 32 用のバイナリライブラリ

http://sites.google.com/site/fiensprototyping/U_OS_Test.tar.gz

http://github.com/fredvs/uos/

関連項目