Internally store all WAVs as 32bit fixed

This commit is contained in:
manongjohn 2021-05-20 07:36:19 -04:00
parent e8bb797adc
commit 1450ca18e8
2 changed files with 12 additions and 1 deletions

View file

@ -4,6 +4,7 @@
#include "tsio_wav.h" #include "tsio_wav.h"
#include "tsystem.h" #include "tsystem.h"
#include "tfilepath_io.h" #include "tfilepath_io.h"
#include "tsop.h"
using namespace std; using namespace std;
@ -303,6 +304,15 @@ TSoundTrackP TSoundTrackReaderWav::load() {
} }
break; break;
} }
// Convert all WAV to 32bit PCM
if (fmtChunk->m_bitPerSample != 32 || fmtChunk->m_encodingType != WAVE_FORMAT_PCM) {
TSoundTrackP origTrack = track;
TSoundTrackFormat fmt = track->getFormat();
fmt.m_bitPerSample = 32;
fmt.m_formatType = WAVE_FORMAT_PCM;
track = TSop::convert(origTrack, fmt);
}
} }
/*if (!TNZ_LITTLE_ENDIAN) /*if (!TNZ_LITTLE_ENDIAN)

View file

@ -1116,7 +1116,8 @@ TSoundTrackP TXshSoundColumn::mixingTogether(
// Per ora perche mov vuole solo 16 bit // Per ora perche mov vuole solo 16 bit
TSoundTrackFormat fmt = mix->getFormat(); TSoundTrackFormat fmt = mix->getFormat();
if (fmt.m_bitPerSample != 16) fmt.m_bitPerSample = 16; if (fmt.m_bitPerSample != 32) fmt.m_bitPerSample = 32;
if (fmt.m_formatType != WAVE_FORMAT_PCM) fmt.m_formatType = WAVE_FORMAT_PCM;
mix = TSop::convert(mix, fmt); mix = TSop::convert(mix, fmt);
return mix; return mix;
} }