Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / classpath / gnu / javax / sound / midi / alsa / AlsaMidiSequencerDevice.java
blobc91f1e39851630a8c7c0f3a8f62f300a8118639e
1 /* AlsaMidiSequencerDevice.java -- The ALSA MIDI sequencer device
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package gnu.javax.sound.midi.alsa;
41 import java.io.IOException;
42 import java.io.InputStream;
44 import javax.sound.midi.ControllerEventListener;
45 import javax.sound.midi.InvalidMidiDataException;
46 import javax.sound.midi.MetaEventListener;
47 import javax.sound.midi.MidiUnavailableException;
48 import javax.sound.midi.Receiver;
49 import javax.sound.midi.Sequence;
50 import javax.sound.midi.Sequencer;
51 import javax.sound.midi.Track;
52 import javax.sound.midi.Transmitter;
54 // FIXME: These next two imports are only required by gcj it seems.
55 import javax.sound.midi.MidiDevice.Info;
56 import javax.sound.midi.Sequencer.SyncMode;
58 /**
59 * The ALSA MIDI sequencer device. This is a singleton device.
61 * @author green@redhat.com
64 public class AlsaMidiSequencerDevice implements Sequencer
66 // The singleton instance.
67 public final static AlsaMidiSequencerDevice instance = new AlsaMidiSequencerDevice();
69 // A pointer to a native chunk of memory
70 private long nativeState;
72 // The sequence to process
73 private Sequence sequence;
75 /**
76 * A private constructor. There should only be one instance of this
77 * device.
79 private AlsaMidiSequencerDevice()
81 super();
84 /**
85 * Return the sequencer singleton.
87 * @return the sequencer singleton
89 public static AlsaMidiSequencerDevice getInstance()
91 return instance;
94 /* (non-Javadoc)
95 * @see javax.sound.midi.Sequencer#setSequence(javax.sound.midi.Sequence)
97 public void setSequence(Sequence seq) throws InvalidMidiDataException
99 sequence = seq;
102 /* (non-Javadoc)
103 * @see javax.sound.midi.Sequencer#setSequence(java.io.InputStream)
105 public void setSequence(InputStream istream) throws IOException,
106 InvalidMidiDataException
108 // TODO Auto-generated method stub
111 /* (non-Javadoc)
112 * @see javax.sound.midi.Sequencer#getSequence()
114 public Sequence getSequence()
116 return sequence;
119 /* (non-Javadoc)
120 * @see javax.sound.midi.Sequencer#start()
122 public void start()
124 // TODO Auto-generated method stub
127 /* (non-Javadoc)
128 * @see javax.sound.midi.Sequencer#stop()
130 public void stop()
132 // TODO Auto-generated method stub
136 /* (non-Javadoc)
137 * @see javax.sound.midi.Sequencer#isRunning()
139 public boolean isRunning()
141 // TODO Auto-generated method stub
142 return false;
145 /* (non-Javadoc)
146 * @see javax.sound.midi.Sequencer#startRecording()
148 public void startRecording()
150 // TODO Auto-generated method stub
154 /* (non-Javadoc)
155 * @see javax.sound.midi.Sequencer#stopRecording()
157 public void stopRecording()
159 // TODO Auto-generated method stub
163 /* (non-Javadoc)
164 * @see javax.sound.midi.Sequencer#isRecording()
166 public boolean isRecording()
168 // TODO Auto-generated method stub
169 return false;
172 /* (non-Javadoc)
173 * @see javax.sound.midi.Sequencer#recordEnable(javax.sound.midi.Track, int)
175 public void recordEnable(Track track, int channel)
177 // TODO Auto-generated method stub
181 /* (non-Javadoc)
182 * @see javax.sound.midi.Sequencer#recordDisable(javax.sound.midi.Track)
184 public void recordDisable(Track track)
186 // TODO Auto-generated method stub
190 /* (non-Javadoc)
191 * @see javax.sound.midi.Sequencer#getTempoInBPM()
193 public float getTempoInBPM()
195 // TODO Auto-generated method stub
196 return 0;
199 /* (non-Javadoc)
200 * @see javax.sound.midi.Sequencer#setTempoInBPM(float)
202 public void setTempoInBPM(float bpm)
204 // TODO Auto-generated method stub
208 /* (non-Javadoc)
209 * @see javax.sound.midi.Sequencer#getTempoInMPQ()
211 public float getTempoInMPQ()
213 // TODO Auto-generated method stub
214 return 0;
217 /* (non-Javadoc)
218 * @see javax.sound.midi.Sequencer#setTempoInMPQ(float)
220 public void setTempoInMPQ(float mpq)
222 // TODO Auto-generated method stub
226 /* (non-Javadoc)
227 * @see javax.sound.midi.Sequencer#setTempoFactor(float)
229 public void setTempoFactor(float factor)
231 // TODO Auto-generated method stub
235 /* (non-Javadoc)
236 * @see javax.sound.midi.Sequencer#getTempoFactor()
238 public float getTempoFactor()
240 // TODO Auto-generated method stub
241 return 0;
244 /* (non-Javadoc)
245 * @see javax.sound.midi.Sequencer#getTickLength()
247 public long getTickLength()
249 // TODO Auto-generated method stub
250 return 0;
253 /* (non-Javadoc)
254 * @see javax.sound.midi.Sequencer#getTickPosition()
256 public long getTickPosition()
258 // TODO Auto-generated method stub
259 return 0;
262 /* (non-Javadoc)
263 * @see javax.sound.midi.Sequencer#setTickPosition(long)
265 public void setTickPosition(long tick)
267 // TODO Auto-generated method stub
271 /* (non-Javadoc)
272 * @see javax.sound.midi.Sequencer#getMicrosecondLength()
274 public long getMicrosecondLength()
276 // TODO Auto-generated method stub
277 return 0;
280 /* (non-Javadoc)
281 * @see javax.sound.midi.Sequencer#getMicrosecondPosition()
283 public long getMicrosecondPosition()
285 // TODO Auto-generated method stub
286 return 0;
289 /* (non-Javadoc)
290 * @see javax.sound.midi.Sequencer#setMicrosecondPosition(long)
292 public void setMicrosecondPosition(long microsecond)
294 // TODO Auto-generated method stub
298 /* (non-Javadoc)
299 * @see javax.sound.midi.Sequencer#setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode)
301 public void setMasterSyncMode(SyncMode sync)
303 // TODO Auto-generated method stub
307 /* (non-Javadoc)
308 * @see javax.sound.midi.Sequencer#getMasterSyncMode()
310 public SyncMode getMasterSyncMode()
312 // TODO Auto-generated method stub
313 return null;
316 /* (non-Javadoc)
317 * @see javax.sound.midi.Sequencer#getMasterSyncModes()
319 public SyncMode[] getMasterSyncModes()
321 // TODO Auto-generated method stub
322 return null;
325 /* (non-Javadoc)
326 * @see javax.sound.midi.Sequencer#setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode)
328 public void setSlaveSyncMode(SyncMode sync)
330 // TODO Auto-generated method stub
334 /* (non-Javadoc)
335 * @see javax.sound.midi.Sequencer#getSlaveSyncMode()
337 public SyncMode getSlaveSyncMode()
339 // TODO Auto-generated method stub
340 return null;
343 /* (non-Javadoc)
344 * @see javax.sound.midi.Sequencer#getSlaveSyncModes()
346 public SyncMode[] getSlaveSyncModes()
348 // TODO Auto-generated method stub
349 return null;
352 /* (non-Javadoc)
353 * @see javax.sound.midi.Sequencer#setTrackMute(int, boolean)
355 public void setTrackMute(int track, boolean mute)
357 // TODO Auto-generated method stub
361 /* (non-Javadoc)
362 * @see javax.sound.midi.Sequencer#getTrackMute(int)
364 public boolean getTrackMute(int track)
366 // TODO Auto-generated method stub
367 return false;
370 /* (non-Javadoc)
371 * @see javax.sound.midi.Sequencer#setTrackSolo(int, boolean)
373 public void setTrackSolo(int track, boolean solo)
375 // TODO Auto-generated method stub
379 /* (non-Javadoc)
380 * @see javax.sound.midi.Sequencer#getTrackSolo(int)
382 public boolean getTrackSolo(int track)
384 // TODO Auto-generated method stub
385 return false;
388 /* (non-Javadoc)
389 * @see javax.sound.midi.Sequencer#addMetaEventListener(javax.sound.midi.MetaEventListener)
391 public boolean addMetaEventListener(MetaEventListener listener)
393 // TODO Auto-generated method stub
394 return false;
397 /* (non-Javadoc)
398 * @see javax.sound.midi.Sequencer#removeMetaEventListener(javax.sound.midi.MetaEventListener)
400 public void removeMetaEventListener(MetaEventListener listener)
402 // TODO Auto-generated method stub
406 /* (non-Javadoc)
407 * @see javax.sound.midi.Sequencer#addControllerEventListener(javax.sound.midi.ControllerEventListener, int[])
409 public int[] addControllerEventListener(ControllerEventListener listener,
410 int[] controllers)
412 // TODO Auto-generated method stub
413 return null;
416 /* (non-Javadoc)
417 * @see javax.sound.midi.Sequencer#removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[])
419 public int[] removeControllerEventListener(ControllerEventListener listener,
420 int[] controllers)
422 // TODO Auto-generated method stub
423 return null;
426 /* (non-Javadoc)
427 * @see javax.sound.midi.MidiDevice#getDeviceInfo()
429 public Info getDeviceInfo()
431 // TODO Auto-generated method stub
432 return null;
435 /* (non-Javadoc)
436 * @see javax.sound.midi.MidiDevice#open()
438 public void open() throws MidiUnavailableException
440 synchronized(this)
442 // Check to see if we're open already.
443 if (nativeState != 0)
444 return;
446 nativeState = open_();
451 * Allocate the native state object, and open the sequencer.
453 * @return a long representation of a pointer to the nativeState.
455 private native long open_();
458 * Close the sequencer and free the native state object.
460 private native void close_(long nativeState);
462 /* (non-Javadoc)
463 * @see javax.sound.midi.MidiDevice#close()
465 public void close()
467 synchronized(this)
469 close_(nativeState);
470 nativeState = 0;
474 /* (non-Javadoc)
475 * @see javax.sound.midi.MidiDevice#isOpen()
477 public boolean isOpen()
479 synchronized(this)
481 return (nativeState != 0);
485 /* (non-Javadoc)
486 * @see javax.sound.midi.MidiDevice#getMaxReceivers()
488 public int getMaxReceivers()
490 return -1;
493 /* (non-Javadoc)
494 * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
496 public int getMaxTransmitters()
498 return -1;
501 /* (non-Javadoc)
502 * @see javax.sound.midi.MidiDevice#getReceiver()
504 public Receiver getReceiver() throws MidiUnavailableException
506 // TODO Auto-generated method stub
507 return null;
510 /* (non-Javadoc)
511 * @see javax.sound.midi.MidiDevice#getTransmitter()
513 public Transmitter getTransmitter() throws MidiUnavailableException
515 // TODO Auto-generated method stub
516 return null;