Skip to content

Commit

Permalink
Breaking change to Player.set_eq, which now accepts an Equalizer ob…
Browse files Browse the repository at this point in the history
…ject and not a list of band/gain pairs.

This update also removes `Player.set_preq`, which is now superseded by the new `Player.set_eq`.

An aliase to `Player.set_eq` was added, `Player.set_equalizer`.
  • Loading branch information
EvieePy committed Feb 9, 2020
1 parent fad063a commit dfae0bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
2 changes: 1 addition & 1 deletion wavelink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__author__ = 'EvieePy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019-2020 (c) PythonistaGuild'
__version__ = '0.4.02'
__version__ = '0.5.0'

from .client import Client
from .errors import *
Expand Down
38 changes: 10 additions & 28 deletions wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,42 +321,24 @@ async def destroy(self) -> None:
await self.node._send(op='destroy', guildId=str(self.guild_id))
del self.node.players[self.guild_id]

async def set_preq(self, mode: str) -> str:
async def set_eq(self, equalizer: Equalizer) -> None:
"""|coro|
Set the Players Equalizer from a Pre-made list. If no/invalid mode is provided, the EQ will be reset.
Set the Players Equalizer.
Modes
-------
Flat:
The base EQ. Complete FlatLine.
Boost:
A Bass and Snare boost. Suitable to DNB type music.
Metal:
A metal/metal rock boost.
Parameters
------------
equalizer: :class:`Equalizer`
The Equalizer to set.
"""
name = mode

mode = self.equalizers.get(mode.upper(), Equalizer.flat())
await self.node._send(op='equalizer', guildId=str(self.guild_id), bands=mode.eq)

return name
await self.node._send(op='equalizer', guildId=str(self.guild_id), bands=equalizer.eq)

async def set_eq(self, *, levels: list):
async def set_equalizer(self, equalizer: Equalizer) -> None:
"""|coro|
Set the Players Equalizer. A list of tuples ranged for 0 to 14 with a gain will be accepted.
Bands: 0 - 14
Gains: -0.25 - 1.0
Example
---------
[(0, .1), (7, .5), (8, .5)]
An alias to :func:`set_eq`.
"""
equalizer = Equalizer.build(levels=levels)

await self.node._send(op='equalizer', guildId=str(self.guild_id), bands=equalizer.eq)
await self.set_eq(equalizer)

async def set_pause(self, pause: bool) -> None:
"""|coro|
Expand Down

0 comments on commit dfae0bf

Please sign in to comment.