diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-20 19:21:23 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-20 19:21:23 +0000 |
commit | 942773883703b519f5b2528aac504e3e6656be65 (patch) | |
tree | c5f55f55a321dbff02f0e567094426b48a36bcde /src | |
parent | fe6c46071b6588f0234000536a5e9c15ee1c9d4c (diff) | |
download | usdx-942773883703b519f5b2528aac504e3e6656be65.tar.gz usdx-942773883703b519f5b2528aac504e3e6656be65.tar.xz usdx-942773883703b519f5b2528aac504e3e6656be65.zip |
- force a BASS version >= 2.4.2 as the BASS ABI is slightly different (although we don't use the changed stuff)
- IMPORTANT: if a version < 2.4.2 is present, usdx will log an error message but will start without sound. If you don't get sound anymore, update BASS
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2256 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src')
-rw-r--r-- | src/media/UAudioCore_Bass.pas | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/media/UAudioCore_Bass.pas b/src/media/UAudioCore_Bass.pas index 197f9760..3a84dcd7 100644 --- a/src/media/UAudioCore_Bass.pas +++ b/src/media/UAudioCore_Bass.pas @@ -49,6 +49,8 @@ type function ErrorGetString(errCode: integer): string; overload; function ConvertAudioFormatToBASSFlags(Format: TAudioSampleFormat; out Flags: DWORD): boolean; function ConvertBASSFlagsToAudioFormat(Flags: DWORD; out Format: TAudioSampleFormat): boolean; + private + function DecodeVersion(VersionHex: integer): string; end; implementation @@ -58,10 +60,9 @@ uses ULog; const - // TODO: 2.4.2 is not ABI compatible with older versions + // BASS 2.4.2 is not ABI compatible with older versions // as (BASS_RECORDINFO.driver was removed) - //BASS_MIN_REQUIRED_VERSION = $02040201; - BASS_MIN_REQUIRED_VERSION = $02000000; + BASS_MIN_REQUIRED_VERSION = $02040201; var Instance: TAudioCore_Bass; @@ -78,9 +79,25 @@ begin Result := Instance; end; +function TAudioCore_Bass.DecodeVersion(VersionHex: integer): string; +var + Version: array [0..3] of integer; +begin + Version[0] := (VersionHex shr 24) and $FF; + Version[1] := (VersionHex shr 16) and $FF; + Version[2] := (VersionHex shr 8) and $FF; + Version[3] := (VersionHex shr 0) and $FF; + Result := Format('%x.%x.%x.%x', [Version[0], Version[1], Version[2], Version[3]]); +end; + function TAudioCore_Bass.CheckVersion(): boolean; begin Result := BASS_GetVersion() >= BASS_MIN_REQUIRED_VERSION; + if (not Result) then + begin + Log.LogWarn('Could not init BASS audio library. ''bass.dll'' version is ' + DecodeVersion(BASS_GetVersion()) + ' but ' + DecodeVersion(BASS_MIN_REQUIRED_VERSION) + ' or higher is required.', + 'TAudioCore_Bass.CheckVersion'); + end; end; function TAudioCore_Bass.ErrorGetString(): string; |