Skip to content

Commit

Permalink
fix calibration player bug when using stereo source.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Sep 1, 2022
1 parent 127f1f0 commit 9cf49d2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Assets/uLipSync/Runtime/uLipSyncCalibrationAudioPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ void OnAudioRead(float[] data)
{
for (int ch = 0; ch < _channels; ++ch)
{
int index = i * _channels + ch;

if (_currentPos < _crossFadeDataCount)
{
float t = (float)_currentPos / _crossFadeDataCount;
Expand All @@ -96,11 +98,11 @@ void OnAudioRead(float[] data)
int indexE = _sampleCount - (_crossFadeDataCount - _currentPos);
float dataS = _data[indexS * _channels + ch];
float dataE = _data[indexE * _channels + ch];
data[i] = dataS * sin + dataE * cos;
data[index] = dataS * sin + dataE * cos;
}
else
{
data[i] = _data[_currentPos * _channels + ch];
data[index] = _data[_currentPos * _channels + ch];
}
}

Expand Down

0 comments on commit 9cf49d2

Please sign in to comment.