aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Output/out_ds/VolCtrl.h
diff options
context:
space:
mode:
authorJean-Francois Mauguit <jfmauguit@mac.com>2024-09-24 09:03:25 -0400
committerGitHub <noreply@github.com>2024-09-24 09:03:25 -0400
commitbab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Output/out_ds/VolCtrl.h
parent4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff)
parent20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff)
downloadwinamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Plugins/Output/out_ds/VolCtrl.h')
-rw-r--r--Src/Plugins/Output/out_ds/VolCtrl.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/Src/Plugins/Output/out_ds/VolCtrl.h b/Src/Plugins/Output/out_ds/VolCtrl.h
new file mode 100644
index 00000000..f7b1a02b
--- /dev/null
+++ b/Src/Plugins/Output/out_ds/VolCtrl.h
@@ -0,0 +1,44 @@
+#ifndef NULLSOFT_OUT_DS_VOLCTRL_H
+#define NULLSOFT_OUT_DS_VOLCTRL_H
+
+#include <windows.h>
+#include <mmsystem.h>
+#include <dsound.h>
+
+class DsVolCtrl
+{
+public:
+ DsVolCtrl(int VolMode, double LogVolMin, bool logfades);
+ void SetFade(__int64 duration, double destvol, double destpan);
+ inline void SetFadeVol(__int64 duration, double destvol) {SetFade(duration, destvol, DestPanHack);}
+ inline void SetFadePan(__int64 duration, double destpan) {SetFade(duration, DestVolHack, destpan);}
+ __int64 RelFade(__int64 max, double destvol);
+ void SetTime(__int64 time);
+ void SetVolume(double vol);
+ void SetPan(double pan);
+ void Apply(IDirectSoundBuffer * pDSB);
+ // inline double GetCurVol() {return CurVol;}
+ inline double GetDestVol() { return DestVolHack;}
+ inline void Reset() {CurTime = 0;FadeDstTime = -1;}
+ double Stat_GetVolLeft();
+ double Stat_GetVolRight();
+
+ bool Fading();
+
+private:
+ bool IsFading;
+ int VolMode;
+ double LogVolMin;
+
+ double FadeSrcVol, FadeDstVol, FadeSrcPan, FadeDstPan;
+ __int64 FadeSrcTime, FadeDstTime;
+
+ __int64 CurTime;
+
+ double CurVol, CurPan, LastVol, LastPan;
+ double DestVolHack, DestPanHack;
+ bool LogFades;
+ void MapVol(double Vol, double Pan, double &NewVol, double &NewPan);
+};
+
+#endif