/[svn]/jsampler/trunk/src/org/jsampler/JSUtils.java
ViewVC logotype

Annotation of /jsampler/trunk/src/org/jsampler/JSUtils.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2200 - (hide annotations) (download)
Sun Jul 3 22:01:16 2011 UTC (12 years, 9 months ago) by iliev
File size: 19519 byte(s)
* added support for exporting effects to LSCP script
* Sampler Browser (work in progress): initial
  implementation of sampler channels

1 iliev 1915 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4     * Copyright (C) 2009 Grigor Iliev <grigor@grigoriliev.com>
5     *
6     * This file is part of JSampler.
7     *
8     * JSampler is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License version 2
10     * as published by the Free Software Foundation.
11     *
12     * JSampler is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with JSampler; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20     * MA 02111-1307 USA
21     */
22    
23     package org.jsampler;
24    
25     import java.io.ByteArrayOutputStream;
26    
27     import java.io.File;
28     import java.text.DateFormat;
29     import java.util.logging.Level;
30 iliev 1916 import java.util.zip.GZIPOutputStream;
31 iliev 1915
32     import org.jsampler.view.JSChannel;
33     import org.jsampler.view.JSChannelsPane;
34    
35     import org.linuxsampler.lscp.AudioOutputChannel;
36     import org.linuxsampler.lscp.AudioOutputDevice;
37     import org.linuxsampler.lscp.Client;
38     import org.linuxsampler.lscp.FxSend;
39     import org.linuxsampler.lscp.MidiInputDevice;
40     import org.linuxsampler.lscp.MidiPort;
41     import org.linuxsampler.lscp.Parameter;
42     import org.linuxsampler.lscp.SamplerChannel;
43    
44 iliev 1916 import org.w3c.dom.Document;
45     import org.w3c.dom.Element;
46    
47 iliev 1915 import static org.jsampler.CC.preferences;
48     import static org.jsampler.JSI18n.i18n;
49    
50     /**
51     *
52     * @author Grigor Iliev
53     */
54     public class JSUtils {
55    
56     /** Forbids the instantiation of this class */
57     private
58     JSUtils() { }
59    
60     /**
61     * Checks whether the JSampler home directory is specified and exist.
62     * If the JSampler home directory is not specifed, or is specified
63     * but doesn't exist, a procedure of specifying a JSampler home
64     * directory is initiated.
65     * @see org.jsampler.view.JSMainFrame#installJSamplerHome
66     */
67     public static void
68     checkJSamplerHome() {
69     if(CC.getJSamplerHome() != null) {
70     File f = new File(CC.getJSamplerHome());
71     if(f.exists() && f.isDirectory()) {
72     return;
73     }
74     }
75    
76     CC.getMainFrame().installJSamplerHome();
77     }
78    
79     /**
80     * Changes the JSampler's home directory and moves all files from
81     * the old JSampler's home directory to the new one. If all files are
82     * moved succesfully, the old directory is deleted.
83     * @param path The location of the new JSampler's home directory. If
84     * the last directory in the path doesn't exist, it is created.
85     */
86     public static void
87     changeJSamplerHome(String path) {
88     File fNew = new File(path);
89     if(fNew.exists() && fNew.isFile()) {
90     HF.showErrorMessage(i18n.getError("CC.JSamplerHomeIsNotDir!"));
91     return;
92     }
93    
94     if(!fNew.exists()) {
95     if(!fNew.mkdir()) {
96     String s = fNew.getAbsolutePath();
97     HF.showErrorMessage(i18n.getError("CC.mkdirFailed", s));
98     return;
99     }
100     }
101    
102     if(CC.getJSamplerHome() == null || path.equals(CC.getJSamplerHome())) {
103     CC.setJSamplerHome(fNew.getAbsolutePath());
104     return;
105     }
106    
107     File fOld = new File(CC.getJSamplerHome());
108     if(!fOld.exists() || !fOld.isDirectory()) {
109     CC.setJSamplerHome(fNew.getAbsolutePath());
110     return;
111     }
112    
113     File[] files = fOld.listFiles();
114     boolean b = true;
115     if(files != null) {
116     String s = fNew.getAbsolutePath() + File.separator;
117     for(File f : files) if(!f.renameTo(new File(s + f.getName()))) b = false;
118     }
119    
120     if(b) fOld.delete();
121     CC.setJSamplerHome(fNew.getAbsolutePath());
122     }
123    
124     public static String
125     exportInstrMapsToLscpScript() {
126     StringBuffer sb = new StringBuffer("# Exported by: ");
127     sb.append("JSampler - a java front-end for LinuxSampler\r\n# Version: ");
128     sb.append(JSampler.VERSION).append("\r\n");
129     sb.append("# Date: ").append(new java.util.Date().toString()).append("\r\n\r\n");
130    
131     Client lscpClient = new Client(true);
132     ByteArrayOutputStream out = new ByteArrayOutputStream();
133     lscpClient.setPrintOnlyModeOutputStream(out);
134    
135     exportInstrMapsToLscpScript(lscpClient);
136     sb.append(out.toString());
137     out.reset();
138    
139     return sb.toString();
140     }
141    
142     private static void
143     exportInstrMapsToLscpScript(Client lscpClient) {
144     try {
145     lscpClient.removeAllMidiInstrumentMaps();
146     MidiInstrumentMap[] maps = CC.getSamplerModel().getMidiInstrumentMaps();
147     for(int i = 0; i < maps.length; i++) {
148     lscpClient.addMidiInstrumentMap(maps[i].getName());
149     exportInstrumentsToLscpScript(i, maps[i], lscpClient);
150     }
151     } catch(Exception e) {
152     CC.getLogger().log(Level.FINE, HF.getErrorMessage(e), e);
153     HF.showErrorMessage(e);
154     }
155     }
156    
157     private static void
158     exportInstrumentsToLscpScript(int mapId, MidiInstrumentMap map, Client lscpClient)
159     throws Exception {
160    
161     boolean b = preferences().getBoolProperty(JSPrefs.LOAD_MIDI_INSTRUMENTS_IN_BACKGROUND);
162    
163     for(MidiInstrument i : map.getAllMidiInstruments()) {
164     lscpClient.mapMidiInstrument(mapId, i.getInfo().getEntry(), i.getInfo(), b);
165     }
166     }
167    
168     public static String
169     exportInstrMapsToText() {
170     String nl = System.getProperty("line.separator");
171     StringBuffer sb = new StringBuffer();
172    
173    
174     MidiInstrumentMap[] maps = CC.getSamplerModel().getMidiInstrumentMaps();
175     for(int i = 0; i < maps.length; i++) {
176     sb.append("MIDI Instrument Map: ");
177     sb.append(maps[i].getName()).append(nl);
178     exportInstrumentsToText(maps[i], sb);
179     }
180    
181     String date = DateFormat.getDateInstance().format(new java.util.Date());
182     sb.append("Date: ").append(date).append(nl);
183     sb.append("Exported by: JSampler - a java front-end for LinuxSampler, Version ");
184     sb.append(JSampler.VERSION).append(nl);
185    
186     return sb.toString();
187     }
188    
189     private static void
190     exportInstrumentsToText(MidiInstrumentMap map, StringBuffer sb) {
191     int bank = -1;
192     String nl = System.getProperty("line.separator");
193     int bnkOffset = preferences().getIntProperty(JSPrefs.FIRST_MIDI_BANK_NUMBER);
194     int prgOffset = preferences().getIntProperty(JSPrefs.FIRST_MIDI_PROGRAM_NUMBER);
195    
196     for(MidiInstrument i : map.getAllMidiInstruments()) {
197     int newBank = i.getInfo().getMidiBank();
198     if(newBank != bank) {
199     bank = newBank;
200     sb.append(nl).append("\tMIDI Bank ");
201     sb.append(bank + bnkOffset).append(nl);
202     }
203     sb.append("\t[").append(bank + bnkOffset).append("] ");
204     sb.append(i.getInfo().getMidiProgram() + prgOffset);
205     sb.append(" - ").append(i.getName()).append(nl);
206     }
207    
208     sb.append(nl);
209     }
210    
211     public static String
212     exportInstrMapsToHtml() {
213     String nl = System.getProperty("line.separator");
214     StringBuffer sb = new StringBuffer("<html>").append(nl);
215    
216     sb.append("<head><title>MIDI Instrument Maps</title></head>");
217    
218     sb.append("<body>").append(nl);
219     sb.append("<h1>MIDI Instrument Maps</h1>").append(nl);
220    
221     String date = DateFormat.getDateInstance().format(new java.util.Date());
222     sb.append("Date: ").append(date).append("<br>").append(nl);
223     sb.append("Exported by <a href=http://linuxsampler.org/jsampler/manual/html/jsampler.html>");
224     sb.append("JSampler</a> version ");
225     sb.append(JSampler.VERSION).append("<br>").append(nl);
226    
227     MidiInstrumentMap[] maps = CC.getSamplerModel().getMidiInstrumentMaps();
228    
229     sb.append("<ol>").append(nl);
230     for(int i = 0; i < maps.length; i++) {
231     String name = toHtmlEscapedText(maps[i].getName());
232     sb.append("<li><a href=#map-").append(i + 1).append(">");
233     sb.append(name).append("</a></li>").append(nl);
234     }
235     sb.append("</ol>").append(nl);
236    
237     for(int i = 0; i < maps.length; i++) {
238     String s = toHtmlEscapedText(maps[i].getName());
239     sb.append("<h2><a name=map-").append(i + 1).append(">");
240     sb.append(s).append("</a></h2>").append(nl);
241     exportInstrumentsToHtml(i, maps[i], sb);
242     }
243    
244     sb.append(nl).append("</body>").append(nl).append("</html>");
245     return sb.toString();
246     }
247    
248     private static void
249     exportInstrumentsToHtml(int mapId, MidiInstrumentMap map, StringBuffer sb) {
250     int bank = -1;
251     String nl = System.getProperty("line.separator");
252     int bnkOffset = preferences().getIntProperty(JSPrefs.FIRST_MIDI_BANK_NUMBER);
253     int prgOffset = preferences().getIntProperty(JSPrefs.FIRST_MIDI_PROGRAM_NUMBER);
254    
255     sb.append("<ol>").append(nl);
256     for(MidiInstrument i : map.getAllMidiInstruments()) {
257     int newBank = i.getInfo().getMidiBank();
258     if(newBank != bank) {
259     bank = newBank;
260     String s = "map-" + (mapId + 1) + "-bank-" + (bank + bnkOffset);
261     sb.append(nl).append("<li><a href=#").append(s);
262     sb.append(">MIDI Bank ");
263     sb.append(bank + bnkOffset).append("</a></li>").append(nl);
264     }
265     }
266     sb.append("</ol>").append(nl);
267    
268     bank = -1;
269     String bankName = "";
270    
271     sb.append("<table border=0>").append(nl);
272     for(MidiInstrument i : map.getAllMidiInstruments()) {
273     int newBank = i.getInfo().getMidiBank();
274     if(newBank != bank) {
275     bank = newBank;
276     sb.append("</table>").append(nl);
277    
278     bankName = "map-" + (mapId + 1) + "-bank-" + (bank + bnkOffset);
279     sb.append(nl).append("<h4><a name=").append(bankName);
280     sb.append(">MIDI Bank ");
281     sb.append(bank + bnkOffset).append("</a></h4>").append(nl);
282    
283     sb.append("<table border=0>").append(nl);
284     }
285    
286     sb.append("<tr><td align='right'>");
287     sb.append(i.getInfo().getMidiProgram() + prgOffset).append(" - </td>");
288     String file = i.getInfo().getFilePath();
289     String tooltip = "File: " + file + ", Index: " + i.getInfo().getInstrumentIndex();
290     sb.append("<td><a title='").append(tooltip).append("'>");
291     String s = toHtmlEscapedText(i.getName());
292     sb.append(s).append("</a></td>");
293    
294     sb.append("<td>&nbsp;&nbsp;<a href=#").append(bankName).append(">");
295     sb.append("[").append(bank + bnkOffset).append("]</a></td>").append(nl);
296     sb.append("</tr>");
297     }
298     sb.append("</table>").append(nl);
299    
300     sb.append(nl);
301     }
302    
303     private static String
304     toHtmlEscapedText(String s) {
305     s = s.replaceAll("&", "&amp;");
306     s = s.replaceAll("<", "&lt;");
307     s = s.replaceAll(">", "&gt;");
308    
309     return s;
310     }
311    
312 iliev 1916 public static byte[]
313     exportInstrMapsToRGD() {
314     Document doc = DOMUtils.createEmptyDocument();
315    
316     Element rgd = doc.createElement("rosegarden-data");
317     rgd.setAttribute("version", "1.7.2");
318     doc.appendChild(rgd);
319    
320     Element studio = doc.createElement("studio");
321     studio.setAttribute("thrufilter", "0");
322     studio.setAttribute("recordfilter", "0");
323     rgd.appendChild(studio);
324    
325     MidiInstrumentMap[] maps = CC.getSamplerModel().getMidiInstrumentMaps();
326     for(int i = 0; i < maps.length; i++) {
327     Element dev = doc.createElement("device");
328     dev.setAttribute("id", String.valueOf(i));
329     dev.setAttribute("name", "LinuxSampler: " + maps[i].getName());
330     dev.setAttribute("type", "midi");
331     studio.appendChild(dev);
332    
333     Element el = doc.createElement("librarian");
334     el.setAttribute("name", "Grigor Iliev");
335     el.setAttribute("email", "grigor@grigoriliev.com");
336     dev.appendChild(el);
337    
338     exportInstrumentsToRGD(maps[i], dev);
339     }
340    
341     ByteArrayOutputStream baos = new ByteArrayOutputStream();
342     DOMUtils.writeObject(doc, baos);
343    
344     // Hack to insert the file name in the archive
345     byte[] data2 = null;
346     try {
347     ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
348     GZIPOutputStream gzos = new GZIPOutputStream(baos2);
349     gzos.write(baos.toByteArray());
350     gzos.finish();
351     byte[] data = baos2.toByteArray();
352     data[3] = 8; // File name
353     byte[] fn = "x-rosegarden-device".getBytes("US-ASCII");
354     int fnsize = fn.length;
355     data2 = new byte[data.length + fnsize + 1];
356    
357     for(int i = 0; i < 10; i++) data2[i] = data[i];
358     for(int i = 0; i < fnsize; i++) data2[i + 10] = fn[i];
359     data2[10 + fnsize] = 0;
360     for(int i = 10; i < data.length; i++) data2[i + fnsize + 1] = data[i];
361    
362     } catch(Exception e) {
363     e.printStackTrace();
364     }
365     //////////////
366    
367     return data2;
368     }
369    
370     private static void
371     exportInstrumentsToRGD(MidiInstrumentMap map, Element el) {
372     int bank = -1;
373     int bnkOffset = preferences().getIntProperty(JSPrefs.FIRST_MIDI_BANK_NUMBER);
374     Element elBank = null;
375    
376     for(MidiInstrument i : map.getAllMidiInstruments()) {
377     int newBank = i.getInfo().getMidiBank();
378     if(newBank != bank) {
379     bank = newBank;
380     elBank = el.getOwnerDocument().createElement("bank");
381     elBank.setAttribute("name", "Bank " + (bank + bnkOffset));
382     elBank.setAttribute("msb", String.valueOf((bank >> 7) & 0x7f));
383     elBank.setAttribute("lsb", String.valueOf(bank & 0x7f));
384     el.appendChild(elBank);
385     }
386    
387     Element elProgram = el.getOwnerDocument().createElement("program");
388     elProgram.setAttribute("id", String.valueOf(i.getInfo().getMidiProgram()));
389     elProgram.setAttribute("name", i.getName());
390    
391     elBank.appendChild(elProgram);
392     }
393     }
394    
395 iliev 1915 public static String
396     exportSessionToLscpScript() {
397     CC.getSamplerModel().setModified(false);
398    
399     StringBuffer sb = new StringBuffer("# Exported by: ");
400     sb.append("JSampler - a java front-end for LinuxSampler\r\n# Version: ");
401     sb.append(JSampler.VERSION).append("\r\n");
402     sb.append("# Date: ").append(new java.util.Date().toString()).append("\r\n\r\n");
403    
404     Client lscpClient = new Client(true);
405     ByteArrayOutputStream out = new ByteArrayOutputStream();
406     lscpClient.setPrintOnlyModeOutputStream(out);
407    
408     try {
409     lscpClient.resetSampler();
410     sb.append(out.toString());
411     out.reset();
412     sb.append("\r\n");
413     lscpClient.setVolume(CC.getSamplerModel().getVolume());
414     sb.append(out.toString());
415     out.reset();
416     sb.append("\r\n");
417     } catch(Exception e) { CC.getLogger().log(Level.FINE, HF.getErrorMessage(e), e); }
418    
419     MidiDeviceModel[] mDevs = CC.getSamplerModel().getMidiDevices();
420     for(int i = 0; i < mDevs.length; i++) {
421     exportMidiDeviceToLscpScript(mDevs[i].getDeviceInfo(), i, lscpClient);
422     sb.append(out.toString());
423     out.reset();
424     sb.append("\r\n");
425     }
426    
427     AudioDeviceModel[] aDevs = CC.getSamplerModel().getAudioDevices();
428 iliev 2200 int fxInsts = 0;
429    
430 iliev 1915 for(int i = 0; i < aDevs.length; i++) {
431 iliev 2200 fxInsts += exportAudioDeviceToLscpScript(aDevs[i], i, fxInsts, lscpClient);
432 iliev 1915 sb.append(out.toString());
433     out.reset();
434     sb.append("\r\n");
435     }
436    
437     boolean b = preferences().getBoolProperty(JSPrefs.EXPORT_MIDI_MAPS_TO_SESSION_SCRIPT);
438     if(b) {
439     exportInstrMapsToLscpScript(lscpClient);
440     sb.append(out.toString());
441     out.reset();
442     sb.append("\r\n");
443     }
444    
445     int chnId = 0;
446     for(JSChannelsPane cp : CC.getMainFrame().getChannelsPaneList()) {
447     for(JSChannel chn : cp.getChannels()) {
448     SamplerChannelModel scm;
449     scm = CC.getSamplerModel().getChannelById(chn.getChannelId());
450     exportChannelToLscpScript(scm.getChannelInfo(), chnId, lscpClient);
451     sb.append(out.toString());
452     out.reset();
453    
454     sb.append("\r\n");
455    
456     exportFxSendsToLscpScript(scm, chnId, lscpClient);
457     sb.append(out.toString());
458     out.reset();
459    
460     sb.append("\r\n");
461    
462     chnId++;
463     }
464     }
465    
466     sb.append(CC.getViewConfig().exportSessionViewConfig());
467    
468     return sb.toString();
469     }
470    
471     private static void
472     exportMidiDeviceToLscpScript(MidiInputDevice mid, int devId, Client lscpCLient) {
473     try {
474     String s = mid.getDriverName();
475     lscpCLient.createMidiInputDevice(s, mid.getAdditionalParameters());
476    
477     MidiPort[] mPorts = mid.getMidiPorts();
478     int l = mPorts.length;
479     if(l != 1) lscpCLient.setMidiInputPortCount(devId, l);
480    
481     for(int i = 0; i < l; i++) {
482     Parameter[] prms = mPorts[i].getAllParameters();
483     for(Parameter p : prms) {
484     if(!p.isFixed() && p.getStringValue().length() > 0)
485     lscpCLient.setMidiInputPortParameter(devId, i, p);
486     }
487     }
488     } catch(Exception e) {
489     CC.getLogger().log(Level.FINE, HF.getErrorMessage(e), e);
490     }
491     }
492    
493 iliev 2200 /**
494     * @param fxInsts The current number of created effect instances.
495     * @return The number of effect instances in this audio device.
496     */
497     private static int
498     exportAudioDeviceToLscpScript(AudioDeviceModel model, int devId, int fxInsts, Client lscpCLient) {
499     int effectInstances = 0;
500    
501 iliev 1915 try {
502 iliev 2200 AudioOutputDevice aod = model.getDeviceInfo();
503 iliev 1915 String s = aod.getDriverName();
504     lscpCLient.createAudioOutputDevice(s, aod.getAllParameters());
505    
506     AudioOutputChannel[] chns = aod.getAudioChannels();
507    
508     for(int i = 0; i < chns.length; i++) {
509     Parameter[] prms = chns[i].getAllParameters();
510     for(Parameter p : prms) {
511     if(p.isFixed() || p.getStringValue().length() == 0);
512     else lscpCLient.setAudioOutputChannelParameter(devId, i, p);
513     }
514     }
515 iliev 2200
516     for(int i = 0; i < model.getSendEffectChainCount(); i++) {
517     lscpCLient.addSendEffectChain(devId);
518     EffectChain chain = model.getSendEffectChain(i);
519     for(int j = 0; j < chain.getEffectInstanceCount(); j++) {
520     EffectInstance ei = chain.getEffectInstance(j);
521     String sys = ei.getInfo().getSystem();
522     String mod = ei.getInfo().getModule();
523     String name = ei.getInfo().getName();
524     lscpCLient.createEffectInstance(sys, mod, name);
525     int fxInstanceId = fxInsts + effectInstances++;
526     lscpCLient.appendEffectInstance(devId, i, fxInstanceId);
527     }
528     }
529 iliev 1915 } catch(Exception e) {
530     CC.getLogger().log(Level.FINE, HF.getErrorMessage(e), e);
531     }
532 iliev 2200
533     return effectInstances;
534 iliev 1915 }
535    
536     private static void
537     exportChannelToLscpScript(SamplerChannel chn, int chnId, Client lscpCLient) {
538     try {
539     lscpCLient.addSamplerChannel();
540    
541     SamplerModel sm = CC.getSamplerModel();
542     int id = chn.getMidiInputDevice();
543     if(id != -1) {
544     for(int i = 0; i < sm.getMidiDeviceCount(); i++) {
545     if(sm.getMidiDevice(i).getDeviceId() == id) {
546     lscpCLient.setChannelMidiInputDevice(chnId, i);
547     break;
548     }
549     }
550     lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort());
551     lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel());
552     }
553    
554     if(chn.getEngine() != null) {
555     lscpCLient.loadSamplerEngine(chn.getEngine().getName(), chnId);
556     lscpCLient.setChannelVolume(chnId, chn.getVolume());
557     int mapId = chn.getMidiInstrumentMapId();
558     lscpCLient.setChannelMidiInstrumentMap(chnId, mapId);
559     }
560    
561     id = chn.getAudioOutputDevice();
562     if(id != -1) {
563     for(int i = 0; i < sm.getAudioDeviceCount(); i++) {
564     if(sm.getAudioDevice(i).getDeviceId() == id) {
565     lscpCLient.setChannelAudioOutputDevice(chnId, i);
566     break;
567     }
568     }
569    
570     Integer[] routing = chn.getAudioOutputRouting();
571    
572     for(int j = 0; j < routing.length; j++) {
573     int k = routing[j];
574     if(k == j) continue;
575    
576     lscpCLient.setChannelAudioOutputChannel(chnId, j, k);
577     }
578     }
579    
580     String s = chn.getInstrumentFile();
581     int i = chn.getInstrumentIndex();
582     if(s != null) lscpCLient.loadInstrument(s, i, chnId, true);
583    
584     if(chn.isMuted() && !chn.isMutedBySolo()) lscpCLient.setChannelMute(chnId, true);
585     if(chn.isSoloChannel()) lscpCLient.setChannelSolo(chnId, true);
586     } catch(Exception e) {
587     CC.getLogger().log(Level.FINE, HF.getErrorMessage(e), e);
588     }
589     }
590    
591     private static void
592     exportFxSendsToLscpScript(SamplerChannelModel scm, int chnId, Client lscpClient) {
593     try {
594     FxSend[] fxSends = scm.getFxSends();
595    
596     for(int i = 0; i < fxSends.length; i++) {
597     FxSend f = fxSends[i];
598     lscpClient.createFxSend(chnId, f.getMidiController(), f.getName());
599     lscpClient.setFxSendLevel(chnId, i, f.getLevel());
600    
601     Integer[] r = f.getAudioOutputRouting();
602     for(int j = 0; j < r.length; j++) {
603     lscpClient.setFxSendAudioOutputChannel(chnId, i, j, r[j]);
604     }
605 iliev 2200
606     int chainId = f.getDestChainId();
607     int chainPos = f.getDestChainPos();
608    
609     if(chainId != -1) {
610     int aid = scm.getChannelInfo().getAudioOutputDevice();
611     AudioDeviceModel m = CC.getSamplerModel().getAudioDeviceById(aid);
612     int idx = m.getSendEffectChainIndex(chainId);
613     lscpClient.setFxSendEffect(chnId, i, idx, chainPos);
614     }
615 iliev 1915 }
616     } catch(Exception e) {
617     CC.getLogger().log(Level.FINE, HF.getErrorMessage(e), e);
618     }
619     }
620     }

  ViewVC Help
Powered by ViewVC