- Timestamp:
- Oct 5, 2011, 12:40:56 PM (13 years ago)
- Location:
- CoolAudio
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolAudio/Demo/Demo.lpi
r279 r280 38 38 </Item2> 39 39 </RequiredPackages> 40 <Units Count="2 3">40 <Units Count="24"> 41 41 <Unit0> 42 42 <Filename Value="Demo.lpr"/> 43 43 <IsPartOfProject Value="True"/> 44 44 <UnitName Value="Demo"/> 45 <EditorIndex Value=" 8"/>45 <EditorIndex Value="10"/> 46 46 <WindowIndex Value="0"/> 47 47 <TopLine Value="1"/> 48 <CursorPos X="1 " Y="1"/>49 <UsageCount Value="3 3"/>48 <CursorPos X="19" Y="10"/> 49 <UsageCount Value="38"/> 50 50 <Loaded Value="True"/> 51 51 </Unit0> … … 56 56 <ResourceBaseClass Value="Form"/> 57 57 <UnitName Value="UMainForm"/> 58 <IsVisibleTab Value="True"/>59 58 <EditorIndex Value="0"/> 60 59 <WindowIndex Value="0"/> 61 <TopLine Value=" 69"/>62 <CursorPos X=" 39" Y="82"/>63 <UsageCount Value="3 3"/>60 <TopLine Value="84"/> 61 <CursorPos X="1" Y="96"/> 62 <UsageCount Value="38"/> 64 63 <Loaded Value="True"/> 65 64 <LoadedDesigner Value="True"/> … … 68 67 <Filename Value="../UCoolAudio.pas"/> 69 68 <UnitName Value="UCoolAudio"/> 70 <EditorIndex Value=" 3"/>71 <WindowIndex Value="0"/> 72 <TopLine Value="1 6"/>73 <CursorPos X=" 9" Y="7"/>74 <UsageCount Value="1 1"/>69 <EditorIndex Value="5"/> 70 <WindowIndex Value="0"/> 71 <TopLine Value="11"/> 72 <CursorPos X="18" Y="16"/> 73 <UsageCount Value="14"/> 75 74 <Loaded Value="True"/> 76 75 </Unit2> … … 78 77 <Filename Value="../Systems/UAudioSystemFMOD.pas"/> 79 78 <UnitName Value="UAudioSystemFMOD"/> 80 <EditorIndex Value=" 6"/>79 <EditorIndex Value="8"/> 81 80 <WindowIndex Value="0"/> 82 81 <TopLine Value="47"/> 83 82 <CursorPos X="1" Y="61"/> 84 <UsageCount Value="1 6"/>83 <UsageCount Value="19"/> 85 84 <Loaded Value="True"/> 86 85 </Unit3> … … 91 90 <TopLine Value="1"/> 92 91 <CursorPos X="29" Y="8"/> 93 <UsageCount Value="2 1"/>92 <UsageCount Value="20"/> 94 93 </Unit4> 95 94 <Unit5> 96 95 <Filename Value="../fmodintf/fmoddyn.pas"/> 97 96 <UnitName Value="fmoddyn"/> 98 <EditorIndex Value=" 7"/>99 <WindowIndex Value="0"/> 100 <TopLine Value="57 7"/>101 <CursorPos X=" 38" Y="581"/>102 <UsageCount Value="1 1"/>97 <EditorIndex Value="9"/> 98 <WindowIndex Value="0"/> 99 <TopLine Value="579"/> 100 <CursorPos X="19" Y="593"/> 101 <UsageCount Value="14"/> 103 102 <Loaded Value="True"/> 104 103 </Unit5> … … 109 108 <TopLine Value="158"/> 110 109 <CursorPos X="43" Y="178"/> 111 <UsageCount Value="1 1"/>110 <UsageCount Value="10"/> 112 111 </Unit6> 113 112 <Unit7> 114 113 <Filename Value="../Systems/UAudioSystemMPlayer.pas"/> 115 114 <UnitName Value="UAudioSystemMPlayer"/> 116 <EditorIndex Value=" 4"/>117 <WindowIndex Value="0"/> 118 <TopLine Value=" 254"/>119 <CursorPos X=" 1" Y="276"/>120 <UsageCount Value="1 6"/>115 <EditorIndex Value="6"/> 116 <WindowIndex Value="0"/> 117 <TopLine Value="30"/> 118 <CursorPos X="31" Y="36"/> 119 <UsageCount Value="19"/> 121 120 <Loaded Value="True"/> 122 121 </Unit7> … … 127 126 <TopLine Value="1"/> 128 127 <CursorPos X="1" Y="1"/> 129 <UsageCount Value=" 9"/>128 <UsageCount Value="8"/> 130 129 </Unit8> 131 130 <Unit9> 132 131 <Filename Value="../Systems/UAudioSystem.pas"/> 133 132 <UnitName Value="UAudioSystem"/> 134 <EditorIndex Value=" 2"/>135 <WindowIndex Value="0"/> 136 <TopLine Value=" 31"/>137 <CursorPos X="1 5" Y="48"/>138 <UsageCount Value="2 6"/>133 <EditorIndex Value="4"/> 134 <WindowIndex Value="0"/> 135 <TopLine Value="123"/> 136 <CursorPos X="1" Y="137"/> 137 <UsageCount Value="29"/> 139 138 <Loaded Value="True"/> 140 139 </Unit9> … … 145 144 <TopLine Value="418"/> 146 145 <CursorPos X="18" Y="430"/> 147 <UsageCount Value="1 1"/>146 <UsageCount Value="10"/> 148 147 </Unit10> 149 148 <Unit11> … … 153 152 <TopLine Value="2427"/> 154 153 <CursorPos X="24" Y="2429"/> 155 <UsageCount Value="1 3"/>154 <UsageCount Value="12"/> 156 155 </Unit11> 157 156 <Unit12> … … 161 160 <TopLine Value="38"/> 162 161 <CursorPos X="32" Y="50"/> 163 <UsageCount Value=" 9"/>162 <UsageCount Value="8"/> 164 163 </Unit12> 165 164 <Unit13> … … 169 168 <TopLine Value="120"/> 170 169 <CursorPos X="16" Y="131"/> 171 <UsageCount Value=" 9"/>170 <UsageCount Value="8"/> 172 171 </Unit13> 173 172 <Unit14> … … 176 175 <TopLine Value="26"/> 177 176 <CursorPos X="18" Y="28"/> 178 <UsageCount Value=" 9"/>177 <UsageCount Value="8"/> 179 178 </Unit14> 180 179 <Unit15> … … 183 182 <TopLine Value="65"/> 184 183 <CursorPos X="17" Y="67"/> 185 <UsageCount Value=" 9"/>184 <UsageCount Value="8"/> 186 185 </Unit15> 187 186 <Unit16> 188 187 <Filename Value="../../../../Lazarus/0.9.31_2.5.1/lcl/include/control.inc"/> 189 <WindowIndex Value="0"/> 190 <TopLine Value="4280"/> 191 <CursorPos X="19" Y="4283"/> 192 <UsageCount Value="9"/> 188 <EditorIndex Value="1"/> 189 <WindowIndex Value="0"/> 190 <TopLine Value="2275"/> 191 <CursorPos X="1" Y="2287"/> 192 <UsageCount Value="13"/> 193 <Loaded Value="True"/> 193 194 </Unit16> 194 195 <Unit17> … … 197 198 <TopLine Value="6307"/> 198 199 <CursorPos X="17" Y="6320"/> 199 <UsageCount Value=" 9"/>200 <UsageCount Value="8"/> 200 201 </Unit17> 201 202 <Unit18> … … 205 206 <TopLine Value="13"/> 206 207 <CursorPos X="21" Y="26"/> 207 <UsageCount Value="1 3"/>208 <UsageCount Value="12"/> 208 209 </Unit18> 209 210 <Unit19> … … 213 214 <TopLine Value="1"/> 214 215 <CursorPos X="1" Y="1"/> 215 <UsageCount Value="1 3"/>216 <UsageCount Value="12"/> 216 217 </Unit19> 217 218 <Unit20> 218 219 <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/packages/winunits-base/src/mmsystem.pp"/> 219 220 <UnitName Value="mmsystem"/> 220 <WindowIndex Value="0"/> 221 <TopLine Value="165"/> 222 <CursorPos X="10" Y="177"/> 223 <UsageCount Value="12"/> 221 <EditorIndex Value="3"/> 222 <WindowIndex Value="0"/> 223 <TopLine Value="882"/> 224 <CursorPos X="5" Y="765"/> 225 <UsageCount Value="15"/> 226 <Loaded Value="True"/> 224 227 </Unit20> 225 228 <Unit21> 226 229 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 227 230 <UnitName Value="UAudioSystemWindows"/> 228 <EditorIndex Value="1"/> 229 <WindowIndex Value="0"/> 230 <TopLine Value="13"/> 231 <CursorPos X="1" Y="46"/> 232 <UsageCount Value="22"/> 231 <IsVisibleTab Value="True"/> 232 <EditorIndex Value="2"/> 233 <WindowIndex Value="0"/> 234 <TopLine Value="117"/> 235 <CursorPos X="26" Y="137"/> 236 <UsageCount Value="25"/> 233 237 <Loaded Value="True"/> 234 238 </Unit21> 235 239 <Unit22> 236 240 <Filename Value="/usr/share/fpcsrc/2.4.2/rtl/objpas/sysutils/sysstrh.inc"/> 237 <EditorIndex Value="5"/>238 241 <WindowIndex Value="0"/> 239 242 <TopLine Value="159"/> 240 243 <CursorPos X="10" Y="176"/> 241 <UsageCount Value="10"/> 242 <Loaded Value="True"/> 244 <UsageCount Value="9"/> 243 245 </Unit22> 246 <Unit23> 247 <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/rtl/objpas/sysutils/osutilsh.inc"/> 248 <EditorIndex Value="7"/> 249 <WindowIndex Value="0"/> 250 <TopLine Value="23"/> 251 <CursorPos X="10" Y="23"/> 252 <UsageCount Value="13"/> 253 <Loaded Value="True"/> 254 </Unit23> 244 255 </Units> 245 <JumpHistory Count="30" HistoryIndex="2 9">256 <JumpHistory Count="30" HistoryIndex="28"> 246 257 <Position1> 247 <Filename Value="../Systems/UAudioSystem .pas"/>248 <Caret Line=" 91" Column="25" TopLine="89"/>258 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 259 <Caret Line="170" Column="49" TopLine="158"/> 249 260 </Position1> 250 261 <Position2> 251 <Filename Value="../Systems/UAudioSystem .pas"/>252 <Caret Line=" 93" Column="25" TopLine="79"/>262 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 263 <Caret Line="162" Column="1" TopLine="158"/> 253 264 </Position2> 254 265 <Position3> 255 <Filename Value="../Systems/UAudioSystem .pas"/>256 <Caret Line=" 76" Column="1" TopLine="56"/>266 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 267 <Caret Line="85" Column="1" TopLine="73"/> 257 268 </Position3> 258 269 <Position4> 259 <Filename Value=" UMainForm.pas"/>260 <Caret Line=" 53" Column="33" TopLine="41"/>270 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 271 <Caret Line="86" Column="1" TopLine="73"/> 261 272 </Position4> 262 273 <Position5> 263 274 <Filename Value="../Systems/UAudioSystem.pas"/> 264 <Caret Line=" 76" Column="50" TopLine="64"/>275 <Caret Line="135" Column="1" TopLine="123"/> 265 276 </Position5> 266 277 <Position6> 267 <Filename Value=" UMainForm.pas"/>268 <Caret Line=" 55" Column="24" TopLine="42"/>278 <Filename Value="../Systems/UAudioSystem.pas"/> 279 <Caret Line="136" Column="1" TopLine="123"/> 269 280 </Position6> 270 281 <Position7> 271 <Filename Value=" UMainForm.pas"/>272 <Caret Line=" 99" Column="28" TopLine="85"/>282 <Filename Value="../Systems/UAudioSystem.pas"/> 283 <Caret Line="137" Column="1" TopLine="123"/> 273 284 </Position7> 274 285 <Position8> 275 <Filename Value=" UMainForm.pas"/>276 <Caret Line=" 100" Column="10" TopLine="85"/>286 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 287 <Caret Line="87" Column="1" TopLine="73"/> 277 288 </Position8> 278 289 <Position9> 279 <Filename Value=" UMainForm.pas"/>280 <Caret Line=" 97" Column="1" TopLine="86"/>290 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 291 <Caret Line="108" Column="1" TopLine="104"/> 281 292 </Position9> 282 293 <Position10> 283 <Filename Value=" UMainForm.pas"/>284 <Caret Line=" 98" Column="1" TopLine="86"/>294 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 295 <Caret Line="161" Column="1" TopLine="149"/> 285 296 </Position10> 286 297 <Position11> 287 <Filename Value="../Systems/UAudioSystem FMOD.pas"/>288 <Caret Line=" 59" Column="1" TopLine="47"/>298 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 299 <Caret Line="162" Column="1" TopLine="149"/> 289 300 </Position11> 290 301 <Position12> 291 <Filename Value="../Systems/UAudioSystem FMOD.pas"/>292 <Caret Line=" 64" Column="1" TopLine="47"/>302 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 303 <Caret Line="42" Column="56" TopLine="30"/> 293 304 </Position12> 294 305 <Position13> 295 <Filename Value="../Systems/UAudioSystem FMOD.pas"/>296 <Caret Line=" 60" Column="1" TopLine="47"/>306 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 307 <Caret Line="134" Column="29" TopLine="116"/> 297 308 </Position13> 298 309 <Position14> 299 <Filename Value="../Systems/UAudioSystem FMOD.pas"/>300 <Caret Line=" 61" Column="1" TopLine="47"/>310 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 311 <Caret Line="112" Column="76" TopLine="100"/> 301 312 </Position14> 302 313 <Position15> 303 <Filename Value="../Systems/UAudioSystem .pas"/>304 <Caret Line=" 66" Column="5" TopLine="54"/>314 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 315 <Caret Line="113" Column="15" TopLine="101"/> 305 316 </Position15> 306 317 <Position16> 307 <Filename Value="../Systems/UAudioSystem .pas"/>308 <Caret Line=" 1" Column="1" TopLine="1"/>318 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 319 <Caret Line="46" Column="28" TopLine="34"/> 309 320 </Position16> 310 321 <Position17> 311 <Filename Value="../ UCoolAudio.pas"/>312 <Caret Line=" 39" Column="30" TopLine="13"/>322 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 323 <Caret Line="134" Column="47" TopLine="122"/> 313 324 </Position17> 314 325 <Position18> 315 <Filename Value=" UMainForm.pas"/>316 <Caret Line=" 57" Column="85" TopLine="43"/>326 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 327 <Caret Line="43" Column="45" TopLine="30"/> 317 328 </Position18> 318 329 <Position19> 319 <Filename Value="../Systems/UAudioSystem MPlayer.pas"/>320 <Caret Line="1 32" Column="30" TopLine="121"/>330 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 331 <Caret Line="146" Column="3" TopLine="140"/> 321 332 </Position19> 322 333 <Position20> 323 <Filename Value="../Systems/UAudioSystem MPlayer.pas"/>324 <Caret Line=" 42" Column="14" TopLine="25"/>334 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 335 <Caret Line="121" Column="1" TopLine="117"/> 325 336 </Position20> 326 337 <Position21> 327 <Filename Value="../Systems/UAudioSystem MPlayer.pas"/>328 <Caret Line=" 74" Column="17" TopLine="49"/>338 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 339 <Caret Line="122" Column="1" TopLine="117"/> 329 340 </Position21> 330 341 <Position22> 331 <Filename Value=" UMainForm.pas"/>332 <Caret Line=" 31" Column="50" TopLine="1"/>342 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 343 <Caret Line="123" Column="1" TopLine="117"/> 333 344 </Position22> 334 345 <Position23> 335 <Filename Value=" UMainForm.pas"/>336 <Caret Line="1 08" Column="1" TopLine="84"/>346 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 347 <Caret Line="128" Column="1" TopLine="117"/> 337 348 </Position23> 338 349 <Position24> 339 <Filename Value="../Systems/UAudioSystem MPlayer.pas"/>340 <Caret Line=" 271" Column="1" TopLine="254"/>350 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 351 <Caret Line="129" Column="1" TopLine="117"/> 341 352 </Position24> 342 353 <Position25> 343 <Filename Value="../Systems/UAudioSystem MPlayer.pas"/>344 <Caret Line=" 272" Column="1" TopLine="254"/>354 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 355 <Caret Line="134" Column="1" TopLine="117"/> 345 356 </Position25> 346 357 <Position26> 347 <Filename Value="../Systems/UAudioSystem MPlayer.pas"/>348 <Caret Line=" 273" Column="1" TopLine="254"/>358 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 359 <Caret Line="135" Column="1" TopLine="117"/> 349 360 </Position26> 350 361 <Position27> 351 <Filename Value="../Systems/UAudioSystem MPlayer.pas"/>352 <Caret Line=" 276" Column="1" TopLine="254"/>362 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 363 <Caret Line="136" Column="1" TopLine="117"/> 353 364 </Position27> 354 365 <Position28> 355 <Filename Value=" UMainForm.pas"/>356 <Caret Line="1 02" Column="17" TopLine="84"/>366 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 367 <Caret Line="138" Column="1" TopLine="118"/> 357 368 </Position28> 358 369 <Position29> 359 <Filename Value=" UMainForm.pas"/>360 <Caret Line=" 94" Column="52" TopLine="84"/>370 <Filename Value="../Systems/UAudioSystemWindows.pas"/> 371 <Caret Line="134" Column="28" TopLine="117"/> 361 372 </Position29> 362 373 <Position30> 363 <Filename Value=" UMainForm.pas"/>364 <Caret Line="7 4" Column="29" TopLine="68"/>374 <Filename Value="../../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/packages/winunits-base/src/mmsystem.pp"/> 375 <Caret Line="765" Column="5" TopLine="882"/> 365 376 </Position30> 366 377 </JumpHistory> … … 378 389 <Debugging> 379 390 <GenerateDebugInfo Value="True"/> 380 <DebugInfoType Value="dsStabs"/>381 391 </Debugging> 382 392 <Options> -
CoolAudio/Demo/Demo.lpr
r279 r280 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UMainForm , USystem;10 Forms, UMainForm; 11 11 12 12 {$R *.res} -
CoolAudio/Demo/UMainForm.lfm
r279 r280 69 69 object ComboBox1: TComboBox 70 70 Left = 80 71 Height = 2 571 Height = 21 72 72 Top = 46 73 73 Width = 128 74 ItemHeight = 074 ItemHeight = 13 75 75 OnChange = ComboBox1Change 76 76 Style = csDropDownList … … 81 81 Height = 14 82 82 Top = 46 83 Width = 5283 Width = 45 84 84 Caption = 'Backend:' 85 85 ParentColor = False … … 89 89 Height = 14 90 90 Top = 152 91 Width = 4 891 Width = 42 92 92 Caption = 'Position:' 93 93 ParentColor = False -
CoolAudio/Demo/UMainForm.pas
r279 r280 54 54 begin 55 55 AudioSystemManager.FillStringList(ComboBox1.Items); 56 AudioSystem := TAudioSystemMPlayer.Create; 57 TAudioSystemMPlayer(AudioSystem).Path := 'c:\Program Files\SMPlayer\mplayer\mplayer.exe'; 58 TAudioSystemMPlayer(AudioSystem).Path := TAudioSystemMPlayer(AudioSystem).FindPath; 59 Player := TPlayerMPlayer.Create; 60 Player.AudioSystem := AudioSystem; 56 if ComboBox1.Items.Count > 0 then 57 ComboBox1.ItemIndex := 0; 58 ComboBox1Change(Self); 61 59 end; 62 60 63 61 procedure TMainForm.FormDestroy(Sender: TObject); 64 62 begin 65 Player.Free;66 AudioSystem.Free;63 FreeAndNil(Player); 64 FreeAndNil(AudioSystem); 67 65 end; 68 66 69 67 procedure TMainForm.TimerPlaybackTimer(Sender: TObject); 70 68 begin 71 if Player.Playing then begin69 if Assigned(Player) and Player.Playing then begin 72 70 TrackBar1.OnChange := nil; 73 71 TrackBar1.Position := Trunc(Player.Position / Player.Length * TrackBar1.Max); … … 96 94 procedure TMainForm.ComboBox1Change(Sender: TObject); 97 95 begin 98 Player.Free;99 AudioSystem.Free;96 FreeAndNil(Player); 97 FreeAndNil(AudioSystem); 100 98 if ComboBox1.ItemIndex <> - 1 then begin 101 99 with TAudioSystemManagerItem(ComboBox1.Items.Objects[ComboBox1.ItemIndex]) do begin … … 103 101 Player := PlayerClass.Create; 104 102 Player.AudioSystem := AudioSystem; 103 //Player.Active := True; 105 104 end; 106 105 end; -
CoolAudio/Systems/UAudioSystem.pas
r278 r280 31 31 TPlayer = class(TComponent) 32 32 private 33 procedure SetPlaying(AValue: Boolean);34 33 protected 34 FActive: Boolean; 35 35 FFileName: string; 36 36 FAudioSystem: TAudioSystem; 37 37 FPlaying: Boolean; 38 function GetMuted: Boolean; virtual; abstract; 39 procedure SetMuted(AValue: Boolean); virtual; abstract; 40 function GetLength: TDateTime; virtual; abstract; 41 function GetPosition: TDateTime; virtual; abstract; 42 function GetVolume: Real; virtual; abstract; 43 procedure SetPosition(AValue: TDateTime); virtual; abstract; 44 procedure SetVolume(AValue: Real); virtual; abstract; 38 procedure SetActive(AValue: Boolean); virtual; 39 procedure SetPlaying(AValue: Boolean); virtual; 40 function GetMuted: Boolean; virtual; 41 procedure SetMuted(AValue: Boolean); virtual; 42 function GetLength: TDateTime; virtual; 43 function GetPosition: TDateTime; virtual; 44 function GetVolume: Real; virtual; 45 procedure SetPosition(AValue: TDateTime); virtual; 46 procedure SetVolume(AValue: Real); virtual; 45 47 procedure SetFileName(AValue: string); virtual; 46 48 public 47 procedure Play; virtual; abstract; 48 procedure Pause; virtual; abstract; 49 procedure Stop; virtual; abstract; 49 procedure Play; virtual; 50 procedure Pause; virtual; 51 procedure Stop; virtual; 52 procedure Open; virtual; 53 procedure Close; virtual; 50 54 property Position: TDateTime read GetPosition write SetPosition; 51 55 property Length: TDateTime read GetLength; … … 55 59 property FileName: string read FFileName write SetFileName; 56 60 property Playing: Boolean read FPlaying write SetPlaying; 61 property Active: Boolean read FActive write SetActive; 57 62 constructor Create; virtual; 63 destructor Destroy; override; 58 64 end; 59 65 … … 125 131 { TPlayer } 126 132 133 procedure TPlayer.SetActive(AValue: Boolean); 134 begin 135 if FActive = AValue then Exit; 136 FActive := AValue; 137 end; 138 127 139 procedure TPlayer.SetPlaying(AValue: Boolean); 128 140 begin … … 131 143 end; 132 144 145 function TPlayer.GetMuted: Boolean; 146 begin 147 Result := False; 148 end; 149 150 procedure TPlayer.SetMuted(AValue: Boolean); 151 begin 152 end; 153 154 function TPlayer.GetLength: TDateTime; 155 begin 156 Result := 0; 157 end; 158 159 function TPlayer.GetPosition: TDateTime; 160 begin 161 Result := 0; 162 end; 163 164 function TPlayer.GetVolume: Real; 165 begin 166 Result := 0; 167 end; 168 169 procedure TPlayer.SetPosition(AValue: TDateTime); 170 begin 171 end; 172 173 procedure TPlayer.SetVolume(AValue: Real); 174 begin 175 end; 176 133 177 procedure TPlayer.SetFileName(AValue: string); 134 178 begin … … 137 181 end; 138 182 183 procedure TPlayer.Play; 184 begin 185 end; 186 187 procedure TPlayer.Pause; 188 begin 189 end; 190 191 procedure TPlayer.Stop; 192 begin 193 end; 194 195 procedure TPlayer.Open; 196 begin 197 Active := True; 198 end; 199 200 procedure TPlayer.Close; 201 begin 202 Active := False; 203 end; 204 139 205 constructor TPlayer.Create; 140 206 begin 141 207 end; 208 209 destructor TPlayer.Destroy; 210 begin 211 Active := False; 212 inherited Destroy; 142 213 end; 143 214 -
CoolAudio/Systems/UAudioSystemMPlayer.pas
r279 r280 105 105 tmps := GetEnvironmentVariable('PATH'); 106 106 repeat 107 I := pos(':', tmps);107 I := Pos(PathSeparator, tmps); 108 108 if I = 0 then I := Length(tmps); 109 109 tmppath := IncludeTrailingPathDelimiter(Copy(tmps, 0, I - 1)) + MPlayerExecutableName; … … 118 118 begin 119 119 inherited Create; 120 FPath := '';120 FPath := FindPath; 121 121 end; 122 122 -
CoolAudio/Systems/UAudioSystemWindows.pas
r279 r280 7 7 {$IFDEF Windows} 8 8 uses 9 Classes, SysUtils, UAudioSystem, MMSystem;9 Windows, Classes, SysUtils, UAudioSystem, MMSystem, DateUtils; 10 10 11 11 type 12 TAudioSystemWindows = class(TAudioSystem) 13 public 14 PlayerIndex: Integer; 15 end; 16 17 TMPDeviceTypes = (dtAutoSelect, dtAVIVideo, dtCDAudio, dtDAT, dtDigitalVideo, dtMMMovie, 18 dtOther, dtOverlay, dtScanner, dtSequencer, dtVCR, dtVideodisc, dtWaveAudio); 12 19 13 20 { TPlayerWindows } … … 15 22 TPlayerWindows = class(TPlayer) 16 23 private 24 FHandle: HWND; 25 FDeviceId: MCIDEVICEID; 26 FDeviceType: TMPDeviceTypes; 27 FFlags: Longint; 28 FUseNotify: Boolean; 29 FNotify: Boolean; 30 FUseWait: Boolean; 31 FWait: Boolean; 32 FAliasName: string; 33 procedure DoClose; 34 procedure DoOpen; 35 procedure SetDeviceType(AValue: TMPDeviceTypes); 36 procedure CheckError(AValue: Integer); 37 function GetErrorMessage(Code: Integer): string; 38 procedure SetActive(AValue: Boolean); override; 39 procedure SetNotify(AValue: Boolean); 40 procedure SetWait(AValue: Boolean); 41 function GetPosition: TDateTime; override; 42 procedure SetPosition(AValue: TDateTime); override; 43 function GetLength: TDateTime; override; 44 public 17 45 procedure Play; override; 18 46 procedure Pause; override; 19 47 procedure Stop; override; 48 constructor Create; override; 49 destructor Destroy; override; 50 property DeviceType: TMPDeviceTypes read FDeviceType write SetDeviceType; 51 property Handle: HWND read FHandle; 52 property Wait: Boolean read FWait write SetWait; 53 property Notify: Boolean read FNotify write SetNotify; 20 54 end; 21 55 {$ENDIF} 22 56 57 resourcestring 58 SMCIUnknownError = 'Unknown error code'; 59 23 60 implementation 24 61 … … 27 64 { TPlayerWindows } 28 65 66 procedure TPlayerWindows.SetDeviceType(AValue: TMPDeviceTypes); 67 begin 68 if FDeviceType = AValue then Exit; 69 FDeviceType := AValue; 70 end; 71 72 procedure TPlayerWindows.CheckError(AValue: Integer); 73 begin 74 if AValue <> 0 then raise Exception.Create('Error ' + IntToStr(AValue) + ': ' + GetErrorMessage(AValue)); 75 end; 76 77 function TPlayerWindows.GetErrorMessage(Code: Integer): string; 78 var 79 ErrMsg: array[0..4095] of Char; 80 begin 81 if not mciGetErrorString(Code, ErrMsg, SizeOf(ErrMsg)) then 82 Result := SMCIUnknownError 83 else SetString(Result, ErrMsg, StrLen(ErrMsg)); 84 end; 85 86 procedure TPlayerWindows.SetActive(AValue: Boolean); 87 begin 88 if FActive = AValue then Exit; 89 inherited SetActive(AValue); 90 if AValue then DoOpen else DoClose; 91 end; 92 93 procedure TPlayerWindows.SetNotify(AValue: Boolean); 94 begin 95 if FNotify = AValue then Exit; 96 FNotify := AValue; 97 FUseNotify := True; 98 end; 99 100 procedure TPlayerWindows.SetWait(AValue: Boolean); 101 begin 102 if FWait = AValue then Exit; 103 FWait := AValue; 104 FUseWait := True; 105 end; 106 107 function TPlayerWindows.GetPosition: TDateTime; 108 var 109 Parm: TMCI_Status_Parms; 110 begin 111 FFlags := mci_Wait or mci_Status_Item; 112 Parm.dwItem := mci_Status_Position; 113 CheckError(mciSendCommand(FDeviceID, mci_Status, FFlags, Longint(@Parm))); 114 Result := Parm.dwReturn * OneMillisecond; 115 end; 116 117 procedure TPlayerWindows.SetPosition(AValue: TDateTime); 118 var 119 Parm: TMCI_Seek_Parms; 120 begin 121 if FDeviceID <> 0 then begin 122 FFlags := 0; 123 if FUseWait then 124 begin 125 if FWait then FFlags := mci_Wait; 126 FUseWait := False; 127 end 128 else FFlags := mci_Wait; 129 if FUseNotify then 130 begin 131 if FNotify then FFlags := FFlags or mci_Notify; 132 FUseNotify := False; 133 end; 134 FFlags := FFlags or mci_To; 135 Parm.dwTo := Round(AValue / OneMillisecond); 136 CheckError(mciSendCommand(FDeviceID, mci_Seek, FFlags, Longint(@Parm))); 137 if FPlaying then Play; 138 end; 139 end; 140 141 function TPlayerWindows.GetLength: TDateTime; 142 var 143 Parm: TMCI_Status_Parms; 144 begin 145 FFlags := mci_Wait or mci_Status_Item; 146 Parm.dwItem := mci_Status_Length; 147 mciSendCommand(FDeviceID, mci_Status, FFlags, Longint(@Parm)); 148 Result := Parm.dwReturn * OneMillisecond; 149 end; 150 29 151 procedure TPlayerWindows.Play; 30 begin 31 PlaySound(); 32 sndPlaySound(FFileName, SND_ASYNC); 152 var 153 Parm: TMCI_Play_Parms; 154 begin 155 if FDeviceID = 0 then DoOpen; 156 157 FFlags := 0; 158 if FUseNotify then 159 begin 160 if FNotify then FFlags := mci_Notify; 161 FUseNotify := False; 162 end else FFlags := mci_Notify; 163 if FUseWait then 164 begin 165 if FWait then FFlags := FFlags or mci_Wait; 166 FUseWait := False; 167 end; 168 CheckError(mciSendCommand(FDeviceID, mci_Play, FFlags, Longint(@Parm))); 169 FPlaying := True; 33 170 end; 34 171 35 172 procedure TPlayerWindows.Pause; 36 begin 37 inherited Pause; 173 var 174 Parm: TMCI_Generic_Parms; 175 begin 176 if FPlaying then begin 177 CheckError(mciSendCommand(FDeviceID, mci_Pause, FFlags, Longint(@Parm))); 178 FPlaying := False; 179 end else begin 180 CheckError(mciSendCommand(FDeviceID, mci_Resume, FFlags, Longint(@Parm))); 181 FPlaying := True; 182 end; 38 183 end; 39 184 40 185 procedure TPlayerWindows.Stop; 41 begin 42 sndPlaySound(nil, 0); 186 var 187 Parm: TMCI_Generic_Parms; 188 begin 189 FFlags := 0; 190 if FUseNotify then 191 begin 192 if FNotify then FFlags := mci_Notify; 193 FUseNotify := False; 194 end else FFlags := mci_Notify; 195 if FUseWait then 196 begin 197 if FWait then FFlags := FFlags or mci_Wait; 198 FUseWait := False; 199 end; 200 CheckError(mciSendCommand(FDeviceID, mci_Stop, FFlags, Longint(@Parm))); 201 FPlaying := False; 202 end; 203 204 constructor TPlayerWindows.Create; 205 begin 206 inherited Create; 207 end; 208 209 destructor TPlayerWindows.Destroy; 210 begin 211 Active := False; 212 inherited Destroy; 213 end; 214 215 procedure TPlayerWindows.DoOpen; 216 const 217 DeviceName: array[TMPDeviceTypes] of PChar = ('', 'AVIVideo', 'CDAudio', 'DAT', 218 'DigitalVideo', 'MMMovie', 'Other', 'Overlay', 'Scanner', 'Sequencer', 219 'VCR', 'Videodisc', 'WaveAudio'); 220 var 221 Parm: TMCI_Open_Parms; 222 begin 223 if FDeviceId <> 0 then DoClose; 224 225 FillChar(Parm, SizeOf(TMCI_Open_Parms), 0); 226 Parm.dwCallback := 0; 227 Parm.lpstrDeviceType := DeviceName[FDeviceType]; 228 Parm.lpstrElementName := PChar(FFileName); 229 230 FFlags := 0; 231 232 if FUseWait then 233 begin 234 if FWait then FFlags := mci_Wait; 235 FUseWait := False; 236 end 237 else 238 FFlags := mci_Wait; 239 240 if FUseNotify then 241 begin 242 if FNotify then FFlags := FFlags or mci_Notify; 243 FUseNotify := False; 244 end; 245 246 if FDeviceType <> dtAutoSelect then 247 FFlags := FFlags or mci_Open_Type; 248 249 if FDeviceType <> dtAutoSelect then 250 FFlags := FFlags or mci_Open_Type 251 else 252 FFlags := FFlags or MCI_OPEN_ELEMENT; 253 254 //Parm.dwCallback := Handle; 255 CheckError(mciSendCommand(0, mci_Open, FFlags, Longint(@Parm))); 256 FDeviceID := Parm.wDeviceID; 257 FActive := True; 258 end; 259 260 procedure TPlayerWindows.DoClose; 261 var 262 Parm: TMCI_Generic_Parms; 263 begin 264 if FDeviceId <> 0 then begin 265 FFlags := 0; 266 if FUseWait then 267 begin 268 if FWait then FFlags := mci_Wait; 269 FUseWait := False; 270 end 271 else FFlags := mci_Wait; 272 if FUseNotify then 273 begin 274 if FNotify then FFlags := FFlags or mci_Notify; 275 FUseNotify := False; 276 end; 277 CheckError(mciSendCommand(FDeviceId, mci_Close, FFlags, Longint(@Parm))); 278 FDeviceId := 0; 279 FActive := False; 280 end; 43 281 end; 44 282
Note:
See TracChangeset
for help on using the changeset viewer.