mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
0a7caf1d10
There are potentially still some minor issues with the resulting files. Some of them appear to have minor artifacts that playing through the actual game do not -- but this is a much better starting point for someone to iterate from if they are interested in improving things.
40 lines
914 B
C++
40 lines
914 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "common/common_types.h"
|
|
#include "common/util/BinaryReader.h"
|
|
#include "common/util/FileUtil.h"
|
|
|
|
// The header data for a simple wave file
|
|
struct WaveFileHeader {
|
|
// wave file header
|
|
char chunk_id[4];
|
|
s32 chunk_size;
|
|
char format[4];
|
|
|
|
// format chunk
|
|
char subchunk1_id[4];
|
|
s32 subchunk1_size;
|
|
s16 aud_format;
|
|
s16 num_channels;
|
|
s32 sample_rate;
|
|
s32 byte_rate;
|
|
s16 block_align;
|
|
s16 bits_per_sample;
|
|
|
|
// data chunk
|
|
char subchunk2_id[4];
|
|
s32 subchunk2_size;
|
|
};
|
|
|
|
void write_wave_file(const std::vector<s16>& left_samples,
|
|
const std::vector<s16>& right_samples,
|
|
s32 sample_rate,
|
|
const fs::path& name);
|
|
|
|
std::pair<std::vector<s16>, std::vector<s16>> decode_adpcm(BinaryReader& reader, const bool mono);
|
|
|
|
std::vector<u8> encode_adpcm(const std::vector<s16>& samples);
|