public WriteStreamAsync ( float data, int offset, int numFrames ) : void | ||
data | float | |
offset | int | |
numFrames | int | |
Результат | void |
void IGATAudioThreadStreamClient.HandleAudioThreadStream(float[] data, int offset, bool emptyData, IGATAudioThreadStream stream) { int framesToWrite = stream.BufferSizePerChannel; if (_writing == false) { double dspTime = AudioSettings.dspTime; double nextDspTime = dspTime + GATInfo.AudioBufferDuration; if (_targetDspTime < dspTime) { _targetDspTime = dspTime; } if (nextDspTime > _targetDspTime) { if (_waiting) { _waiting = false; _writing = true; int frameOffsetInBuffer = ( int )((_targetDspTime - dspTime) * GATInfo.OutputSampleRate); offset += frameOffsetInBuffer * stream.NbOfChannels; framesToWrite -= frameOffsetInBuffer; } else { return; } } else { return; } } if (_recFixedFrames > 0 && (_writtenFrames + framesToWrite > _recFixedFrames)) { framesToWrite = _recFixedFrames - _writtenFrames; _writer.WriteStreamAsync(data, offset, framesToWrite); EndWriting(); return; } _writer.WriteStreamAsync(data, offset, framesToWrite); _writtenFrames += framesToWrite; }