From 5142d64ca5edc5499098513912959834b971e75b Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 20 Feb 2008 18:30:46 +0000 Subject: - 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 --- Game/Code/Classes/UMusic.pas | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'Game/Code/Classes/UMusic.pas') 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; -- cgit v1.2.3