processing / processing-sound

Audio library for Processing built with JSyn
https://processing.org/reference/libraries/sound/
GNU Lesser General Public License v2.1
149 stars 50 forks source link

supress warnings #93

Closed trackme518 closed 11 months ago

trackme518 commented 11 months ago

I have red the issue: https://github.com/processing/processing-sound/issues/65 but did not find the function to suppress warnings. Usecase described below:

suspendWarning

Hi, I still have these warning when setting the amplitude to 0 with version 2.4.0 - but this is intentional as I need to dynamically change volumes and at times assign 0 to certain channels.

In Engine.java line 606:

    // static helper methods that do stuff like checking argument values or 
    // printing library messages

    protected static boolean checkAmp(float amp) {
        if (amp < -1 || amp > 1) {
            Engine.printError("amplitude has to be in [-1,1]");
            return false;
        } else if (amp == 0.0) {
            Engine.printWarning("an amplitude of 0 means this sound is not audible now");
        }
        return true;
    }

line 651

    protected static void printError(String message) {
        Engine.println("Sound library error: " + message);
    }

What is the method to suppress warnings? I can probably just hack it by assigning Float.MIN_VALUE but I would rather have a truly 0.0 volume there...

kevinstadler commented 11 months ago

Updated preview (with no more overly restrictive amplitude checks) already available at https://github.com/processing/processing-sound/releases/tag/v2.4.0-preview, thanks for reporting!

trackme518 commented 11 months ago

Hi, I just tested on Linux64bit (Mint) with the new build and warnings are gone - thanks.