diff options
author | basisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2015-10-11 22:15:05 +0000 |
---|---|---|
committer | basisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2015-10-11 22:15:05 +0000 |
commit | 086642246da49e0ad2de8857004e083081a14867 (patch) | |
tree | d17de7a3de34c55f9029742eca0abcd2980790eb /src/media | |
parent | 6cef6c00598000b85d0bd9f8c1d8795a04e07c99 (diff) | |
download | usdx-086642246da49e0ad2de8857004e083081a14867.tar.gz usdx-086642246da49e0ad2de8857004e083081a14867.tar.xz usdx-086642246da49e0ad2de8857004e083081a14867.zip |
* modified to support current Bass.dll which fixes sound-issues on windows 8 and newer
ToDo: implement usage of Bass device latency for usage when syncing video playback and audio playback
* implemented the split-feature for linux-users. see https://sourceforge.net/p/ultrastardx/patches/16/
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3141 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/media')
-rw-r--r-- | src/media/UAudioPlayback_Bass.pas | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/media/UAudioPlayback_Bass.pas b/src/media/UAudioPlayback_Bass.pas index 36d84b22..f50e2aa0 100644 --- a/src/media/UAudioPlayback_Bass.pas +++ b/src/media/UAudioPlayback_Bass.pas @@ -45,7 +45,7 @@ uses UAudioCore_Bass, ULog, sdl, - bass, + Bass, SysUtils; type @@ -172,8 +172,6 @@ var SourceFormatInfo: TAudioFormatInfo; FrameSize: integer; PadFrame: PByteArray; - //Info: BASS_INFO; - //Latency: double; begin Result := -1; @@ -249,7 +247,6 @@ var FormatFlags: DWORD; begin Result := false; - // close previous stream and reset state Reset(); @@ -365,13 +362,13 @@ begin end; function TBassPlaybackStream.GetLatency(): double; +var + Info: BASS_INFO; begin - // TODO: should we consider output latency for synching (needs BASS_DEVICE_LATENCY)? - //if (BASS_GetInfo(Info)) then - // Latency := Info.latency / 1000 - //else - // Latency := 0; - Result := 0; + if (BASS_GetInfo(Info)) then + Result := Info.latency / 1000 + else + Result := 0; end; function TBassPlaybackStream.GetVolume(): single; @@ -706,9 +703,9 @@ begin //Log.BenchmarkStart(4); //Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); - + BASS_SetConfig(BASS_CONFIG_DEV_DEFAULT, 1); // TODO: use BASS_DEVICE_LATENCY to determine the latency - if not BASS_Init(-1, 44100, 0, 0, nil) then + if not BASS_Init(-1, 44100, BASS_DEVICE_LATENCY, 0, nil) then begin Log.LogError('Could not initialize BASS', 'TAudioPlayback_Bass.InitializePlayback'); Exit; @@ -759,8 +756,13 @@ begin end; function TAudioPlayback_Bass.GetLatency(): double; +var + Info: BASS_INFO; begin - Result := 0; + if (BASS_GetInfo(Info)) then + Result := Info.latency / 1000 + else + Result := 0; end; |