forgot null check for AudioMixer repeat mix of lastPopOutput

This commit is contained in:
wangyix 2014-08-13 09:46:43 -07:00
parent 7f53ae0e4f
commit 23b3d06260
2 changed files with 5 additions and 1 deletions

View file

@ -105,7 +105,9 @@ int AudioMixer::addStreamToMixForListeningNodeWithStream(PositionalAudioStream*
float repeatedFrameFadeFactor = 1.0f;
if (!streamToAdd->lastPopSucceeded()) {
if (_streamSettings._repetitionWithFade) {
if (_streamSettings._repetitionWithFade && !streamToAdd->getLastPopOutput().isNull()) {
// reptition with fade is enabled, and we do have a valid previous frame to repeat.
// calculate its fade factor, which depends on how many times it's already been repeated.
repeatedFrameFadeFactor = calculateRepeatedFrameFadeFactor(streamToAdd->getConsecutiveNotMixedCount() - 1);
if (repeatedFrameFadeFactor == 0.0f) {
return 0;

View file

@ -108,6 +108,8 @@ public:
_bufferLast(bufferFirst + capacity - 1),
_at(at) {}
bool isNull() const { return _at == NULL; }
bool operator==(const ConstIterator& rhs) { return _at == rhs._at; }
bool operator!=(const ConstIterator& rhs) { return _at != rhs._at; }
const int16_t& operator*() { return *_at; }