• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MidiDevice类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onPortSelected

import android.media.midi.MidiDevice; //导入依赖的package包/类
@Override
public void onPortSelected(final MidiPortWrapper wrapper) {
    close();
    final MidiDeviceInfo info = wrapper.getDeviceInfo();
    if (info != null) {
        mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
                @Override
            public void onDeviceOpened(MidiDevice device) {
                if (device == null) {
                    Log.e(MidiConstants.TAG, "could not open " + info);
                } else {
                    mOpenDevice = device;
                    mInputPort = mOpenDevice.openInputPort(
                            wrapper.getPortIndex());
                    if (mInputPort == null) {
                        Log.e(MidiConstants.TAG, "could not open input port on " + info);
                    }
                }
            }
        }, null);
        // Don't run the callback on the UI thread because openInputPort might take a while.
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:24,代码来源:MidiInputPortSelector.java


示例2: findMidiDevice

import android.media.midi.MidiDevice; //导入依赖的package包/类
private void findMidiDevice() {
    MidiDeviceInfo[] infos = midiManager.getDevices();
    for(MidiDeviceInfo info : infos) {
        String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME);
        logger.log("Found MIDI device named " + name);
        if(TEENSY_MIDI_NAME.equals(name)) {
            logger.log("^^^ using this device ^^^");
            isConnecting = true;
            midiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
                @Override
                public void onDeviceOpened(MidiDevice device) {
                    if (device == null) {
                        logger.log("Error, unable to open MIDI device");
                    } else {
                        logger.log("Opened MIDI device successfully!");
                        midiDevice = device;
                    }
                    isConnecting = false;
                }
            }, null);
            break;
        }
    }
}
 
开发者ID:google,项目名称:walt,代码行数:25,代码来源:MidiTest.java


示例3: MidiDeviceAndroid

import android.media.midi.MidiDevice; //导入依赖的package包/类
/**
 * constructor
 * @param device the underlying device
 */
MidiDeviceAndroid(MidiDevice device) {
    mIsOpen = true;
    mDevice = device;
    // Note we use "input" and "output" in the Web MIDI manner.

    mOutputPorts = new MidiOutputPortAndroid[getInfo().getInputPortCount()];
    for (int i = 0; i < mOutputPorts.length; ++i) {
        mOutputPorts[i] = new MidiOutputPortAndroid(device, i);
    }

    mInputPorts = new MidiInputPortAndroid[getInfo().getOutputPortCount()];
    for (int i = 0; i < mInputPorts.length; ++i) {
        mInputPorts[i] = new MidiInputPortAndroid(device, i);
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:20,代码来源:MidiDeviceAndroid.java


示例4: onBluetoothDeviceOpen

import android.media.midi.MidiDevice; //导入依赖的package包/类
private void onBluetoothDeviceOpen(final BluetoothDevice bluetoothDevice,
        final MidiDevice midiDevice) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (midiDevice != null) {
                BluetoothMidiDeviceTracker tracker = new BluetoothMidiDeviceTracker(
                        bluetoothDevice, midiDevice);
                mOpenDeviceListAdapter.addDevice(tracker);
            } else {
                Toast.makeText(MainActivity.this,
                        "MIDI device open failed!", Toast.LENGTH_LONG)
                        .show();
            }
        }
    });
}
 
开发者ID:philburk,项目名称:android-midisuite,代码行数:18,代码来源:MainActivity.java


示例5: onActivityResult

import android.media.midi.MidiDevice; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode,
        Intent data) {
    if (requestCode == REQUEST_BLUETOOTH_SCAN && resultCode == RESULT_OK) {
        final BluetoothDevice fBluetoothDevice = (BluetoothDevice) data
                .getParcelableExtra("device");
        if (fBluetoothDevice != null) {
            Log.i(TAG, "Bluetooth device name = "
                    + fBluetoothDevice.getName()
                    + ", address = "
                    + fBluetoothDevice.getAddress());
            mMidiManager.openBluetoothDevice(fBluetoothDevice,
                    new MidiManager.OnDeviceOpenedListener() {
                        @Override
                        public void onDeviceOpened(MidiDevice device) {
                            onBluetoothDeviceOpen(fBluetoothDevice, device);
                        }
                    }, null);
        }
    }
}
 
开发者ID:philburk,项目名称:android-midisuite,代码行数:22,代码来源:MainActivity.java


示例6: onDeviceOpened

