private void Reset() { var buffer = CurrentAudioBuffer; if (_voice.State.BuffersQueued > 0) { _voice.Stop(); _voice.FlushSourceBuffers(); } _voice.SubmitSourceBuffer(buffer); buffer.PlayBegin = GetPlayOffset(StartingPosition.totalSeconds); _voice.Start(); }
private void voice_VoiceProcessingPassStart(uint bufferSize) { var bufferSamples = bufferSize / sizeof(float); var buffer = new XAudio2Buffer(bufferSamples); for (uint i = 0; i < bufferSamples; ++i) { buffer.SetSample(i, (float)Math.Sin(phase)); phase = (phase + (Delta * frequency)) % TwoPi; } voice.SubmitSourceBuffer(buffer); }