//public void ApplyVolumeSettings() //{ // if (!IsStarted) return; // double volume = Global.Config.SoundVolume / 100.0; // if (volume < 0.0) volume = 0.0; // if (volume > 1.0) volume = 1.0; // _soundOutput.ApplyVolumeSettings(volume); //} public void SetSyncInputPin(ISyncSoundProvider source) { if (_asyncSoundProvider != null) { _asyncSoundProvider.DiscardSamples(); _asyncSoundProvider = null; } _semiSync.DiscardSamples(); _semiSync.BaseSoundProvider = null; _syncSoundProvider = source; if (_outputProvider != null) { _outputProvider.BaseSoundProvider = source; } }
public void DiscardSamples() { if (BaseSoundProvider != null) { BaseSoundProvider.DiscardSamples(); } }
public void DiscardSamples() { buffer.Clear(); if (BaseSoundProvider != null) { BaseSoundProvider.DiscardSamples(); } }
public void DiscardSamples() { ResetBuffer(); _extraCountHistory.Clear(); _outputCountHistory.Clear(); _hardCorrectionHistory.Clear(); _baseConsecutiveEmptyFrames = 0; _baseEmptyFrameCorrectionHistory.Clear(); _lastAdvertisedSamplesPerFrame = 0.0; _baseSamplesPerFrame.Clear(); _outputBuffer = new short[0]; _resampleBuffer = new short[0]; _resampleLengthRoundingError = 0.0; if (BaseSoundProvider != null) { BaseSoundProvider.DiscardSamples(); } }
public void DiscardSamples() { _soundProvider.DiscardSamples(); }
public void DiscardSamples() { _input.DiscardSamples(); _buffer.Clear(); }
public void UpdateSound() { if (Global.Config.SoundEnabled == false || disposed) { if (asyncsoundProvider != null) { asyncsoundProvider.DiscardSamples(); } if (syncsoundProvider != null) { syncsoundProvider.DiscardSamples(); } return; } int samplesNeeded = SNDDXGetAudioSpace() * 2; short[] samples; int samplesProvided; if (Muted) { if (samplesNeeded == 0) { return; } samples = new short[samplesNeeded]; samplesProvided = samplesNeeded; if (asyncsoundProvider != null) { asyncsoundProvider.DiscardSamples(); } if (syncsoundProvider != null) { syncsoundProvider.DiscardSamples(); } } else if (syncsoundProvider != null) { if (DSoundBuffer == null) { return; // can cause SNDDXGetAudioSpace() = 0 } int nsampgot; syncsoundProvider.GetSamples(out samples, out nsampgot); samplesProvided = 2 * nsampgot; if (!Global.ForceNoThrottle) { while (samplesNeeded < samplesProvided) { System.Threading.Thread.Sleep((samplesProvided - samplesNeeded) / 88); // let audio clock control sleep time samplesNeeded = SNDDXGetAudioSpace() * 2; } } } else if (asyncsoundProvider != null) { if (samplesNeeded == 0) { return; } samples = new short[samplesNeeded]; //if (asyncsoundProvider != null && Muted == false) //{ semisync.BaseSoundProvider = asyncsoundProvider; semisync.GetSamples(samples); //} //else asyncsoundProvider.DiscardSamples(); samplesProvided = samplesNeeded; } else { return; } int cursor = soundoffset; for (int i = 0; i < samplesProvided; i++) { short s = samples[i]; SoundBuffer[cursor++] = (byte)(s & 0xFF); SoundBuffer[cursor++] = (byte)(s >> 8); if (cursor >= SoundBuffer.Length) { cursor = 0; } } DSoundBuffer.Write(SoundBuffer, 0, LockFlags.EntireBuffer); soundoffset += samplesProvided * 2; soundoffset %= BufferSize; }
public void DiscardSamples() { input.DiscardSamples(); buffer.clear(); }
void ISoundProvider.DiscardSamples() { input.DiscardSamples(); }
public void DiscardSamples() { source.DiscardSamples(); }