1

我目前正在尝试在我的项目中成功使用 JFugue 5.0.9,并打算使用延迟播放功能来呈现进度条和音符的位置。我编写了自己的解析器并生成了一个可以播放的模式。曲目使用和弦(如“C4+B5q”)。每当和弦的音符出现时,就会触发一个音符事件,而不是一个和弦事件,并且DiagnosticParserListener的输出不同步。播放器很好,听起来不错。我在和弦符号上做错了吗?

我使用的示例和跟踪:

import org.jfugue.player.Player;
import org.jfugue.temporal.TemporalPLP;
import org.staccato.StaccatoParser;

public class TemporalExample {
    private static final String MUSIC = "TIME:3/4 T108 B4h D5q A4h G4i A4i B4h D5q A4h. B4h D5q A5h G5q D5h C5i B4i A4h G4i A4i B4h D5q A4h Rq B4h D5q A4h. B4h D5q A5h G5q D6h. D6q Rq G5s A5s B5s C6s D5+D6h C5+C6i B4+B5i C5+C6i B4+B5i G4+G5h C5+C6h B4+B5i A4+A5i B4+B5i A4+A5i E4+E5h D5+D6h C5+C6i B4+B5i T96 C5+C6i B4+B5i G4+G5q C5+C6q T86 G5+G6h. A5i C6i F6i A6i D6i B6i G7h.";
    private static final long TEMPORAL_DELAY = 0;

    public static void main(String[] args) {
        // Part 1. Parse the original music
        StaccatoParser parser = new StaccatoParser();
        TemporalPLP plp = new TemporalPLP();
        parser.addParserListener(plp);
        parser.parse(MUSIC);

        // Part 2. Send the events from Part 1, and play the original music with a delay
        DiagnosticParserListener dpl = new DiagnosticParserListener(); // Or your AnimationParserListener!
        plp.addParserListener(dpl);
        new Player().delayPlay(TEMPORAL_DELAY, MUSIC);
        plp.parse();
    }
}
4

0 回答 0