• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MidiReceiver类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中android.media.midi.MidiReceiver的典型用法代码示例。如果您正苦于以下问题:Java MidiReceiver类的具体用法?Java MidiReceiver怎么用?Java MidiReceiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

MidiReceiver类属于android.media.midi包,在下文中一共展示了MidiReceiver类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: open

点赞 3

import android.media.midi.MidiReceiver; //导入依赖的package包/类
/**
 * Registers this object to the underlying port so as to the C++ function will be called with
 * the given C++ object when data arrives.
 * @param nativeReceiverPointer a pointer to a midi::MidiInputPortAndroid object.
 * @return true if this operation succeeds or the port is already open.
 */
@CalledByNative
boolean open(long nativeReceiverPointer) {
    if (mPort != null) {
        return true;
    }
    mPort = mDevice.openOutputPort(mIndex);
    if (mPort == null) {
        return false;
    }
    mNativeReceiverPointer = nativeReceiverPointer;
    mPort.connect(new MidiReceiver() {
        @Override
        public void onSend(byte[] bs, int offset, int count, long timestamp) {
            nativeOnData(mNativeReceiverPointer, bs, offset, count, timestamp);
        }
    });
    return true;
}
 

开发者ID:mogoweb,
项目名称:365browser,
代码行数:25,
代码来源:MidiInputPortAndroid.java

示例2: onSend

点赞 3

import android.media.midi.MidiReceiver; //导入依赖的package包/类
@Override
public void onSend(byte[] msg, int offset, int count, long timestamp) throws IOException {
   for (MidiReceiver receiver : mReceivers) {
        try {
            receiver.send(msg, offset, count, timestamp);
        } catch (IOException e) {
            // if the receiver fails we remove the receiver but do not propagate the exception
            mReceivers.remove(receiver);
        }
    }
}
 

开发者ID:philburk,
项目名称:android-midisuite,
代码行数:12,
代码来源:MidiDispatcher.java

示例3: midiSend

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
private void midiSend(byte[] buffer, int count, long timestamp) {
    if (mKeyboardReceiverSelector != null) {
        try {
            // send event immediately
            MidiReceiver receiver = mKeyboardReceiverSelector.getReceiver();
            if (receiver != null) {
                receiver.send(buffer, 0, count, timestamp);
            }
        } catch (IOException e) {
            Log.e(TAG, "mKeyboardReceiverSelector.send() failed " + e);
        }
    }
}
 

开发者ID:philburk,
项目名称:android-midisuite,
代码行数:14,
代码来源:MainActivity.java

示例4: onGetInputPortReceivers

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
@Override
public MidiReceiver[] onGetInputPortReceivers() {
    return new MidiReceiver[] { mInputReceiver };
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:5,
代码来源:MidiScope.java

示例5: onCreate

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    setActionBar((Toolbar) findViewById(R.id.toolbar));
    ActionBar actionBar = getActionBar();
    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);
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:45,
代码来源:MainActivity.java

示例6: getReceiver

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
public MidiReceiver getReceiver() {
    return mInputPort;
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:4,
代码来源:MidiInputPortSelector.java

示例7: flush

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
@Override
public void flush() throws IOException {
   for (MidiReceiver receiver : mReceivers) {
        receiver.flush();
   }
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:7,
代码来源:MidiDispatcher.java

示例8: MidiFramer

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
public MidiFramer(MidiReceiver receiver) {
    mReceiver = receiver;
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:4,
代码来源:MidiFramer.java

示例9: onGetInputPortReceivers

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
@Override
public MidiReceiver[] onGetInputPortReceivers() {
    return new MidiReceiver[]{mSynthEngine};
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:5,
代码来源:MidiSynthDeviceService.java

示例10: onGetInputPortReceivers

点赞 2

import android.media.midi.MidiReceiver; //导入依赖的package包/类
@Override
public MidiReceiver[] onGetInputPortReceivers() {
    return new MidiReceiver[] { mSynthEngine };
}
 

开发者ID:philburk,
项目名称:android-midisuite,
代码行数:5,
代码来源:MidiSynthDeviceService.java

示例11: onConnect

点赞 1

import android.media.midi.MidiReceiver; //导入依赖的package包/类
/**
 * Called to connect a {@link MidiReceiver} to the sender
 *
 * @param receiver the receiver to connect
 */
@Override
public void onConnect(MidiReceiver receiver) {
    mReceivers.add(receiver);
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:10,
代码来源:MidiDispatcher.java

示例12: onDisconnect

点赞 1

import android.media.midi.MidiReceiver; //导入依赖的package包/类
/**
 * Called to disconnect a {@link MidiReceiver} from the sender
 *
 * @param receiver the receiver to disconnect
 */
@Override
public void onDisconnect(MidiReceiver receiver) {
    mReceivers.remove(receiver);
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:10,
代码来源:MidiDispatcher.java

示例13: getReceiver

点赞 1

import android.media.midi.MidiReceiver; //导入依赖的package包/类
/**
 * This MidiReceiver will write date to the scheduling buffer.
 * @return the MidiReceiver
 */
public MidiReceiver getReceiver() {
    return mReceiver;
}
 

开发者ID:sdrausty,
项目名称:buildAPKsSamples,
代码行数:8,
代码来源:MidiEventScheduler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)