aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UMusic.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-04-10 15:04:18 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-04-10 15:04:18 +0000
commit596265628f267cd0d91f6e834a0f78c591cd8a3e (patch)
tree67fc18e2b457b270b73a4739cb37998dea249f99 /Game/Code/Classes/UMusic.pas
parentde19222a6fc53d455a91a8e5c8c99c080408392b (diff)
downloadusdx-596265628f267cd0d91f6e834a0f78c591cd8a3e.tar.gz
usdx-596265628f267cd0d91f6e834a0f78c591cd8a3e.tar.xz
usdx-596265628f267cd0d91f6e834a0f78c591cd8a3e.zip
workaround for erroneously detection of 48000Hz-only devices as 44100Hz devices in portaudio
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1017 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UMusic.pas')
-rw-r--r--Game/Code/Classes/UMusic.pas31
1 files changed, 24 insertions, 7 deletions
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas
index c389574b..8efb8be7 100644
--- a/Game/Code/Classes/UMusic.pas
+++ b/Game/Code/Classes/UMusic.pas
@@ -117,11 +117,11 @@ type
TAudioFormatInfo = class
public
Channels : byte;
- SampleRate : integer;
+ SampleRate : double;
Format : TAudioSampleFormat;
FrameSize : integer; // calculated on construction
- constructor Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat);
+ constructor Create(Channels: byte; SampleRate: double; Format: TAudioSampleFormat);
end;
type
@@ -273,6 +273,9 @@ type
constructor Create();
destructor Destroy(); override;
+
+ procedure LoadSounds();
+ procedure UnloadSounds();
end;
var // TODO : JB --- THESE SHOULD NOT BE GLOBAL
@@ -302,6 +305,7 @@ uses
sysutils,
UMain,
UCommandLine,
+ URecord,
ULog;
var
@@ -314,7 +318,7 @@ var
singleton_AudioManager : TInterfaceList = nil;
-constructor TAudioFormatInfo.Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat);
+constructor TAudioFormatInfo.Create(Channels: byte; SampleRate: double; Format: TAudioSampleFormat);
begin
Self.Channels := Channels;
Self.SampleRate := SampleRate;
@@ -476,12 +480,26 @@ begin
end;
end;
+
+{ TSoundLibrary }
+
constructor TSoundLibrary.Create();
begin
- //Log.LogStatus('Loading Sounds', 'Music Initialize');
+ LoadSounds();
+end;
+
+destructor TSoundLibrary.Destroy();
+begin
+ UnloadSounds();
+end;
+procedure TSoundLibrary.LoadSounds();
+begin
+ //Log.LogStatus('Loading Sounds', 'Music Initialize');
//Log.BenchmarkStart(4);
+ UnloadSounds();
+
Start := AudioPlayback.OpenSound(SoundPath + 'Common start.mp3');
Back := AudioPlayback.OpenSound(SoundPath + 'Common back.mp3');
Swoosh := AudioPlayback.OpenSound(SoundPath + 'menu swoosh.mp3');
@@ -499,7 +517,7 @@ begin
//Log.LogBenchmark('--> Loading Sounds', 4);
end;
-destructor TSoundLibrary.Destroy();
+procedure TSoundLibrary.UnloadSounds();
begin
Start.Free;
Back.Free;
@@ -515,11 +533,10 @@ begin
//Shuffle.Free;
end;
-
initialization
begin
singleton_AudioManager := TInterfaceList.Create();
-
+
end;
finalization