mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
Add PCMVolumeTransformer to augment volume of a PCM stream.
This also introduces the idea of replacing the VoiceClient.source on the fly. Note that this internally pauses and resumes the audio stream.
This commit is contained in:
@ -359,9 +359,22 @@ class VoiceClient:
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
"""Optional[:class:`AudioSource`]: The audio source being played, if playing."""
|
||||
"""Optional[:class:`AudioSource`]: The audio source being played, if playing.
|
||||
|
||||
This property can also be used to change the audio source currently being played.
|
||||
"""
|
||||
return self._player.source if self._player else None
|
||||
|
||||
@source.setter
|
||||
def source(self, value):
|
||||
if not isinstance(value, AudioSource):
|
||||
raise TypeError('expected AudioSource not {0.__class__.__name__}.'.format(value))
|
||||
|
||||
if self._player is None:
|
||||
raise ValueError('Not playing anything.')
|
||||
|
||||
self._player._set_source(value)
|
||||
|
||||
def send_audio_packet(self, data, *, encode=True):
|
||||
"""Sends an audio packet composed of the data.
|
||||
|
||||
|
Reference in New Issue
Block a user