aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UMusic.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-02-20 18:30:46 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-02-20 18:30:46 +0000
commit5142d64ca5edc5499098513912959834b971e75b (patch)
tree7c8a6944b693dab8c99fec215e696fc16551f178 /Game/Code/Classes/UMusic.pas
parent0e0f6fcc1b26fdb551789b1a2d4d2dc62242ac4d (diff)
downloadusdx-5142d64ca5edc5499098513912959834b971e75b.tar.gz
usdx-5142d64ca5edc5499098513912959834b971e75b.tar.xz
usdx-5142d64ca5edc5499098513912959834b971e75b.zip
- Resampling support added
- DecodeStreams are closed now if they are not used anymore - Fixed the crash that occured when USDX was closed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@875 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UMusic.pas')
-rw-r--r--Game/Code/Classes/UMusic.pas34
1 files changed, 29 insertions, 5 deletions
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas
index 8bbd297a..9b8cd606 100644
--- a/Game/Code/Classes/UMusic.pas
+++ b/Game/Code/Classes/UMusic.pas
@@ -109,10 +109,27 @@ type
asfFloat // float
);
- TAudioFormatInfo = record
- Channels: byte;
- SampleRate: integer;
- Format: TAudioSampleFormat;
+const
+ // Size of one sample (one channel only) in bytes
+ AudioSampleSize: array[TAudioSampleFormat] of integer = (
+ 1, 1, // asfU8, asfS8
+ 2, 2, // asfU16LSB, asfS16LSB
+ 2, 2, // asfU16MSB, asfS16MSB
+ 2, 2, // asfU16, asfS16
+ 3, // asfS24
+ 4, // asfS32
+ 4 // asfFloat
+ );
+
+type
+ TAudioFormatInfo = class
+ public
+ Channels : byte;
+ SampleRate : integer;
+ Format : TAudioSampleFormat;
+ FrameSize : integer; // calculated on construction
+
+ constructor Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat);
end;
type
@@ -307,6 +324,14 @@ var
singleton_AudioManager : TInterfaceList = nil;
+constructor TAudioFormatInfo.Create(Channels: byte; SampleRate: integer; Format: TAudioSampleFormat);
+begin
+ Self.Channels := Channels;
+ Self.SampleRate := SampleRate;
+ Self.Format := Format;
+ Self.FrameSize := AudioSampleSize[Format] * Channels;
+end;
+
function AudioManager: TInterfaceList;
begin
if singleton_AudioManager = nil then
@@ -404,7 +429,6 @@ begin
AssignSingletonObjects();
-
if VideoPlayback <> nil then
begin
end;