diff options
author | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2013-02-22 22:33:33 +0000 |
---|---|---|
committer | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2013-02-22 22:33:33 +0000 |
commit | fb364dd193945e9027df807b4648e1f325b43d35 (patch) | |
tree | 341448afbb8152e8370326fb1fbd90679a0ec0dd /src | |
parent | 716c7b842a3b5d9a4b0b5b0134a46906661d6522 (diff) | |
download | usdx-fb364dd193945e9027df807b4648e1f325b43d35.tar.gz usdx-fb364dd193945e9027df807b4648e1f325b43d35.tar.xz usdx-fb364dd193945e9027df807b4648e1f325b43d35.zip |
add fade for medley mod.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2945 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src')
-rw-r--r-- | src/base/UMusic.pas | 2 | ||||
-rw-r--r-- | src/media/UAudioPlaybackBase.pas | 7 | ||||
-rw-r--r-- | src/media/UAudioPlayback_Bass.pas | 7 | ||||
-rw-r--r-- | src/media/UAudioPlayback_SoftMixer.pas | 9 | ||||
-rw-r--r-- | src/media/UMedia_dummy.pas | 5 | ||||
-rw-r--r-- | src/screens/UScreenSing.pas | 1 |
6 files changed, 31 insertions, 0 deletions
diff --git a/src/base/UMusic.pas b/src/base/UMusic.pas index ca577db4..b7179d8c 100644 --- a/src/base/UMusic.pas +++ b/src/base/UMusic.pas @@ -294,6 +294,7 @@ type procedure Pause(); virtual; abstract; procedure Stop(); virtual; abstract; procedure FadeIn(Time: real; TargetVolume: single); virtual; abstract; + procedure Fade(Time: real; TargetVolume: single); virtual; abstract; procedure GetFFTData(var data: TFFTData); virtual; abstract; function GetPCMData(var data: TPCMData): Cardinal; virtual; abstract; @@ -428,6 +429,7 @@ type procedure SetLoop(Enabled: boolean); procedure FadeIn(Time: real; TargetVolume: single); + procedure Fade(Time: real; TargetVolume: single); procedure SetSyncSource(SyncSource: TSyncSource); procedure Rewind; diff --git a/src/media/UAudioPlaybackBase.pas b/src/media/UAudioPlaybackBase.pas index ffee671d..45130a7c 100644 --- a/src/media/UAudioPlaybackBase.pas +++ b/src/media/UAudioPlaybackBase.pas @@ -63,6 +63,7 @@ type procedure Pause; procedure Stop; procedure FadeIn(Time: real; TargetVolume: single); + procedure Fade(Time: real; TargetVolume: single); procedure SetSyncSource(SyncSource: TSyncSource); @@ -304,6 +305,12 @@ begin MusicStream.FadeIn(Time, TargetVolume); end; +procedure TAudioPlaybackBase.Fade(Time: real; TargetVolume: single); +begin + if assigned(MusicStream) then + MusicStream.Fade(Time, TargetVolume); +end; + procedure TAudioPlaybackBase.SetLoop(Enabled: boolean); begin if assigned(MusicStream) then diff --git a/src/media/UAudioPlayback_Bass.pas b/src/media/UAudioPlayback_Bass.pas index a3c3bd30..36d84b22 100644 --- a/src/media/UAudioPlayback_Bass.pas +++ b/src/media/UAudioPlayback_Bass.pas @@ -81,6 +81,7 @@ type procedure Pause(); override; procedure Stop(); override; procedure FadeIn(Time: real; TargetVolume: single); override; + procedure Fade(Time: real; TargetVolume: single); override; procedure AddSoundEffect(Effect: TSoundEffect); override; procedure RemoveSoundEffect(Effect: TSoundEffect); override; @@ -339,6 +340,12 @@ begin BASS_ChannelSlideAttribute(Handle, BASS_ATTRIB_VOL, TargetVolume, Trunc(Time * 1000)); end; +procedure TBassPlaybackStream.Fade(Time: real; TargetVolume: single); +begin + // start fade-in: slide from fadeStart- to fadeEnd-volume in FadeInTime + BASS_ChannelSlideAttribute(Handle, BASS_ATTRIB_VOL, TargetVolume, Trunc(Time * 1000)); +end; + procedure TBassPlaybackStream.Pause(); begin BASS_ChannelPause(Handle); diff --git a/src/media/UAudioPlayback_SoftMixer.pas b/src/media/UAudioPlayback_SoftMixer.pas index 11df4df5..a8639ee3 100644 --- a/src/media/UAudioPlayback_SoftMixer.pas +++ b/src/media/UAudioPlayback_SoftMixer.pas @@ -101,6 +101,7 @@ type procedure Pause(); override; procedure Stop(); override; procedure FadeIn(Time: real; TargetVolume: single); override; + procedure Fade(Time: real; TargetVolume: single); override; function GetAudioFormatInfo(): TAudioFormatInfo; override; @@ -479,6 +480,14 @@ begin Play(); end; +procedure TGenericPlaybackStream.Fade(Time: real; TargetVolume: single); +begin + FadeInTime := Trunc(Time * 1000); + FadeInStartTime := SDL_GetTicks(); + FadeInStartVolume := fVolume; + FadeInTargetVolume := TargetVolume; +end; + procedure TGenericPlaybackStream.Pause(); var Mixer: TAudioMixerStream; diff --git a/src/media/UMedia_dummy.pas b/src/media/UMedia_dummy.pas index 34f85226..e430b609 100644 --- a/src/media/UMedia_dummy.pas +++ b/src/media/UMedia_dummy.pas @@ -80,6 +80,7 @@ type function GetOutputDeviceList(): TAudioOutputDeviceList; procedure FadeIn(Time: real; TargetVolume: single); + procedure Fade(Time: real; TargetVolume: single); procedure SetAppVolume(Volume: single); procedure SetVolume(Volume: single); procedure Rewind; @@ -288,6 +289,10 @@ procedure TAudio_Dummy.FadeIn(Time: real; TargetVolume: single); begin end; +procedure TAudio_Dummy.Fade(Time: real; TargetVolume: single); +begin +end; + procedure TAudio_Dummy.Rewind; begin end; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index f9770cb3..13350511 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -1437,6 +1437,7 @@ begin (PlaylistMedley.CurrentMedleySong <= PlaylistMedley.NumMedleySongs) then begin PlaylistMedley.ApplausePlayed := true; + AudioPlayback.Fade(CurrentSong.Medley.FadeOut_time, 0.1); AudioPlayback.PlaySound(SoundLib.Applause); end; end; |