Mixer & PlayHandle: Support PlayHandle without audioPort and set

audioPort as nullptr by default.
This commit is contained in:
Shmuel H
2017-11-06 22:42:40 +02:00
parent 44fa0c5e53
commit 59964e78fa
2 changed files with 10 additions and 5 deletions

View File

@@ -451,7 +451,8 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
}
if( ( *it )->isFinished() )
{
( *it )->audioPort()->removePlayHandle( ( *it ) );
if (( *it )->audioPort())
( *it )->audioPort()->removePlayHandle( ( *it ) );
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
{
NotePlayHandleManager::release( (NotePlayHandle*) *it );
@@ -653,7 +654,8 @@ bool Mixer::addPlayHandle( PlayHandle* handle )
if( criticalXRuns() == false )
{
m_newPlayHandles.push( handle );
handle->audioPort()->addPlayHandle( handle );
if (handle->audioPort())
handle->audioPort()->addPlayHandle( handle );
return true;
}
@@ -675,7 +677,8 @@ void Mixer::removePlayHandle( PlayHandle * _ph )
if( _ph->affinityMatters() &&
_ph->affinity() == QThread::currentThread() )
{
_ph->audioPort()->removePlayHandle( _ph );
if (_ph->audioPort())
_ph->audioPort()->removePlayHandle( _ph );
bool removedFromList = false;
// Check m_newPlayHandles first because doing it the other way around
// creates a race condition
@@ -735,7 +738,8 @@ void Mixer::removePlayHandlesOfTypes( Track * _track, const quint8 types )
{
if( ( *it )->isFromTrack( _track ) && ( ( *it )->type() & types ) )
{
( *it )->audioPort()->removePlayHandle( ( *it ) );
if (( *it )->audioPort())
( *it )->audioPort()->removePlayHandle( ( *it ) );
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
{
NotePlayHandleManager::release( (NotePlayHandle*) *it );

View File

@@ -38,7 +38,8 @@ PlayHandle::PlayHandle(const Type type, f_cnt_t offset) :
m_affinity(QThread::currentThread()),
m_playHandleBuffer(BufferManager::acquire()),
m_bufferReleased(true),
m_usesBuffer(true)
m_usesBuffer(true),
m_audioPort{nullptr}
{
}