Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.huguesjohnson.tiamat.audio
Class MidiPlayer

    java.lang.Object
      com.huguesjohnson.tiamat.audio.AudioPlayer
          com.huguesjohnson.tiamat.audio.MidiPlayer

All Implemented Interfaces:
  java.util.EventListener, javax.sound.midi.MetaEventListener

    public class MidiPlayer

extends AudioPlayer
implements javax.sound.midi.MetaEventListener

MidiPlayer - plays midi files

Author:
  Hugues Johnson

Field Summary

Fields inherited from class com.huguesjohnson.tiamat.audio.AudioPlayer
`INFINITE_LOOP, loop, trackIndex, trackList`

Constructor Summary
`MidiPlayer()`

Method Summary
`void` | `meta(javax.sound.midi.MetaMessage metaMessage)` Trap meta events.
`void` | `play(java.lang.String path)` Play with no loop.
`void` | `play(java.lang.String[] paths)` Play with no loop.
`void` | `play(java.lang.String[] paths, int loop)` Play with looping, loops back to the first track after playing the last one.
`void` | `play(java.lang.String path, int loop)` Play with looping.
`void` | `stop()` Stops playback.

Methods inherited from class com.huguesjohnson.tiamat.audio.AudioPlayer
`toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MidiPlayer

    public MidiPlayer()

Method Detail

### play

    public void play(java.lang.String path)

  Description copied from class: `AudioPlayer`
  Play with no loop.

  Specified by:
    `play` in class `AudioPlayer`
  Parameters:
    `path` - The path of the audio file to play.

### play

    public void play(java.lang.String path,
                     int loop)

  Description copied from class: `AudioPlayer`
  Play with looping.

  Specified by:
    `play` in class `AudioPlayer`
  Parameters:
    `path` - The path of the audio file to play.
    `loop` - The number of times to loop, if loop <0 the infinite loop.

### play

    public void play(java.lang.String[] paths)

  Description copied from class: `AudioPlayer`
  Play with no loop.

  Specified by:
    `play` in class `AudioPlayer`
  Parameters:
    `paths` - The paths of the audio files to play.

### play

    public void play(java.lang.String[] paths,
                     int loop)

  Description copied from class: `AudioPlayer`
  Play with looping, loops back to the first track after playing the last one.

  Specified by:
    `play` in class `AudioPlayer`
  Parameters:
    `paths` - The paths of the audio files to play.
    `loop` - The number of times to loop, if loop <0 the infinite loop.

### stop

    public void stop()

  Description copied from class: `AudioPlayer`
  Stops playback.

  Specified by:
    `stop` in class `AudioPlayer`

### meta

    public void meta(javax.sound.midi.MetaMessage metaMessage)

  Trap meta events. Why isn't there a simple way to loop midi? Let me get this straight.. the only way to loop a midi is to:
  - 1) register a MetaEventListener
  - 2) override the meta() method.. whatever that does
  - 3) look for type 47, of course this is not enumerated anywhere
  - 4) manually restart the sequencer
  Someone please explain to me why this is better than sequencer.setLoop(true)?

  Specified by:
    `meta` in interface `javax.sound.midi.MetaEventListener`
  Parameters:
    `metaMessage` - I have no idea.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD