@@ -212,9 +212,10 @@ class AudioFile
212
212
213
213
// =============================================================
214
214
int8_t sampleToSingleByte (T sample);
215
+ public:
215
216
T singleByteToSample (uint8_t sample);
216
217
T singleByteToSample (int8_t sample);
217
-
218
+ private:
218
219
uint32_t getAiffSampleRate (std::vector<uint8_t >& fileData, int sampleRateStartIndex);
219
220
bool tenByteMatch (std::vector<uint8_t >& v1, int startIndex1, std::vector<uint8_t >& v2, int startIndex2);
220
221
void addSampleRateToAiffData (std::vector<uint8_t >& fileData, uint32_t sampleRate);
@@ -945,7 +946,7 @@ bool AudioFile<T>::saveToWaveFile (std::string filePath)
945
946
{
946
947
if (bitDepth == 8 )
947
948
{
948
- int8_t byte = sampleToSingleByte (samples[channel][i]);
949
+ uint8_t byte = sampleToSingleByte (samples[channel][i]);
949
950
fileData.push_back (byte);
950
951
}
951
952
else if (bitDepth == 16 )
@@ -1055,7 +1056,7 @@ bool AudioFile<T>::saveToAiffFile (std::string filePath)
1055
1056
{
1056
1057
if (bitDepth == 8 )
1057
1058
{
1058
- int8_t byte = sampleToSingleByte (samples[channel][i]);
1059
+ uint8_t byte = sampleToSingleByte (samples[channel][i]);
1059
1060
fileData.push_back (byte);
1060
1061
}
1061
1062
else if (bitDepth == 16 )
@@ -1384,7 +1385,7 @@ T AudioFile<T>::singleByteToSample (uint8_t sample)
1384
1385
{
1385
1386
if (std::is_floating_point<T>::value)
1386
1387
{
1387
- return static_cast <T> (sample - 128 ) / static_cast <T> (128 .);
1388
+ return static_cast <T> (static_cast < int >( sample) - 128 ) / static_cast <T> (128 .);
1388
1389
}
1389
1390
1390
1391
else if (std::numeric_limits<T>::is_integer)
0 commit comments