fix(discord): inherit AudioSource in VoiceMixer for vc.play() compatibility

VoiceMixer duck-typed the discord.AudioSource interface (is_opus, read,
cleanup) but never inherited from it. discord.py's vc.play() does an
isinstance check and rejects non-AudioSource objects, causing the voice
fx mixer to silently fail with:

  "Voice mixer failed to start: source must be an AudioSource not
   VoiceMixer"

Added missing `import discord` and changed the class definition from
`class VoiceMixer:` to `class VoiceMixer(discord.AudioSource):`.
This commit is contained in:
Carlos Diosdado 2026-06-10 23:38:00 -06:00 committed by Teknium
parent 31301c1af7
commit eef1ab72d5

View file

@ -46,6 +46,8 @@ import logging
import threading
from typing import TYPE_CHECKING, List, Optional
import discord
if TYPE_CHECKING: # numpy is an optional ("voice" extra) dep — never import at runtime top-level
import numpy as np
@ -145,7 +147,7 @@ class MixerChild:
return samples
class VoiceMixer:
class VoiceMixer(discord.AudioSource):
"""A continuous ``discord.AudioSource`` that mixes N child streams.
Use :meth:`set_ambient` to install/replace the looping idle bed and