mirror of
https://github.com/isledecomp/SIEdit.git
synced 2025-04-01 23:49:44 -04:00
ensure MediaInstance is audio before using it
This commit is contained in:
parent
41c9e54cd7
commit
e09b50e071
1 changed files with 11 additions and 9 deletions
|
@ -812,16 +812,18 @@ qint64 MediaAudioMixer::readData(char *data, qint64 maxSize)
|
|||
for (auto it = m_mediaInstances->cbegin(); it != m_mediaInstances->cend(); it++) {
|
||||
auto m = *it;
|
||||
|
||||
qint64 thisRead = m->ReadAudio(reinterpret_cast<char *>(tmp), maxSize);
|
||||
if (thisRead > touchedBytes) {
|
||||
memset(data + touchedBytes, 0, thisRead - touchedBytes);
|
||||
touchedBytes = thisRead;
|
||||
}
|
||||
if (m->codec_type() == AVMEDIA_TYPE_AUDIO) {
|
||||
qint64 thisRead = m->ReadAudio(reinterpret_cast<char *>(tmp), maxSize);
|
||||
if (thisRead > touchedBytes) {
|
||||
memset(data + touchedBytes, 0, thisRead - touchedBytes);
|
||||
touchedBytes = thisRead;
|
||||
}
|
||||
|
||||
// TODO: Optimize with SSE and NEON
|
||||
qint64 thisSamples = thisRead / m_audioFormat.bytesPerSample();
|
||||
for (qint64 j = 0; j < thisSamples; j++) {
|
||||
output[j] += tmp[j] * m->GetVolume();
|
||||
// TODO: Optimize with SSE and NEON
|
||||
qint64 thisSamples = thisRead / m_audioFormat.bytesPerSample();
|
||||
for (qint64 j = 0; j < thisSamples; j++) {
|
||||
output[j] += tmp[j] * m->GetVolume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue