Index: modules/sound/src/main/java/common/javax/sound/midi/MidiDevice.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/MidiDevice.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/MidiDevice.java (revision 0) @@ -0,0 +1,114 @@ +/* + * 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; + +import java.util.List; + +public interface MidiDevice +{ + public static class Info + { + private String m_name; + private String m_vendor; + private String m_description; + private String m_version; + + protected Info( String name, String vendor, String description, String version ) + { + m_name = name; + m_vendor = vendor; + m_description = description; + m_version = version; + } + + public final boolean equals( Object obj ) + { + if( obj instanceof MidiDevice.Info ) + { + if( (( Info )obj).getName().equals( m_name ) && + (( Info )obj).getVendor().equals( m_vendor ) && + (( Info )obj).getDescription().equals( m_description ) && + (( Info )obj).getVersion().equals( m_version ) ) + { + return true; + } + } + return false; + } + + public final String getDescription() + { + return m_description; + } + + public final String getName() + { + return m_name; + } + + public final String getVendor() + { + return m_vendor; + } + + public final String getVersion() + { + return m_version; + } + + public final int hashCode() + { + //TODO + return 1; + + } + + public final String toString() + { + return m_name; + } + } + + public void close(); + + public MidiDevice.Info getDeviceInfo(); + + public int getMaxReceivers(); + + public int getMaxTransmitters(); + + public long getMicrosecondPosition(); + + public Receiver getReceiver() + throws MidiUnavailableException; + + public List getReceivers(); + + public Transmitter getTransmitter() + throws MidiUnavailableException; + + public List getTransmitters(); + + public boolean isOpen(); + + public void open() + throws MidiUnavailableException; +} \ No newline at end of file Index: modules/sound/src/main/java/common/javax/sound/midi/Soundbank.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/Soundbank.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/Soundbank.java (revision 0) @@ -0,0 +1,32 @@ +/* + * 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 interface Soundbank +{ + public String getDescription(); + public Instrument getInstrument(Patch patch); + public Instrument[] getInstruments(); + public String getName(); + public SoundbankResource[] getResources(); + public String getVendor(); + public String getVersion(); +} Index: modules/sound/src/main/java/common/javax/sound/midi/Receiver.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/Receiver.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/Receiver.java (revision 0) @@ -0,0 +1,27 @@ +/* + * 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 interface Receiver +{ + public void close(); + public void send( MidiMessage message, long timeStamp ); +} Index: modules/sound/src/main/java/common/javax/sound/midi/Synthesizer.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/Synthesizer.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/Synthesizer.java (revision 0) @@ -0,0 +1,40 @@ +/* + * 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 interface Synthesizer extends MidiDevice +{ + public Instrument[] getAvailableInstruments(); + public MidiChannel[] getChannels(); + public Soundbank getDefaultSoundbank(); + public long getLatency(); + public Instrument[] getLoadedInstruments(); + public int getMaxPolyphony(); + public VoiceStatus[] getVoiceStatus(); + public boolean isSoundbankSupported( Soundbank soundbank ); + public boolean loadAllInstruments( Soundbank soundbank ); + public boolean loadInstrument( Instrument instrument ); + public boolean loadInstruments( Soundbank soundbank, Patch[] patchList ); + public boolean remapInstrument( Instrument from, Instrument to ); + public void unloadAllInstruments( Soundbank soundbank ); + public void unloadInstrument( Instrument instrument ); + public void unloadInstruments( Soundbank soundbank, Patch[] patchList ); +} Index: modules/sound/src/main/java/common/javax/sound/midi/Sequencer.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/Sequencer.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/Sequencer.java (revision 0) @@ -0,0 +1,158 @@ +/* + * 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; + +import java.io.IOException; +import java.io.InputStream; + +public interface Sequencer extends MidiDevice +{ + public static final int LOOP_CONTINUOUSLY = -1; + + public static class SyncMode + { + private String m_name; + + public static final SyncMode INTERNAL_CLOCK = new SyncMode( "INTERNAL_CLOCK" ); + public static final SyncMode MIDI_SYNC = new SyncMode( "MIDI_SYNC" ); + public static final SyncMode MIDI_TIME_CODE = new SyncMode( "MIDI_TIME_CODE" ); + public static final SyncMode NO_SYNC = new SyncMode( "NO_SYNC" ); + + protected SyncMode( String name ) + { + m_name = name; + } + + public final boolean equals( Object obj ) + { + if( obj instanceof Sequencer.SyncMode ) + { + if( (( SyncMode )obj).toString().equals( m_name ) ) + { + return true; + } + } + return false; + } + + public final int hashCode() + { + //TODO + return 1; + } + + public final String toString() + { + return m_name; + } + } + + public int[] addControllerEventListener( ControllerEventListener listener, + int[] controllers ); + + public boolean addMetaEventListener( MetaEventListener listener ); + + public int getLoopCount(); + + public long getLoopEndPoint(); + + public long getLoopStartPoint(); + + public Sequencer.SyncMode getMasterSyncMode(); + + public Sequencer.SyncMode[] getMasterSyncModes(); + + public long getMicrosecondLength(); + + public long getMicrosecondPosition(); + + public Sequence getSequence(); + + public Sequencer.SyncMode getSlaveSyncMode(); + + public Sequencer.SyncMode[] getSlaveSyncModes(); + + public float getTempoFactor(); + + public float getTempoInBPM(); + + public float getTempoInMPQ(); + + public long getTickLength(); + + public long getTickPosition(); + + public boolean getTrackMute( int track); + + public void getTrackSolo( int track, boolean solo ); + + public boolean isRecording(); + + public boolean isRunning(); + + public void recordDisable( Track track ); + + public void recordEnable( Track track, int channel ); + + public int[] removeControllerEventListener( ControllerEventListener listener, + int[] controllers ); + + public void removeMetaEventListener( MetaEventListener listener ); + + public void setLoopCount( int count ); + + public void setLoopEndPoint( long tick ); + + public void setLoopStartPoint( long tick ); + + public void setMasterSyncMode( Sequencer.SyncMode sync ); + + public void setMicrosecondPosition( long microseconds ); + + public void setSequence( InputStream stream ) + throws IOException, InvalidMidiDataException; + + public void setSequence( Sequence sequence ) + throws InvalidMidiDataException; + + public void setSlaveSyncMode( Sequencer.SyncMode sync ); + + public void setTempoFactor( float factor ); + + public void setTempoInBPM( float bpm ); + + public void setTempoInMPQ( float mpq ); + + public void setTickPosition( long tick ); + + public void setTrackMute( int track, boolean mute ); + + public void setTrackSolo( int track, boolean solo ); + + public void start(); + + public void startRecording(); + + public void stop(); + + public void stopRecording(); + +} \ No newline at end of file Index: modules/sound/src/main/java/common/javax/sound/midi/MidiChannel.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/MidiChannel.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/MidiChannel.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 interface MidiChannel +{ + public void allNotesOff(); + + public void allSoundOff(); + + public void controlChange( int controller, int value ); + + public int getChannelPressure(); + + public int getController( int controller ); + + public boolean getMono(); + + public boolean getMute(); + + public boolean getOmni(); + + public int getPitchBend(); + + public int getPolyPressure( int noteNumber ); + + public int getProgram(); + + public boolean getSolo(); + + public boolean localControl( boolean on ); + + public void noteOff( int noteNumber ); + + public void noteOff( int noteNumber, int velocity ); + + public void noteOn( int noteNumber, int velocity ); + + public void programChange( int program ); + + public void programChange( int bank, int program ); + + public void resetAllControllers(); + + public void setChannelPressure( int pressure ); + + public void setMono( boolean on ); + + public void setMute( boolean mute ); + + public void setOmni( boolean on ); + + public void setPitchBend( int bend ); + + public void setPolyPressure( int noteNumber, int pressure ); + + public void setSolo( boolean soloState ); +} Index: modules/sound/src/main/java/common/javax/sound/midi/ControllerEventListener.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/ControllerEventListener.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/ControllerEventListener.java (revision 0) @@ -0,0 +1,28 @@ +/* + * 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; + +import java.util.EventListener; + +public interface ControllerEventListener extends EventListener +{ + public void controlChange( ShortMessage event ); +} Index: modules/sound/src/main/java/common/javax/sound/midi/Transmitter.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/Transmitter.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/Transmitter.java (revision 0) @@ -0,0 +1,29 @@ +/* + * 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 interface Transmitter +{ + public void close(); + public Receiver getReceiver(); + public void setReceiver( Receiver receiver ); + +} Index: modules/sound/src/main/java/common/javax/sound/midi/MetaEventListener.java =================================================================== --- modules/sound/src/main/java/common/javax/sound/midi/MetaEventListener.java (revision 0) +++ modules/sound/src/main/java/common/javax/sound/midi/MetaEventListener.java (revision 0) @@ -0,0 +1,29 @@ +/* + * 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; + +import java.util.EventListener; + + +public interface MetaEventListener extends EventListener +{ + public void meta( MetaMessage meta ); +}