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:
Rapptz committed 2017-04-19 17:23:39 -04:00
1 parent 07d5328873
commit f5cfc96aaf
3 files changed
+72 -4

No files matched your search

+14 -1
View File
@@ -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.