aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens/UScreenSong.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-02-05 20:36:19 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-02-05 20:36:19 +0000
commitdee94f5dae9e6b5ae6c7b54a12a567745abc8dc3 (patch)
tree21767870a9f01fe8df91fd3ce5331e2fe89862fc /Game/Code/Screens/UScreenSong.pas
parent2e6592ceadb3e3c910164c76595e7ae435b8823a (diff)
downloadusdx-dee94f5dae9e6b5ae6c7b54a12a567745abc8dc3.tar.gz
usdx-dee94f5dae9e6b5ae6c7b54a12a567745abc8dc3.tar.xz
usdx-dee94f5dae9e6b5ae6c7b54a12a567745abc8dc3.zip
General:
- cleanup and adaption of SingDrawOscilloscope Portaudio/SDL audio output: - stuttering in portaudio output has been fixed (SDL_MixBuffers cannot be used without initializing the SDL audio stuff first, so it is not usable with portaudio. Now SDL is used for audio-output instead of portaudio (although the file-name is UAudioPlayback_Portaudio.pas at the moment). - cleaner file closing - volume adjustment UMusic: - cleanup of the audio-interfaces - introduced TNoteType = (ntFreestyle, ntNormal, ntGolden) - some bug-fixes - introduced TSoundLibrary. This is library for all in-game sounds used by USDX. Instead of calling AudioPlayer.PlaySwoosh you should call AudioPlayer.PlaySound(SoundLib.Swoosh) now. You might call SoundLib.Swoosh.Play too, but this is not recommended at the moment because SoundLib.Swoosh could be nil if the file was not found. The SoundLibrary approach is much cleaner than the previous one. The AudioPlayer does not have to specify a Play... and Stop... method for every available sound anymore. In addition it is not an AudioPlayers responsibility to init the in-game sounds. URecord: - polish to english translation of some variables - CaptureSoundLeft/Right is CaptureChannel[0/1] now - TSoundCardInput -> TAudioInputDeviceSource - TGenericSoundCard.Input -> TGenericSoundCard.Source - autocorrelation algorithm more readable now - Clean-up of the audio-input interface - moved cloned code of the input-classes to one base class (TAudioInputBase) - Cleaner finalization - Start-/StopCapture will not crash anymore in the recording-options menu - Fixed several bugs in the autocorrelation stuff (e.g. wrong usage of $10000) - SzczytJest (now ToneValid) was not used correctly. ToneValid is set to true if a valid tone was found (= the sound was louder than the threshold -> no background noise). If i remember correctly the sound was accepted although the tone was invalid. So the old data was used although noone was singing. This resulted in some sort of ghost-singer effect. UIni: - moved TIni.Card to TScreenOptionsRecord.Card because it is not stored in the ini-file and will not be in the future. - TIni.CardList ist now TIni.InputDeviceConfig. The name cardlist was misleading because it just specifies input- but no output-devices. In addition a soundcard can have multiple input-devices (at least in linux). - bugfix on InputDeviceConfig (formerly CardList) usage. USDX expected that the indices of the corresponding elements in TIni.InputDeviceConfig[] and TAudioInputProcessor.Device[] were the same. This is wrong. If device 2 was defined at first place in the ini and device 1 at the second, the indices of the two arrays didn't match (they were swapped) erroneously. To fix this and to support the item listed below the index to TIni.InputDeviceConfig[] is now stored in TAudioInputDevice.CfgIndex. NOTE: InputDeviceConfig[] contains configurations of non-available (unplugged) devices. Iterate over TAudioInputProcessor.Device[] for available devices. - configurations of external devices that are not plugged in will not be deleted anymore. - multiple definitions of one device in the ini-file will not crash USDX anymore - CardList[I].ChannelL/R now are InputDeviceConfig[I].ChannelToPlayerMap[0/1]. I think the new name is more intuitive because it maps a channel to a player number. Now the both vars are joint to one array. Now it is possible to use loops to process them and we might support more than two input channels on one device in the future (if such devices exist) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@827 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Screens/UScreenSong.pas')
-rw-r--r--Game/Code/Screens/UScreenSong.pas52
1 files changed, 26 insertions, 26 deletions
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 4773cdac..3be0be84 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -29,6 +29,11 @@ uses
type
TScreenSong = class(TMenu)
+ private
+ EqualizerData: TFFTData; // moved here to avoid stack overflows
+ EqualizerBands: array of Byte;
+ EqualizerTime: Cardinal;
+ EqualizerTime2: Byte;
public
TextArtist: integer;
TextTitle: integer;
@@ -52,10 +57,6 @@ type
is_jump: boolean; // Jump to Song Mod
is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title
- EqualizerBands: array of Byte;
- EqualizerTime: Cardinal;
- EqualizerTime2: Byte;
-
//Party Mod
Mode: TSingMode;
@@ -270,7 +271,7 @@ begin
begin
SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
ChangeMusic;
SetScroll4;
@@ -291,7 +292,7 @@ begin
begin
SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2));
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
ChangeMusic;
SetScroll4;
@@ -369,7 +370,7 @@ begin
else
begin
AudioPlayback.Stop;
- AudioPlayback.PlayBack;
+ AudioPlayback.PlaySound(SoundLib.Back);
FadeTo(@ScreenMain);
end;
@@ -379,7 +380,7 @@ begin
//When in party Mode then Ask before Close
else if (Mode = smPartyMode) then
begin
- AudioPlayback.PlayBack;
+ AudioPlayback.PlaySound(SoundLib.Back);
CheckFadeTo(@ScreenMain,'MSG_END_PARTY');
end;
end;
@@ -504,7 +505,7 @@ begin
FixSelected;
//Play Music:
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
ChangeMusic;
end;
@@ -547,7 +548,7 @@ begin
FixSelected;
//Play Music:
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
ChangeMusic;
end;
end;
@@ -559,7 +560,7 @@ begin
begin
if (Songs.SongList.Count > 0) AND (Mode = smNormal) then
begin
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
SelectNext;
// InteractNext;
// SongTarget := Interaction;
@@ -573,7 +574,7 @@ begin
SDLK_LEFT:
begin
if (Songs.SongList.Count > 0)AND (Mode = smNormal) then begin
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
SelectPrev;
ChangeMusic;
SetScroll4;
@@ -655,7 +656,7 @@ begin
begin
SkipTo(Random(CatSongs.VisibleSongs));
end;
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
ChangeMusic;
SetScroll4;
@@ -1804,7 +1805,6 @@ end;
procedure TScreenSong.DrawEqualizer;
var
- Data: TFFTData; //Audio Data
I, J: Integer;
Res: byte;
A, B: Integer;
@@ -1822,7 +1822,7 @@ begin
if (A <> EqualizerTime) then
begin
EqualizerTime := A;
- Data := AudioPlayback.GetFFTData;
+ AudioPlayback.GetFFTData(EqualizerData);
B := 0;
Pos := 0;
@@ -1850,23 +1850,23 @@ begin
end;
if I > 35 then
- Data[i] := Data[i] * 8
+ EqualizerData[i] := EqualizerData[i] * 8
else if I > 11 then
- Data[i] := Data[i] * 4.5
+ EqualizerData[i] := EqualizerData[i] * 4.5
else
- Data[i] := Data[i] * 1.1;
+ EqualizerData[i] := EqualizerData[i] * 1.1;
- if (Data[i] >= 1) then
- Data[i] := 0.9999999999999;
+ if (EqualizerData[i] >= 1) then
+ EqualizerData[i] := 0.9999999999999;
try
if ( assigned( Theme ) ) AND
( assigned( Theme.Song ) ) AND
- ( i < length( Data ) ) THEN
+ ( i < length( EqualizerData ) ) THEN
begin
- if single( Data[i] ) > 1 then
+ if single( EqualizerData[i] ) > 1 then
begin
- lTmp := Single(Data[i]) * Theme.Song.Equalizer.Length;
+ lTmp := Single(EqualizerData[i]) * Theme.Song.Equalizer.Length;
if lTmp > Pos then
Pos := lTmp;
end;
@@ -1874,7 +1874,7 @@ begin
except
{$IFDEF FPC}
on E:EInvalidOp do
- writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( Data[i] ) )+' * '+ ')' );
+ writeln( 'UScreenSong - DOH !!!! ('+inttostr(i)+' '+ inttostr( integer( EqualizerData[i] ) )+' * '+ ')' );
{$ENDIF}
end
@@ -1989,7 +1989,7 @@ begin
end;
end;
- AudioPlayback.PlayChange;
+ AudioPlayback.PlaySound(SoundLib.Change);
ChangeMusic;
SetScroll;
UpdateLCD;
@@ -2129,7 +2129,7 @@ begin
if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then
begin
AudioPlayback.Stop;
- AudioPlayback.PlayStart;
+ AudioPlayback.PlaySound(SoundLib.Start);
ScreenEditSub.Path := CatSongs.Song[Interaction].Path;
ScreenEditSub.FileName := CatSongs.Song[Interaction].FileName;
FadeTo(@ScreenEditSub);