diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-06 10:40:15 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-06 10:40:15 +0000 |
commit | 27ca028ea19879bb3b109c58bae86b61e60b3370 (patch) | |
tree | aa06cdb49e22c70f00d7b2da8242d408df7518ff /Game/Code/Classes/UAudio_bass.pas | |
parent | 486ad8796acc5883ef83f3a78cd615f6711d77f0 (diff) | |
download | usdx-27ca028ea19879bb3b109c58bae86b61e60b3370.tar.gz usdx-27ca028ea19879bb3b109c58bae86b61e60b3370.tar.xz usdx-27ca028ea19879bb3b109c58bae86b61e60b3370.zip |
Visualizer changes (audio connection, some opengl fixes)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@679 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UAudio_bass.pas | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Game/Code/Classes/UAudio_bass.pas b/Game/Code/Classes/UAudio_bass.pas index bcf01f92..69278cca 100644 --- a/Game/Code/Classes/UAudio_bass.pas +++ b/Game/Code/Classes/UAudio_bass.pas @@ -100,6 +100,9 @@ type //Equalizer
function GetFFTData: TFFTData;
+ // Interface for Visualizer
+ function GetPCMData(var data: TPCMData): Cardinal;
+
//Custom Sounds
function LoadCustomSound(const Filename: String): Cardinal;
procedure PlayCustomSound(const Index: Cardinal );
@@ -384,6 +387,40 @@ begin BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512);
end;
+{*
+ * Copies interleaved PCM 16bit uint (maybe fake) stereo samples into data.
+ * Returns the number of frames (= stereo/mono sample)
+ *}
+function TAudio_bass.GetPCMData(var data: TPCMData): Cardinal;
+var
+ info: BASS_CHANNELINFO;
+ nBytes: DWORD;
+begin
+ //Get Channel Data Mono and 256 Values
+ BASS_ChannelGetInfo(Bass, info);
+ ZeroMemory(@data, sizeof(TPCMData));
+
+ if (info.chans = 1) then
+ begin
+ // mono file -> add stereo channel
+ {
+ nBytes := BASS_ChannelGetData(Bass, @data[0], samples*sizeof(Smallint));
+ // interleave data
+ //CopyMemory(@data[1], @data[0], samples*sizeof(Smallint));
+ }
+ result := 0;
+ end
+ else
+ begin
+ // stereo file
+ nBytes := BASS_ChannelGetData(Bass, @data, sizeof(TPCMData));
+ end;
+ if(nBytes <= 0) then
+ result := 0
+ else
+ result := nBytes div sizeof(TPCMStereoSample);
+end;
+
function TAudio_bass.LoadCustomSound(const Filename: String): Cardinal;
var
S: hStream;
|