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/media | |
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/media')
-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 |
4 files changed, 28 insertions, 0 deletions
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; |