import android.media.midi.MidiDevice; //导入依赖的package包/类
@Override
public void onDeviceOpened(MidiDevice device) {
    this.device = device;
    stream(device.getInfo().getPorts())
            .filter(port -> port.getType() == MidiDeviceInfo.PortInfo.TYPE_OUTPUT).findFirst()
            .ifPresent(port -> device.openOutputPort(port.getPortNumber()).connect(this));
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:8,代码来源:MidiReceiver.java


示例7: onPortSelected

import android.media.midi.MidiDevice; //导入依赖的package包/类
@Override
public void onPortSelected(final MidiPortWrapper wrapper) {
    Log.i(MidiConstants.TAG, "onPortSelected: " + wrapper);
    close();

    final MidiDeviceInfo info = wrapper.getDeviceInfo();
    if (info != null) {
        mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {

                @Override
            public void onDeviceOpened(MidiDevice device) {
                if (device == null) {
                    Log.e(MidiConstants.TAG, "could not open " + info);
                } else {
                    mOpenDevice = device;
                    mOutputPort = device.openOutputPort(wrapper.getPortIndex());
                    if (mOutputPort == null) {
                        Log.e(MidiConstants.TAG,
                                "could not open output port for " + info);
                        return;
                    }
                    mOutputPort.connect(mDispatcher);
                }
            }
        }, null);
        // Don't run the callback on the UI thread because openOutputPort might take a while.
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:29,代码来源:MidiOutputPortSelector.java


示例8: connectToDevicePort

import android.media.midi.MidiDevice; //导入依赖的package包/类
/**
 * Open a source device and connect its output port to the
 * destinationInputPort.
 *
 * @param sourceDeviceInfo
 * @param sourcePortIndex
 * @param destinationInputPort
 */
private void connectToDevicePort(final MidiDeviceInfo sourceDeviceInfo,
        final int sourcePortIndex,
        final MidiInputPort destinationInputPort,
        final OnPortsConnectedListener listener, final Handler handler) {
    mMidiManager.openDevice(sourceDeviceInfo,
            new MidiManager.OnDeviceOpenedListener() {
                @Override
                public void onDeviceOpened(MidiDevice device) {
                    if (device == null) {
                        Log.e(MidiConstants.TAG,
                                "could not open " + sourceDeviceInfo);
                        safeClose();
                        if (listener != null) {
                            listener.onPortsConnected(null);
                        }
                    } else {
                        Log.i(MidiConstants.TAG,
                                "connectToDevicePort opened "
                                        + sourceDeviceInfo);
                        // Device was opened so connect the ports.
                        mSourceDevice = device;
                        mConnection = device.connectPorts(
                                destinationInputPort, sourcePortIndex);
                        if (mConnection == null) {
                            Log.e(MidiConstants.TAG, "could not connect to "
                                    + sourceDeviceInfo);
                            safeClose();
                        }
                        if (listener != null) {
                            listener.onPortsConnected(mConnection);
                        }
                    }
                }
            }, handler);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:44,代码来源:MidiPortConnector.java


示例9: onItemSelected

import android.media.midi.MidiDevice; //导入依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
    System.out.println(i);
    m.openDevice(infos[midiDevice], new MidiManager.OnDeviceOpenedListener() {
        @Override
        public void onDeviceOpened(MidiDevice device) {
            if (device == null) {
                Toast.makeText(getApplicationContext(), "Could not open device!",
                        Toast.LENGTH_LONG).show();
            } else {
                inputPort = device.openInputPort(0);
            }
        }
    }, new Handler(Looper.getMainLooper()));
}
 
开发者ID:MartiniMoe,项目名称:MIDICtrl,代码行数:16,代码来源:ControlActivity.java


示例10: openDevice

import android.media.midi.MidiDevice; //导入依赖的package包/类
private void openDevice(final MidiDeviceInfo info) {
    mManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
        @Override
        public void onDeviceOpened(MidiDevice device) {
            MidiManagerAndroid.this.onDeviceOpened(device, info);
        }
    }, mHandler);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:MidiManagerAndroid.java


示例11: onDeviceOpened

import android.media.midi.MidiDevice; //导入依赖的package包/类
private void onDeviceOpened(MidiDevice device, MidiDeviceInfo info) {
    mPendingDevices.remove(info);
    if (device != null) {
        MidiDeviceAndroid xdevice = new MidiDeviceAndroid(device);
        mDevices.add(xdevice);
        if (mIsInitialized) {
            nativeOnAttached(mNativeManagerPointer, xdevice);
        }
    }
    if (!mIsInitialized && mPendingDevices.isEmpty()) {
        nativeOnInitialized(mNativeManagerPointer, mDevices.toArray(new MidiDeviceAndroid[0]));
        mIsInitialized = true;
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:MidiManagerAndroid.java


示例12: onPortSelected

import android.media.midi.MidiDevice; //导入依赖的package包/类
@Override
public void onPortSelected(final MidiPortWrapper wrapper) {
    close();

    final MidiDeviceInfo info = wrapper.getDeviceInfo();
    if (info != null) {
        mMidiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {

                @Override
            public void onDeviceOpened(MidiDevice device) {
                if (device == null) {
                    Log.e(MidiConstants.TAG, "could not open " + info);
                } else {
                    mOpenDevice = device;
                    mOutputPort = device.openOutputPort(wrapper.getPortIndex());
                    if (mOutputPort == null) {
                        Log.e(MidiConstants.TAG,
                                "could not open output port for " + info);
                        return;
                    }
                    mOutputPort.connect(mDispatcher);
                }
            }
        }, null);
        // Don't run the callback on the UI thread because openOutputPort might take a while.
    }
}
 
开发者ID:philburk,项目名称:android-midisuite,代码行数:28,代码来源:MidiOutputPortSelector.java


示例13: initPort

import android.media.midi.MidiDevice; //导入依赖的package包/类
public void initPort() {
  Log.d("DEBUG", "initPort...");

  midiManager = (MidiManager) context.getSystemService(Context.MIDI_SERVICE);
  if (midiManager != null) {
    final MidiDeviceInfo[] infos = midiManager.getDevices();

    for (final MidiDeviceInfo info : infos) {
      final int numInputs = info.getInputPortCount();
      final int numOutputs = info.getOutputPortCount();

      if (numOutputs == 0)
        continue;

      Log.d("DEBUG", "in port num = " + numInputs);
      Log.d("DEBUG", "out port num = " + numOutputs);

      int portIndex = 0;
      for (MidiDeviceInfo.PortInfo portInfo : info.getPorts()) {
        Log.d("DEBUG", "name: " + portInfo.getName());

        String portName = portInfo.getName();

        final int pi = portIndex;
        midiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() {
          @Override
          public void onDeviceOpened(MidiDevice device) {
            if (device == null) {
              Log.d("DEBUG", "could not open device " + info);
            } else {
              Log.d("DEBUG", "a onDeviceOpend...");

              switch (pi) {
                case 0:
                  midiInputPort = device.openInputPort(numInputs - 1);

                  if (midiInputPort == null) {
                    Log.d("DEBUG", "midi input port is null...");
                  }
                  break;
                case 1:
                  midiOutputPort = device.openOutputPort(numOutputs - 1);

                  if (midiOutputPort == null) {
                    Log.d("DEBUG", "midi output port is null...");
                  }
                  break;
              }
              initializedMidi = true;
            }
          }
        }, null);

        portIndex++;
      }
    }
    //Log.d("DEBUG", "midi:" + infos.length);
  }
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:60,代码来源:MemeMIDI.java


示例14: getDevice

import android.media.midi.MidiDevice; //导入依赖的package包/类
/**
 * Returns the underlying device.
 */
MidiDevice getDevice() {
    return mDevice;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:7,代码来源:MidiDeviceAndroid.java


示例15: BluetoothMidiDeviceTracker

import android.media.midi.MidiDevice; //导入依赖的package包/类
/**
 * @param bluetoothDevice
 * @param midiDevice
 */
public BluetoothMidiDeviceTracker(BluetoothDevice bluetoothDevice,
        MidiDevice midiDevice) {
    this.bluetoothDevice = bluetoothDevice;
    this.midiDevice = midiDevice;
}
 
开发者ID:philburk,项目名称:android-midisuite,代码行数:10,代码来源:MainActivity.java


示例16: MidiOutputPortAndroid

import android.media.midi.MidiDevice; //导入依赖的package包/类
/**
 * constructor
 * @param device The device this port belongs to.
 * @param index The index of the port in the associated device.
 */
MidiOutputPortAndroid(MidiDevice device, int index) {
    mDevice = device;
    mIndex = index;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:MidiOutputPortAndroid.java


示例17: MidiInputPortAndroid

import android.media.midi.MidiDevice; //导入依赖的package包/类
/**
 * constructor
 * @param device the device this port belongs to.
 * @param index the index of the port in the associated device.
 */
MidiInputPortAndroid(MidiDevice device, int index) {
    mDevice = device;
    mIndex = index;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:MidiInputPortAndroid.java



注:本文中的android.media.midi.MidiDevice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TupleTag类代码示例发布时间:2022-05-23
下一篇:
Java Issuer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap