diff options
Diffstat (limited to '')
-rw-r--r-- | medley_new/src/base/UMusic.pas | 2 | ||||
-rw-r--r-- | medley_new/src/media/UAudioPlaybackBase.pas | 7 | ||||
-rw-r--r-- | medley_new/src/media/UAudioPlayback_Bass.pas | 7 | ||||
-rw-r--r-- | medley_new/src/media/UAudioPlayback_SoftMixer.pas | 11 | ||||
-rw-r--r-- | medley_new/src/media/UMedia_dummy.pas | 5 | ||||
-rw-r--r-- | medley_new/src/screens/UScreenSing.pas | 3 |
6 files changed, 33 insertions, 2 deletions
diff --git a/medley_new/src/base/UMusic.pas b/medley_new/src/base/UMusic.pas index 0fa625ee..e21c9bd8 100644 --- a/medley_new/src/base/UMusic.pas +++ b/medley_new/src/base/UMusic.pas @@ -292,6 +292,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; @@ -426,6 +427,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/medley_new/src/media/UAudioPlaybackBase.pas b/medley_new/src/media/UAudioPlaybackBase.pas index 5f317257..58f0b85d 100644 --- a/medley_new/src/media/UAudioPlaybackBase.pas +++ b/medley_new/src/media/UAudioPlaybackBase.pas @@ -60,6 +60,7 @@ type procedure Pause; procedure Stop; procedure FadeIn(Time: real; TargetVolume: single); + procedure Fade(Time: real; TargetVolume: single); procedure SetSyncSource(SyncSource: TSyncSource); @@ -260,6 +261,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/medley_new/src/media/UAudioPlayback_Bass.pas b/medley_new/src/media/UAudioPlayback_Bass.pas index 1d7a44dc..8e1e5a9f 100644 --- a/medley_new/src/media/UAudioPlayback_Bass.pas +++ b/medley_new/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 FadeTime + BASS_ChannelSlideAttribute(Handle, BASS_ATTRIB_VOL, TargetVolume, Trunc(Time * 1000)); +end; + procedure TBassPlaybackStream.Pause(); begin BASS_ChannelPause(Handle); diff --git a/medley_new/src/media/UAudioPlayback_SoftMixer.pas b/medley_new/src/media/UAudioPlayback_SoftMixer.pas index 11df4df5..ac65fd68 100644 --- a/medley_new/src/media/UAudioPlayback_SoftMixer.pas +++ b/medley_new/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,16 @@ begin Play(); end; +procedure TGenericPlaybackStream.Fade(Time: real; TargetVolume: single); +begin + (* TODO: test + FadeInTime := Trunc(Time * 1000); + FadeInStartTime := SDL_GetTicks(); + FadeInStartVolume := fVolume; + FadeInTargetVolume := TargetVolume; + *) +end; + procedure TGenericPlaybackStream.Pause(); var Mixer: TAudioMixerStream; diff --git a/medley_new/src/media/UMedia_dummy.pas b/medley_new/src/media/UMedia_dummy.pas index 46cbe6b8..6bae58ec 100644 --- a/medley_new/src/media/UMedia_dummy.pas +++ b/medley_new/src/media/UMedia_dummy.pas @@ -79,6 +79,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; @@ -286,6 +287,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/medley_new/src/screens/UScreenSing.pas b/medley_new/src/screens/UScreenSing.pas index 4998ed02..6cadaf16 100644 --- a/medley_new/src/screens/UScreenSing.pas +++ b/medley_new/src/screens/UScreenSing.pas @@ -1424,9 +1424,8 @@ begin (PlaylistMedley.CurrentMedleySong<=PlaylistMedley.NumMedleySongs) then begin PlaylistMedley.ApplausePlayed:=true; - // TODO: add fade-out! + AudioPlayback.Fade(CurrentSong.Medley.FadeOut_time, 0.1); AudioPlayback.PlaySound(SoundLib.Applause); - //Music.Fade(MP3Volume, 10, CurrentSong.Medley.FadeOut_time); end; end; |