Cog/Frameworks/OpenMPT/OpenMPT/soundlib/MixerSettings.cpp
Christopher Snowhill da1973bcd9 Build libOpenMPT from source once again
Bundle libOpenMPT as a dynamic framework, which should be safe once
again, now that there is only one version to bundle. Also, now it is
using the versions of libvorbisfile and libmpg123 that are bundled with
the player, instead of compiling minimp3 and stbvorbis.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-30 22:56:52 -07:00

59 lines
1.3 KiB
C++

/*
* MixerSettings.cpp
* -----------------
* Purpose: A struct containing settings for the mixer of soundlib.
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#include "stdafx.h"
#include "MixerSettings.h"
#include "Snd_defs.h"
#include "../common/misc_util.h"
OPENMPT_NAMESPACE_BEGIN
MixerSettings::MixerSettings()
{
// SNDMIX: These are global flags for playback control
m_nStereoSeparation = 128;
m_nMaxMixChannels = MAX_CHANNELS;
DSPMask = 0;
MixerFlags = 0;
// Mixing Configuration
gnChannels = 2;
gdwMixingFreq = 48000;
m_nPreAmp = 128;
VolumeRampUpMicroseconds = 363; // 16 @44100
VolumeRampDownMicroseconds = 952; // 42 @44100
NumInputChannels = 0;
}
int32 MixerSettings::GetVolumeRampUpSamples() const
{
return Util::muldivr(VolumeRampUpMicroseconds, gdwMixingFreq, 1000000);
}
int32 MixerSettings::GetVolumeRampDownSamples() const
{
return Util::muldivr(VolumeRampDownMicroseconds, gdwMixingFreq, 1000000);
}
void MixerSettings::SetVolumeRampUpSamples(int32 rampUpSamples)
{
VolumeRampUpMicroseconds = Util::muldivr(rampUpSamples, 1000000, gdwMixingFreq);
}
void MixerSettings::SetVolumeRampDownSamples(int32 rampDownSamples)
{
VolumeRampDownMicroseconds = Util::muldivr(rampDownSamples, 1000000, gdwMixingFreq);
}
OPENMPT_NAMESPACE_END