我正在尝试连接PSR-A3000键盘来播放计算机中的某些midi文件。当我运行代码时:
import java.io.File;
import java.io.IOException;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Sequence;
public class jFugeFilePlayer {
public static void main(String args[]) {
DeviceThatWillReceiveMidi device = null;
device = new DeviceThatWillReceiveMidi(); // handle MIDI Unavailable Exception
Sequence sequence = null;
try {
sequence = MidiSystem.getSequence(new File("/Users/path.../baharanMelody.midi"));
} catch (InvalidMidiDataException e) {
// handle Invalid MIDI Data Exception
} catch (IOException e) {
// handle IO Exception
e.printStackTrace();
}
device.setSequence(sequence);
}
}
我看到这里的帖子也有类似的问题,并且不能在“ device.sendSequence”上出现另一个异常。 JFugue 5 external midi device
我得到了错误:
Building renderMidi 1.0-SNAPSHOT
------------------------------------------------------------------------
--- exec-maven-plugin:1.5.0:exec (default-cli) @ renderMidi ---
Exception in thread "main" java.lang.UnsupportedOperationException: Not supported yet.
at DeviceThatWillReceiveMidi.setSequence(DeviceThatWillReceiveMidi.java:17)
at jFugeFilePlayer.main(jFugeFilePlayer.java:34)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
------------------------------------------------------------------------
BUILD FAILURE
我尝试了javaxsound.midi.MidiSystem,它确认我的设备正常工作。我已经添加了堆栈跟踪信息以查看是否可以提供帮助。
请问有任何关于我做错事情的想法吗?
任何帮助将不胜感激。
CS