File: MidiDeviceOpenedListener.java

package info (click to toggle)
rtmidi 6.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,392 kB
  • sloc: cpp: 5,370; xml: 240; sh: 229; makefile: 92; ansic: 19; java: 16
file content (26 lines) | stat: -rw-r--r-- 804 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.yellowlab.rtmidi;

import android.media.midi.MidiDevice;
import android.media.midi.MidiManager;

/**
 * This class must be included in the Android app using rtmidi. It is used by the
 * C++ code in the Android library because a Java listener class is required by the
 * Android Midi API.
 */
public class MidiDeviceOpenedListener implements MidiManager.OnDeviceOpenedListener {
    private long nativeId;
    private boolean isOutput;

    public MidiDeviceOpenedListener(long id, boolean output) {
        nativeId = id;
        isOutput = output;
    }

    @Override
    public void onDeviceOpened(MidiDevice midiDevice) {
        midiDeviceOpened(midiDevice, nativeId, isOutput);
    }

    private native static void midiDeviceOpened(MidiDevice midiDevice, long id, boolean isOutput);
}