aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbasisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c>2015-10-11 22:15:05 +0000
committerbasisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c>2015-10-11 22:15:05 +0000
commit086642246da49e0ad2de8857004e083081a14867 (patch)
treed17de7a3de34c55f9029742eca0abcd2980790eb
parent6cef6c00598000b85d0bd9f8c1d8795a04e07c99 (diff)
downloadusdx-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
-rw-r--r--COPYRIGHT.txt4
-rw-r--r--src/base/UCommandLine.pas7
-rw-r--r--src/base/UGraphic.pas13
-rw-r--r--src/base/UIni.pas8
-rw-r--r--src/lib/bass/delphi/bass.pas10
-rw-r--r--src/media/UAudioPlayback_Bass.pas28
6 files changed, 52 insertions, 18 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index f2a8e249..ebcea407 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -14,6 +14,7 @@ Tobias Gunkel "tobigun"
Alexander S. "s_alexander"
Karl-Michael Schindler "mischi"
Philipp Steinhardt "whiteshark"
+Stefan Ludowicy "basisbit"
Based on UltraStar written by:
"Corvus5"
@@ -27,4 +28,5 @@ Patches contributed by:
Benedikt Krueger
Holger Kuhn "hawkear"
Florian Küpper "flokuep"
-Wesley Stessens "profoX" \ No newline at end of file
+Wesley Stessens "profoX"
+team of the Ultrastar Deluxe World Party mod \ No newline at end of file
diff --git a/src/base/UCommandLine.pas b/src/base/UCommandLine.pas
index ac0db2c2..7a3761da 100644
--- a/src/base/UCommandLine.pas
+++ b/src/base/UCommandLine.pas
@@ -38,6 +38,7 @@ uses
type
TScreenMode = (scmDefault, scmFullscreen, scmWindowed);
+ TSplitMode = (spmDefault, spmNoSplit, spmSplit);
{**
* Reads infos from ParamStr and set some easy interface variables
@@ -61,6 +62,7 @@ type
NoLog: boolean;
ScreenMode: TScreenMode;
Joypad: boolean;
+ Split: TSplitMode;
// some value variables set when reading infos {-1: Not Set, others: Value}
Depth: integer;
@@ -139,6 +141,7 @@ begin
NoLog := False;
ScreenMode := scmDefault;
Joypad := False;
+ Split := spmDefault;
// some value variables set when reading infos {-1: Not Set, others: Value}
fResolution := '';
@@ -190,6 +193,10 @@ begin
ScreenMode := scmWindowed
else if (Command = 'joypad') then
Joypad := True
+ else if (Command = 'split') then
+ Split := spmSplit
+ else if (Command = 'nosplit') then
+ Split := spmNoSplit
// integer variables
else if (Command = 'depth') then
diff --git a/src/base/UGraphic.pas b/src/base/UGraphic.pas
index bf297220..f0b60b95 100644
--- a/src/base/UGraphic.pas
+++ b/src/base/UGraphic.pas
@@ -616,11 +616,20 @@ var
W, H: integer;
Depth: Integer;
Fullscreen: boolean;
+ Split: boolean;
begin
if (Params.Screens <> -1) then
Screens := Params.Screens + 1
else
Screens := Ini.Screens + 1;
+ case Params.Split of
+ spmSplit:
+ Split := True;
+ spmNoSplit:
+ Split := False;
+ else
+ Split := Ini.Split = 1;
+ end; // case
// Set minimum color component sizes
// Note: do not request an alpha plane with SDL_GL_ALPHA_SIZE here as
@@ -647,8 +656,10 @@ begin
S := IResolution[Ini.Resolution];
I := Pos('x', S);
- W := StrToInt(Copy(S, 1, I-1)) * Screens;
+ W := StrToInt(Copy(S, 1, I-1));
H := StrToInt(Copy(S, I+1, 1000));
+ if ((Screens > 1) and not Split) then
+ W := W * Screens;
if (Params.Depth <> -1) then
Depth := Params.Depth
diff --git a/src/base/UIni.pas b/src/base/UIni.pas
index beb9faa8..a455ed8b 100644
--- a/src/base/UIni.pas
+++ b/src/base/UIni.pas
@@ -115,6 +115,7 @@ type
// Graphics
Screens: integer;
+ Split: integer;
Resolution: integer;
Depth: integer;
VisualizerOption: integer;
@@ -206,6 +207,7 @@ const
IDebug: array[0..1] of UTF8String = ('Off', 'On');
IScreens: array[0..1] of UTF8String = ('1', '2');
+ ISplit: array[0..1] of UTF8String = ('Off', 'On');
IFullScreen: array[0..1] of UTF8String = ('Off', 'On');
IDepth: array[0..1] of UTF8String = ('16 bit', '32 bit');
IVisualizer: array[0..2] of UTF8String = ('Off', 'WhenNoVideo','On');
@@ -786,6 +788,9 @@ begin
// Screens
Screens := GetArrayIndex(IScreens, IniFile.ReadString('Graphics', 'Screens', IScreens[0]));
+ // Split mode
+ Split := GetArrayIndex(ISplit, IniFile.ReadString('Graphics', 'Split', ISplit[0]));
+
// FullScreen
FullScreen := GetArrayIndex(IFullScreen, IniFile.ReadString('Graphics', 'FullScreen', 'On'));
@@ -1072,6 +1077,9 @@ begin
// Screens
IniFile.WriteString('Graphics', 'Screens', IScreens[Screens]);
+ // Split
+ IniFile.WriteString('Graphics', 'Split', ISplit[Split]);
+
// FullScreen
IniFile.WriteString('Graphics', 'FullScreen', IFullScreen[FullScreen]);
diff --git a/src/lib/bass/delphi/bass.pas b/src/lib/bass/delphi/bass.pas
index e87b05f5..7ff68fbe 100644
--- a/src/lib/bass/delphi/bass.pas
+++ b/src/lib/bass/delphi/bass.pas
@@ -96,9 +96,9 @@ const
BASS_CONFIG_MUSIC_VIRTUAL = 22;
BASS_CONFIG_VERIFY = 23;
BASS_CONFIG_UPDATETHREADS = 24;
- {$IFDEF LINUX}
BASS_CONFIG_DEV_BUFFER = 27;
- {$ENDIF}
+ BASS_CONFIG_DEV_DEFAULT = 36;
+ BASS_CONFIG_NET_READTIMEOUT = 37;
// BASS_SetConfigPtr options
BASS_CONFIG_NET_AGENT = 16;
@@ -330,6 +330,7 @@ const
BASS_ATTRIB_VOL = 2;
BASS_ATTRIB_PAN = 3;
BASS_ATTRIB_EAXMIX = 4;
+ BASS_ATTRIB_NOBUFFER = 5;
BASS_ATTRIB_MUSIC_AMPLIFY = $100;
BASS_ATTRIB_MUSIC_PANSEP = $101;
BASS_ATTRIB_MUSIC_PSCALER = $102;
@@ -348,6 +349,7 @@ const
BASS_DATA_FFT2048 = $80000003; // 2048 FFT
BASS_DATA_FFT4096 = $80000004; // 4096 FFT
BASS_DATA_FFT8192 = $80000005; // 8192 FFT
+ BASS_DATA_FFT16384 = $80000006; // 16384 FFT
BASS_DATA_FFT_INDIVIDUAL = $10; // FFT flag: FFT for each channel, else all combined
BASS_DATA_FFT_NOWINDOW = $20; // FFT flag: no Hanning window
@@ -364,6 +366,7 @@ const
BASS_TAG_RIFF_INFO = $100; // RIFF "INFO" tags : series of null-terminated ANSI strings
BASS_TAG_RIFF_BEXT = $101; // RIFF/BWF "bext" tags : TAG_BEXT structure
BASS_TAG_RIFF_CART = $102; // RIFF/BWF "cart" tags : TAG_CART structure
+ BASS_TAG_RIFF_DISP = $103; // RIFF "DISP" text tag : ANSI string
BASS_TAG_MUSIC_NAME = $10000; // MOD music name : ANSI string
BASS_TAG_MUSIC_MESSAGE = $10001; // MOD message : ANSI string
BASS_TAG_MUSIC_ORDERS = $10002; // MOD order list : BYTE array of pattern numbers
@@ -374,7 +377,8 @@ const
BASS_POS_BYTE = 0; // byte position
BASS_POS_MUSIC_ORDER = 1; // order.row position, MAKELONG(order,row)
BASS_POS_DECODE = $10000000; // flag: get the decoding (not playing) position
-
+ BASS_POS_DECODETO = $20000000; // flag: decode to the position instead of seeking
+
// BASS_RecordSetInput flags
BASS_INPUT_OFF = $10000;
BASS_INPUT_ON = $20000;
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;