1
0

MixerSettings.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * MixerSettings.cpp
  3. * -----------------
  4. * Purpose: A struct containing settings for the mixer of soundlib.
  5. * Notes : (currently none)
  6. * Authors: OpenMPT Devs
  7. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  8. */
  9. #include "stdafx.h"
  10. #include "MixerSettings.h"
  11. #include "Snd_defs.h"
  12. #include "../common/misc_util.h"
  13. OPENMPT_NAMESPACE_BEGIN
  14. MixerSettings::MixerSettings()
  15. {
  16. // SNDMIX: These are global flags for playback control
  17. m_nStereoSeparation = 128;
  18. m_nMaxMixChannels = MAX_CHANNELS;
  19. DSPMask = 0;
  20. MixerFlags = 0;
  21. // Mixing Configuration
  22. gnChannels = 2;
  23. gdwMixingFreq = 48000;
  24. m_nPreAmp = 128;
  25. VolumeRampUpMicroseconds = 363; // 16 @44100
  26. VolumeRampDownMicroseconds = 952; // 42 @44100
  27. NumInputChannels = 0;
  28. }
  29. int32 MixerSettings::GetVolumeRampUpSamples() const
  30. {
  31. return Util::muldivr(VolumeRampUpMicroseconds, gdwMixingFreq, 1000000);
  32. }
  33. int32 MixerSettings::GetVolumeRampDownSamples() const
  34. {
  35. return Util::muldivr(VolumeRampDownMicroseconds, gdwMixingFreq, 1000000);
  36. }
  37. void MixerSettings::SetVolumeRampUpSamples(int32 rampUpSamples)
  38. {
  39. VolumeRampUpMicroseconds = Util::muldivr(rampUpSamples, 1000000, gdwMixingFreq);
  40. }
  41. void MixerSettings::SetVolumeRampDownSamples(int32 rampDownSamples)
  42. {
  43. VolumeRampDownMicroseconds = Util::muldivr(rampDownSamples, 1000000, gdwMixingFreq);
  44. }
  45. OPENMPT_NAMESPACE_END