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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
/*
* DSP.h
* -----
* Purpose: Mixing code for various DSPs (EQ, Mega-Bass, ...)
* Notes : Ugh... This should really be removed at some point.
* Authors: Olivier Lapicque
* OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
OPENMPT_NAMESPACE_BEGIN
#ifndef NO_DSP
// Buffer Sizes
#define SURROUNDBUFFERSIZE 2048 // 50ms @ 48kHz
class CSurroundSettings
{
public:
uint32 m_nProLogicDepth;
uint32 m_nProLogicDelay;
public:
CSurroundSettings();
};
class CMegaBassSettings
{
public:
uint32 m_nXBassDepth;
uint32 m_nXBassRange;
public:
CMegaBassSettings();
};
struct BitCrushSettings
{
int m_Bits;
BitCrushSettings();
};
class CSurround
{
public:
CSurroundSettings m_Settings;
// Surround Encoding: 1 delay line + low-pass filter + high-pass filter
int32 nSurroundSize;
int32 nSurroundPos;
int32 nDolbyDepth;
// Surround Biquads
int32 nDolbyHP_Y1;
int32 nDolbyHP_X1;
int32 nDolbyLP_Y1;
int32 nDolbyHP_B0;
int32 nDolbyHP_B1;
int32 nDolbyHP_A1;
int32 nDolbyLP_B0;
int32 nDolbyLP_B1;
int32 nDolbyLP_A1;
int32 SurroundBuffer[SURROUNDBUFFERSIZE];
public:
CSurround();
public:
void SetSettings(const CSurroundSettings &settings) { m_Settings = settings; }
// [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100]
bool SetXBassParameters(uint32 nDepth, uint32 nRange);
// [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms]
void SetSurroundParameters(uint32 nDepth, uint32 nDelay);
void Initialize(bool bReset, DWORD MixingFreq);
void Process(int * MixSoundBuffer, int * MixRearBuffer, int count, uint32 nChannels);
private:
void ProcessStereoSurround(int * MixSoundBuffer, int count);
void ProcessQuadSurround(int * MixSoundBuffer, int * MixRearBuffer, int count);
};
class CMegaBass
{
public:
CMegaBassSettings m_Settings;
// Bass Expansion: low-pass filter
int32 nXBassFlt_Y1;
int32 nXBassFlt_X1;
int32 nXBassFlt_B0;
int32 nXBassFlt_B1;
int32 nXBassFlt_A1;
// DC Removal Biquad
int32 nDCRFlt_Y1lf;
int32 nDCRFlt_X1lf;
int32 nDCRFlt_Y1rf;
int32 nDCRFlt_X1rf;
int32 nDCRFlt_Y1lb;
int32 nDCRFlt_X1lb;
int32 nDCRFlt_Y1rb;
int32 nDCRFlt_X1rb;
public:
CMegaBass();
public:
void SetSettings(const CMegaBassSettings &settings) { m_Settings = settings; }
// [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100]
void SetXBassParameters(uint32 nDepth, uint32 nRange);
void Initialize(bool bReset, DWORD MixingFreq);
void Process(int * MixSoundBuffer, int * MixRearBuffer, int count, uint32 nChannels);
};
class BitCrush
{
public:
BitCrushSettings m_Settings;
public:
BitCrush();
public:
void SetSettings(const BitCrushSettings &settings) { m_Settings = settings; }
void Initialize(bool bReset, DWORD MixingFreq);
void Process(int * MixSoundBuffer, int * MixRearBuffer, int count, uint32 nChannels);
};
#endif // NO_DSP
OPENMPT_NAMESPACE_END
|