Changeset 665 for trunk/Music.pas
- Timestamp:
- Jul 9, 2025, 4:45:12 PM (12 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Music.pas
r664 r665 4 4 5 5 uses 6 Classes, SysUtils, Dialogs, uos_flat ;6 Classes, SysUtils, Dialogs, uos_flat, ctypes; 7 7 8 8 type … … 19 19 AutoPlayNext: Boolean; 20 20 procedure Initialize; 21 procedure EndPlay; 22 procedure LoopEndProc; 21 procedure EndPlay(PlayerIndex: cint32); 23 22 function GetNextPlaylistItem: string; 24 23 procedure PlayNext(Data: PtrInt); … … 46 45 procedure TMusicPlayer.Initialize; 47 46 var 48 res: Integer;49 47 SndFileFileName: string; 50 48 PortAudioFileName: string; … … 53 51 if Initialized then Exit; 54 52 53 {$IFDEF UNIX} 55 54 SndFileFileName := 'libsndfile.so.1'; 56 55 PortAudioFileName := 'libportaudio.so'; 57 56 XmpFileName := 'libxmp.so.4'; 57 {$ELSE} 58 {$if defined(cpu64)} 59 SndFileFileName := 'LibSndFile-64.dll'; 60 PortAudioFileName := 'LibPortaudio-64.dll'; 61 XmpFileName := 'libxmp-64.dll'; 62 {$ELSE} 63 SndFileFileName := 'LibSndFile-32.dll'; 64 PortAudioFileName := 'LibPortaudio-32.dll'; 65 XmpFileName := 'libxmp-32.dll'; 66 {$ENDIF} 67 {$ENDIF} 58 68 59 69 if (SndFileFileName <> 'system') and (SndFileFileName <> '') then … … 61 71 SndFileFileName := SndFileFileName + '.2'; 62 72 63 res := uos_LoadLib(PChar(PortAudioFileName), PChar(SndFileFileName), Nil, Nil, 64 Nil, Nil, PChar(XmpFileName)); 73 if uos_LoadLib(PChar(PortAudioFileName), PChar(SndFileFileName), Nil, Nil, 74 Nil, Nil, PChar(XmpFileName)) <> 0 then 75 raise Exception.Create('Error while loading audio libraries.'); 65 76 66 77 Initialized := True; 67 78 end; 68 79 69 procedure TMusicPlayer.EndPlay; 70 begin 71 if AutoPlayNext then Application.QueueAsyncCall(PlayNext, 0); 72 end; 73 74 procedure TMusicPlayer.LoopEndProc; 75 var 76 Position: Integer; 77 begin 78 Position := uos_InputPosition(PlayerIndex1, InputIndex1); 79 if Position >= InputLength then 80 Play; 80 procedure TMusicPlayer.EndPlay(PlayerIndex: cint32); 81 begin 82 if AutoPlayNext and (PlayerIndex = PlayerIndex1) then Application.QueueAsyncCall(PlayNext, 0); 81 83 end; 82 84 … … 152 154 153 155 AutoPlayNext := False; 154 //uos_Stop(PlayerIndex1); 155 uos_StopAndWait(PlayerIndex1); 156 157 //Inc(PlayerIndex1); 156 uos_Stop(PlayerIndex1); 157 158 Inc(PlayerIndex1); 158 159 159 160 uos_CreatePlayer(PlayerIndex1);
Note:
See TracChangeset
for help on using the changeset viewer.