1
0

VolCtrl.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef NULLSOFT_OUT_DS_VOLCTRL_H
  2. #define NULLSOFT_OUT_DS_VOLCTRL_H
  3. #include <windows.h>
  4. #include <mmsystem.h>
  5. #include <dsound.h>
  6. class DsVolCtrl
  7. {
  8. public:
  9. DsVolCtrl(int VolMode, double LogVolMin, bool logfades);
  10. void SetFade(__int64 duration, double destvol, double destpan);
  11. inline void SetFadeVol(__int64 duration, double destvol) {SetFade(duration, destvol, DestPanHack);}
  12. inline void SetFadePan(__int64 duration, double destpan) {SetFade(duration, DestVolHack, destpan);}
  13. __int64 RelFade(__int64 max, double destvol);
  14. void SetTime(__int64 time);
  15. void SetVolume(double vol);
  16. void SetPan(double pan);
  17. void Apply(IDirectSoundBuffer * pDSB);
  18. // inline double GetCurVol() {return CurVol;}
  19. inline double GetDestVol() { return DestVolHack;}
  20. inline void Reset() {CurTime = 0;FadeDstTime = -1;}
  21. double Stat_GetVolLeft();
  22. double Stat_GetVolRight();
  23. bool Fading();
  24. private:
  25. bool IsFading;
  26. int VolMode;
  27. double LogVolMin;
  28. double FadeSrcVol, FadeDstVol, FadeSrcPan, FadeDstPan;
  29. __int64 FadeSrcTime, FadeDstTime;
  30. __int64 CurTime;
  31. double CurVol, CurPan, LastVol, LastPan;
  32. double DestVolHack, DestPanHack;
  33. bool LogFades;
  34. void MapVol(double Vol, double Pan, double &NewVol, double &NewPan);
  35. };
  36. #endif