concrete subclasses
Hi
I have to edit a midi file. When I get the data byte[ ] from a MidiMessage and I edit it, I can't invoke the constructor MidiMessage(byte[ ]) because it's protected and "can be called only by concrete subclasses". So how can I rebuilt my sequence after editing it?
Thak you for your help
[312 byte] By [
fedeeea] at [2007-11-26 18:42:23]

MidiMessage is abstract, isn't it? What about one of its concrete subclasses, like SysexMessage? The MidiMessage you are tinkering with -- what class is it an instance of:String classname = myMidiMessage.getClass().getName();
Thank you for your help but I'm not an expert java user and I didn't understand, sorry:
also the subclasses like SysexMessage and ShortMessage have protected constructors. Try to explain better:
If I write:
byte [] bla = MyMidiMessage.getMessage();
// edit the byte[]
now I'd like to do
AnotherMidiMessage = MidiMessage(editedbyte[]);
But I can't. Maybe I didn't understand the code you wrote.
1. MidiMessage is an abstract class. Do you know what that means? It means you can't create an instance of the class.
2. What class is you current midi message object an instance of? What does this print?
System.out.println(yourMidiMessage.getClass());
3. I don't know anything about midi, but I can read documentation. The class I mentioned, SysexMessage is not abstract and has a public constructor and public setMessage methods. Try using them and see if they work.
Thank you all for the help, guys.
The message I want to edit is an instance of the MidiMessage class, not created by me but read from a file.
I tried with the ShortMessage constructor, since a "note on" message should belong to this class, but when I replace the original message with the one I bult the sequence becomes unreadable. Surely I'm doing something in the wrong way, but I don't know what. I'd need some code... Surely it's a simple thing to do if one knows how to....
Thank you again
P.s. by the way, I found the Messages in the file are instances of com.sun.media.sound.FastShortMessage and I can find no doc for that package, bt my editor says that class's not visible