コード例 #1
0
    /// <summary>
    /// Resets the instance to its uninitialized state.
    /// </summary>
    public void ResetInputStream()
    {
      TerminateBufferUpdateThread();
      if (_inputStreamInitialized)
      {
        _inputStreamInitialized = false;

        _outputStream.Dispose();
        _outputStream = null;

        _vizStream.Dispose();
        _vizStream = null;

        _vizRawStream.Dispose();
        _vizRawStream = null;

        _buffer = null;
        _inputStream = null;
        _vizReadOffsetBytes = 0;
      }
    }
コード例 #2
0
    /// <summary>
    /// Sets the Bass inputstream and initializes the playbackbuffer.
    /// </summary>
    /// <param name="stream">New inputstream.</param>
    public void SetInputStream(BassStream stream)
    {
      ResetInputStream();

      _inputStream = stream;

      UpdateVizLatencyCorrection();

      _buffer = new AudioRingBuffer(stream.SampleRate, stream.Channels, _bufferSize + _vizReadOffset);
      _streamEnded = false;
      _buffer.ResetPointers();

      CreateOutputStream();
      CreateVizStream();
      _inputStreamInitialized = true;

      // Ensure prebuffering
      _updateThreadFinished.Reset();

      StartBufferUpdateThread();
      _updateThreadFinished.WaitOne();
    }