本文整理汇总了Java中javax.sound.midi.spi.MidiDeviceProvider.getDeviceInfo方法的典型用法代码示例。如果您正苦于以下问题:Java MidiDeviceProvider.getDeviceInfo方法的具体用法?Java MidiDeviceProvider.getDeviceInfo怎么用?Java MidiDeviceProvider.getDeviceInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sound.midi.spi.MidiDeviceProvider
的用法示例。
在下文中一共展示了MidiDeviceProvider.getDeviceInfo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNamedDevice
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
@param deviceName The name of the MidiDevice to be returned.
@param provider The MidiDeviceProvider to check for MidiDevices.
@param deviceClass The requested device type, one of Synthesizer.class,
Sequencer.class, Receiver.class or Transmitter.class.
@return A MidiDevice matching the requirements, or null if none is found.
*/
private static MidiDevice getNamedDevice(String deviceName,
MidiDeviceProvider provider,
Class deviceClass,
boolean allowSynthesizer,
boolean allowSequencer) {
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = 0; i < infos.length; i++) {
if (infos[i].getName().equals(deviceName)) {
MidiDevice device = provider.getDevice(infos[i]);
if (isAppropriateDevice(device, deviceClass,
allowSynthesizer, allowSequencer)) {
return device;
}
}
}
return null;
}
示例2: main
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
boolean allOk = true;
MidiDevice.Info[] infos;
out("\nTesting MidiDevices retrieved via MidiSystem");
infos = MidiSystem.getMidiDeviceInfo();
allOk &= testDevices(infos, null);
out("\nTesting MidiDevices retrieved from MidiDeviceProviders");
List providers = JDK13Services.getProviders(MidiDeviceProvider.class);
for (int i = 0; i < providers.size(); i++) {
MidiDeviceProvider provider = (MidiDeviceProvider)providers.get(i);
infos = provider.getDeviceInfo();
allOk &= testDevices(infos, provider.getClass().getName());
}
if (!allOk) {
throw new Exception("Test failed");
} else {
out("Test passed");
}
}
示例3: getNamedDevice
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* Return a MidiDevice with a given name from a given MidiDeviceProvider.
*
* @param deviceName The name of the MidiDevice to be returned
* @param provider The MidiDeviceProvider to check for MidiDevices
* @param deviceClass The requested device type, one of Synthesizer.class,
* Sequencer.class, Receiver.class or Transmitter.class
* @return A MidiDevice matching the requirements, or null if none is found
*/
private static MidiDevice getNamedDevice(String deviceName,
MidiDeviceProvider provider,
Class<?> deviceClass,
boolean allowSynthesizer,
boolean allowSequencer) {
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = 0; i < infos.length; i++) {
if (infos[i].getName().equals(deviceName)) {
MidiDevice device = provider.getDevice(infos[i]);
if (isAppropriateDevice(device, deviceClass,
allowSynthesizer, allowSequencer)) {
return device;
}
}
}
return null;
}
示例4: getMidiDeviceInfo
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* Get an array of all available MIDI devices.
*
* @return a possibly empty array of all available MIDI devices
*/
public static MidiDevice.Info[] getMidiDeviceInfo()
{
Iterator deviceProviders =
ServiceFactory.lookupProviders(MidiDeviceProvider.class);
List infoList = new ArrayList();
while (deviceProviders.hasNext())
{
MidiDeviceProvider provider = (MidiDeviceProvider) deviceProviders.next();
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = infos.length; i > 0; )
infoList.add(infos[--i]);
}
return (MidiDevice.Info[])
infoList.toArray(new MidiDevice.Info[infoList.size()]);
}
示例5: getMidiDeviceInfo
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* Get an array of all available MIDI devices.
*
* @return a possibly empty array of all available MIDI devices
*/
public static MidiDevice.Info[] getMidiDeviceInfo()
{
Iterator deviceProviders =
ServiceFactory.lookupProviders(MidiDeviceProvider.class);
List infoList = new ArrayList();
while (deviceProviders.hasNext())
{
MidiDeviceProvider provider = (MidiDeviceProvider) deviceProviders.next();
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = infos.length; i > 0; )
infoList.add(infos[--i]);
}
return (MidiDevice.Info[])
infoList.toArray(new MidiDevice.Info[infoList.size()]);
}
示例6: getMidiDeviceInfo
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* Get an array of all available MIDI devices.
*
* @return a possibly empty array of all available MIDI devices
*/
public static MidiDevice.Info[] getMidiDeviceInfo()
{
Iterator<MidiDeviceProvider> deviceProviders =
ServiceFactory.lookupProviders(MidiDeviceProvider.class);
List<MidiDevice.Info> infoList = new ArrayList<MidiDevice.Info>();
while (deviceProviders.hasNext())
{
MidiDeviceProvider provider = (MidiDeviceProvider) deviceProviders.next();
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = infos.length; i > 0; )
infoList.add(infos[--i]);
}
return infoList.toArray(new MidiDevice.Info[infoList.size()]);
}
示例7: getMidiDeviceInfo
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* Obtains an array of information objects representing
* the set of all MIDI devices available on the system.
* A returned information object can then be used to obtain the
* corresponding device object, by invoking
* {@link #getMidiDevice(MidiDevice.Info) getMidiDevice}.
*
* @return an array of <code>MidiDevice.Info</code> objects, one
* for each installed MIDI device. If no such devices are installed,
* an array of length 0 is returned.
*/
public static MidiDevice.Info[] getMidiDeviceInfo() {
List allInfos = new ArrayList();
List providers = getMidiDeviceProviders();
for(int i = 0; i < providers.size(); i++) {
MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
MidiDevice.Info[] tmpinfo = provider.getDeviceInfo();
for (int j = 0; j < tmpinfo.length; j++) {
allInfos.add( tmpinfo[j] );
}
}
MidiDevice.Info[] infosArray = (MidiDevice.Info[]) allInfos.toArray(new MidiDevice.Info[0]);
return infosArray;
}
示例8: getFirstDevice
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/** From a given MidiDeviceProvider, return the first appropriate device.
@param provider The MidiDeviceProvider to check for MidiDevices.
@param deviceClass The requested device type, one of Synthesizer.class,
Sequencer.class, Receiver.class or Transmitter.class.
@return A MidiDevice is considered appropriate, or null if no
appropriate device is found.
*/
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
Class deviceClass,
boolean allowSynthesizer,
boolean allowSequencer) {
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int j = 0; j < infos.length; j++) {
MidiDevice device = provider.getDevice(infos[j]);
if (isAppropriateDevice(device, deviceClass,
allowSynthesizer, allowSequencer)) {
return device;
}
}
return null;
}
示例9: getFirstDevice
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* From a given MidiDeviceProvider, return the first appropriate device.
*
* @param provider The MidiDeviceProvider to check for MidiDevices
* @param deviceClass The requested device type, one of Synthesizer.class,
* Sequencer.class, Receiver.class or Transmitter.class
* @return A MidiDevice is considered appropriate, or null if no appropriate
* device is found
*/
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
Class<?> deviceClass,
boolean allowSynthesizer,
boolean allowSequencer) {
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int j = 0; j < infos.length; j++) {
MidiDevice device = provider.getDevice(infos[j]);
if (isAppropriateDevice(device, deviceClass,
allowSynthesizer, allowSequencer)) {
return device;
}
}
return null;
}
示例10: getNamedDevice
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* Return a MidiDevice with a given name from a given MidiDeviceProvider.
*
* @param deviceName The name of the MidiDevice to be returned
* @param provider The MidiDeviceProvider to check for MidiDevices
* @param deviceClass The requested device type, one of Synthesizer.class,
* Sequencer.class, Receiver.class or Transmitter.class
* @param allowSynthesizer if true, Synthesizers are considered
* appropriate. Otherwise only pure MidiDevices are considered
* appropriate (unless allowSequencer is true). This flag only has
* an effect for deviceClass Receiver and Transmitter. For other
* device classes (Sequencer and Synthesizer), this flag has no
* effect.
* @param allowSequencer if true, Sequencers are considered appropriate.
* Otherwise only pure MidiDevices are considered appropriate
* (unless allowSynthesizer is true). This flag only has an effect
* for deviceClass Receiver and Transmitter. For other device
* classes (Sequencer and Synthesizer), this flag has no effect.
* @return A MidiDevice matching the requirements, or null if none is found
*/
private static MidiDevice getNamedDevice(String deviceName,
MidiDeviceProvider provider,
Class<?> deviceClass,
boolean allowSynthesizer,
boolean allowSequencer) {
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int i = 0; i < infos.length; i++) {
if (infos[i].getName().equals(deviceName)) {
MidiDevice device = provider.getDevice(infos[i]);
if (isAppropriateDevice(device, deviceClass,
allowSynthesizer, allowSequencer)) {
return device;
}
}
}
return null;
}
示例11: getFirstDevice
import javax.sound.midi.spi.MidiDeviceProvider; //导入方法依赖的package包/类
/**
* From a given MidiDeviceProvider, return the first appropriate device.
*
* @param provider The MidiDeviceProvider to check for MidiDevices
* @param deviceClass The requested device type, one of Synthesizer.class,
* Sequencer.class, Receiver.class or Transmitter.class
* @param allowSynthesizer if true, Synthesizers are considered
* appropriate. Otherwise only pure MidiDevices are considered
* appropriate (unless allowSequencer is true). This flag only has
* an effect for deviceClass Receiver and Transmitter. For other
* device classes (Sequencer and Synthesizer), this flag has no
* effect.
* @param allowSequencer if true, Sequencers are considered appropriate.
* Otherwise only pure MidiDevices are considered appropriate
* (unless allowSynthesizer is true). This flag only has an effect
* for deviceClass Receiver and Transmitter. For other device
* classes (Sequencer and Synthesizer), this flag has no effect.
* @return A MidiDevice is considered appropriate, or null if no appropriate
* device is found
*/
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
Class<?> deviceClass,
boolean allowSynthesizer,
boolean allowSequencer) {
MidiDevice.Info[] infos = provider.getDeviceInfo();
for (int j = 0; j < infos.length; j++) {
MidiDevice device = provider.getDevice(infos[j]);
if (isAppropriateDevice(device, deviceClass,
allowSynthesizer, allowSequencer)) {
return device;
}
}
return null;
}