本文整理汇总了Java中javax.sound.midi.MidiDevice.Info类的典型用法代码示例。如果您正苦于以下问题:Java Info类的具体用法?Java Info怎么用?Java Info使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Info类属于javax.sound.midi.MidiDevice包,在下文中一共展示了Info类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAvailableMidiInDevices
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static Collection<String> getAvailableMidiInDevices() {
ArrayList<String> a = new ArrayList<String>();
Info infos[] = MidiSystem.getMidiDeviceInfo();
for (Info info : infos) {
try {
MidiDevice dev=MidiSystem.getMidiDevice(info);
if (dev.getMaxTransmitters() == 0 ) continue;
String str = info.toString();
a.add(str);
} catch (MidiUnavailableException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
}
}
return a;
}
示例2: findAudioSynthesizer
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
/**
* Find available AudioSynthesizer
*/
public static AudioSynthesizer findAudioSynthesizer() throws MidiUnavailableException
{
// First check if default synthesizer is AudioSynthesizer.
Synthesizer synth = MidiSystem.getSynthesizer();
if (synth instanceof AudioSynthesizer)
return (AudioSynthesizer) synth;
// If default synhtesizer is not AudioSynthesizer, check others.
for (Info info : MidiSystem.getMidiDeviceInfo())
{
MidiDevice dev = MidiSystem.getMidiDevice(info);
if (dev instanceof AudioSynthesizer)
return (AudioSynthesizer) dev;
}
// No AudioSynthesizer was found, return null.
return null;
}
示例3: findAudioSynthesizer
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static AudioSynthesizer findAudioSynthesizer() throws MidiUnavailableException, IOException, InvalidMidiDataException {
// First check if default synthesizer is AudioSynthesizer.
Synthesizer synth = MidiSystem.getSynthesizer();
if (synth instanceof AudioSynthesizer) {
return (AudioSynthesizer) synth;
}
// If default synhtesizer is not AudioSynthesizer, check others.
Info[] infos = MidiSystem.getMidiDeviceInfo();
for (int i = 0; i < infos.length; i++) {
MidiDevice dev = MidiSystem.getMidiDevice(infos[i]);
if (dev instanceof AudioSynthesizer) {
return (AudioSynthesizer) dev;
}
}
// No AudioSynthesizer was found, return null.
return null;
}
示例4: getMidiDeviceInfo
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static MidiDevice.Info[] getMidiDeviceInfo() {
/*
* obtain the list of MidiDeviceProviders
*/
List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
//variable to save MidiDevice.Info
List<MidiDevice.Info> infos = new ArrayList<MidiDevice.Info>();
/*
* look through list of providers and save info of devices
*/
for (int i = 0; i < deviceProviders.size(); i++) {
MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
for (Info element : deviceInfo) {
infos.add(element);
}
}
MidiDevice.Info[] temp = new MidiDevice.Info[infos.size()];
return infos.toArray(temp);
}
示例5: findAudioSynthesizer
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static AudioSynthesizer findAudioSynthesizer()
throws MidiUnavailableException {
// First check if default synthesizer is AudioSynthesizer.
Synthesizer synth = MidiSystem.getSynthesizer();
if (synth instanceof AudioSynthesizer)
return (AudioSynthesizer) synth;
// If default synhtesizer is not AudioSynthesizer, check others.
Info[] infos = MidiSystem.getMidiDeviceInfo();
for (int i = 0; i < infos.length; i++) {
MidiDevice dev = MidiSystem.getMidiDevice(infos[i]);
if (dev instanceof AudioSynthesizer)
return (AudioSynthesizer) dev;
}
// No AudioSynthesizer was found, return null.
return null;
}
示例6: findAudioSynthesizer
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static AudioSynthesizer findAudioSynthesizer()
throws MidiUnavailableException {
// First check if default synthesizer is AudioSynthesizer.
Synthesizer synth = MidiSystem.getSynthesizer();
if (synth instanceof AudioSynthesizer)
return (AudioSynthesizer) synth;
// If default synhtesizer is not AudioSynthesizer, check others.
Info[] infos = MidiSystem.getMidiDeviceInfo();
for (val info : infos) {
MidiDevice dev = MidiSystem.getMidiDevice(info);
if (dev instanceof AudioSynthesizer)
return (AudioSynthesizer) dev;
}
// No AudioSynthesizer was found, return null.
return null;
}
示例7: findAudioSynthesizer
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
private AudioSynthesizer findAudioSynthesizer()
throws MidiUnavailableException {
//first check if default synthesizer is AudioSynthesizer.
Synthesizer synth = MidiSystem.getSynthesizer();
if (synth instanceof AudioSynthesizer)
return (AudioSynthesizer) synth;
//if default synthesizer is not AudioSynthesizer, check others.
Info[] infos = MidiSystem.getMidiDeviceInfo();
for (val info : infos) {
MidiDevice dev = MidiSystem.getMidiDevice(info);
if (dev instanceof AudioSynthesizer)
return (AudioSynthesizer) dev;
}
//no AudioSynthesizer was found, return null.
return null;
}
示例8: getMidiDevice
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static MidiDevice getMidiDevice(String name) {
MidiDevice.Info[] info = MidiSystem.getMidiDeviceInfo();
for (Info element : info) {
if (element.getName().equals(name)) {
try {
return MidiSystem.getMidiDevice(element);
} catch (MidiUnavailableException e) {
log.error("{}", e);
}
}
}
return null;
}
示例9: getDeviceMap
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
/**
* Returns the map of all available MIDI devices.
*
* @return the map of all available MIDI devices.
*/
public static Map<MidiDevice.Info, MidiDevice> getDeviceMap() {
Map<MidiDevice.Info, MidiDevice> result = new LinkedHashMap<>();
try {
for (Info info : MidiSystem.getMidiDeviceInfo()) {
result.put(info, MidiSystem.getMidiDevice(info));
}
} catch (MidiUnavailableException e) {
throw SpongeUtils.wrapException(e);
}
return result;
}
示例10: main
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
SoftProvider provider = new SoftProvider();
Info[] infos = provider.getDeviceInfo();
assertTrue(infos.length > 0);
for (int i = 0; i < infos.length; i++) {
assertTrue(infos[i] != null);
MidiDevice d = provider.getDevice(infos[i]);
assertTrue(d instanceof SoftSynthesizer);
}
assertTrue(provider.getDevice(new FakeInfo()) == null);
}
示例11: main
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
SoftProvider provider = new SoftProvider();
Info[] infos = provider.getDeviceInfo();
assertTrue(infos.length > 0);
for (int i = 0; i < infos.length; i++) {
assertTrue(infos[i] != null);
MidiDevice d = provider.getDevice(infos[i]);
assertTrue(d instanceof SoftSynthesizer);
}
}
示例12: getDevice
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public MidiDevice getDevice(Info info)
{
for (int i = 0; i < infos.length; i++)
{
if (info.equals(infos[i]))
{
return new DSSISynthesizer(infos[i],
infos[i].soname,
infos[i].index);
}
}
throw new IllegalArgumentException("Don't recognize MIDI device " + info);
}
示例13: getDevice
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public MidiDevice getDevice(Info info)
{
for (int i = 0; i < infos.length; i++)
{
if (info.equals(infos[i]))
{
return infos[i].getDevice();
}
}
throw new IllegalArgumentException("Don't recognize MIDI device " + info);
}
示例14: getDevice
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
public MidiDevice getDevice(Info info)
{
for (int i = 0; i < infos.length; i++)
{
if (info.equals(infos[i]))
{
return new DSSISynthesizer(infos[i],
infos[i].soname,
infos[i].index);
}
}
throw new IllegalArgumentException("Don't recognize MIDI device " + info);
}
示例15: processMidiMessageFromDevice
import javax.sound.midi.MidiDevice.Info; //导入依赖的package包/类
/**
* Redirects midi events used for controls
*
* If not consumed event is sent to midiReciever.
*
*
* @param devInfo
* @param arg0
* @param arg1
*/
public void processMidiMessageFromDevice(Info devInfo, MidiMessage arg0, long arg1) {
if (midiDeviceRouter != null && midiDeviceRouter.consume(devInfo, arg0, arg1)) {
return;
}
try {
sequencer.getReceiver().send(arg0, arg1);
} catch (MidiUnavailableException ex) {
Logger.getLogger(ProjectContainer.class.getName()).log(Level.SEVERE, null, ex);
}
}