From 596265628f267cd0d91f6e834a0f78c591cd8a3e Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 10 Apr 2008 15:04:18 +0000 Subject: 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 --- Game/Code/Classes/UMusic.pas | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'Game/Code/Classes/UMusic.pas') 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 -- cgit v1.2.3