com.example.android.common.midi.MidiFramer Java Examples

The following examples show how to use com.example.android.common.midi.MidiFramer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MidiScope.java    From media-samples with Apache License 2.0 5 votes vote down vote up
public static void setScopeLogger(ScopeLogger logger) {
    if (logger != null) {
        // Receiver that prints the messages.
        LoggingReceiver loggingReceiver = new LoggingReceiver(logger);
        mDeviceFramer = new MidiFramer(loggingReceiver);
    }
    mScopeLogger = logger;
}
 
Example #2
Source File: MidiScope.java    From android-MidiScope with Apache License 2.0 5 votes vote down vote up
public static void setScopeLogger(ScopeLogger logger) {
    if (logger != null) {
        // Receiver that prints the messages.
        LoggingReceiver loggingReceiver = new LoggingReceiver(logger);
        mDeviceFramer = new MidiFramer(loggingReceiver);
    }
    mScopeLogger = logger;
}
 
Example #3
Source File: MainActivity.java    From media-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
    }

    mLog = (TextView) findViewById(R.id.log);
    mScroller = (ScrollView) findViewById(R.id.scroll);

    // Setup MIDI
    MidiManager midiManager = (MidiManager) getSystemService(MIDI_SERVICE);

    // Receiver that prints the messages.
    MidiReceiver loggingReceiver = new LoggingReceiver(this);

    // Receiver that parses raw data into complete messages.
    MidiFramer connectFramer = new MidiFramer(loggingReceiver);

    // Setup a menu to select an input source.
    mLogSenderSelector = new MidiOutputPortSelector(midiManager, this, R.id.spinner_senders) {
        @Override
        public void onPortSelected(final MidiPortWrapper wrapper) {
            super.onPortSelected(wrapper);
            if (wrapper != null) {
                mLogLines.clear();
                MidiDeviceInfo deviceInfo = wrapper.getDeviceInfo();
                if (deviceInfo == null) {
                    log(getString(R.string.header_text));
                } else {
                    log(MidiPrinter.formatDeviceInfo(deviceInfo));
                }
            }
        }
    };
    mLogSenderSelector.getSender().connect(connectFramer);

    // Tell the virtual device to log its messages here..
    MidiScope.setScopeLogger(this);
}
 
Example #4
Source File: SynthEngine.java    From media-samples with Apache License 2.0 4 votes vote down vote up
public SynthEngine(SimpleAudioOutput audioOutput) {
    mReceiver = new MyReceiver();
    mFramer = new MidiFramer(mReceiver);
    mAudioOutput = audioOutput;
}
 
Example #5
Source File: SynthEngine.java    From media-samples with Apache License 2.0 4 votes vote down vote up
public SynthEngine(SimpleAudioOutput audioOutput) {
    mReceiver = new MyReceiver();
    mFramer = new MidiFramer(mReceiver);
    mAudioOutput = audioOutput;
}
 
Example #6
Source File: SynthEngine.java    From android-MidiSynth with Apache License 2.0 4 votes vote down vote up
public SynthEngine(SimpleAudioOutput audioOutput) {
    mReceiver = new MyReceiver();
    mFramer = new MidiFramer(mReceiver);
    mAudioOutput = audioOutput;
}
 
Example #7
Source File: MainActivity.java    From android-MidiScope with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
    }

    mLog = (TextView) findViewById(R.id.log);
    mScroller = (ScrollView) findViewById(R.id.scroll);

    // Setup MIDI
    MidiManager midiManager = (MidiManager) getSystemService(MIDI_SERVICE);

    // Receiver that prints the messages.
    MidiReceiver loggingReceiver = new LoggingReceiver(this);

    // Receiver that parses raw data into complete messages.
    MidiFramer connectFramer = new MidiFramer(loggingReceiver);

    // Setup a menu to select an input source.
    mLogSenderSelector = new MidiOutputPortSelector(midiManager, this, R.id.spinner_senders) {
        @Override
        public void onPortSelected(final MidiPortWrapper wrapper) {
            super.onPortSelected(wrapper);
            if (wrapper != null) {
                mLogLines.clear();
                MidiDeviceInfo deviceInfo = wrapper.getDeviceInfo();
                if (deviceInfo == null) {
                    log(getString(R.string.header_text));
                } else {
                    log(MidiPrinter.formatDeviceInfo(deviceInfo));
                }
            }
        }
    };
    mLogSenderSelector.getSender().connect(connectFramer);

    // Tell the virtual device to log its messages here..
    MidiScope.setScopeLogger(this);
}
 
Example #8
Source File: SynthEngine.java    From android-MidiScope with Apache License 2.0 4 votes vote down vote up
public SynthEngine(SimpleAudioOutput audioOutput) {
    mReceiver = new MyReceiver();
    mFramer = new MidiFramer(mReceiver);
    mAudioOutput = audioOutput;
}