aboutsummaryrefslogtreecommitdiffstats
path: root/medley_new/src/media
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-10-17 11:35:26 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-10-17 11:35:26 +0000
commit6857c4c06206f80aee1855951b916a6526c87fc7 (patch)
tree24dc6438ab5c1c470a16ff85c4fa60aa70275865 /medley_new/src/media
parentb75e7399a7a3b7672d85f52013f916d06dd63651 (diff)
downloadusdx-6857c4c06206f80aee1855951b916a6526c87fc7.tar.gz
usdx-6857c4c06206f80aee1855951b916a6526c87fc7.tar.xz
usdx-6857c4c06206f80aee1855951b916a6526c87fc7.zip
added general fading (for fade-out)
it must be tested on MacOS and Linux. a more general fading function would be better (with "fade to pause" and "fade to end"). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2672 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'medley_new/src/media')
-rw-r--r--medley_new/src/media/UAudioPlaybackBase.pas7
-rw-r--r--medley_new/src/media/UAudioPlayback_Bass.pas7
-rw-r--r--medley_new/src/media/UAudioPlayback_SoftMixer.pas11
-rw-r--r--medley_new/src/media/UMedia_dummy.pas5
4 files changed, 30 insertions, 0 deletions
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;