Skip to content

Commit

Permalink
refactor(Player): remove parameter default null from setFilters p…
Browse files Browse the repository at this point in the history
…arent
  • Loading branch information
Fab1o0107 committed Dec 21, 2023
1 parent df30010 commit 26528bb
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/guild/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ export class Player extends EventEmitter {
});

this.volume = player.volume;

return undefined;
}

/**
Expand All @@ -327,63 +325,63 @@ export class Player extends EventEmitter {
* Change the karaoke settings applied to to the Player State.
* @param karaoke An object that conforms to the KaraokeSettings type that defines a range of frequencies to mute.
*/
public setKaraoke(karaoke: KaraokeSettings | null = null): Promise<void> {
public setKaraoke(karaoke: KaraokeSettings): Promise<void> {
return this.setFilters({ karaoke });
}

/**
* Change the timescale settings applied to to the Player State.
* @param timescale An object that conforms to the TimescaleSettings type that defines the time signature to play the audio at.
*/
public setTimescale(timescale: TimescaleSettings | null = null): Promise<void> {
public setTimescale(timescale: TimescaleSettings): Promise<void> {
return this.setFilters({ timescale });
}

/**
* Change the tremolo settings applied to to the Player State.
* @param tremolo An object that conforms to the FreqSettings type that defines an oscillation in volume.
*/
public setTremolo(tremolo: FreqSettings | null = null): Promise<void> {
public setTremolo(tremolo: FreqSettings): Promise<void> {
return this.setFilters({ tremolo });
}

/**
* Change the vibrato settings applied to to the Player State.
* @param vibrato An object that conforms to the FreqSettings type that defines an oscillation in pitch.
*/
public setVibrato(vibrato: FreqSettings | null = null): Promise<void> {
public setVibrato(vibrato: FreqSettings): Promise<void> {
return this.setFilters({ vibrato });
}

/**
* Change the rotation settings applied to the Player State.
* @param rotation An object that conforms to the RotationSettings type that defines the frequency of audio rotating round the listener.
*/
public setRotation(rotation: RotationSettings | null = null): Promise<void> {
public setRotation(rotation: RotationSettings): Promise<void> {
return this.setFilters({ rotation });
}

/**
* Change the distortion settings applied to the Player State.
* @param distortion An object that conforms to DistortionSettings that defines distortions in the audio.
*/
public setDistortion(distortion: DistortionSettings | null = null): Promise<void> {
public setDistortion(distortion: DistortionSettings): Promise<void> {
return this.setFilters({ distortion });
}

/**
* Change the channel mix settings applied to the Player State.
* @param channelMix An object that conforms to ChannelMixSettings that defines how much the left and right channels affect each other. (setting all factors to 0.5 causes both channels to get the same audio)
*/
public setChannelMix(channelMix: ChannelMixSettings | null = null): Promise<void> {
public setChannelMix(channelMix: ChannelMixSettings): Promise<void> {
return this.setFilters({ channelMix });
}

/**
* Change the low pass settings applied to the Player State.
* @param lowPass An object that conforms to LowPassSettings that defines the amount of suppression on higher frequencies.
*/
public setLowPass(lowPass: LowPassSettings | null = null): Promise<void> {
public setLowPass(lowPass: LowPassSettings): Promise<void> {
return this.setFilters({ lowPass });
}

Expand Down Expand Up @@ -479,8 +477,6 @@ export class Player extends EventEmitter {
this.paused = player.paused;
this.filters = player.filters;
this._encodedTrack = player.track?.encoded ?? null;

return undefined;
}

/**
Expand All @@ -494,8 +490,6 @@ export class Player extends EventEmitter {
this.ping = ping;

this.emit("update", data);

return undefined;
}

/**
Expand Down

0 comments on commit 26528bb

Please sign in to comment.