DiscordVoiceDataSource

public protocol DiscordVoiceDataSource : class

Specifies that a type will be a data source for a VoiceEngine.

  • The size of a frame in samples per channel. Needed to calculate the maximum size of a frame.

    Declaration

    Swift

    var frameSize: Int
  • Called when the engine needs voice data. If there is no more data left, a DiscordVoiceDataSourceStatus.done error should be thrown.

    Declaration

    Swift

    func engineNeedsData(_ engine: DiscordVoiceEngine) throws -> [UInt8]

    Parameters

    engine

    The voice engine that needs data.

    Return Value

    An array of Opus encoded bytes.

  • Call when you want data collection to stop.

    Declaration

    Swift

    func finishUpAndClose()
  • Signals that the source should start producing data for consumption.

    Declaration

    Swift

    func startReading()