midi api java_Java声音api – 扫描MIDI设备
MidiSystem.getMidiDeviceInfo()獲取完整的提供程序列表,并從每個提供程序中提取設(shè)備的信息.
MIDIs提供程序列表從JDK底層類別com.sun.media.sound.JDK13Services中恢復(fù),通過靜態(tài)方法getProviders()
public static synchronized List getProviders(Class serviceClass)
Obtains a List containing installed
instances of the providers for the
requested service. The List of
providers is cached for the period of
time given by cachingPeriod . During
this period, the same List instance is
returned for the same type of
provider. After this period, a new
instance is constructed and returned.
The returned List is immutable.
所以,這個類似乎在你的緩存中保存了你的提供者列表,一段時間后會被重新加載.您可以使用setCachingPeriod(int seconds)方法將此時段設(shè)置為自定義值.只要我知道,默認(rèn)緩存期間設(shè)置為60秒.
例如,要每秒刷新此緩存,您可以將此行添加到您的代碼中:
com.sun.media.sound.JDK13Services.setCachingPeriod(1);
請注意,這個解決方案使用了Sun Propietary類,所以它不能100%便攜.
總結(jié)
以上是生活随笔為你收集整理的midi api java_Java声音api – 扫描MIDI设备的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 联系人排序java代码_Android仿
- 下一篇: python 冷门_csvkit---p