30 Commits

Author SHA1 Message Date
Skezza
2552a268cb Add double backticks for some parameter mentions in the documentation. 2020-07-22 23:15:16 -04:00
Sebastian Law
b4b953bfc6
Fix various inconsistencies within the documentation (#5067) 2020-06-28 03:45:58 -04:00
Terrance
017591dc9e player: Close ffmpeg stdin during streaming
A `stdin` of `None` means the ffmpeg subprocess input inherits from the
parent process, which may cause undesired control from a terminal (e.g.
`C` causes ffmpeg to prompt for a command).  It also closes the parent's
stdin when the subprocess exits.

This commit switches to `subprocess.DEVNULL`, which provides a separate
pre-closed stdin for ffmpeg subprocesses.
2020-05-23 21:43:26 -04:00
Austin Lasher
032a866fec Fix an FFmpegOpusAudio documentation detail, and some capitalization 2020-04-14 03:24:46 -04:00
Rapptz
02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Imayhaveborkedit
839afce178 Print exception tracebacks in voice threads
Errors occurring within `AudioSource.read()` and `after()` functions will now display their tracebacks as if they were unhandled exceptions.
2019-11-26 05:16:53 -05:00
Imayhaveborkedit
bc147ea37b
Fix FFmpegAudio._process not existing if _spawn_process raises 2019-08-27 19:53:44 -04:00
Rapptz
12343c1422 Add versionadded tags to new ffmpeg related classes. 2019-07-27 23:17:06 -04:00
Imayhaveborkedit
fedf26bf3e Add FFmpegOpusAudio and other voice improvements
Rework FFmpeg player and add FFmpegOpusAudio

I have extracted some of the base FFmpeg source code into its own
base class and reimplemented the PCM and the new Opus variants.

Support avconv probing

Also fix a few things

Update `__all__`

Fix the bugs

Rework probe functions and add factory function

Probing involves subprocess so it has been reworked into an async
factory function.

Add docs + a few tweaks

* Removed unnecessary read() and is_opus() functions from FFmpegAudio
* Clear self._stdout in cleanup()
* Add 20 second process communication timeout to probe functions
* Capped probe function bitrate values at 512

Change AudioPlayer to use more accurate, monotonic time.perf_counter()

Add lazy opus loading

The library now no longer loads libopus on import, only on
opus.Encoder creation or manually.

Fix review nits
2019-07-22 20:46:40 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Rapptz
919dbcafb3 Consistent use of __all__ to prevent merge conflicts. 2019-04-20 17:20:58 -04:00
NCPlayz
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
Imayhaveborkedit
9c5259afd7 Update voice code to vws V4
- Update internals to be compatible with v4
- Adds multiple encryption mode support.  Previously only `xsalsa20_poly1305` was supported.  Now `xsalsa20_poly1305_suffix` is also supported.
  Note: There is no (nice) way to manually select a mode.  The user needn't worry about this however.
- Fixed speaking state bug.  When you disconnected from a voice channel while a bot was playing, upon reconnect you would be unable to hear the bot.  This was caused by bots not sending their speaking state while transmitting.  Bots will now set their speaking state properly when transmitting.  
  Note: This does not account for sending actual silence, the speaking indicator will still be active.
2019-01-28 22:22:52 -05:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Hornwitser
fa46b07db1 [lint] Rename exception variables to exc
Use the more explicit (and common) exc instead of e as the variable
holding the exception in except handlers.
2018-11-24 22:17:57 -05:00
Hornwitser
a71b3b5fa0 [lint] Limit unneccessarily broad except clauses
Add exception qualifier(s) to bare except clauses swallowing exceptions.
2018-11-24 22:17:57 -05:00
Rapptz
5c24e69cf2 Fix up the Sphinx strings causing warnings. 2018-09-15 09:54:00 -04:00
Hornwitser
c8b49d37be [lint] Fix incorrect and inconsistent whitespace
Adjust whitespace to be consistent with the rest of the library.
2018-08-22 21:43:53 -04:00
Daniel
ceb82ecc7b
Fix self._process not existing during cleanup() in case of error 2017-11-21 17:51:34 -05:00
Daniel
b532da7906 Fix waiting for resume when calling stop() on AudioPlayer 2017-07-21 18:37:22 -04:00
Rapptz
5d75c44651 Call cleanup on AudioSource.__del__. 2017-07-19 05:58:20 -04:00
Rapptz
eda903f6b1 Add some logging for when ffmpeg processes get terminated. 2017-07-18 18:46:56 -04:00
Rapptz
daf066dd39 Log when a player's after function fails. 2017-06-02 06:43:33 -04:00
Rapptz
34c60002bf Allow setting a default volume in PCMVolumeTransformer. 2017-04-19 17:33:16 -04:00
Rapptz
f5cfc96aaf 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.
2017-04-19 17:23:39 -04:00
Rapptz
07d5328873 Add VoiceClient.is_paused to query pause state. 2017-04-19 16:06:45 -04:00
Rapptz
efd6d11e9a Fix static cut-off when playing. 2017-04-18 22:20:40 -04:00
Rapptz
b4bc4dfd12 Fix FFmpegPCMAudio not working with spaces in filename. 2017-04-18 16:05:32 -04:00
Rapptz
3b1b26ffb1 Re-implement voice sending.
This is a complete redesign of the old voice code.

A list of major changes is as follows:

* The voice websocket will now automatically reconnect with
  exponential back-off just like the regular Client does.
* Removal of the stream player concept.
* Audio now gracefully pauses and resumes when a disconnect is found.
* Introduce a discord.AudioSource concept to abstract streams
* Flatten previous stream player functionality with the
  VoiceClient, e.g. player.stop() is now voice_client.stop()
* With the above re-coupling this means you no longer have to
  store players anywhere.
* The after function now requires a single parameter, the error,
  if any existed. This will typically be None.

A lot of this design is experimental.
2017-04-18 03:49:48 -04:00