001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package javax.sound.midi;
019:
020: import java.io.IOException;
021: import java.io.InputStream;
022:
023: public interface Sequencer extends MidiDevice {
024: int LOOP_CONTINUOUSLY = -1;
025:
026: class SyncMode {
027: public static final SyncMode INTERNAL_CLOCK = new SyncMode(
028: "INTERNAL_CLOCK"); //$NON-NLS-1$
029:
030: public static final SyncMode MIDI_SYNC = new SyncMode(
031: "MIDI_SYNC"); //$NON-NLS-1$
032:
033: public static final SyncMode MIDI_TIME_CODE = new SyncMode(
034: "MIDI_TIME_CODE"); //$NON-NLS-1$
035:
036: public static final SyncMode NO_SYNC = new SyncMode("NO_SYNC"); //$NON-NLS-1$
037:
038: private String name;
039:
040: protected SyncMode(String name) {
041: this .name = name;
042: }
043:
044: @Override
045: public final boolean equals(Object obj) {
046: if (this == obj) {
047: return true;
048: }
049: if (!super .equals(obj)) {
050: return false;
051: }
052: if (getClass() != obj.getClass()) {
053: return false;
054: }
055: final SyncMode other = (SyncMode) obj;
056: if (name == null) {
057: if (other.name != null) {
058: return false;
059: }
060: } else if (!name.equals(other.name)) {
061: return false;
062: }
063: return true;
064: }
065:
066: @Override
067: public final int hashCode() {
068: final int PRIME = 31;
069: int result = super .hashCode();
070: result = PRIME * result
071: + ((name == null) ? 0 : name.hashCode());
072: return result;
073: }
074:
075: @Override
076: public final String toString() {
077: return name;
078: }
079: }
080:
081: int[] addControllerEventListener(ControllerEventListener listener,
082: int[] controllers);
083:
084: boolean addMetaEventListener(MetaEventListener listener);
085:
086: int getLoopCount();
087:
088: long getLoopEndPoint();
089:
090: long getLoopStartPoint();
091:
092: Sequencer.SyncMode getMasterSyncMode();
093:
094: Sequencer.SyncMode[] getMasterSyncModes();
095:
096: long getMicrosecondLength();
097:
098: long getMicrosecondPosition();
099:
100: Sequence getSequence();
101:
102: Sequencer.SyncMode getSlaveSyncMode();
103:
104: Sequencer.SyncMode[] getSlaveSyncModes();
105:
106: float getTempoFactor();
107:
108: float getTempoInBPM();
109:
110: float getTempoInMPQ();
111:
112: long getTickLength();
113:
114: long getTickPosition();
115:
116: boolean getTrackMute(int track);
117:
118: boolean getTrackSolo(int track);
119:
120: boolean isRecording();
121:
122: boolean isRunning();
123:
124: void recordDisable(Track track);
125:
126: void recordEnable(Track track, int channel);
127:
128: int[] removeControllerEventListener(
129: ControllerEventListener listener, int[] controllers);
130:
131: void removeMetaEventListener(MetaEventListener listener);
132:
133: void setLoopCount(int count);
134:
135: void setLoopEndPoint(long tick);
136:
137: void setLoopStartPoint(long tick);
138:
139: void setMasterSyncMode(Sequencer.SyncMode sync);
140:
141: void setMicrosecondPosition(long microseconds);
142:
143: void setSequence(InputStream stream) throws IOException,
144: InvalidMidiDataException;
145:
146: void setSequence(Sequence sequence) throws InvalidMidiDataException;
147:
148: void setSlaveSyncMode(Sequencer.SyncMode sync);
149:
150: void setTempoFactor(float factor);
151:
152: void setTempoInBPM(float bpm);
153:
154: void setTempoInMPQ(float mpq);
155:
156: void setTickPosition(long tick);
157:
158: void setTrackMute(int track, boolean mute);
159:
160: void setTrackSolo(int track, boolean solo);
161:
162: void start();
163:
164: void startRecording();
165:
166: void stop();
167:
168: void stopRecording();
169:
170: }
|