mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into lasagna-not-spaghetti
This commit is contained in:
commit
1cf88e7666
3 changed files with 14 additions and 5 deletions
|
@ -450,7 +450,9 @@ void Audio::start() {
|
|||
qDebug() << "Unable to set up audio output because of a problem with output format.";
|
||||
}
|
||||
|
||||
_inputFrameBuffer.initialize( _inputFormat.channelCount(), _audioInput->bufferSize() * 8 );
|
||||
if (_audioInput) {
|
||||
_inputFrameBuffer.initialize( _inputFormat.channelCount(), _audioInput->bufferSize() * 8 );
|
||||
}
|
||||
_inputGain.initialize();
|
||||
_sourceGain.initialize();
|
||||
_noiseSource.initialize();
|
||||
|
@ -1954,6 +1956,9 @@ int Audio::calculateNumberOfFrameSamples(int numBytes) const {
|
|||
}
|
||||
|
||||
float Audio::getAudioOutputMsecsUnplayed() const {
|
||||
if (!_audioOutput) {
|
||||
return 0.0f;
|
||||
}
|
||||
int bytesAudioOutputUnplayed = _audioOutput->bufferSize() - _audioOutput->bytesFree();
|
||||
float msecsAudioOutputUnplayed = bytesAudioOutputUnplayed / (float)_outputFormat.bytesForDuration(USECS_PER_MSEC);
|
||||
return msecsAudioOutputUnplayed;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
float getNextOutputFrameLoudness() const;
|
||||
|
||||
int samplesAvailable() const;
|
||||
int framesAvailable() const { return samplesAvailable() / _numFrameSamples; }
|
||||
int framesAvailable() const { return (_numFrameSamples == 0) ? 0 : samplesAvailable() / _numFrameSamples; }
|
||||
|
||||
int getNumFrameSamples() const { return _numFrameSamples; }
|
||||
|
||||
|
|
|
@ -28,9 +28,13 @@ ResourceCache::ResourceCache(QObject* parent) :
|
|||
}
|
||||
|
||||
ResourceCache::~ResourceCache() {
|
||||
// make sure our unused resources know we're out of commission
|
||||
foreach (const QSharedPointer<Resource>& resource, _unusedResources) {
|
||||
resource->setCache(NULL);
|
||||
// the unused resources may themselves reference resources that will be added to the unused
|
||||
// list on destruction, so keep clearing until there are no references left
|
||||
while (!_unusedResources.isEmpty()) {
|
||||
foreach (const QSharedPointer<Resource>& resource, _unusedResources) {
|
||||
resource->setCache(NULL);
|
||||
}
|
||||
_unusedResources.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue