File: MixerSettings.cpp

package info (click to toggle)
libopenmpt 0.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,844 kB
  • sloc: cpp: 129,441; sh: 4,695; ansic: 1,107; makefile: 712
file content (59 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * 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