我想为send()
添加一个额外的参数在DumpSequence.java中:
private static Receiver sm_receiver = new DumpReceiver(System.out, true);
sm_receiver.send(message, lTicks); (Work)
sm_receiver.send(message, lTicks, addParam1); (Won't work)
DumnpReceiver.java我试图添加额外的参数,即lTimeStamp2:
public void send(MidiMessage message, long lTimeStamp, long lTimeStamp2) {...}
错误:
DumpSequence.java:136: send(javax.sound.midi.MidiMessage,long) in javax.sound.mi
di.Receiver cannot be applied to (javax.sound.midi.MidiMessage,long,long)
sm_receiver.send(message, lTicks, lTicks);
^
.\DumpReceiver.java:21: DumpReceiver is not abstract and does not override abstr
act method send(javax.sound.midi.MidiMessage,long) in javax.sound.midi.Receiver
public class DumpReceiver
^
2 errors
答案 0 :(得分:1)
从第21行删除@Override注释
答案 1 :(得分:0)
答案 2 :(得分:0)
如果您想致电send(MidiMessage message, long lTimeStamp, long lTimeStamp2)
,则需要使用DumpReceiver
个实例,而不是Receiver
个实例。在`Receiver
private static DumpReceiver sm_receiver = new DumpReceiver(System.out, true);
通过继承 编辑,您仍然可以将其用作普通Receiver
对象。
答案 3 :(得分:0)
即使您不使用它,您仍然必须实施send(javax.sound.midi.MidiMessage,long)
- 您实施的界面需要它