Skip to content

Commit

Permalink
Merge pull request #334 from lukaspj/fix/sfx-player-bitstream-data
Browse files Browse the repository at this point in the history
SFX Player fixes #74
  • Loading branch information
Azaezel authored Oct 3, 2020
2 parents 777a506 + 70de01e commit 40f9dfe
Showing 1 changed file with 57 additions and 38 deletions.
95 changes: 57 additions & 38 deletions Engine/source/sfx/sfxPlayList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,25 +379,44 @@ void SFXPlayList::packData( BitStream* stream )
FOR_EACH_SLOT stream->writeInt( mSlots.mTransitionOut[ i ], NUM_TRANSITION_MODE_BITS );
FOR_EACH_SLOT stream->writeInt( mSlots.mStateMode[ i ], NUM_STATE_MODE_BITS );

FOR_EACH_SLOT stream->write( mSlots.mFadeTimeIn.mValue[ i ] );
FOR_EACH_SLOT stream->write( mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->write( mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->write( mSlots.mFadeTimeOut.mValue[ i ] );
FOR_EACH_SLOT stream->write( mSlots.mFadeTimeOut.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->write( mSlots.mFadeTimeOut.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->write( mSlots.mDelayTimeIn.mValue[ i ] );
FOR_EACH_SLOT stream->write( mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->write( mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->write( mSlots.mDelayTimeOut.mValue[ i ] );
FOR_EACH_SLOT stream->write( mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->write( mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->write( mSlots.mVolumeScale.mValue[ i ] );
FOR_EACH_SLOT stream->write( mSlots.mVolumeScale.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->write( mSlots.mVolumeScale.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->write( mSlots.mPitchScale.mValue[ i ] );
FOR_EACH_SLOT stream->write( mSlots.mPitchScale.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->write( mSlots.mPitchScale.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->write( mSlots.mRepeatCount[ i ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeIn.mValue[ i ] != -1 ))
stream->write( mSlots.mFadeTimeIn.mValue[ i ] );
FOR_EACH_SLOT if (stream->writeFlag( mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] > 0))
stream->write(mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT if (stream->writeFlag( mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] > 0))
stream->write(mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mValue[ i ] != -1 ))
stream->write( mSlots.mFadeTimeOut.mValue[ i ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][0] > 0))
stream->write(mSlots.mFadeTimeOut.mVariance[i][0]);
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][1] > 0))
stream->write(mSlots.mFadeTimeOut.mVariance[i][1]);
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mValue[ i ] > 0))
stream->write(mSlots.mDelayTimeIn.mValue[ i ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] > 0))
stream->write(mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] > 0))
stream->write(mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mValue[ i ] > 0))
stream->write(mSlots.mDelayTimeOut.mValue[ i ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] > 0))
stream->write(mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] > 0))
stream->write(mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mValue[ i ] != 1))
stream->write(mSlots.mVolumeScale.mValue[ i ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mVariance[ i ][ 0 ] > 0))
stream->write(mSlots.mVolumeScale.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mVariance[ i ][ 1 ] > 0))
stream->write(mSlots.mVolumeScale.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mValue[ i ] != 1))
stream->write(mSlots.mPitchScale.mValue[ i ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mVariance[ i ][ 0 ] > 0))
stream->write(mSlots.mPitchScale.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mVariance[ i ][ 1 ] > 0))
stream->write(mSlots.mPitchScale.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT if (stream->writeFlag( mSlots.mRepeatCount[ i ] > 0))
stream->write( mSlots.mRepeatCount[ i ] );

FOR_EACH_SLOT sfxWrite( stream, mSlots.mState[ i ] );
FOR_EACH_SLOT sfxWrite( stream, mSlots.mTrack[ i ] );
Expand All @@ -418,25 +437,25 @@ void SFXPlayList::unpackData( BitStream* stream )
FOR_EACH_SLOT mSlots.mTransitionOut[ i ] = ( ETransitionMode ) stream->readInt( NUM_TRANSITION_MODE_BITS );
FOR_EACH_SLOT mSlots.mStateMode[ i ] = ( EStateMode ) stream->readInt( NUM_STATE_MODE_BITS );

FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeIn.mValue[ i ] );
FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeOut.mValue[ i ] );
FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeIn.mValue[ i ] );
FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeOut.mValue[ i ] );
FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->read( &mSlots.mVolumeScale.mValue[ i ] );
FOR_EACH_SLOT stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->read( &mSlots.mPitchScale.mValue[ i ] );
FOR_EACH_SLOT stream->read( &mSlots.mPitchScale.mVariance[ i ][ 0 ] );
FOR_EACH_SLOT stream->read( &mSlots.mPitchScale.mVariance[ i ][ 1 ] );
FOR_EACH_SLOT stream->read( &mSlots.mRepeatCount[ i ] );
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mValue[ i ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mValue[ i ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 0 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 1 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mValue[ i ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mValue[ i ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mValue[ i ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 0 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 1 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mValue[ i ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mVariance[ i ][ 0 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mVariance[ i ][ 1 ] );}
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mRepeatCount[ i ] );}

FOR_EACH_SLOT sfxRead( stream, &mSlots.mState[ i ] );
FOR_EACH_SLOT sfxRead( stream, &mSlots.mTrack[ i ] );
Expand Down

0 comments on commit 40f9dfe

Please sign in to comment.