diff --git a/toonz/sources/toonzlib/txshsoundcolumn.cpp b/toonz/sources/toonzlib/txshsoundcolumn.cpp index a6a64a7..900145f 100644 --- a/toonz/sources/toonzlib/txshsoundcolumn.cpp +++ b/toonz/sources/toonzlib/txshsoundcolumn.cpp @@ -977,7 +977,7 @@ TSoundTrackP TXshSoundColumn::getOverallSoundTrack(int fromFrame, int toFrame, } #ifdef _WIN32 - if (format.m_sampleRate > 44100) format.m_sampleRate = 44100; + if (format.m_sampleRate > 48000) format.m_sampleRate = 48000; #else QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); if (info.deviceName().length() == 0) @@ -990,10 +990,15 @@ TSoundTrackP TXshSoundColumn::getOverallSoundTrack(int fromFrame, int toFrame, switch (format.m_sampleType) { case TSound::INT: qFormat.setSampleType(QAudioFormat::SignedInt); + break; case TSound::UINT: qFormat.setSampleType(QAudioFormat::UnSignedInt); + break; case TSound::FLOAT: qFormat.setSampleType(QAudioFormat::Float); + break; + default: + break; } qFormat.setSampleSize(format.m_bitPerSample); qFormat.setCodec("audio/pcm"); @@ -1007,10 +1012,15 @@ TSoundTrackP TXshSoundColumn::getOverallSoundTrack(int fromFrame, int toFrame, switch (qFormat.sampleType()) { case QAudioFormat::SignedInt: format.m_sampleType = TSound::INT; + break; case QAudioFormat::UnSignedInt: format.m_sampleType = TSound::UINT; + break; case QAudioFormat::Float: format.m_sampleType = TSound::FLOAT; + break; + default: + break; } } #endif @@ -1069,15 +1079,14 @@ TSoundTrackP TXshSoundColumn::getOverallSoundTrack(int fromFrame, int toFrame, if (s1 > 0 && s1 >= s0) { soundTrack = soundTrack->extract(s0, s1); - - // Copy the sound track - overallSoundTrack->copy( - soundTrack, - int((levelStartFrame - fromFrame) * - samplePerFrame)); // The int cast is IMPORTANT, since - } // there are 2 overloads (int & double) - } // with DIFFERENT SCALES. We mean the - // SAMPLES-BASED one. + if (format.m_sampleType != TSound::FLOAT) + overallSoundTrack->copy( + soundTrack, int((levelStartFrame - fromFrame) * samplePerFrame)); + else + overallSoundTrack->copy( + soundTrack, double((levelStartFrame - fromFrame) * samplePerFrame)); + } + } return overallSoundTrack; }