Skip to content

Commit

Permalink
Fix mixing multiple audio + rendering 32bit float
Browse files Browse the repository at this point in the history
  • Loading branch information
manongjohn committed Mar 30, 2023
1 parent 15a22a4 commit 00f96a5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion toonz/sources/common/tsound/tsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ TSoundTrack::TSoundTrack(TUINT32 sampleRate, int bitPerSample, int channelCount,
, m_sampleCount(sampleCount)
, m_channelCount(channelCount)
, m_parent(0)
, m_bufferOwner(true) {
, m_bufferOwner(true)
, m_sampleType(sampleType) {
m_buffer = (UCHAR *)malloc(sampleCount * m_sampleSize);
if (!m_buffer) return;

Expand Down
3 changes: 2 additions & 1 deletion toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ void Ffmpeg::saveSoundTrack(TSoundTrack *st) {

m_audioPath = getFfmpegCache().getQString() + "//" +
QString::fromStdString(m_path.getName()) + "tempOut.raw";
m_audioFormat = "s" + QString::number(m_bitsPerSample);
m_audioFormat = ((st->getSampleType() == TSound::FLOAT) ? "f" : "s") +
QString::number(m_bitsPerSample);
if (m_bitsPerSample > 8) m_audioFormat = m_audioFormat + "le";
std::string strPath = m_audioPath.toStdString();

Expand Down
4 changes: 0 additions & 4 deletions toonz/sources/toonzlib/txshsoundcolumn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,12 +1082,8 @@ TSoundTrackP TXshSoundColumn::getOverallSoundTrack(int fromFrame, int toFrame,

if (s1 > 0 && s1 >= s0) {
soundTrack = soundTrack->extract(s0, s1);
if (format.m_sampleType != TSound::FLOAT)
overallSoundTrack->copy(
soundTrack, int((levelStartFrame - fromFrame) * samplePerFrame));
else
overallSoundTrack->copy(
soundTrack, double((levelStartFrame - fromFrame) * samplePerFrame));
}
}
return overallSoundTrack;
Expand Down

0 comments on commit 00f96a5

Please sign in to comment.