Merge pull request #1150 from manongjohn/fix_sound_rendering_badly
Fix mixing multiple audio + rendering 32bit float sound
This commit is contained in:
commit
9cfb5933e0
3 changed files with 4 additions and 6 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue