Index: modules/sound/src/main/java/common/javax/sound/midi/Instrument.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/Instrument.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/Instrument.java (revision 0) @@ -0,0 +1,38 @@ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @author Evgeny S. Sidorenko + */ + +package javax.sound.midi; + +public abstract class Instrument extends SoundbankResource +{ + private Patch m_patch; + + protected Instrument( Soundbank soundbank, Patch patch, + String name, Class dataClass ) + { + super( soundbank, name, dataClass ); + m_patch = patch; + } + + public Patch getPatch() + { + return m_patch; + } +} Index: modules/sound/src/main/java/common/javax/sound/midi/MetaMessage.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/MetaMessage.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/MetaMessage.java (revision 0) @@ -0,0 +1,76 @@ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @author Evgeny S. Sidorenko + */ + +package javax.sound.midi; + +public class MetaMessage extends MidiMessage +{ + private int m_type; + + public static final int META = 255; + + public MetaMessage() + { + super( null ); //I don't confident that it's true + } + + protected MetaMessage( byte[] data ) + { + super( data ); + } + + public Object clone() + { + MetaMessage metaMessage = new MetaMessage(); + try + { + metaMessage.setMessage( this.getType(), this.getData(), this.getLength() ); + } + catch( InvalidMidiDataException e ) { } + return metaMessage; + } + + public byte[] getData() + { + return super.data; + } + + public int getType() + { + return m_type; + } + + public void setMessage( int type, byte[] data, int length ) + throws InvalidMidiDataException + { + if( type < 0 && type >= 128 ) + { + throw new InvalidMidiDataException( "Invalid meta event with type " + type ); + } + m_type = type; + try { + super.setMessage( data, length ); + } + catch( InvalidMidiDataException e ) + { + throw e; + } + } +}