mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 06:41:51 +00:00
WAGE: Implement sound decoder
This commit is contained in:
parent
57449d32d4
commit
7bbe1a94c1
@ -45,10 +45,35 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/stream.h"
|
||||
|
||||
#include "wage/wage.h"
|
||||
#include "wage/sound.h"
|
||||
|
||||
namespace Wage {
|
||||
|
||||
static const int8 deltas[] = { 0,-49,-36,-25,-16,-9,-4,-1,0,1,4,9,16,25,36,49 };
|
||||
|
||||
Sound::Sound(Common::String name, Common::SeekableReadStream *data) : _name(name) {
|
||||
int size = data->size() - 20;
|
||||
_data = (byte *)calloc(2 * size, 1);
|
||||
|
||||
data->skip(20); // Skip header
|
||||
|
||||
byte value = 0x80;
|
||||
for (int i = 0; i < size; i++) {
|
||||
byte d = data->readByte();
|
||||
value += deltas[d & 0xf];
|
||||
_data[i * 2] = value;
|
||||
value += deltas[(d >> 4) & 0xf];
|
||||
_data[i * 2 + 1] = value;
|
||||
}
|
||||
}
|
||||
|
||||
Sound::~Sound() {
|
||||
free(_data);
|
||||
}
|
||||
|
||||
void WageEngine::playSound(Common::String soundName) {
|
||||
warning("STUB: WageEngine::playSound(%s)", soundName.c_str());
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ namespace Wage {
|
||||
|
||||
class Sound {
|
||||
public:
|
||||
Sound(Common::String name, Common::SeekableReadStream *data) : _name(name), _data(data) {}
|
||||
~Sound() { }
|
||||
Sound(Common::String name, Common::SeekableReadStream *data);
|
||||
~Sound();
|
||||
|
||||
Common::String _name;
|
||||
Common::SeekableReadStream *_data;
|
||||
byte *_data;
|
||||
};
|
||||
|
||||
} // End of namespace Wage
|
||||
|
Loading…
x
Reference in New Issue
Block a user