0

我正在开发一个 Java 程序,该程序使用从 MidiSystem 获得的 Sequencer,同时使用 JFrame 对象,让我选择不同的序列来播放。到目前为止,我可以播放新序列的唯一方法是停止程序并重新开始。有没有办法可以在 JFrame 保持活动状态时更改序列或跟踪,而不是停止程序并重新启动。谢谢。

4

1 回答 1

0
// Get the default sequencer connected to the default synth
Sequencer sequencer = MidiSystem.getSequencer();

// Create a Midi sequence
Sequence newSequence = new Sequence(...);

... // Add track(s) to newSequence

// Sets the current sequence on which the sequencer operates.
sequencer.setSequence(sequence)
于 2020-12-06T15:59:12.277 回答