Vixen
02b45cc4
csharp
public interface IAudioSampleProvider

Where a voice's samples come from.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

One interface for a clip in memory, a compressed track being decoded as it plays, and a tone a test generates, because the mixer has no reason to tell them apart: it wants interleaved floats at some rate, and it resamples whatever it gets to the device's.

Called from the audio thread. Everything IAudioRenderSource is forbidden applies here — no locks, no allocation, no I/O. A provider that has to wait for a disk keeps a buffer somebody else fills; see Vixen.Audio.Streaming.StreamingSampleProvider, which is that arrangement.

Looping belongs here and not in the voice. A loop is a seek, and only the provider knows whether it can seek and what it costs — a clip wraps an index, a stream may have to re-open a file. Putting the wrap in the voice would mean every provider grew a seek the voice could call from the audio thread, including the ones that cannot.

Fields and properties (4)

  • AudioFormat Format

    The rate and channel count of what Read produces.

  • long FrameCount

    How many frames there are in total, or -1 if that is not knowable.

  • long Position

    Where the next Read will start, in frames.

  • bool IsLooping

    Whether it will keep producing after it has run out.

Methods (2)

  • int Read(Span<float> destination, int frameCount)

    Produces the next frames.

  • void Seek(long frame)

    Starts again from a frame.

Used by (11)

  • AudioEngineVixen.Audio
  • AudioEventVixen.Audio
  • CaptureSampleProviderVixen.Audio
  • ClipSampleProviderVixen.Audio
  • FakeProviderVixen.Video.Tests
  • LiveSampleProviderVixen.Audio
  • SilentProviderVixen.Video.Tests
  • StreamingSampleProviderVixen.Audio
  • VideoPlaybackVixen.Video
  • VideoPlayerVixen.Video
  • VoiceVixen.Audio