19/03/29 16:00:34.89 lpOPYMih.net
bool mode_8bit_to_16bit(PcmWave& wave1, PcmWave& wave2)
{
interpolation_test();
if (wave1.mode() != 8)
{
assert(0);
return false;
}
switch (wave1.num_channels())
{
case 1:
wave2.set_info(1, 16, wave1.sample_rate());
for (size_t i = 0; i < wave1.num_units() * wave1.num_channels(); i++)
{
int value = wave1.data_8bit(i);
assert(0 <= value && value <= 255);
value = linear_interpolation(value, 0, 255, -32768, 32767);
assert(-32768 <= value && value <= 32767);
wave2.push_16bit(uint16_t(value));
}
break;