JFugue 5.0 не может контролировать динамические изменения громкости, исходящие от мыши - PullRequest
0 голосов
/ 25 октября 2019

Я пытаюсь получить громкость и высоту звука от позиции мыши, где я нажимаю на экран JPanel.

Player player = new Player();

        // Read screen Dimensions and Mouse Position
        Point loc = MouseInfo.getPointerInfo().getLocation();
        // We need to know where we are at the screen
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = screenSize.getWidth();
        double height = screenSize.getHeight();

        // Pitch = higher pitch the higher user click on the sreen
        //        = lower pitch the lower user click on the screen
        // Volume = right side of the screen is for higher volumes
        //          left side of the screen is for lower volumes
        int pitch = 127 - (int)(loc.y*127/height);
        int volume = (int)(loc.x*16383/width);


       // Pattern pattern = new Pattern("X[Volume]=" + volume + " [" + pitch + "]");
        // Since I am using jFugue v5 I, remove the brackets around note numbers
        //Brackets should be used in cases where the contents of the brackets is a string representation of a value that needs to be looked up
        // (e.g., I[Piano], T[Allegro])
        player.play(":CON(7, " + volume + ")" );

Однако я не удалась,

Я пробовал много способов, но либоЯ получаю исключения, которые я не могу решить, прибегая к помощи или не получая ответа;

Пока что я попробовал:

player.play(":CON("+volume+","+pitch+")");
player.play(":Controller(9"+  volume + ")");

Спасибо за вашу помощь.

...