LoopDecoder
Keywords: micromod.LoopDecoder class

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

## micromod
Class LoopDecoder

    java.lang.Object
      micromod.LoopDecoder

public class LoopDecoder
extends java.lang.Object

LoopDecoder streams the samples of an instrument in the correct order. Because looping is done independently of anything else, it makes bidi loops etc. easy to do, and fast, because the loop can be made tight. This implementation is rather strange, because in order to emulate a widely used quirk of ProTracker, an Instrument can be assigned to the decoder while another one is playing. The assigned instrument will be triggered automatically by the decoder depending upon certain conditions.

Field Summary
`protected Instrument` | `assigned`
`protected Instrument` | `instrument`
`protected int` | `samplePos`

Constructor Summary
`LoopDecoder()` Constructor

Method Summary
`void` | `assignInstrument(Instrument inst)` Assign an Instrument to the decoder.
`boolean` | `finishedPlaying()`
`Instrument` | `getInstrument()`
`int` | `getSamplePosition()`
`void` | `output(short[] buffer, int offset, int length, boolean snapBack)` Output looped(or not) audio into buffer.
`void` | `setAssigned()` Switch to the assigned instrument
`void` | `setSamplePosition(int samplePosition)` Set the sample position of playback.
`protected static void` | `zero(short[] buffer, int start, int end)`

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

Field Detail

### instrument

    protected Instrument instrument

### assigned

    protected Instrument assigned

### samplePos

    protected int samplePos

Constructor Detail

### LoopDecoder

    public LoopDecoder()

  Constructor

Method Detail

### assignInstrument

    public void assignInstrument(Instrument inst)

  Assign an Instrument to the decoder.

### setAssigned

    public void setAssigned()

  Switch to the assigned instrument

### getInstrument

    public Instrument getInstrument()

  Returns:
    The Instrument currently being decoded

### finishedPlaying

    public boolean finishedPlaying()

  Returns:
    true if the Instrument has finished playback.

### setSamplePosition

    public void setSamplePosition(int samplePosition)

  Set the sample position of playback. If out of range, a sensible position will be chosen.

### getSamplePosition

    public int getSamplePosition()

  Returns:
    The current sample position.

### output

    public void output(short[] buffer,
                       int offset,
                       int length,
                       boolean snapBack)

  Output looped(or not) audio into buffer.

  Parameters:
    `snapBack` - if true, the sample position will not be updated.

### zero

    protected static void zero(short[] buffer,
                               int start,
                               int end)

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