mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-29 23:01:58 +00:00
TITANIC: Implemented CMusicWave fn2
This commit is contained in:
parent
c31efeb8c7
commit
b0b534e4a0
@ -31,16 +31,21 @@ bool CMusicWave::_pianoToggle;
|
|||||||
int CMusicWave::_pianoCtr;
|
int CMusicWave::_pianoCtr;
|
||||||
int CMusicWave::_bassCtr;
|
int CMusicWave::_bassCtr;
|
||||||
byte *CMusicWave::_buffer;
|
byte *CMusicWave::_buffer;
|
||||||
|
double *CMusicWave::_array;
|
||||||
|
int CMusicWave::_arrayIndex;
|
||||||
|
|
||||||
void CMusicWave::init() {
|
void CMusicWave::init() {
|
||||||
_pianoToggle = false;
|
_pianoToggle = false;
|
||||||
_pianoCtr = 0;
|
_pianoCtr = 0;
|
||||||
_bassCtr = 0;
|
_bassCtr = 0;
|
||||||
_buffer = nullptr;
|
_buffer = nullptr;
|
||||||
|
_array = nullptr;
|
||||||
|
_arrayIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMusicWave::deinit() {
|
void CMusicWave::deinit() {
|
||||||
delete[] _buffer;
|
delete[] _buffer;
|
||||||
|
delete[] _array;
|
||||||
_buffer = nullptr;
|
_buffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,8 +273,31 @@ int CMusicWave::setData(const byte *data, int count) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMusicWave::fn1(int val1, int val2) {
|
void CMusicWave::fn1(int minVal, int maxVal) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMusicWave::fn2(int minVal, int maxVal) {
|
||||||
|
delete[] _array;
|
||||||
|
|
||||||
|
// TODO: Figure out if the weird shift can be represented as a simpler equation
|
||||||
|
uint32 arrSize = ((uint32)minVal << 29) - (uint32)minVal + maxVal;
|
||||||
|
_array = new double[arrSize / 8];
|
||||||
|
_arrayIndex = maxVal;
|
||||||
|
|
||||||
|
_array[_arrayIndex] = 1.0;
|
||||||
|
|
||||||
|
double val = 1.0594634;
|
||||||
|
for (int idx = 1; idx <= maxVal; ++idx) {
|
||||||
|
val *= 1.0594634;
|
||||||
|
_array[_arrayIndex + idx] = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
val = 0.94387404038686;
|
||||||
|
for (int idx = -1; idx >= minVal; --idx) {
|
||||||
|
val *= 0.94387404038686;
|
||||||
|
_array[_arrayIndex + idx] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Titanic
|
} // End of namespace Titanic
|
||||||
|
@ -46,6 +46,8 @@ private:
|
|||||||
static int _pianoCtr;
|
static int _pianoCtr;
|
||||||
static int _bassCtr;
|
static int _bassCtr;
|
||||||
static byte *_buffer;
|
static byte *_buffer;
|
||||||
|
static double *_array;
|
||||||
|
static int _arrayIndex;
|
||||||
private:
|
private:
|
||||||
CSoundManager *_soundManager;
|
CSoundManager *_soundManager;
|
||||||
Common::Array<CMusicWaveFile> _items;
|
Common::Array<CMusicWaveFile> _items;
|
||||||
@ -63,6 +65,8 @@ private:
|
|||||||
* Loads the specified wave file, and returns a CWaveFile instance for it
|
* Loads the specified wave file, and returns a CWaveFile instance for it
|
||||||
*/
|
*/
|
||||||
CWaveFile *createWaveFile(const CString &name);
|
CWaveFile *createWaveFile(const CString &name);
|
||||||
|
|
||||||
|
void fn2(int val1, int val2);
|
||||||
public:
|
public:
|
||||||
double _floatVal;
|
double _floatVal;
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user