use of blue.services.render.DeviceInfo in project blue by kunstmusik.
the class RealtimeRenderSettingsPanel method midiInButtonActionPerformed.
// GEN-LAST:event_audioInButtonActionPerformed
private void midiInButtonActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_midiInButtonActionPerformed
String driver = null;
if (midiDriverCBox.isSelected()) {
driver = (String) midiDriverCombo.getSelectedItem();
}
String command = csoundExecText.getText();
RealtimeRenderServiceFactory factory = (RealtimeRenderServiceFactory) renderServiceComboBox.getSelectedItem();
DiskRenderService service = factory.createDiskRenderService();
List<DeviceInfo> vals = DriverUtilities.getMidiDevices(command, driver, service, true);
Object val = chooseDriver(vals);
if (val != null) {
DeviceInfo info = (DeviceInfo) val;
midiInText.setText(info.getDeviceId());
fireUpdate();
}
}
use of blue.services.render.DeviceInfo in project blue by kunstmusik.
the class RealtimeRenderSettingsPanel method audioOutButtonActionPerformed.
// GEN-LAST:event_midiOutCBoxActionPerformed
private void audioOutButtonActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_audioOutButtonActionPerformed
String driver = null;
if (audioDriverCBox.isSelected()) {
driver = (String) audioDriverCombo.getSelectedItem();
}
String command = csoundExecText.getText();
RealtimeRenderServiceFactory factory = (RealtimeRenderServiceFactory) renderServiceComboBox.getSelectedItem();
DiskRenderService service = factory.createDiskRenderService();
List<DeviceInfo> vals = DriverUtilities.getAudioDevices(command, driver, service, false);
Object val = chooseDriver(vals);
if (val != null) {
DeviceInfo info = (DeviceInfo) val;
audioOutText.setText(info.getDeviceId());
fireUpdate();
}
}
use of blue.services.render.DeviceInfo in project blue by kunstmusik.
the class DriverUtilitiesTest method testParseJackLspOutput.
@Test
public void testParseJackLspOutput() {
List<DeviceInfo> v = new ArrayList<>();
DriverUtilities.parseJackLspOutput(TEST_JACK_LSP_OUTPUT, "audio", "input", "adc:", v);
assertEquals(1, v.size());
DeviceInfo info = v.get(0);
assertEquals("adc:system:playback_", info.getDeviceId());
assertEquals("system:playback_ (10 channels)", info.toString());
v.clear();
DriverUtilities.parseJackLspOutput(TEST_JACK_LSP_OUTPUT, "audio", "output", "dac:", v);
assertEquals(1, v.size());
info = v.get(0);
assertEquals("dac:system:capture_", info.getDeviceId());
assertEquals("system:capture_ (12 channels)", info.toString());
}
use of blue.services.render.DeviceInfo in project blue by kunstmusik.
the class DriverUtilitiesTest method testParseAlsaMidiDevices.
@Test
public void testParseAlsaMidiDevices() {
assertEquals(null, DriverUtilities.parseAlsaMidiDevices("", "R", "hw:%d,%d"));
assertEquals(null, DriverUtilities.parseAlsaMidiDevices("a", "", "hw:%d,%d"));
String seqClients = TextUtilities.getTextFromSystemResource("blue/settings/test_seq_clients_alsa.txt");
List<DeviceInfo> drivers = DriverUtilities.parseAlsaMidiDevices(seqClients, "R", "hw:%d,%d");
assertEquals(5, drivers.size());
for (DeviceInfo d : drivers) {
System.out.println(d + " :" + d.getDeviceId());
}
}
use of blue.services.render.DeviceInfo in project blue by kunstmusik.
the class DriverUtilities method parseJackLspOutput.
protected static void parseJackLspOutput(String output, String portType, String subType, String prepend, List<DeviceInfo> vals) throws NumberFormatException {
// System.out.println(retVal);
String[] lines = output.split("\\n");
ArrayList<String> ports = new ArrayList<>();
Map<String, Integer> portMap = new HashMap<>();
for (int i = 0; i < lines.length; i += 3) {
if (lines[i + 2].contains(portType) && lines[i + 1].contains(subType)) {
String port = lines[i].trim();
int end = port.length() - 1;
while (end >= 0 && Character.isDigit(port.charAt(end))) {
end--;
}
end++;
String portName = port.substring(0, end);
String chn = port.substring(end);
if (portMap.containsKey(portName)) {
portMap.put(portName, portMap.get(portName) + 1);
} else {
portMap.put(portName, 1);
}
}
}
portMap.entrySet().stream().forEach((entry) -> {
String displayName = entry.getKey();
String deviceId = prepend + displayName;
if (entry.getValue().intValue() == 1) {
displayName = displayName + "(1 channel)";
} else {
displayName = displayName + " (" + entry.getValue() + " channels)";
}
vals.add(new DeviceInfo(displayName, deviceId));
});
}
Aggregations