linux¿¡¼ ÇÁ·Î±×·¥À» ÇÏ´Ùº¸´Ï Çì¸Þ±â ÀϾ¥ À̳׿ä Ȥ½Ã Àúó·³ Çì¸Þ´ÂºÐÀÌ ¾È»ý±âµµ·Ï ¸®´ª½º¿¡¼ °£´ÜÈ÷ wavÆÄÀÏÀ» Ç÷¹ÀÌ ÇÏ´Â funtionÀ» °øÀ¯ ÇÕ´Ï´Ù ^^
ÀÚ·áÃâó : http://forum.lazarus.freepascal.org/index.php?topic=5215.0
uses Process Ãß°¡ÇϽðí
function PlaySoundLnx(fileName: String): Boolean; //wav sound play function const playerCmd = 'paplay'; // pulseaudio client var AProcess: TProcess; begin AProcess := TProcess.Create(nil); with Aprocess do begin CommandLine := FindDefaultExecutablePath(playerCmd) + ' ' + filename; // Options := Options + [poWaitOnExit]; //ÀÌ ¿É¼ÇÀº ASync , Sync ¼±Åà try try Execute; except on E: Exception do ShowMessage(E.ClassName + ' error raised, with message : ' + E.Message); end; finally Free; end; end; end;
procedure TMain_Form.Button1Click(Sender: TObject); var AppDir: String; begin AppDir := ExtractFilePath(Application.ExeName); PlaySoundLnx(AppDir + 'audio/2.wav'); end;
|