From 8eff93fc631298a668cd703fe4cc439bd0a599fe Mon Sep 17 00:00:00 2001 From: Danielku15 Date: Thu, 31 Dec 2020 14:38:33 +0100 Subject: [PATCH] Remove max volume limitation --- src/platform/javascript/AlphaSynthWebWorkerApi.ts | 8 ++++---- src/synth/AlphaSynth.ts | 8 ++++---- src/synth/SynthConstants.ts | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/platform/javascript/AlphaSynthWebWorkerApi.ts b/src/platform/javascript/AlphaSynthWebWorkerApi.ts index b3a2f985c..33fc6efd7 100644 --- a/src/platform/javascript/AlphaSynthWebWorkerApi.ts +++ b/src/platform/javascript/AlphaSynthWebWorkerApi.ts @@ -63,7 +63,7 @@ export class AlphaSynthWebWorkerApi implements IAlphaSynth { } public set masterVolume(value: number) { - value = SynthHelper.clamp(value, SynthConstants.MinVolume, SynthConstants.MaxVolume); + value = Math.max(value, SynthConstants.MinVolume); this._masterVolume = value; this._synth.postMessage({ cmd: 'alphaSynth.setMasterVolume', @@ -76,7 +76,7 @@ export class AlphaSynthWebWorkerApi implements IAlphaSynth { } public set metronomeVolume(value: number) { - value = SynthHelper.clamp(value, SynthConstants.MinVolume, SynthConstants.MaxVolume); + value = Math.max(value, SynthConstants.MinVolume); this._metronomeVolume = value; this._synth.postMessage({ cmd: 'alphaSynth.setMetronomeVolume', @@ -88,7 +88,7 @@ export class AlphaSynthWebWorkerApi implements IAlphaSynth { } public set countInVolume(value: number) { - value = SynthHelper.clamp(value, SynthConstants.MinVolume, SynthConstants.MaxVolume); + value = Math.max(value, SynthConstants.MinVolume); this._countInVolume = value; this._synth.postMessage({ cmd: 'alphaSynth.setCountInVolume', @@ -318,7 +318,7 @@ export class AlphaSynthWebWorkerApi implements IAlphaSynth { } public setChannelVolume(channel: number, volume: number): void { - volume = SynthHelper.clamp(volume, SynthConstants.MinVolume, SynthConstants.MaxVolume); + volume = Math.max(volume, SynthConstants.MinVolume); this._synth.postMessage({ cmd: 'alphaSynth.setChannelVolume', channel: channel, diff --git a/src/synth/AlphaSynth.ts b/src/synth/AlphaSynth.ts index ea35ee08d..2c6f85b31 100644 --- a/src/synth/AlphaSynth.ts +++ b/src/synth/AlphaSynth.ts @@ -55,7 +55,7 @@ export class AlphaSynth implements IAlphaSynth { } public set masterVolume(value: number) { - value = SynthHelper.clamp(value, SynthConstants.MinVolume, SynthConstants.MaxVolume); + value = Math.max(value, SynthConstants.MinVolume); this._synthesizer.masterVolume = value; } @@ -64,7 +64,7 @@ export class AlphaSynth implements IAlphaSynth { } public set metronomeVolume(value: number) { - value = SynthHelper.clamp(value, SynthConstants.MinVolume, SynthConstants.MaxVolume); + value = Math.max(value, SynthConstants.MinVolume); this._metronomeVolume = value; this._synthesizer.metronomeVolume = value; } @@ -74,7 +74,7 @@ export class AlphaSynth implements IAlphaSynth { } public set countInVolume(value: number) { - value = SynthHelper.clamp(value, SynthConstants.MinVolume, SynthConstants.MaxVolume); + value = Math.max(value, SynthConstants.MinVolume); this._countInVolume = value; } @@ -333,7 +333,7 @@ export class AlphaSynth implements IAlphaSynth { } public setChannelVolume(channel: number, volume: number): void { - volume = SynthHelper.clamp(volume, SynthConstants.MinVolume, SynthConstants.MaxVolume); + volume = Math.max(volume, SynthConstants.MinVolume); this._synthesizer.channelSetMixVolume(channel, volume); } diff --git a/src/synth/SynthConstants.ts b/src/synth/SynthConstants.ts index 786575981..b437a977f 100644 --- a/src/synth/SynthConstants.ts +++ b/src/synth/SynthConstants.ts @@ -7,7 +7,6 @@ export class SynthConstants { public static readonly MetronomeChannel: number = SynthConstants.DefaultChannelCount - 1; public static readonly AudioChannels: number = 2; public static readonly MinVolume: number = 0; - public static readonly MaxVolume: number = 1; public static readonly MinProgram: number = 0; public static readonly MaxProgram: number = 127; public static readonly MinPlaybackSpeed: number = 0.125;