[Scummvm-git-logs] scummvm master -> b0b534e4a008c0ea38eff559a2f579eba5f8ab01

dreammaster dreammaster at scummvm.org
Sun Feb 5 02:55:19 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b0b534e4a0 TITANIC: Implemented CMusicWave fn2


Commit: b0b534e4a008c0ea38eff559a2f579eba5f8ab01
    https://github.com/scummvm/scummvm/commit/b0b534e4a008c0ea38eff559a2f579eba5f8ab01
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-02-04T20:55:11-05:00

Commit Message:
TITANIC: Implemented CMusicWave fn2

Changed paths:
    engines/titanic/sound/music_wave.cpp
    engines/titanic/sound/music_wave.h


diff --git a/engines/titanic/sound/music_wave.cpp b/engines/titanic/sound/music_wave.cpp
index e000356..1d6642a 100644
--- a/engines/titanic/sound/music_wave.cpp
+++ b/engines/titanic/sound/music_wave.cpp
@@ -31,16 +31,21 @@ bool CMusicWave::_pianoToggle;
 int CMusicWave::_pianoCtr;
 int CMusicWave::_bassCtr;
 byte *CMusicWave::_buffer;
+double *CMusicWave::_array;
+int CMusicWave::_arrayIndex;
 
 void CMusicWave::init() {
 	_pianoToggle = false;
 	_pianoCtr = 0;
 	_bassCtr = 0;
 	_buffer = nullptr;
+	_array = nullptr;
+	_arrayIndex = 0;
 }
 
 void CMusicWave::deinit() {
 	delete[] _buffer;
+	delete[] _array;
 	_buffer = nullptr;
 }
 
@@ -268,8 +273,31 @@ int CMusicWave::setData(const byte *data, int count) {
 	return 0;
 }
 
-void CMusicWave::fn1(int val1, int val2) {
+void CMusicWave::fn1(int minVal, int maxVal) {
 	// 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
diff --git a/engines/titanic/sound/music_wave.h b/engines/titanic/sound/music_wave.h
index 0e46965..6dea734 100644
--- a/engines/titanic/sound/music_wave.h
+++ b/engines/titanic/sound/music_wave.h
@@ -46,6 +46,8 @@ private:
 	static int _pianoCtr;
 	static int _bassCtr;
 	static byte *_buffer;
+	static double *_array;
+	static int _arrayIndex;
 private:
 	CSoundManager *_soundManager;
 	Common::Array<CMusicWaveFile> _items;
@@ -63,6 +65,8 @@ private:
 	 * Loads the specified wave file, and returns a CWaveFile instance for it
 	 */
 	CWaveFile *createWaveFile(const CString &name);
+
+	void fn2(int val1, int val2);
 public:
 	double _floatVal;
 public:





More information about the Scummvm-git-logs mailing list