mirror of https://github.com/mgba-emu/mgba.git
fix hang in AudioDevice
This commit is contained in:
parent
d1a6e6b747
commit
4bd09bdac2
|
@ -64,11 +64,15 @@ qint64 AudioDevice::writeData(const char*, qint64) {
|
|||
}
|
||||
|
||||
bool AudioDevice::atEnd() const {
|
||||
return !bytesAvailable();
|
||||
}
|
||||
|
||||
qint64 AudioDevice::bytesAvailable() const {
|
||||
if (!m_context->core) {
|
||||
return true;
|
||||
}
|
||||
mCoreSyncLockAudio(&m_context->impl->sync);
|
||||
bool available = blip_samples_avail(m_context->core->getAudioChannel(m_context->core, 0)) == 0;
|
||||
int available = blip_samples_avail(m_context->core->getAudioChannel(m_context->core, 0));
|
||||
mCoreSyncUnlockAudio(&m_context->impl->sync);
|
||||
return available;
|
||||
return available * sizeof(mStereoSample);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
void setInput(mCoreThread* input);
|
||||
void setFormat(const QAudioFormat& format);
|
||||
bool atEnd() const override;
|
||||
qint64 bytesAvailable() const override;
|
||||
|
||||
protected:
|
||||
virtual qint64 readData(char* data, qint64 maxSize) override;
|
||||
|
|
Loading…
Reference in New Issue