ManagesReceiving
Inbound-audio concern of {@see \Discord\Voice\VoiceClient}: SSRC/speaking bookkeeping, per-user decoder processes and receive streams, and the {@see handleAudioData()} decode path.
Tags
Table of Contents
Methods
- getReceiveStream() : ReceiveStream|null
- Gets a receive voice stream.
- getRecieveStream() : RecieveStream|ReceiveStream|null
- Gets a recieve voice stream.
- handleAudioData() : void
- Handles raw opus data from the UDP server.
- isSpeaking() : bool
- Checks if the user is speaking.
- createDecoder() : void
- Creates and initializes a decoder process for the given stream session.
- monitorProcessExit() : void
- Monitor a process for exit and trigger callbacks when it exits.
- removeDecoder() : void
- Removes and closes the voice decoder associated with the given SSRC.
Methods
getReceiveStream()
Gets a receive voice stream.
public
getReceiveStream(int|string $id) : ReceiveStream|null
Parameters
- $id : int|string
-
Either a SSRC or User ID.
Return values
ReceiveStream|nullgetRecieveStream()
Gets a recieve voice stream.
public
getRecieveStream(int|string $id) : RecieveStream|ReceiveStream|null
Use getReceiveStream instead.
Parameters
- $id : int|string
-
Either a SSRC or User ID.
Return values
RecieveStream|ReceiveStream|nullhandleAudioData()
Handles raw opus data from the UDP server.
public
handleAudioData(Packet $voicePacket) : void
Parameters
- $voicePacket : Packet
-
The data from the UDP server.
isSpeaking()
Checks if the user is speaking.
public
isSpeaking([string|int|null $id = null ]) : bool
Parameters
- $id : string|int|null = null
-
Either the User ID or SSRC (if null, return discords speaking status).
Return values
bool —Whether the user is speaking.
createDecoder()
Creates and initializes a decoder process for the given stream session.
protected
createDecoder(object $ss) : void
Parameters
- $ss : object
-
The stream session object containing information such as SSRC and user ID.
monitorProcessExit()
Monitor a process for exit and trigger callbacks when it exits.
protected
monitorProcessExit(Process $process, object $ss) : void
Parameters
- $process : Process
-
The process to monitor
- $ss : object
-
The speaking status object
removeDecoder()
Removes and closes the voice decoder associated with the given SSRC.
protected
removeDecoder(object $ss) : void
Parameters
- $ss : object
-
An object containing the SSRC (Synchronization Source identifier). Expected to have a property 'ssrc'.