Skip to content

Commit 5146a07

Browse files
authored
Bound panning (#3899)
1 parent ea14cb9 commit 5146a07

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/channel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ void CChannel::SetPan ( const int iChanID, const float fNewPan )
337337
// set value (make sure channel ID is in range)
338338
if ( ( iChanID >= 0 ) && ( iChanID < MAX_NUM_CHANNELS ) )
339339
{
340-
vecfPannings[iChanID] = fNewPan;
340+
// pan range is 0..1; guard to avoid wrong values from the network
341+
vecfPannings[iChanID] = std::min ( 1.0f, std::max ( fNewPan, 0.0f ) );
341342
}
342343
}
343344

0 commit comments

Comments
 (0)