Rev 4 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4 | Rev 16 | ||
---|---|---|---|
Line 275... | Line 275... | ||
275 | {$ELSE} |
275 | {$ELSE} |
276 | // DelphiX Version 992404 and earlier |
276 | // DelphiX Version 992404 and earlier |
277 | S1,S2:Integer; |
277 | S1,S2:Integer; |
278 | {$ENDIF} |
278 | {$ENDIF} |
279 | NumWrite:Longint; |
279 | NumWrite:Longint; |
280 | Pos:Integer; |
280 | Pos:{$IFDEF UNICODE}Cardinal{$ELSE}Integer{$ENDIF}; |
281 | Written1:Integer; |
281 | Written1:Integer; |
282 | begin |
282 | begin |
283 | if Event = 0 then |
283 | if Event = 0 then |
284 | Pos := TDSBPositionNotify(Notify[EVENTCOUNT -1]^).dwOffset |
284 | Pos := TDSBPositionNotify(Notify[EVENTCOUNT -1]^).dwOffset |
285 | else |
285 | else |
286 | Pos := TDSBPositionNotify(Notify[Event-1]^).dwOffset; |
286 | Pos := TDSBPositionNotify(Notify[Event-1]^).dwOffset; |
287 | NumWrite := TDSBPositionNotify(Notify[Event]^).dwOffset - Pos; |
287 | NumWrite := TDSBPositionNotify(Notify[Event]^).dwOffset - Pos; |
288 | if (NumWrite < 0) then |
288 | if (NumWrite < 0) then |
289 | inc(NumWrite,BufferDesc.dwBufferBytes); |
289 | inc(NumWrite,BufferDesc.dwBufferBytes); |
290 | if SoundBuffer.IBuffer.Lock(Pos,NumWrite,w1,{$IFDEF UNICODE}@{$ENDIF}s1,Pointer(nil^),{$IFDEF UNICODE}@{$ENDIF}s2,0) = 0 then |
290 | if SoundBuffer.IBuffer.Lock(Pos,NumWrite,w1,{$IFDEF UNICODE}{$IFNDEF D26UP}@{$ENDIF}{$ENDIF}s1,Pointer(nil^),{$IFDEF UNICODE}{$IFNDEF D26UP}@{$ENDIF}{$ENDIF}s2,0) = 0 then |
291 | begin |
291 | begin |
292 | Written1 := ModMixer.Render(W1,S1); |
292 | Written1 := ModMixer.Render(W1,S1); |
293 | SoundBuffer.IBuffer.Unlock(w1,Written1, nil,0); |
293 | SoundBuffer.IBuffer.Unlock(w1,Written1, nil,0); |
294 | if (Written1 = 0) then |
294 | if (Written1 = 0) then |
295 | Stop; |
295 | Stop; |
Line 342... | Line 342... | ||
342 | Result.CreateBuffer(BufferDesc); |
342 | Result.CreateBuffer(BufferDesc); |
343 | end; |
343 | end; |
344 | function TSXModPlayer.CreateSoundNotify : IDirectSoundNotify; |
344 | function TSXModPlayer.CreateSoundNotify : IDirectSoundNotify; |
345 | type TNotifyArray = Array[0..99] of TDSBPositionNotify; |
345 | type TNotifyArray = Array[0..99] of TDSBPositionNotify; |
346 | var PDSNotify : PDSBPositionNotify; |
346 | var PDSNotify : PDSBPositionNotify; |
347 | index : Integer; Offset: Integer; |
347 | index : Integer; Offset: {$IFDEF UNICODE}DWORD{$ELSE}Integer{$ENDIF}; |
348 | PNotify: ^TNotifyArray; |
348 | PNotify: ^TNotifyArray; |
349 | begin |
349 | begin |
350 | Result := nil; |
350 | Result := nil; |
351 | if SoundBuffer.IBuffer.QueryInterface(IID_IDirectSoundNotify,Result) = 0 then |
351 | if SoundBuffer.IBuffer.QueryInterface(IID_IDirectSoundNotify,Result) = 0 then |
352 | begin |
352 | begin |
Line 359... | Line 359... | ||
359 | PDSNotify^.dwOffset := OffSet; |
359 | PDSNotify^.dwOffset := OffSet; |
360 | PDSNotify^.hEventNotify := CreateEvent(nil,False,False,nil); |
360 | PDSNotify^.hEventNotify := CreateEvent(nil,False,False,nil); |
361 | Notify.Add(PDSNotify); |
361 | Notify.Add(PDSNotify); |
362 | Events.Add(Pointer(PDSNotify^.hEventNotify)); |
362 | Events.Add(Pointer(PDSNotify^.hEventNotify)); |
363 | PNotify[Index-1] := PDSNotify^; |
363 | PNotify[Index-1] := PDSNotify^; |
364 | inc(Offset,WaveFormat.nAvgBytesPerSec div EVENTCOUNT); |
364 | Inc(Offset, WaveFormat.nAvgBytesPerSec div {$IFDEF UNICODE}DWORD{$ELSE}Integer{$ENDIF}(EVENTCOUNT)); |
365 | end; |
365 | end; |
366 | 366 | ||
367 | if Result.SetNotificationPositions(EVENTCOUNT,{$IFDEF UNICODE}@{$ENDIF}PNotify[0]) <> 0 then |
367 | if Result.SetNotificationPositions(EVENTCOUNT,{$IFDEF UNICODE}{$IFNDEF D26UP}@{$ENDIF}{$ENDIF}PNotify[0]) <> 0 then |
368 | ShowMessage('Notification Falied'); |
368 | ShowMessage('Notification Falied'); |
369 | FreeMem(PNotify,EVENTCOUNT * Sizeof(TDSBPositionNotify)); |
369 | FreeMem(PNotify,EVENTCOUNT * Sizeof(TDSBPositionNotify)); |
370 | end; |
370 | end; |
371 | end; |
371 | end; |
372 | procedure TSXModPlayer.ClearSoundNotify; |
372 | procedure TSXModPlayer.ClearSoundNotify; |
Line 402... | Line 402... | ||
402 | S1,S2:Integer; |
402 | S1,S2:Integer; |
403 | {$ENDIF} |
403 | {$ENDIF} |
404 | Data:Word; |
404 | Data:Word; |
405 | begin |
405 | begin |
406 | Data := GetSilenceData; |
406 | Data := GetSilenceData; |
407 | if SoundBuffer.IBuffer.Lock(0,0,w1,{$IFDEF UNICODE}@{$ENDIF}s1,w2,{$IFDEF UNICODE}@{$ENDIF}s2,DSBLOCK_ENTIREBUFFER) = 0 then |
407 | if SoundBuffer.IBuffer.Lock(0,0,w1,{$IFDEF UNICODE}{$IFNDEF D26UP}@{$ENDIF}{$ENDIF}s1,w2,{$IFDEF UNICODE}{$IFNDEF D26UP}@{$ENDIF}{$ENDIF}s2,DSBLOCK_ENTIREBUFFER) = 0 then |
408 | begin |
408 | begin |
409 | FillMemory(W1,S1,Data); |
409 | FillMemory(W1,S1,Data); |
410 | if W2 <> nil then |
410 | if W2 <> nil then |
411 | FillMemory(W2,S2,Data); |
411 | FillMemory(W2,S2,Data); |
412 | SoundBuffer.IBuffer.Unlock(W1,S1,W2,S2); |
412 | SoundBuffer.IBuffer.Unlock(W1,S1,W2,S2); |
Line 488... | Line 488... | ||
488 | ModMixer.SetMixerOptions(Flags); |
488 | ModMixer.SetMixerOptions(Flags); |
489 | end; |
489 | end; |
490 | end; |
490 | end; |
491 | end; |
491 | end; |
492 | procedure TSXModPlayer.SetOptions( const Value : TModOptions ); |
492 | procedure TSXModPlayer.SetOptions( const Value : TModOptions ); |
493 | const OptionArray: array[Boolean,TModOption] of Integer = ( |
493 | const OptionArray: array[Boolean,TModOption] of DWord = ( |
494 | (0,0,0,0,0,0,0), |
494 | (0,0,0,0,0,0,0), |
495 | (MPPMIX_NORESAMPLING, MPPMIX_BASSEXPANSION, MPPMIX_SURROUND, |
495 | (MPPMIX_NORESAMPLING, MPPMIX_BASSEXPANSION, MPPMIX_SURROUND, |
496 | MPPMIX_REVERB, MPPMIX_HIGHQUALITY, MPPMIX_GAINCONTROL, |
496 | MPPMIX_REVERB, MPPMIX_HIGHQUALITY, MPPMIX_GAINCONTROL, |
497 | MPPMIX_NOISEREDUCTION) |
497 | MPPMIX_NOISEREDUCTION) |
498 | ); |
498 | ); |