~ubuntu-branches/debian/squeeze/qsampler/squeeze

« back to all changes in this revision

Viewing changes to debian/patches/10_cvs-snapshot.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2008-08-28 08:43:21 UTC
  • mfrom: (1.1.1 upstream) (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080828084321-guq8v04yg31co9gm
Tags: 0.2.1-1
* New upstream release
* Uploaded to Debian (Closes: #280576)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
## 10cvs-snapshot.dpatch by Free Ekanayaka <freee@debian.org>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: Apply all CVS changes since the latest release
 
6
 
 
7
if [ $# -lt 1 ]; then
 
8
    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
 
9
    exit 1
 
10
fi  
 
11
 
 
12
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
 
13
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
 
14
 
 
15
case "$1" in
 
16
    -patch) patch -p1 ${patch_opts} < $0;;
 
17
    -unpatch) patch -R -p1 ${patch_opts} < $0;;
 
18
    *)
 
19
        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
 
20
        exit 1;;
 
21
esac
 
22
 
 
23
exit 0
 
24
 
 
25
@DPATCH@
 
26
Index: qsampler/COPYING
 
27
diff -u qsampler/COPYING:1.1.1.1 qsampler/COPYING:1.2
 
28
--- qsampler/COPYING:1.1.1.1    Thu Oct 30 23:26:46 2003
 
29
+++ qsampler/COPYING    Sun Sep 24 14:47:51 2006
 
30
@@ -1,8 +1,8 @@
 
31
                    GNU GENERAL PUBLIC LICENSE
 
32
                       Version 2, June 1991
 
33
 
 
34
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 
35
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
36
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 
37
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
38
  Everyone is permitted to copy and distribute verbatim copies
 
39
  of this license document, but changing it is not allowed.
 
40
 
 
41
@@ -15,7 +15,7 @@
 
42
 General Public License applies to most of the Free Software
 
43
 Foundation's software and to any other program whose authors commit to
 
44
 using it.  (Some other Free Software Foundation software is covered by
 
45
-the GNU Library General Public License instead.)  You can apply it to
 
46
+the GNU Lesser General Public License instead.)  You can apply it to
 
47
 your programs, too.
 
48
 
 
49
   When we speak of free software, we are referring to freedom, not
 
50
@@ -55,7 +55,7 @@
 
51
 
 
52
   The precise terms and conditions for copying, distribution and
 
53
 modification follow.
 
54
-
 
55
+
 
56
                    GNU GENERAL PUBLIC LICENSE
 
57
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
58
 
 
59
@@ -110,7 +110,7 @@
 
60
     License.  (Exception: if the Program itself is interactive but
 
61
     does not normally print such an announcement, your work based on
 
62
     the Program is not required to print an announcement.)
 
63
-
 
64
+
 
65
 These requirements apply to the modified work as a whole.  If
 
66
 identifiable sections of that work are not derived from the Program,
 
67
 and can be reasonably considered independent and separate works in
 
68
@@ -168,7 +168,7 @@
 
69
 access to copy the source code from the same place counts as
 
70
 distribution of the source code, even though third parties are not
 
71
 compelled to copy the source along with the object code.
 
72
-
 
73
+
 
74
   4. You may not copy, modify, sublicense, or distribute the Program
 
75
 except as expressly provided under this License.  Any attempt
 
76
 otherwise to copy, modify, sublicense or distribute the Program is
 
77
@@ -225,7 +225,7 @@
 
78
 
 
79
 This section is intended to make thoroughly clear what is believed to
 
80
 be a consequence of the rest of this License.
 
81
-
 
82
+
 
83
   8. If the distribution and/or use of the Program is restricted in
 
84
 certain countries either by patents or by copyrighted interfaces, the
 
85
 original copyright holder who places the Program under this License
 
86
@@ -278,7 +278,7 @@
 
87
 POSSIBILITY OF SUCH DAMAGES.
 
88
 
 
89
                     END OF TERMS AND CONDITIONS
 
90
-
 
91
+
 
92
            How to Apply These Terms to Your New Programs
 
93
 
 
94
   If you develop a new program, and you want it to be of the greatest
 
95
@@ -303,10 +303,9 @@
 
96
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
97
     GNU General Public License for more details.
 
98
 
 
99
-    You should have received a copy of the GNU General Public License
 
100
-    along with this program; if not, write to the Free Software
 
101
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
102
-
 
103
+    You should have received a copy of the GNU General Public License along
 
104
+    with this program; if not, write to the Free Software Foundation, Inc.,
 
105
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
106
 
 
107
 Also add information on how to contact you by electronic and paper mail.
 
108
 
 
109
@@ -336,5 +335,5 @@
 
110
 This General Public License does not permit incorporating your program into
 
111
 proprietary programs.  If your program is a subroutine library, you may
 
112
 consider it more useful to permit linking proprietary applications with the
 
113
-library.  If this is what you want to do, use the GNU Library General
 
114
+library.  If this is what you want to do, use the GNU Lesser General
 
115
 Public License instead of this License.
 
116
Index: qsampler/ChangeLog
 
117
diff -u qsampler/ChangeLog:1.87 qsampler/ChangeLog:1.101
 
118
--- qsampler/ChangeLog:1.87     Thu Jun  1 10:41:42 2006
 
119
+++ qsampler/ChangeLog  Mon Jan 15 20:11:58 2007
 
120
@@ -5,6 +5,37 @@
 
121
 
 
122
 CVS HEAD
 
123
 
 
124
+* Channel button colors have changed: yellow for mute and
 
125
+  cyan for solo is now the rule, but note that this color
 
126
+  highlighting is only rendered on some widget styles.
 
127
+
 
128
+* Master sampler volume slider/spinbox combo is now featured.
 
129
+
 
130
+* Initial support for sampler channel FX sends, while saving
 
131
+  the session state, only at code-level.
 
132
+
 
133
+* Sampler channel setup dialog does not mandate for valid nor
 
134
+  existing instrument file name.
 
135
+
 
136
+* Revised error verbosity in general and on session load/save;
 
137
+  hour-glass wait cursor is now displayed on session load/save;
 
138
+  keyboard shortcuts changed on MIDI instruments view context;
 
139
+  improved channel strip arrangement on session open/load;
 
140
+  instrument map entry removal confirmation (as optional);
 
141
+  corrected some tooltip text strings.
 
142
+
 
143
+* Most top-level widgets were missing the normal-widget flag,
 
144
+  which were causing some sticky size behavior while on some
 
145
+  window managers.
 
146
+
 
147
+* Added preliminary MIDI instrument mapping support; now
 
148
+  with an instrument list widget and editing capabilities;
 
149
+  MIDI instrumeent map program numbers are now displayed in
 
150
+  the range 1-128, instead of the internal 0-127.
 
151
+
 
152
+* GPL address update.
 
153
+
 
154
+
 
155
 0.1.3   2006-06-01 Its been a long year isn't it?
 
156
 
 
157
 * Changed deprecated copyright attribute to license,
 
158
Index: qsampler/Makefile.in
 
159
diff -u qsampler/Makefile.in:1.12 qsampler/Makefile.in:1.13
 
160
--- qsampler/Makefile.in:1.12   Sun Jun 12 11:40:24 2005
 
161
+++ qsampler/Makefile.in        Sun Dec  3 19:26:12 2006
 
162
@@ -8,7 +8,11 @@
 
163
        src/qsamplerOptions.h \
 
164
        src/qsamplerChannel.h \
 
165
        src/qsamplerMessages.h \
 
166
+       src/qsamplerInstrument.h \
 
167
+       src/qsamplerInstrumentList.h \
 
168
        src/qsamplerDevice.h \
 
169
+       src/qsamplerInstrumentForm.ui.h \
 
170
+       src/qsamplerInstrumentListForm.ui.h \
 
171
        src/qsamplerDeviceForm.ui.h \
 
172
        src/qsamplerChannelStrip.ui.h \
 
173
        src/qsamplerChannelForm.ui.h \
 
174
@@ -19,7 +23,11 @@
 
175
        src/qsamplerOptions.cpp \
 
176
        src/qsamplerChannel.cpp \
 
177
        src/qsamplerMessages.cpp \
 
178
+       src/qsamplerInstrument.cpp \
 
179
+       src/qsamplerInstrumentList.cpp \
 
180
        src/qsamplerDevice.cpp \
 
181
+       src/qsamplerInstrumentForm.ui \
 
182
+       src/qsamplerInstrumentListForm.ui \
 
183
        src/qsamplerDeviceForm.ui \
 
184
        src/qsamplerChannelStrip.ui \
 
185
        src/qsamplerChannelForm.ui \
 
186
Index: qsampler/README
 
187
diff -u qsampler/README:1.2 qsampler/README:1.3
 
188
--- qsampler/README:1.2 Fri Apr  1 16:18:49 2005
 
189
+++ qsampler/README     Wed Nov 29 12:48:26 2006
 
190
@@ -53,7 +53,7 @@
 
191
 Bugs
 
192
 ----
 
193
 
 
194
-Plenty still, after all this is early alpha software ;)
 
195
+Plenty still, after all this is alpha software ;)
 
196
 
 
197
 
 
198
 Support
 
199
Index: qsampler/configure.ac
 
200
diff -u qsampler/configure.ac:1.13 qsampler/configure.ac:1.37
 
201
--- qsampler/configure.ac:1.13  Thu Jun  1 10:41:42 2006
 
202
+++ qsampler/configure.ac       Mon Jan 15 20:11:58 2007
 
203
@@ -1,5 +1,5 @@
 
204
 # Process this file with autoconf to produce a configure script.
 
205
-AC_INIT(Qsampler, 0.1.3, rncbc@rncbc.org, qsampler)
 
206
+AC_INIT(Qsampler, 0.1.3.25, rncbc@rncbc.org, qsampler)
 
207
 AC_CONFIG_SRCDIR(src/qsamplerMainForm.ui.h)
 
208
 AC_CONFIG_HEADERS(config.h)
 
209
 AC_CONFIG_FILES(Makefile qsampler.pro qsampler.spec)
 
210
@@ -193,6 +193,42 @@
 
211
    AC_DEFINE(CONFIG_MUTE_SOLO, 1, [Define if mute/solo is available.])
 
212
 fi
 
213
 
 
214
+AC_CHECK_LIB(lscp, lscp_map_midi_instrument, [ac_midi_instrument="yes"], [ac_midi_instrument="no"])
 
215
+if test "x$ac_midi_instrument" = "xyes"; then
 
216
+  AC_DEFINE(CONFIG_MIDI_INSTRUMENT, 1, [Define if MIDI instrument mapping is available.])
 
217
+fi
 
218
+
 
219
+AC_CHECK_LIB(lscp, lscp_create_fxsend, [ac_fxsend="yes"], [ac_fxsend="no"])
 
220
+if test "x$ac_fxsend" = "xyes"; then
 
221
+  AC_DEFINE(CONFIG_FXSEND, 1, [Define if FX sends is available.])
 
222
+  AC_CACHE_CHECK([for FX send level in lscp_fxsend_info_t],
 
223
+    ac_fxsend_level, [
 
224
+    AC_TRY_COMPILE([#include "lscp/client.h"], [
 
225
+         lscp_fxsend_info_t info;
 
226
+         info.level = 0.0f;
 
227
+      ], ac_fxsend_level="yes", ac_fxsend_level="no")
 
228
+  ])
 
229
+  if test "x$ac_fxsend_level" = "xyes"; then
 
230
+         AC_DEFINE(CONFIG_FXSEND_LEVEL, 1, [Define if FX send level is available.])
 
231
+  fi
 
232
+fi
 
233
+
 
234
+AC_CACHE_CHECK([for audio_routing array type],
 
235
+  ac_audio_routing, [
 
236
+  AC_TRY_COMPILE([#include "lscp/client.h"], [
 
237
+       lscp_channel_info_t info;
 
238
+       char ch = info.audio_routing[0][0];
 
239
+    ], ac_audio_routing="no", ac_audio_routing="yes")
 
240
+])
 
241
+if test "x$ac_audio_routing" = "xyes"; then
 
242
+   AC_DEFINE(CONFIG_AUDIO_ROUTING, 1, [Define if audio_routing is an integer array.])
 
243
+fi
 
244
+
 
245
+AC_CHECK_LIB(lscp, lscp_set_volume, [ac_volume="yes"], [ac_volume="no"])
 
246
+if test "x$ac_volume" = "xyes"; then
 
247
+  AC_DEFINE(CONFIG_VOLUME, 1, [Define if global volume is available.])
 
248
+fi
 
249
+
 
250
 # Check for optional libraries.
 
251
 if test "x$ac_libgig" = "xyes"; then
 
252
    AC_CHECK_LIB(gig, main, [ac_libgig="yes"], [ac_libgig="no"])
 
253
@@ -202,6 +238,12 @@
 
254
    fi
 
255
 fi
 
256
 
 
257
+# Check for round math function.
 
258
+AC_CHECK_LIB(m, lroundf, [ac_round="yes"], [ac_round="no"])
 
259
+if test "x$ac_round" = "xyes"; then
 
260
+   AC_DEFINE(CONFIG_ROUND, 1, [Define if round is available.])
 
261
+fi
 
262
+
 
263
 AC_SUBST(ac_libs)
 
264
 AC_SUBST(ac_incpath)
 
265
 
 
266
Index: qsampler/qsampler.pro.in
 
267
diff -u qsampler/qsampler.pro.in:1.10 qsampler/qsampler.pro.in:1.12
 
268
--- qsampler/qsampler.pro.in:1.10       Tue Jan  3 14:51:35 2006
 
269
+++ qsampler/qsampler.pro.in    Mon Jan  8 17:52:48 2007
 
270
@@ -1,52 +1,66 @@
 
271
 INCLUDEPATH += ./src
 
272
 
 
273
-SOURCES += src/main.cpp \
 
274
-           src/qsamplerOptions.cpp \
 
275
-           src/qsamplerChannel.cpp \
 
276
-           src/qsamplerMessages.cpp \
 
277
-           src/qsamplerDevice.cpp
 
278
-
 
279
-HEADERS += src/qsamplerAbout.h \
 
280
-           src/qsamplerOptions.h \
 
281
-           src/qsamplerChannel.h \
 
282
-           src/qsamplerMessages.h \
 
283
-           src/qsamplerDevice.h
 
284
-
 
285
-FORMS    = src/qsamplerMainForm.ui \
 
286
-           src/qsamplerChannelStrip.ui \
 
287
-           src/qsamplerChannelForm.ui \
 
288
-           src/qsamplerOptionsForm.ui \
 
289
-              src/qsamplerDeviceForm.ui
 
290
-
 
291
-IMAGES   = icons/qsampler.png \
 
292
-           icons/qsamplerChannel.png \
 
293
-           icons/qsamplerDevice.png \
 
294
-           icons/fileNew.png \
 
295
-           icons/fileOpen.png \
 
296
-           icons/fileSave.png \
 
297
-           icons/fileRestart.png \
 
298
-           icons/fileReset.png \
 
299
-           icons/editAddChannel.png \
 
300
-           icons/editRemoveChannel.png \
 
301
-           icons/editSetupChannel.png \
 
302
-           icons/editResetChannel.png \
 
303
-           icons/editResetAllChannels.png \
 
304
-           icons/channelsArrange.png \
 
305
-           icons/formAccept.png \
 
306
-           icons/formReject.png \
 
307
-           icons/formRefresh.png \
 
308
-           icons/deviceCreate.png \
 
309
-           icons/deviceDelete.png \
 
310
-           icons/displaybg1.png \
 
311
-           icons/midi1.png \
 
312
-           icons/midi2.png \
 
313
-           icons/audio1.png \
 
314
-           icons/audio2.png
 
315
-
 
316
-TEMPLATE = app
 
317
-CONFIG  += qt @ac_thread@ warn_on @ac_debug@
 
318
-LANGUAGE = C++
 
319
+HEADERS  += src/qsamplerAbout.h \
 
320
+                       src/qsamplerOptions.h \
 
321
+                       src/qsamplerChannel.h \
 
322
+                       src/qsamplerMessages.h \
 
323
+                       src/qsamplerInstrument.h \
 
324
+                       src/qsamplerInstrumentList.h \
 
325
+                       src/qsamplerDevice.h
 
326
+
 
327
+SOURCES  += src/main.cpp \
 
328
+                       src/qsamplerOptions.cpp \
 
329
+                       src/qsamplerChannel.cpp \
 
330
+                       src/qsamplerMessages.cpp \
 
331
+                       src/qsamplerInstrument.cpp \
 
332
+                       src/qsamplerInstrumentList.cpp \
 
333
+                       src/qsamplerDevice.cpp
 
334
+
 
335
+FORMS     = src/qsamplerMainForm.ui \
 
336
+                       src/qsamplerChannelStrip.ui \
 
337
+                       src/qsamplerChannelForm.ui \
 
338
+                       src/qsamplerOptionsForm.ui \
 
339
+                       src/qsamplerInstrumentForm.ui \
 
340
+                       src/qsamplerInstrumentListForm.ui \
 
341
+                       src/qsamplerDeviceForm.ui
 
342
+
 
343
+IMAGES    = icons/qsampler.png \
 
344
+                       icons/qsamplerChannel.png \
 
345
+                       icons/qsamplerInstrument.png \
 
346
+                       icons/qsamplerDevice.png \
 
347
+                       icons/fileNew.png \
 
348
+                       icons/fileOpen.png \
 
349
+                       icons/fileSave.png \
 
350
+                       icons/fileRestart.png \
 
351
+                       icons/fileReset.png \
 
352
+                       icons/editAddChannel.png \
 
353
+                       icons/editRemoveChannel.png \
 
354
+                       icons/editSetupChannel.png \
 
355
+                       icons/editResetChannel.png \
 
356
+                       icons/editResetAllChannels.png \
 
357
+                       icons/channelsArrange.png \
 
358
+                       icons/itemGroup.png \
 
359
+                       icons/itemGroupOpen.png \
 
360
+                       icons/itemGroupNew.png \
 
361
+                       icons/itemNew.png \
 
362
+                       icons/itemFile.png \
 
363
+                       icons/formEdit.png \
 
364
+                       icons/formRemove.png \
 
365
+                       icons/formAccept.png \
 
366
+                       icons/formReject.png \
 
367
+                       icons/formRefresh.png \
 
368
+                       icons/deviceCreate.png \
 
369
+                       icons/deviceDelete.png \
 
370
+                       icons/displaybg1.png \
 
371
+                       icons/midi1.png \
 
372
+                       icons/midi2.png \
 
373
+                       icons/audio1.png \
 
374
+                       icons/audio2.png
 
375
+
 
376
+TEMPLATE  = app
 
377
+CONFIG   += qt @ac_thread@ warn_on @ac_debug@
 
378
+LANGUAGE  = C++
 
379
 
 
380
-LIBS    += @ac_libs@
 
381
-INCPATH += @ac_incpath@
 
382
+LIBS     += @ac_libs@
 
383
+INCPATH  += @ac_incpath@
 
384
 
 
385
Index: qsampler/qsampler.spec.in
 
386
diff -u qsampler/qsampler.spec.in:1.3 qsampler/qsampler.spec.in:1.8
 
387
--- qsampler/qsampler.spec.in:1.3       Thu Jun  1 10:41:42 2006
 
388
+++ qsampler/qsampler.spec.in   Mon Jan 15 17:21:01 2007
 
389
@@ -1,6 +1,6 @@
 
390
 %define name    @PACKAGE_TARNAME@
 
391
 %define version @PACKAGE_VERSION@
 
392
-%define release 7
 
393
+%define release 9
 
394
 %define prefix  /usr/local
 
395
 
 
396
 Summary:       A LinuxSampler Qt GUI interface.
 
397
@@ -13,7 +13,7 @@
 
398
 Source0:       %{name}-%{version}.tar.gz
 
399
 URL:           http://qsampler.sourceforge.net/
 
400
 BuildRoot:     /var/tmp/%{name}-%{version}-buildroot
 
401
-Requires:      liblscp >= 0.3.2, libgig >= 2.0.2
 
402
+Requires:      liblscp >= 0.5.3, libgig >= 3.1.0
 
403
 
 
404
 %description
 
405
 QSampler is a LinuxSampler GUI front-end application written in C++ around
 
406
@@ -45,6 +45,11 @@
 
407
 %{prefix}/share/icons/qsampler.png
 
408
 
 
409
 %changelog
 
410
+* Mon Jan 15 2007 Rui Nuno Capela <rncbc@users.sourceforge.net>
 
411
+- Added sampler channel FX send support at session save code-level.
 
412
+- Global sampler volume slider/spinbox combo is now featured.
 
413
+* Thu Dec 17 2006 Rui Nuno Capela <rncbc@users.sourceforge.net>
 
414
+- Added preliminary MIDI instrument mapping support.
 
415
 * Thu Jun 01 2006 Rui Nuno Capela <rncbc@users.sourceforge.net>
 
416
 - Take a chance for a new 0.1.3 release.
 
417
 - Changed deprecated copyright attribute to license.
 
418
Index: qsampler/debian/changelog
 
419
diff -u qsampler/debian/changelog:1.5 qsampler/debian/changelog:1.6
 
420
Index: qsampler/icons/formEdit.png
 
421
Index: qsampler/icons/formRemove.png
 
422
Index: qsampler/icons/itemFile.png
 
423
Index: qsampler/icons/itemGroup.png
 
424
Index: qsampler/icons/itemGroupNew.png
 
425
Index: qsampler/icons/itemGroupOpen.png
 
426
Index: qsampler/icons/itemNew.png
 
427
Index: qsampler/icons/qsamplerInstrument.png
 
428
Index: qsampler/src/main.cpp
 
429
diff -u qsampler/src/main.cpp:1.4 qsampler/src/main.cpp:1.5
 
430
--- qsampler/src/main.cpp:1.4   Wed Aug 24 19:44:04 2005
 
431
+++ qsampler/src/main.cpp       Sun Sep 24 14:47:51 2006
 
432
@@ -1,7 +1,7 @@
 
433
 // main.cpp
 
434
 //
 
435
 /****************************************************************************
 
436
-   Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.
 
437
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
438
 
 
439
    This program is free software; you can redistribute it and/or
 
440
    modify it under the terms of the GNU General Public License
 
441
@@ -13,9 +13,9 @@
 
442
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
443
    GNU General Public License for more details.
 
444
 
 
445
-   You should have received a copy of the GNU General Public License
 
446
-   along with this program; if not, write to the Free Software
 
447
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
448
+   You should have received a copy of the GNU General Public License along
 
449
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
450
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
451
 
 
452
 *****************************************************************************/
 
453
 
 
454
Index: qsampler/src/qsamplerAbout.h
 
455
diff -u qsampler/src/qsamplerAbout.h:1.115 qsampler/src/qsamplerAbout.h:1.117
 
456
--- qsampler/src/qsamplerAbout.h:1.115  Mon Mar 20 11:53:33 2006
 
457
+++ qsampler/src/qsamplerAbout.h        Mon Jan  8 17:52:48 2007
 
458
@@ -1,7 +1,7 @@
 
459
 // qsamplerAbout.h
 
460
 //
 
461
 /****************************************************************************
 
462
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
463
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
464
 
 
465
    This program is free software; you can redistribute it and/or
 
466
    modify it under the terms of the GNU General Public License
 
467
@@ -13,9 +13,9 @@
 
468
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
469
    GNU General Public License for more details.
 
470
 
 
471
-   You should have received a copy of the GNU General Public License
 
472
-   along with this program; if not, write to the Free Software
 
473
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
474
+   You should have received a copy of the GNU General Public License along
 
475
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
476
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
477
 
 
478
 *****************************************************************************/
 
479
 
 
480
@@ -29,7 +29,7 @@
 
481
 
 
482
 #define QSAMPLER_SUBTITLE     "A LinuxSampler Qt GUI Interface"
 
483
 #define QSAMPLER_WEBSITE      "http://qsampler.sourceforge.net"
 
484
-#define QSAMPLER_COPYRIGHT    "Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved."
 
485
+#define QSAMPLER_COPYRIGHT    "Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved."
 
486
 
 
487
 #endif  // __qsamplerAbout_h
 
488
 
 
489
Index: qsampler/src/qsamplerChannel.cpp
 
490
diff -u qsampler/src/qsamplerChannel.cpp:1.30 qsampler/src/qsamplerChannel.cpp:1.34
 
491
--- qsampler/src/qsamplerChannel.cpp:1.30       Fri Dec 23 02:40:56 2005
 
492
+++ qsampler/src/qsamplerChannel.cpp    Thu Jan 11 17:14:31 2007
 
493
@@ -1,7 +1,7 @@
 
494
 // qsamplerChannel.cpp
 
495
 //
 
496
 /****************************************************************************
 
497
-   Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
498
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
499
 
 
500
    This program is free software; you can redistribute it and/or
 
501
    modify it under the terms of the GNU General Public License
 
502
@@ -13,9 +13,9 @@
 
503
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
504
    GNU General Public License for more details.
 
505
 
 
506
-   You should have received a copy of the GNU General Public License
 
507
-   along with this program; if not, write to the Free Software
 
508
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
509
+   You should have received a copy of the GNU General Public License along
 
510
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
511
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
512
 
 
513
 *****************************************************************************/
 
514
 
 
515
@@ -40,9 +40,8 @@
 
516
 //
 
517
 
 
518
 // Constructor.
 
519
-qsamplerChannel::qsamplerChannel ( qsamplerMainForm *pMainForm, int iChannelID )
 
520
+qsamplerChannel::qsamplerChannel ( int iChannelID )
 
521
 {
 
522
-       m_pMainForm  = pMainForm;
 
523
        m_iChannelID = iChannelID;
 
524
 
 
525
 //  m_sEngineName       = noEngineName();
 
526
@@ -54,6 +53,7 @@
 
527
        m_iMidiDevice       = -1;
 
528
        m_iMidiPort         = -1;
 
529
        m_iMidiChannel      = -1;
 
530
+       m_iMidiMap          = -1;
 
531
        m_sAudioDriver      = "ALSA";
 
532
        m_iAudioDevice      = -1;
 
533
        m_fVolume           = 0.0;
 
534
@@ -67,45 +67,22 @@
 
535
 }
 
536
 
 
537
 
 
538
-// Main application form accessor.
 
539
-qsamplerMainForm *qsamplerChannel::mainForm(void) const
 
540
-{
 
541
-       return m_pMainForm;
 
542
-}
 
543
-
 
544
-
 
545
-// The global options settings delegated property.
 
546
-qsamplerOptions *qsamplerChannel::options (void) const
 
547
-{
 
548
-       if (m_pMainForm == NULL)
 
549
-               return NULL;
 
550
-
 
551
-       return m_pMainForm->options();
 
552
-}
 
553
-
 
554
-
 
555
-// The client descriptor delegated property.
 
556
-lscp_client_t *qsamplerChannel::client (void) const
 
557
-{
 
558
-       if (m_pMainForm == NULL)
 
559
-               return NULL;
 
560
-
 
561
-       return m_pMainForm->client();
 
562
-}
 
563
-
 
564
-
 
565
 // Create a new sampler channel, if not already.
 
566
 bool qsamplerChannel::addChannel (void)
 
567
 {
 
568
-       if (client() == NULL)
 
569
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
570
+       if (pMainForm == NULL)
 
571
+               return false;
 
572
+       if (pMainForm->client() == NULL)
 
573
                return false;
 
574
 
 
575
        // Are we a new channel?
 
576
        if (m_iChannelID < 0) {
 
577
-               m_iChannelID = ::lscp_add_channel(client());
 
578
+               m_iChannelID = ::lscp_add_channel(pMainForm->client());
 
579
                if (m_iChannelID < 0) {
 
580
                        appendMessagesClient("lscp_add_channel");
 
581
-                       appendMessagesError(QObject::tr("Could not add channel.\n\nSorry."));
 
582
+                       appendMessagesError(
 
583
+                               QObject::tr("Could not add channel.\n\nSorry."));
 
584
                }   // Otherwise it's created...
 
585
                else appendMessages(QObject::tr("added."));
 
586
        }
 
587
@@ -118,12 +95,15 @@
 
588
 // Remove sampler channel.
 
589
 bool qsamplerChannel::removeChannel (void)
 
590
 {
 
591
-       if (client() == NULL)
 
592
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
593
+       if (pMainForm == NULL)
 
594
+               return false;
 
595
+       if (pMainForm->client() == NULL)
 
596
                return false;
 
597
 
 
598
        // Are we an existing channel?
 
599
        if (m_iChannelID >= 0) {
 
600
-               if (::lscp_remove_channel(client(), m_iChannelID) != LSCP_OK) {
 
601
+               if (::lscp_remove_channel(pMainForm->client(), m_iChannelID) != LSCP_OK) {
 
602
                        appendMessagesClient("lscp_remove_channel");
 
603
                        appendMessagesError(QObject::tr("Could not remove channel.\n\nSorry."));
 
604
                } else {
 
605
@@ -165,15 +145,19 @@
 
606
 
 
607
 bool qsamplerChannel::loadEngine ( const QString& sEngineName )
 
608
 {
 
609
-       if (client() == NULL || m_iChannelID < 0)
 
610
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
611
+       if (pMainForm == NULL)
 
612
+               return false;
 
613
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
614
                return false;
 
615
        if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName)
 
616
                return true;
 
617
 
 
618
-       if (::lscp_load_engine(client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) {
 
619
+       if (::lscp_load_engine(pMainForm->client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) {
 
620
                appendMessagesClient("lscp_load_engine");
 
621
                return false;
 
622
        }
 
623
+
 
624
        appendMessages(QObject::tr("Engine: %1.").arg(sEngineName));
 
625
 
 
626
        m_sEngineName = sEngineName;
 
627
@@ -208,14 +192,17 @@
 
628
 // Instrument file loader.
 
629
 bool qsamplerChannel::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr )
 
630
 {
 
631
-       if (client() == NULL || m_iChannelID < 0)
 
632
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
633
+       if (pMainForm == NULL)
 
634
+               return false;
 
635
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
636
                return false;
 
637
        if (!isInstrumentFile(sInstrumentFile))
 
638
                return false;
 
639
        if (m_iInstrumentStatus == 100 && m_sInstrumentFile == sInstrumentFile && m_iInstrumentNr == iInstrumentNr)
 
640
                return true;
 
641
 
 
642
-       if (::lscp_load_instrument_non_modal(client(), sInstrumentFile.latin1(), iInstrumentNr, m_iChannelID) != LSCP_OK) {
 
643
+       if (::lscp_load_instrument_non_modal(pMainForm->client(), sInstrumentFile.latin1(), iInstrumentNr, m_iChannelID) != LSCP_OK) {
 
644
                appendMessagesClient("lscp_load_instrument");
 
645
                return false;
 
646
        }
 
647
@@ -251,12 +238,15 @@
 
648
 
 
649
 bool qsamplerChannel::setMidiDriver ( const QString& sMidiDriver )
 
650
 {
 
651
-       if (client() == NULL || m_iChannelID < 0)
 
652
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
653
+       if (pMainForm == NULL)
 
654
+               return false;
 
655
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
656
                return false;
 
657
        if (m_iInstrumentStatus == 100 && m_sMidiDriver == sMidiDriver)
 
658
                return true;
 
659
 
 
660
-       if (::lscp_set_channel_midi_type(client(), m_iChannelID, sMidiDriver.latin1()) != LSCP_OK) {
 
661
+       if (::lscp_set_channel_midi_type(pMainForm->client(), m_iChannelID, sMidiDriver.latin1()) != LSCP_OK) {
 
662
                appendMessagesClient("lscp_set_channel_midi_type");
 
663
                return false;
 
664
        }
 
665
@@ -276,12 +266,15 @@
 
666
 
 
667
 bool qsamplerChannel::setMidiDevice ( int iMidiDevice )
 
668
 {
 
669
-       if (client() == NULL || m_iChannelID < 0)
 
670
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
671
+       if (pMainForm == NULL)
 
672
+               return false;
 
673
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
674
                return false;
 
675
        if (m_iInstrumentStatus == 100 && m_iMidiDevice == iMidiDevice)
 
676
                return true;
 
677
 
 
678
-       if (::lscp_set_channel_midi_device(client(), m_iChannelID, iMidiDevice) != LSCP_OK) {
 
679
+       if (::lscp_set_channel_midi_device(pMainForm->client(), m_iChannelID, iMidiDevice) != LSCP_OK) {
 
680
                appendMessagesClient("lscp_set_channel_midi_device");
 
681
                return false;
 
682
        }
 
683
@@ -301,12 +294,15 @@
 
684
 
 
685
 bool qsamplerChannel::setMidiPort ( int iMidiPort )
 
686
 {
 
687
-       if (client() == NULL || m_iChannelID < 0)
 
688
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
689
+       if (pMainForm == NULL)
 
690
+               return false;
 
691
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
692
                return false;
 
693
        if (m_iInstrumentStatus == 100 && m_iMidiPort == iMidiPort)
 
694
                return true;
 
695
 
 
696
-       if (::lscp_set_channel_midi_port(client(), m_iChannelID, iMidiPort) != LSCP_OK) {
 
697
+       if (::lscp_set_channel_midi_port(pMainForm->client(), m_iChannelID, iMidiPort) != LSCP_OK) {
 
698
                appendMessagesClient("lscp_set_channel_midi_port");
 
699
                return false;
 
700
        }
 
701
@@ -326,12 +322,15 @@
 
702
 
 
703
 bool qsamplerChannel::setMidiChannel ( int iMidiChannel )
 
704
 {
 
705
-       if (client() == NULL || m_iChannelID < 0)
 
706
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
707
+       if (pMainForm == NULL)
 
708
+               return false;
 
709
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
710
                return false;
 
711
        if (m_iInstrumentStatus == 100 && m_iMidiChannel == iMidiChannel)
 
712
                return true;
 
713
 
 
714
-       if (::lscp_set_channel_midi_channel(client(), m_iChannelID, iMidiChannel) != LSCP_OK) {
 
715
+       if (::lscp_set_channel_midi_channel(pMainForm->client(), m_iChannelID, iMidiChannel) != LSCP_OK) {
 
716
                appendMessagesClient("lscp_set_channel_midi_channel");
 
717
                return false;
 
718
        }
 
719
@@ -343,6 +342,34 @@
 
720
 }
 
721
 
 
722
 
 
723
+// MIDI instrument map accessor.
 
724
+int qsamplerChannel::midiMap (void) const
 
725
+{
 
726
+       return m_iMidiMap;
 
727
+}
 
728
+
 
729
+bool qsamplerChannel::setMidiMap ( int iMidiMap )
 
730
+{
 
731
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
732
+       if (pMainForm == NULL)
 
733
+               return false;
 
734
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
735
+               return false;
 
736
+       if (m_iInstrumentStatus == 100 && m_iMidiMap == iMidiMap)
 
737
+               return true;
 
738
+#ifdef CONFIG_MIDI_INSTRUMENT
 
739
+       if (::lscp_set_channel_midi_map(pMainForm->client(), m_iChannelID, iMidiMap) != LSCP_OK) {
 
740
+               appendMessagesClient("lscp_set_channel_midi_map");
 
741
+               return false;
 
742
+       }
 
743
+#endif
 
744
+       appendMessages(QObject::tr("MIDI map: %1.").arg(iMidiMap));
 
745
+
 
746
+       m_iMidiMap = iMidiMap;
 
747
+       return true;
 
748
+}
 
749
+
 
750
+
 
751
 // Audio device accessor.
 
752
 int qsamplerChannel::audioDevice (void) const
 
753
 {
 
754
@@ -351,12 +378,15 @@
 
755
 
 
756
 bool qsamplerChannel::setAudioDevice ( int iAudioDevice )
 
757
 {
 
758
-       if (client() == NULL || m_iChannelID < 0)
 
759
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
760
+       if (pMainForm == NULL)
 
761
+               return false;
 
762
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
763
                return false;
 
764
        if (m_iInstrumentStatus == 100 && m_iAudioDevice == iAudioDevice)
 
765
                return true;
 
766
 
 
767
-       if (::lscp_set_channel_audio_device(client(), m_iChannelID, iAudioDevice) != LSCP_OK) {
 
768
+       if (::lscp_set_channel_audio_device(pMainForm->client(), m_iChannelID, iAudioDevice) != LSCP_OK) {
 
769
                appendMessagesClient("lscp_set_channel_audio_device");
 
770
                return false;
 
771
        }
 
772
@@ -376,12 +406,15 @@
 
773
 
 
774
 bool qsamplerChannel::setAudioDriver ( const QString& sAudioDriver )
 
775
 {
 
776
-       if (client() == NULL || m_iChannelID < 0)
 
777
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
778
+       if (pMainForm == NULL)
 
779
+               return false;
 
780
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
781
                return false;
 
782
        if (m_iInstrumentStatus == 100 && m_sAudioDriver == sAudioDriver)
 
783
                return true;
 
784
 
 
785
-       if (::lscp_set_channel_audio_type(client(), m_iChannelID, sAudioDriver.latin1()) != LSCP_OK) {
 
786
+       if (::lscp_set_channel_audio_type(pMainForm->client(), m_iChannelID, sAudioDriver.latin1()) != LSCP_OK) {
 
787
                appendMessagesClient("lscp_set_channel_audio_type");
 
788
                return false;
 
789
        }
 
790
@@ -401,12 +434,15 @@
 
791
 
 
792
 bool qsamplerChannel::setVolume ( float fVolume )
 
793
 {
 
794
-       if (client() == NULL || m_iChannelID < 0)
 
795
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
796
+       if (pMainForm == NULL)
 
797
+               return false;
 
798
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
799
                return false;
 
800
        if (m_iInstrumentStatus == 100 && m_fVolume == fVolume)
 
801
                return true;
 
802
 
 
803
-       if (::lscp_set_channel_volume(client(), m_iChannelID, fVolume) != LSCP_OK) {
 
804
+       if (::lscp_set_channel_volume(pMainForm->client(), m_iChannelID, fVolume) != LSCP_OK) {
 
805
                appendMessagesClient("lscp_set_channel_volume");
 
806
                return false;
 
807
        }
 
808
@@ -426,13 +462,16 @@
 
809
 
 
810
 bool qsamplerChannel::setChannelMute ( bool bMute )
 
811
 {
 
812
-       if (client() == NULL || m_iChannelID < 0)
 
813
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
814
+       if (pMainForm == NULL)
 
815
+               return false;
 
816
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
817
                return false;
 
818
        if (m_iInstrumentStatus == 100 && ((m_bMute && bMute) || (!m_bMute && !bMute)))
 
819
                return true;
 
820
 
 
821
 #ifdef CONFIG_MUTE_SOLO
 
822
-       if (::lscp_set_channel_mute(client(), m_iChannelID, bMute) != LSCP_OK) {
 
823
+       if (::lscp_set_channel_mute(pMainForm->client(), m_iChannelID, bMute) != LSCP_OK) {
 
824
                appendMessagesClient("lscp_set_channel_mute");
 
825
                return false;
 
826
        }
 
827
@@ -453,13 +492,16 @@
 
828
 
 
829
 bool qsamplerChannel::setChannelSolo ( bool bSolo )
 
830
 {
 
831
-       if (client() == NULL || m_iChannelID < 0)
 
832
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
833
+       if (pMainForm == NULL)
 
834
+               return false;
 
835
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
836
                return false;
 
837
        if (m_iInstrumentStatus == 100 && ((m_bSolo && bSolo) || (!m_bSolo && !bSolo)))
 
838
                return true;
 
839
 
 
840
 #ifdef CONFIG_MUTE_SOLO
 
841
-       if (::lscp_set_channel_solo(client(), m_iChannelID, bSolo) != LSCP_OK) {
 
842
+       if (::lscp_set_channel_solo(pMainForm->client(), m_iChannelID, bSolo) != LSCP_OK) {
 
843
                appendMessagesClient("lscp_set_channel_solo");
 
844
                return false;
 
845
        }
 
846
@@ -480,13 +522,16 @@
 
847
 
 
848
 bool qsamplerChannel::setAudioChannel ( int iAudioOut, int iAudioIn )
 
849
 {
 
850
-       if (client() == NULL || m_iChannelID < 0)
 
851
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
852
+       if (pMainForm == NULL)
 
853
+               return false;
 
854
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
855
                return false;
 
856
        if (m_iInstrumentStatus == 100 &&
 
857
                        m_audioRouting[iAudioOut] == iAudioIn)
 
858
                return true;
 
859
 
 
860
-       if (::lscp_set_channel_audio_channel(client(),
 
861
+       if (::lscp_set_channel_audio_channel(pMainForm->client(),
 
862
                        m_iChannelID, iAudioOut, iAudioIn) != LSCP_OK) {
 
863
                appendMessagesClient("lscp_set_channel_audio_channel");
 
864
                return false;
 
865
@@ -519,11 +564,14 @@
 
866
 // Update whole channel info state.
 
867
 bool qsamplerChannel::updateChannelInfo (void)
 
868
 {
 
869
-       if (client() == NULL || m_iChannelID < 0)
 
870
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
871
+       if (pMainForm == NULL)
 
872
+               return false;
 
873
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
874
                return false;
 
875
 
 
876
        // Read channel information.
 
877
-       lscp_channel_info_t *pChannelInfo = ::lscp_get_channel_info(client(), m_iChannelID);
 
878
+       lscp_channel_info_t *pChannelInfo = ::lscp_get_channel_info(pMainForm->client(), m_iChannelID);
 
879
        if (pChannelInfo == NULL) {
 
880
                appendMessagesClient("lscp_get_channel_info");
 
881
                appendMessagesError(QObject::tr("Could not get channel information.\n\nSorry."));
 
882
@@ -552,6 +600,9 @@
 
883
        m_iMidiDevice       = pChannelInfo->midi_device;
 
884
        m_iMidiPort         = pChannelInfo->midi_port;
 
885
        m_iMidiChannel      = pChannelInfo->midi_channel;
 
886
+#ifdef CONFIG_MIDI_INSTRUMENT
 
887
+       m_iMidiMap          = pChannelInfo->midi_map;
 
888
+#endif
 
889
        m_iAudioDevice      = pChannelInfo->audio_device;
 
890
        m_fVolume           = pChannelInfo->volume;
 
891
 #ifdef CONFIG_MUTE_SOLO
 
892
@@ -570,7 +621,7 @@
 
893
        lscp_device_info_t *pDeviceInfo;
 
894
        const QString sNone = QObject::tr("(none)");
 
895
        // Audio device driver type.
 
896
-       pDeviceInfo = ::lscp_get_audio_device_info(client(), m_iAudioDevice);
 
897
+       pDeviceInfo = ::lscp_get_audio_device_info(pMainForm->client(), m_iAudioDevice);
 
898
        if (pDeviceInfo == NULL) {
 
899
                appendMessagesClient("lscp_get_audio_device_info");
 
900
                m_sAudioDriver = sNone;
 
901
@@ -578,7 +629,7 @@
 
902
                m_sAudioDriver = pDeviceInfo->driver;
 
903
        }
 
904
        // MIDI device driver type.
 
905
-       pDeviceInfo = ::lscp_get_midi_device_info(client(), m_iMidiDevice);
 
906
+       pDeviceInfo = ::lscp_get_midi_device_info(pMainForm->client(), m_iMidiDevice);
 
907
        if (pDeviceInfo == NULL) {
 
908
                appendMessagesClient("lscp_get_midi_device_info");
 
909
                m_sMidiDriver = sNone;
 
910
@@ -588,10 +639,15 @@
 
911
 
 
912
        // Set the audio routing map.
 
913
        m_audioRouting.clear();
 
914
-       char **ppszRouting = pChannelInfo->audio_routing;
 
915
-       for (int i = 0; ppszRouting && ppszRouting[i]; i++) {
 
916
-               m_audioRouting[i] = ::atoi(ppszRouting[i]);
 
917
-       }
 
918
+#ifdef CONFIG_AUDIO_ROUTING
 
919
+       int *piAudioRouting = pChannelInfo->audio_routing;
 
920
+       for (int i = 0; piAudioRouting && piAudioRouting[i] >= 0; i++)
 
921
+               m_audioRouting[i] = piAudioRouting[i];
 
922
+#else
 
923
+       char **ppszAudioRouting = pChannelInfo->audio_routing;
 
924
+       for (int i = 0; ppszAudioRouting && ppszAudioRouting[i]; i++)
 
925
+               m_audioRouting[i] = ::atoi(ppszAudioRouting[i]);
 
926
+#endif
 
927
 
 
928
        return true;
 
929
 }
 
930
@@ -600,10 +656,13 @@
 
931
 // Reset channel method.
 
932
 bool qsamplerChannel::channelReset (void)
 
933
 {
 
934
-       if (client() == NULL || m_iChannelID < 0)
 
935
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
936
+       if (pMainForm == NULL)
 
937
+               return false;
 
938
+       if (pMainForm->client() == NULL || m_iChannelID < 0)
 
939
                return false;
 
940
 
 
941
-       if (::lscp_reset_channel(client(), m_iChannelID) != LSCP_OK) {
 
942
+       if (::lscp_reset_channel(pMainForm->client(), m_iChannelID) != LSCP_OK) {
 
943
                appendMessagesClient("lscp_reset_channel");
 
944
                return false;
 
945
        }
 
946
@@ -617,6 +676,10 @@
 
947
 // Channel setup dialog form.
 
948
 bool qsamplerChannel::channelSetup ( QWidget *pParent )
 
949
 {
 
950
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
951
+       if (pMainForm == NULL)
 
952
+               return false;
 
953
+
 
954
        bool bResult = false;
 
955
 
 
956
        appendMessages(QObject::tr("setup..."));
 
957
@@ -635,41 +698,47 @@
 
958
 // Redirected messages output methods.
 
959
 void qsamplerChannel::appendMessages( const QString& s ) const
 
960
 {
 
961
-       if (m_pMainForm)
 
962
-               m_pMainForm->appendMessages(channelName() + ' ' + s);
 
963
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
964
+       if (pMainForm)
 
965
+               pMainForm->appendMessages(channelName() + ' ' + s);
 
966
 }
 
967
 
 
968
 void qsamplerChannel::appendMessagesColor( const QString& s,
 
969
        const QString& c ) const
 
970
 {
 
971
-       if (m_pMainForm)
 
972
-               m_pMainForm->appendMessagesColor(channelName() + ' ' + s, c);
 
973
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
974
+       if (pMainForm)
 
975
+               pMainForm->appendMessagesColor(channelName() + ' ' + s, c);
 
976
 }
 
977
 
 
978
 void qsamplerChannel::appendMessagesText( const QString& s ) const
 
979
 {
 
980
-       if (m_pMainForm)
 
981
-               m_pMainForm->appendMessagesText(channelName() + ' ' + s);
 
982
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
983
+       if (pMainForm)
 
984
+               pMainForm->appendMessagesText(channelName() + ' ' + s);
 
985
 }
 
986
 
 
987
 void qsamplerChannel::appendMessagesError( const QString& s ) const
 
988
 {
 
989
-       if (m_pMainForm)
 
990
-               m_pMainForm->appendMessagesError(channelName() + "\n\n" + s);
 
991
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
992
+       if (pMainForm)
 
993
+               pMainForm->appendMessagesError(channelName() + "\n\n" + s);
 
994
 }
 
995
 
 
996
 void qsamplerChannel::appendMessagesClient( const QString& s ) const
 
997
 {
 
998
-       if (m_pMainForm)
 
999
-               m_pMainForm->appendMessagesClient(channelName() + ' ' + s);
 
1000
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
1001
+       if (pMainForm)
 
1002
+               pMainForm->appendMessagesClient(channelName() + ' ' + s);
 
1003
 }
 
1004
 
 
1005
 
 
1006
 // Context menu event handler.
 
1007
 void qsamplerChannel::contextMenuEvent( QContextMenuEvent *pEvent )
 
1008
 {
 
1009
-       if (m_pMainForm)
 
1010
-               m_pMainForm->contextMenuEvent(pEvent);
 
1011
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
1012
+       if (pMainForm)
 
1013
+               pMainForm->contextMenuEvent(pEvent);
 
1014
 }
 
1015
 
 
1016
 
 
1017
Index: qsampler/src/qsamplerChannel.h
 
1018
diff -u qsampler/src/qsamplerChannel.h:1.18 qsampler/src/qsamplerChannel.h:1.22
 
1019
--- qsampler/src/qsamplerChannel.h:1.18 Tue Aug 30 11:52:46 2005
 
1020
+++ qsampler/src/qsamplerChannel.h      Thu Jan 11 17:14:31 2007
 
1021
@@ -1,7 +1,7 @@
 
1022
 // qsamplerChannel.h
 
1023
 //
 
1024
 /****************************************************************************
 
1025
-   Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
1026
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
1027
 
 
1028
    This program is free software; you can redistribute it and/or
 
1029
    modify it under the terms of the GNU General Public License
 
1030
@@ -13,9 +13,9 @@
 
1031
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1032
    GNU General Public License for more details.
 
1033
 
 
1034
-   You should have received a copy of the GNU General Public License
 
1035
-   along with this program; if not, write to the Free Software
 
1036
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
1037
+   You should have received a copy of the GNU General Public License along
 
1038
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
1039
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
1040
 
 
1041
 *****************************************************************************/
 
1042
 
 
1043
@@ -30,7 +30,6 @@
 
1044
 #include "qsamplerOptions.h"
 
1045
 
 
1046
 class qsamplerDevice;
 
1047
-class qsamplerMainForm;
 
1048
 
 
1049
 
 
1050
 // Typedef'd QMap.
 
1051
@@ -46,19 +45,10 @@
 
1052
 public:
 
1053
 
 
1054
        // Constructor.
 
1055
-       qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1);
 
1056
+       qsamplerChannel(int iChannelID = -1);
 
1057
        // Default destructor.
 
1058
        ~qsamplerChannel();
 
1059
 
 
1060
-       // Main application form accessor.
 
1061
-       qsamplerMainForm *mainForm() const;
 
1062
-
 
1063
-       // Main application options accessor.
 
1064
-       qsamplerOptions *options() const;
 
1065
-
 
1066
-       // LSCP client descriptor accessor.
 
1067
-       lscp_client_t * client() const;
 
1068
-
 
1069
        // Add/remove sampler channel methods.
 
1070
        bool     addChannel();
 
1071
        bool     removeChannel();
 
1072
@@ -101,6 +91,10 @@
 
1073
        int      midiChannel() const;
 
1074
        bool     setMidiChannel(int iMidiChannel);
 
1075
 
 
1076
+       // MIDI instrument map.
 
1077
+       int      midiMap() const;
 
1078
+       bool     setMidiMap(int iMidiMap);
 
1079
+
 
1080
        // Audio output driver (DEPRECATED).
 
1081
        const QString& audioDriver() const;
 
1082
        bool     setAudioDriver(const QString& sAudioDriver);
 
1083
@@ -165,9 +159,6 @@
 
1084
 
 
1085
 private:
 
1086
 
 
1087
-       // Main application form reference.
 
1088
-       qsamplerMainForm *m_pMainForm;
 
1089
-
 
1090
        // Unique channel identifier.
 
1091
        int     m_iChannelID;
 
1092
 
 
1093
@@ -181,6 +172,7 @@
 
1094
        int     m_iMidiDevice;
 
1095
        int     m_iMidiPort;
 
1096
        int     m_iMidiChannel;
 
1097
+       int     m_iMidiMap;
 
1098
        QString m_sAudioDriver;
 
1099
        int     m_iAudioDevice;
 
1100
        float   m_fVolume;
 
1101
Index: qsampler/src/qsamplerChannelForm.ui
 
1102
diff -u qsampler/src/qsamplerChannelForm.ui:1.18 qsampler/src/qsamplerChannelForm.ui:1.22
 
1103
--- qsampler/src/qsamplerChannelForm.ui:1.18    Fri Dec 23 02:40:56 2005
 
1104
+++ qsampler/src/qsamplerChannelForm.ui Mon Jan  8 23:04:33 2007
 
1105
@@ -2,7 +2,7 @@
 
1106
 <class>qsamplerChannelForm</class>
 
1107
 <comment>qsampler - A LinuxSampler Qt GUI Interface.
 
1108
 
 
1109
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
1110
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
1111
 
 
1112
    This program is free software; you can redistribute it and/or
 
1113
    modify it under the terms of the GNU General Public License
 
1114
@@ -14,9 +14,9 @@
 
1115
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1116
    GNU General Public License for more details.
 
1117
 
 
1118
-   You should have received a copy of the GNU General Public License
 
1119
-   along with this program; if not, write to the Free Software
 
1120
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
1121
+   You should have received a copy of the GNU General Public License along
 
1122
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
1123
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
1124
 
 
1125
 </comment>
 
1126
 <author>rncbc aka Rui Nuno Capela</author>
 
1127
@@ -28,8 +28,8 @@
 
1128
         <rect>
 
1129
             <x>0</x>
 
1130
             <y>0</y>
 
1131
-            <width>491</width>
 
1132
-            <height>417</height>
 
1133
+            <width>446</width>
 
1134
+            <height>436</height>
 
1135
         </rect>
 
1136
     </property>
 
1137
     <property name="sizePolicy">
 
1138
@@ -121,14 +121,14 @@
 
1139
                     <height>26</height>
 
1140
                 </size>
 
1141
             </property>
 
1142
-                       <property name="focusPolicy">
 
1143
-                               <enum>TabFocus</enum>
 
1144
-                       </property>
 
1145
+            <property name="focusPolicy">
 
1146
+                <enum>TabFocus</enum>
 
1147
+            </property>
 
1148
             <property name="text">
 
1149
                 <string></string>
 
1150
             </property>
 
1151
-            <property name="pixmap">
 
1152
-                <pixmap>fileOpen.png</pixmap>
 
1153
+            <property name="iconSet">
 
1154
+                <iconset>fileOpen.png</iconset>
 
1155
             </property>
 
1156
             <property name="toolTip" stdset="0">
 
1157
                 <string>Browse for instrument filename</string>
 
1158
@@ -159,27 +159,235 @@
 
1159
                 <string>Instrument filename</string>
 
1160
             </property>
 
1161
         </widget>
 
1162
-        <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="2">
 
1163
+        <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="3">
 
1164
             <property name="name">
 
1165
-                <cstring>InstrumentNrComboBox</cstring>
 
1166
+                <cstring>layout01</cstring>
 
1167
+            </property>
 
1168
+            <hbox>
 
1169
+                <property name="name">
 
1170
+                    <cstring>unnamed</cstring>
 
1171
+                </property>
 
1172
+                <spacer>
 
1173
+                    <property name="name">
 
1174
+                        <cstring>spacer4</cstring>
 
1175
+                    </property>
 
1176
+                    <property name="orientation">
 
1177
+                        <enum>Horizontal</enum>
 
1178
+                    </property>
 
1179
+                    <property name="sizeType">
 
1180
+                        <enum>Expanding</enum>
 
1181
+                    </property>
 
1182
+                    <property name="sizeHint">
 
1183
+                        <size>
 
1184
+                            <width>8</width>
 
1185
+                            <height>8</height>
 
1186
+                        </size>
 
1187
+                    </property>
 
1188
+                </spacer>
 
1189
+                <widget class="QPushButton">
 
1190
+                    <property name="name">
 
1191
+                        <cstring>OkPushButton</cstring>
 
1192
+                    </property>
 
1193
+                    <property name="text">
 
1194
+                        <string>OK</string>
 
1195
+                    </property>
 
1196
+                    <property name="iconSet">
 
1197
+                        <iconset>formAccept.png</iconset>
 
1198
+                    </property>
 
1199
+                </widget>
 
1200
+                <widget class="QPushButton">
 
1201
+                    <property name="name">
 
1202
+                        <cstring>CancelPushButton</cstring>
 
1203
+                    </property>
 
1204
+                    <property name="text">
 
1205
+                        <string>Cancel</string>
 
1206
+                    </property>
 
1207
+                    <property name="iconSet">
 
1208
+                        <iconset>formReject.png</iconset>
 
1209
+                    </property>
 
1210
+                </widget>
 
1211
+            </hbox>
 
1212
+        </widget>
 
1213
+        <widget class="QGroupBox" row="4" column="1" rowspan="1" colspan="2">
 
1214
+            <property name="name">
 
1215
+                <cstring>AudioGroupBox</cstring>
 
1216
             </property>
 
1217
             <property name="sizePolicy">
 
1218
                 <sizepolicy>
 
1219
                     <hsizetype>7</hsizetype>
 
1220
-                    <vsizetype>0</vsizetype>
 
1221
+                    <vsizetype>5</vsizetype>
 
1222
                     <horstretch>0</horstretch>
 
1223
                     <verstretch>0</verstretch>
 
1224
                 </sizepolicy>
 
1225
             </property>
 
1226
-            <property name="minimumSize">
 
1227
-                <size>
 
1228
-                    <width>320</width>
 
1229
-                    <height>0</height>
 
1230
-                </size>
 
1231
+            <property name="title">
 
1232
+                <string>Audio / Output</string>
 
1233
             </property>
 
1234
-            <property name="toolTip" stdset="0">
 
1235
-                <string>Instrument name</string>
 
1236
+            <property name="alignment">
 
1237
+                <set>AlignAuto</set>
 
1238
             </property>
 
1239
+            <grid>
 
1240
+                <property name="name">
 
1241
+                    <cstring>unnamed</cstring>
 
1242
+                </property>
 
1243
+                <property name="margin">
 
1244
+                    <number>8</number>
 
1245
+                </property>
 
1246
+                <property name="spacing">
 
1247
+                    <number>8</number>
 
1248
+                </property>
 
1249
+                <widget class="QLabel" row="0" column="0">
 
1250
+                    <property name="name">
 
1251
+                        <cstring>AudioDriverTextLabel</cstring>
 
1252
+                    </property>
 
1253
+                    <property name="text">
 
1254
+                        <string>&amp;Type:</string>
 
1255
+                    </property>
 
1256
+                    <property name="alignment">
 
1257
+                        <set>AlignVCenter</set>
 
1258
+                    </property>
 
1259
+                    <property name="buddy" stdset="0">
 
1260
+                        <cstring>AudioDriverComboBox</cstring>
 
1261
+                    </property>
 
1262
+                </widget>
 
1263
+                <widget class="QLayoutWidget" row="0" column="1">
 
1264
+                    <property name="name">
 
1265
+                        <cstring>layout21</cstring>
 
1266
+                    </property>
 
1267
+                    <hbox>
 
1268
+                        <property name="name">
 
1269
+                            <cstring>unnamed</cstring>
 
1270
+                        </property>
 
1271
+                        <widget class="QComboBox">
 
1272
+                            <property name="name">
 
1273
+                                <cstring>AudioDriverComboBox</cstring>
 
1274
+                            </property>
 
1275
+                            <property name="sizePolicy">
 
1276
+                                <sizepolicy>
 
1277
+                                    <hsizetype>5</hsizetype>
 
1278
+                                    <vsizetype>0</vsizetype>
 
1279
+                                    <horstretch>0</horstretch>
 
1280
+                                    <verstretch>0</verstretch>
 
1281
+                                </sizepolicy>
 
1282
+                            </property>
 
1283
+                            <property name="toolTip" stdset="0">
 
1284
+                                <string>Audio output driver type</string>
 
1285
+                            </property>
 
1286
+                        </widget>
 
1287
+                        <spacer>
 
1288
+                            <property name="name">
 
1289
+                                <cstring>spacer3</cstring>
 
1290
+                            </property>
 
1291
+                            <property name="orientation">
 
1292
+                                <enum>Horizontal</enum>
 
1293
+                            </property>
 
1294
+                            <property name="sizeType">
 
1295
+                                <enum>Expanding</enum>
 
1296
+                            </property>
 
1297
+                            <property name="sizeHint">
 
1298
+                                <size>
 
1299
+                                    <width>20</width>
 
1300
+                                    <height>20</height>
 
1301
+                                </size>
 
1302
+                            </property>
 
1303
+                        </spacer>
 
1304
+                    </hbox>
 
1305
+                </widget>
 
1306
+                <widget class="QLayoutWidget" row="1" column="1">
 
1307
+                    <property name="name">
 
1308
+                        <cstring>layout22</cstring>
 
1309
+                    </property>
 
1310
+                    <hbox>
 
1311
+                        <property name="name">
 
1312
+                            <cstring>unnamed</cstring>
 
1313
+                        </property>
 
1314
+                        <widget class="QComboBox">
 
1315
+                            <property name="name">
 
1316
+                                <cstring>AudioDeviceComboBox</cstring>
 
1317
+                            </property>
 
1318
+                            <property name="sizePolicy">
 
1319
+                                <sizepolicy>
 
1320
+                                    <hsizetype>7</hsizetype>
 
1321
+                                    <vsizetype>0</vsizetype>
 
1322
+                                    <horstretch>0</horstretch>
 
1323
+                                    <verstretch>0</verstretch>
 
1324
+                                </sizepolicy>
 
1325
+                            </property>
 
1326
+                            <property name="toolTip" stdset="0">
 
1327
+                                <string>Audio output device</string>
 
1328
+                            </property>
 
1329
+                        </widget>
 
1330
+                        <widget class="QToolButton">
 
1331
+                            <property name="name">
 
1332
+                                <cstring>AudioDeviceToolButton</cstring>
 
1333
+                            </property>
 
1334
+                            <property name="sizePolicy">
 
1335
+                                <sizepolicy>
 
1336
+                                    <hsizetype>0</hsizetype>
 
1337
+                                    <vsizetype>0</vsizetype>
 
1338
+                                    <horstretch>0</horstretch>
 
1339
+                                    <verstretch>0</verstretch>
 
1340
+                                </sizepolicy>
 
1341
+                            </property>
 
1342
+                            <property name="minimumSize">
 
1343
+                                <size>
 
1344
+                                    <width>24</width>
 
1345
+                                    <height>24</height>
 
1346
+                                </size>
 
1347
+                            </property>
 
1348
+                            <property name="maximumSize">
 
1349
+                                <size>
 
1350
+                                    <width>26</width>
 
1351
+                                    <height>26</height>
 
1352
+                                </size>
 
1353
+                            </property>
 
1354
+                            <property name="focusPolicy">
 
1355
+                                <enum>TabFocus</enum>
 
1356
+                            </property>
 
1357
+                            <property name="text">
 
1358
+                                <string></string>
 
1359
+                            </property>
 
1360
+                            <property name="iconSet">
 
1361
+                                <iconset>audio1.png</iconset>
 
1362
+                            </property>
 
1363
+                            <property name="toolTip" stdset="0">
 
1364
+                                <string>Audio output device setup</string>
 
1365
+                            </property>
 
1366
+                        </widget>
 
1367
+                    </hbox>
 
1368
+                </widget>
 
1369
+                <widget class="QLabel" row="1" column="0">
 
1370
+                    <property name="name">
 
1371
+                        <cstring>AudioDeviceTextLabel</cstring>
 
1372
+                    </property>
 
1373
+                    <property name="text">
 
1374
+                        <string>&amp;Device:</string>
 
1375
+                    </property>
 
1376
+                    <property name="alignment">
 
1377
+                        <set>AlignVCenter</set>
 
1378
+                    </property>
 
1379
+                    <property name="buddy" stdset="0">
 
1380
+                        <cstring>AudioDeviceComboBox</cstring>
 
1381
+                    </property>
 
1382
+                </widget>
 
1383
+                <widget class="qsamplerChannelRoutingTable" row="2" column="1">
 
1384
+                    <property name="name">
 
1385
+                        <cstring>AudioRoutingTable</cstring>
 
1386
+                    </property>
 
1387
+                    <property name="minimumSize">
 
1388
+                        <size>
 
1389
+                            <width>0</width>
 
1390
+                            <height>100</height>
 
1391
+                        </size>
 
1392
+                    </property>
 
1393
+                    <property name="focusPolicy">
 
1394
+                        <enum>StrongFocus</enum>
 
1395
+                    </property>
 
1396
+                    <property name="toolTip" stdset="0">
 
1397
+                        <string>Audio output channel routing</string>
 
1398
+                    </property>
 
1399
+                </widget>
 
1400
+            </grid>
 
1401
         </widget>
 
1402
         <widget class="QLabel" row="2" column="0">
 
1403
             <property name="name">
 
1404
@@ -195,6 +403,28 @@
 
1405
                 <cstring>InstrumentNrComboBox</cstring>
 
1406
             </property>
 
1407
         </widget>
 
1408
+        <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="2">
 
1409
+            <property name="name">
 
1410
+                <cstring>InstrumentNrComboBox</cstring>
 
1411
+            </property>
 
1412
+            <property name="sizePolicy">
 
1413
+                <sizepolicy>
 
1414
+                    <hsizetype>7</hsizetype>
 
1415
+                    <vsizetype>0</vsizetype>
 
1416
+                    <horstretch>0</horstretch>
 
1417
+                    <verstretch>0</verstretch>
 
1418
+                </sizepolicy>
 
1419
+            </property>
 
1420
+            <property name="minimumSize">
 
1421
+                <size>
 
1422
+                    <width>320</width>
 
1423
+                    <height>0</height>
 
1424
+                </size>
 
1425
+            </property>
 
1426
+            <property name="toolTip" stdset="0">
 
1427
+                <string>Instrument name</string>
 
1428
+            </property>
 
1429
+        </widget>
 
1430
         <widget class="QGroupBox" row="3" column="1" rowspan="1" colspan="2">
 
1431
             <property name="name">
 
1432
                 <cstring>MidiGroupBox</cstring>
 
1433
@@ -231,21 +461,98 @@
 
1434
                         <set>AlignVCenter</set>
 
1435
                     </property>
 
1436
                     <property name="buddy" stdset="0">
 
1437
-                        <cstring>MidiDriverComboBox</cstring>
 
1438
+                        <cstring>MidiDriverComboBox</cstring>
 
1439
+                    </property>
 
1440
+                </widget>
 
1441
+                <widget class="QLayoutWidget" row="1" column="1">
 
1442
+                    <property name="name">
 
1443
+                        <cstring>layout12</cstring>
 
1444
+                    </property>
 
1445
+                    <hbox>
 
1446
+                        <property name="name">
 
1447
+                            <cstring>unnamed</cstring>
 
1448
+                        </property>
 
1449
+                        <widget class="QComboBox">
 
1450
+                            <property name="name">
 
1451
+                                <cstring>MidiDeviceComboBox</cstring>
 
1452
+                            </property>
 
1453
+                            <property name="sizePolicy">
 
1454
+                                <sizepolicy>
 
1455
+                                    <hsizetype>7</hsizetype>
 
1456
+                                    <vsizetype>0</vsizetype>
 
1457
+                                    <horstretch>0</horstretch>
 
1458
+                                    <verstretch>0</verstretch>
 
1459
+                                </sizepolicy>
 
1460
+                            </property>
 
1461
+                            <property name="toolTip" stdset="0">
 
1462
+                                <string>MIDI input device</string>
 
1463
+                            </property>
 
1464
+                        </widget>
 
1465
+                        <widget class="QToolButton">
 
1466
+                            <property name="name">
 
1467
+                                <cstring>MidiDeviceToolButton</cstring>
 
1468
+                            </property>
 
1469
+                            <property name="sizePolicy">
 
1470
+                                <sizepolicy>
 
1471
+                                    <hsizetype>0</hsizetype>
 
1472
+                                    <vsizetype>0</vsizetype>
 
1473
+                                    <horstretch>0</horstretch>
 
1474
+                                    <verstretch>0</verstretch>
 
1475
+                                </sizepolicy>
 
1476
+                            </property>
 
1477
+                            <property name="minimumSize">
 
1478
+                                <size>
 
1479
+                                    <width>24</width>
 
1480
+                                    <height>24</height>
 
1481
+                                </size>
 
1482
+                            </property>
 
1483
+                            <property name="maximumSize">
 
1484
+                                <size>
 
1485
+                                    <width>26</width>
 
1486
+                                    <height>26</height>
 
1487
+                                </size>
 
1488
+                            </property>
 
1489
+                            <property name="focusPolicy">
 
1490
+                                <enum>TabFocus</enum>
 
1491
+                            </property>
 
1492
+                            <property name="text">
 
1493
+                                <string></string>
 
1494
+                            </property>
 
1495
+                            <property name="iconSet">
 
1496
+                                <iconset>midi1.png</iconset>
 
1497
+                            </property>
 
1498
+                            <property name="toolTip" stdset="0">
 
1499
+                                <string>MIDI input device setup</string>
 
1500
+                            </property>
 
1501
+                        </widget>
 
1502
+                    </hbox>
 
1503
+                </widget>
 
1504
+                <widget class="QLabel" row="1" column="0">
 
1505
+                    <property name="name">
 
1506
+                        <cstring>MidiDeviceTextLabel</cstring>
 
1507
+                    </property>
 
1508
+                    <property name="text">
 
1509
+                        <string>&amp;Device:</string>
 
1510
+                    </property>
 
1511
+                    <property name="alignment">
 
1512
+                        <set>AlignVCenter</set>
 
1513
+                    </property>
 
1514
+                    <property name="buddy" stdset="0">
 
1515
+                        <cstring>MidiDeviceComboBox</cstring>
 
1516
                     </property>
 
1517
                 </widget>
 
1518
-                <widget class="QLabel" row="1" column="0">
 
1519
+                <widget class="QLabel" row="2" column="0">
 
1520
                     <property name="name">
 
1521
-                        <cstring>MidiDeviceTextLabel</cstring>
 
1522
+                        <cstring>MidiMapTextLabel</cstring>
 
1523
                     </property>
 
1524
                     <property name="text">
 
1525
-                        <string>&amp;Device:</string>
 
1526
+                        <string>&amp;Map:</string>
 
1527
                     </property>
 
1528
                     <property name="alignment">
 
1529
-                        <set>AlignVCenter</set>
 
1530
+                        <set>AlignVCenter|AlignRight</set>
 
1531
                     </property>
 
1532
                     <property name="buddy" stdset="0">
 
1533
-                        <cstring>MidiDeviceComboBox</cstring>
 
1534
+                        <cstring>MidiMapComboBox</cstring>
 
1535
                     </property>
 
1536
                 </widget>
 
1537
                 <widget class="QLayoutWidget" row="0" column="1">
 
1538
@@ -420,9 +727,9 @@
 
1539
                         </widget>
 
1540
                     </hbox>
 
1541
                 </widget>
 
1542
-                <widget class="QLayoutWidget" row="1" column="1">
 
1543
+                <widget class="QLayoutWidget" row="2" column="1">
 
1544
                     <property name="name">
 
1545
-                        <cstring>layout12</cstring>
 
1546
+                        <cstring>layout6</cstring>
 
1547
                     </property>
 
1548
                     <hbox>
 
1549
                         <property name="name">
 
1550
@@ -430,7 +737,7 @@
 
1551
                         </property>
 
1552
                         <widget class="QComboBox">
 
1553
                             <property name="name">
 
1554
-                                <cstring>MidiDeviceComboBox</cstring>
 
1555
+                                <cstring>MidiMapComboBox</cstring>
 
1556
                             </property>
 
1557
                             <property name="sizePolicy">
 
1558
                                 <sizepolicy>
 
1559
@@ -441,168 +748,12 @@
 
1560
                                 </sizepolicy>
 
1561
                             </property>
 
1562
                             <property name="toolTip" stdset="0">
 
1563
-                                <string>MIDI input device</string>
 
1564
-                            </property>
 
1565
-                        </widget>
 
1566
-                        <widget class="QToolButton">
 
1567
-                            <property name="name">
 
1568
-                                <cstring>MidiDeviceToolButton</cstring>
 
1569
-                            </property>
 
1570
-                            <property name="sizePolicy">
 
1571
-                                <sizepolicy>
 
1572
-                                    <hsizetype>0</hsizetype>
 
1573
-                                    <vsizetype>0</vsizetype>
 
1574
-                                    <horstretch>0</horstretch>
 
1575
-                                    <verstretch>0</verstretch>
 
1576
-                                </sizepolicy>
 
1577
-                            </property>
 
1578
-                            <property name="minimumSize">
 
1579
-                                <size>
 
1580
-                                    <width>24</width>
 
1581
-                                    <height>24</height>
 
1582
-                                </size>
 
1583
-                            </property>
 
1584
-                            <property name="maximumSize">
 
1585
-                                <size>
 
1586
-                                    <width>26</width>
 
1587
-                                    <height>26</height>
 
1588
-                                </size>
 
1589
-                            </property>
 
1590
-                                                       <property name="focusPolicy">
 
1591
-                                                               <enum>TabFocus</enum>
 
1592
-                                                       </property>
 
1593
-                            <property name="text">
 
1594
-                                <string></string>
 
1595
-                            </property>
 
1596
-                            <property name="pixmap">
 
1597
-                                <pixmap>midi1.png</pixmap>
 
1598
-                            </property>
 
1599
-                            <property name="toolTip" stdset="0">
 
1600
-                                <string>MIDI input device setup</string>
 
1601
-                            </property>
 
1602
-                        </widget>
 
1603
-                    </hbox>
 
1604
-                </widget>
 
1605
-            </grid>
 
1606
-        </widget>
 
1607
-        <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="3">
 
1608
-            <property name="name">
 
1609
-                <cstring>layout01</cstring>
 
1610
-            </property>
 
1611
-            <hbox>
 
1612
-                <property name="name">
 
1613
-                    <cstring>unnamed</cstring>
 
1614
-                </property>
 
1615
-                <spacer>
 
1616
-                    <property name="name">
 
1617
-                        <cstring>spacer3</cstring>
 
1618
-                    </property>
 
1619
-                    <property name="orientation">
 
1620
-                        <enum>Horizontal</enum>
 
1621
-                    </property>
 
1622
-                    <property name="sizeType">
 
1623
-                        <enum>Expanding</enum>
 
1624
-                    </property>
 
1625
-                    <property name="sizeHint">
 
1626
-                        <size>
 
1627
-                            <width>8</width>
 
1628
-                            <height>8</height>
 
1629
-                        </size>
 
1630
-                    </property>
 
1631
-                </spacer>
 
1632
-                <widget class="QPushButton">
 
1633
-                    <property name="name">
 
1634
-                        <cstring>OkPushButton</cstring>
 
1635
-                    </property>
 
1636
-                    <property name="text">
 
1637
-                        <string>OK</string>
 
1638
-                    </property>
 
1639
-                    <property name="iconSet">
 
1640
-                        <iconset>formAccept.png</iconset>
 
1641
-                    </property>
 
1642
-                </widget>
 
1643
-                <widget class="QPushButton">
 
1644
-                    <property name="name">
 
1645
-                        <cstring>CancelPushButton</cstring>
 
1646
-                    </property>
 
1647
-                    <property name="text">
 
1648
-                        <string>Cancel</string>
 
1649
-                    </property>
 
1650
-                    <property name="iconSet">
 
1651
-                        <iconset>formReject.png</iconset>
 
1652
-                    </property>
 
1653
-                </widget>
 
1654
-            </hbox>
 
1655
-        </widget>
 
1656
-        <widget class="QGroupBox" row="4" column="1" rowspan="1" colspan="2">
 
1657
-            <property name="name">
 
1658
-                <cstring>AudioGroupBox</cstring>
 
1659
-            </property>
 
1660
-            <property name="sizePolicy">
 
1661
-                <sizepolicy>
 
1662
-                    <hsizetype>7</hsizetype>
 
1663
-                    <vsizetype>5</vsizetype>
 
1664
-                    <horstretch>0</horstretch>
 
1665
-                    <verstretch>0</verstretch>
 
1666
-                </sizepolicy>
 
1667
-            </property>
 
1668
-            <property name="title">
 
1669
-                <string>Audio / Output</string>
 
1670
-            </property>
 
1671
-            <property name="alignment">
 
1672
-                <set>AlignAuto</set>
 
1673
-            </property>
 
1674
-            <grid>
 
1675
-                <property name="name">
 
1676
-                    <cstring>unnamed</cstring>
 
1677
-                </property>
 
1678
-                <property name="margin">
 
1679
-                    <number>8</number>
 
1680
-                </property>
 
1681
-                <property name="spacing">
 
1682
-                    <number>8</number>
 
1683
-                </property>
 
1684
-                <widget class="QLabel" row="0" column="0">
 
1685
-                    <property name="name">
 
1686
-                        <cstring>AudioDriverTextLabel</cstring>
 
1687
-                    </property>
 
1688
-                    <property name="text">
 
1689
-                        <string>&amp;Type:</string>
 
1690
-                    </property>
 
1691
-                    <property name="alignment">
 
1692
-                        <set>AlignVCenter</set>
 
1693
-                    </property>
 
1694
-                    <property name="buddy" stdset="0">
 
1695
-                        <cstring>AudioDriverComboBox</cstring>
 
1696
-                    </property>
 
1697
-                </widget>
 
1698
-                <widget class="QLayoutWidget" row="0" column="1">
 
1699
-                    <property name="name">
 
1700
-                        <cstring>layout21</cstring>
 
1701
-                    </property>
 
1702
-                    <hbox>
 
1703
-                        <property name="name">
 
1704
-                            <cstring>unnamed</cstring>
 
1705
-                        </property>
 
1706
-                        <widget class="QComboBox">
 
1707
-                            <property name="name">
 
1708
-                                <cstring>AudioDriverComboBox</cstring>
 
1709
-                            </property>
 
1710
-                            <property name="sizePolicy">
 
1711
-                                <sizepolicy>
 
1712
-                                    <hsizetype>5</hsizetype>
 
1713
-                                    <vsizetype>0</vsizetype>
 
1714
-                                    <horstretch>0</horstretch>
 
1715
-                                    <verstretch>0</verstretch>
 
1716
-                                </sizepolicy>
 
1717
-                            </property>
 
1718
-                            <property name="toolTip" stdset="0">
 
1719
-                                <string>Audio output driver type</string>
 
1720
+                                <string>Instrument map</string>
 
1721
                             </property>
 
1722
                         </widget>
 
1723
                         <spacer>
 
1724
                             <property name="name">
 
1725
-                                <cstring>spacer2</cstring>
 
1726
+                                <cstring>spacer1_2</cstring>
 
1727
                             </property>
 
1728
                             <property name="orientation">
 
1729
                                 <enum>Horizontal</enum>
 
1730
@@ -612,107 +763,13 @@
 
1731
                             </property>
 
1732
                             <property name="sizeHint">
 
1733
                                 <size>
 
1734
-                                    <width>20</width>
 
1735
+                                    <width>160</width>
 
1736
                                     <height>20</height>
 
1737
                                 </size>
 
1738
                             </property>
 
1739
                         </spacer>
 
1740
                     </hbox>
 
1741
                 </widget>
 
1742
-                <widget class="QLayoutWidget" row="1" column="1">
 
1743
-                    <property name="name">
 
1744
-                        <cstring>layout22</cstring>
 
1745
-                    </property>
 
1746
-                    <hbox>
 
1747
-                        <property name="name">
 
1748
-                            <cstring>unnamed</cstring>
 
1749
-                        </property>
 
1750
-                        <widget class="QComboBox">
 
1751
-                            <property name="name">
 
1752
-                                <cstring>AudioDeviceComboBox</cstring>
 
1753
-                            </property>
 
1754
-                            <property name="sizePolicy">
 
1755
-                                <sizepolicy>
 
1756
-                                    <hsizetype>7</hsizetype>
 
1757
-                                    <vsizetype>0</vsizetype>
 
1758
-                                    <horstretch>0</horstretch>
 
1759
-                                    <verstretch>0</verstretch>
 
1760
-                                </sizepolicy>
 
1761
-                            </property>
 
1762
-                            <property name="toolTip" stdset="0">
 
1763
-                                <string>Audio output device</string>
 
1764
-                            </property>
 
1765
-                        </widget>
 
1766
-                        <widget class="QToolButton">
 
1767
-                            <property name="name">
 
1768
-                                <cstring>AudioDeviceToolButton</cstring>
 
1769
-                            </property>
 
1770
-                            <property name="sizePolicy">
 
1771
-                                <sizepolicy>
 
1772
-                                    <hsizetype>0</hsizetype>
 
1773
-                                    <vsizetype>0</vsizetype>
 
1774
-                                    <horstretch>0</horstretch>
 
1775
-                                    <verstretch>0</verstretch>
 
1776
-                                </sizepolicy>
 
1777
-                            </property>
 
1778
-                            <property name="minimumSize">
 
1779
-                                <size>
 
1780
-                                    <width>24</width>
 
1781
-                                    <height>24</height>
 
1782
-                                </size>
 
1783
-                            </property>
 
1784
-                            <property name="maximumSize">
 
1785
-                                <size>
 
1786
-                                    <width>26</width>
 
1787
-                                    <height>26</height>
 
1788
-                                </size>
 
1789
-                            </property>
 
1790
-                                                       <property name="focusPolicy">
 
1791
-                                                               <enum>TabFocus</enum>
 
1792
-                                                       </property>
 
1793
-                            <property name="text">
 
1794
-                                <string></string>
 
1795
-                            </property>
 
1796
-                            <property name="pixmap">
 
1797
-                                <pixmap>audio1.png</pixmap>
 
1798
-                            </property>
 
1799
-                            <property name="toolTip" stdset="0">
 
1800
-                                <string>Audio output device setup</string>
 
1801
-                            </property>
 
1802
-                        </widget>
 
1803
-                    </hbox>
 
1804
-                </widget>
 
1805
-                <widget class="QLabel" row="1" column="0">
 
1806
-                    <property name="name">
 
1807
-                        <cstring>AudioDeviceTextLabel</cstring>
 
1808
-                    </property>
 
1809
-                    <property name="text">
 
1810
-                        <string>&amp;Device:</string>
 
1811
-                    </property>
 
1812
-                    <property name="alignment">
 
1813
-                        <set>AlignVCenter</set>
 
1814
-                    </property>
 
1815
-                    <property name="buddy" stdset="0">
 
1816
-                        <cstring>AudioDeviceComboBox</cstring>
 
1817
-                    </property>
 
1818
-                </widget>
 
1819
-                <widget class="qsamplerChannelRoutingTable" row="2" column="1">
 
1820
-                    <property name="name">
 
1821
-                        <cstring>AudioRoutingTable</cstring>
 
1822
-                    </property>
 
1823
-                    <property name="minimumSize">
 
1824
-                        <size>
 
1825
-                            <width>0</width>
 
1826
-                            <height>100</height>
 
1827
-                        </size>
 
1828
-                    </property>
 
1829
-                    <property name="focusPolicy">
 
1830
-                        <enum>StrongFocus</enum>
 
1831
-                    </property>
 
1832
-                    <property name="toolTip" stdset="0">
 
1833
-                        <string>Audio output channel routing</string>
 
1834
-                    </property>
 
1835
-                </widget>
 
1836
             </grid>
 
1837
         </widget>
 
1838
     </grid>
 
1839
@@ -784,6 +841,12 @@
 
1840
         <slot>optionsChanged()</slot>
 
1841
     </connection>
 
1842
     <connection>
 
1843
+        <sender>MidiMapComboBox</sender>
 
1844
+        <signal>activated(int)</signal>
 
1845
+        <receiver>qsamplerChannelForm</receiver>
 
1846
+        <slot>optionsChanged()</slot>
 
1847
+    </connection>
 
1848
+    <connection>
 
1849
         <sender>AudioDriverComboBox</sender>
 
1850
         <signal>activated(const QString&amp;)</signal>
 
1851
         <receiver>qsamplerChannelForm</receiver>
 
1852
@@ -830,6 +893,7 @@
 
1853
     <tabstop>MidiChannelComboBox</tabstop>
 
1854
     <tabstop>MidiDeviceComboBox</tabstop>
 
1855
     <tabstop>MidiDeviceToolButton</tabstop>
 
1856
+    <tabstop>MidiMapComboBox</tabstop>
 
1857
     <tabstop>AudioDriverComboBox</tabstop>
 
1858
     <tabstop>AudioDeviceComboBox</tabstop>
 
1859
     <tabstop>AudioDeviceToolButton</tabstop>
 
1860
@@ -882,4 +946,7 @@
 
1861
 </functions>
 
1862
 <pixmapinproject/>
 
1863
 <layoutdefaults spacing="4" margin="4"/>
 
1864
+<includehints>
 
1865
+    <includehint>qsamplerChannel.h</includehint>
 
1866
+</includehints>
 
1867
 </UI>
 
1868
Index: qsampler/src/qsamplerChannelForm.ui.h
 
1869
diff -u qsampler/src/qsamplerChannelForm.ui.h:1.34 qsampler/src/qsamplerChannelForm.ui.h:1.38
 
1870
--- qsampler/src/qsamplerChannelForm.ui.h:1.34  Tue Aug 30 11:52:46 2005
 
1871
+++ qsampler/src/qsamplerChannelForm.ui.h       Mon Jan  8 23:04:33 2007
 
1872
@@ -2,7 +2,7 @@
 
1873
 //
 
1874
 // ui.h extension file, included from the uic-generated form implementation.
 
1875
 /****************************************************************************
 
1876
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
1877
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
1878
 
 
1879
    This program is free software; you can redistribute it and/or
 
1880
    modify it under the terms of the GNU General Public License
 
1881
@@ -14,15 +14,19 @@
 
1882
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
1883
    GNU General Public License for more details.
 
1884
 
 
1885
-   You should have received a copy of the GNU General Public License
 
1886
-   along with this program; if not, write to the Free Software
 
1887
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
1888
+   You should have received a copy of the GNU General Public License along
 
1889
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
1890
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
1891
 
 
1892
 *****************************************************************************/
 
1893
 
 
1894
 #include "qsamplerAbout.h"
 
1895
 #include "qsamplerDeviceForm.h"
 
1896
 
 
1897
+#include "qsamplerMainForm.h"
 
1898
+#include "qsamplerInstrument.h"
 
1899
+
 
1900
+
 
1901
 #include <qvalidator.h>
 
1902
 #include <qmessagebox.h>
 
1903
 #include <qfiledialog.h>
 
1904
@@ -74,10 +78,13 @@
 
1905
        setCaption(QSAMPLER_TITLE ": " + m_pChannel->channelName());
 
1906
 
 
1907
        // Check if we're up and connected.
 
1908
-       if (m_pChannel->client() == NULL)
 
1909
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
1910
+       if (pMainForm == NULL)
 
1911
+               return;
 
1912
+       if (pMainForm->client() == NULL)
 
1913
                return;
 
1914
 
 
1915
-       qsamplerOptions *pOptions = m_pChannel->options();
 
1916
+       qsamplerOptions *pOptions = pMainForm->options();
 
1917
        if (pOptions == NULL)
 
1918
                return;
 
1919
 
 
1920
@@ -92,7 +99,7 @@
 
1921
                this, SLOT(changeAudioRouting(int,int)));
 
1922
 
 
1923
        // Populate Engines list.
 
1924
-       const char **ppszEngines = ::lscp_list_available_engines(m_pChannel->client());
 
1925
+       const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client());
 
1926
        if (ppszEngines) {
 
1927
                EngineNameComboBox->clear();
 
1928
                for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)
 
1929
@@ -103,12 +110,16 @@
 
1930
        // Populate Audio output type list.
 
1931
        AudioDriverComboBox->clear();
 
1932
        AudioDriverComboBox->insertStringList(
 
1933
-               qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Audio));
 
1934
+               qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio));
 
1935
 
 
1936
        // Populate MIDI input type list.
 
1937
        MidiDriverComboBox->clear();
 
1938
        MidiDriverComboBox->insertStringList(
 
1939
-               qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Midi));
 
1940
+               qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi));
 
1941
+
 
1942
+       // Populate Maps list.
 
1943
+       MidiMapComboBox->clear();
 
1944
+       MidiMapComboBox->insertStringList(qsamplerInstrument::getMapNames());
 
1945
 
 
1946
        // Read proper channel information,
 
1947
        // and populate the channel form fields.
 
1948
@@ -136,8 +147,7 @@
 
1949
        InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
 
1950
 
 
1951
        // MIDI input device...
 
1952
-       qsamplerDevice midiDevice(m_pChannel->mainForm(),
 
1953
-               qsamplerDevice::Midi, m_pChannel->midiDevice());
 
1954
+       qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice());
 
1955
        // MIDI input driver...
 
1956
        QString sMidiDriver = midiDevice.driverName();
 
1957
        if (sMidiDriver.isEmpty() || bNew)
 
1958
@@ -159,12 +169,23 @@
 
1959
        int iMidiChannel = pChannel->midiChannel();
 
1960
        // When new, try to suggest a sensible MIDI channel...
 
1961
        if (iMidiChannel < 0)
 
1962
-               iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16);
 
1963
+               iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16);
 
1964
        MidiChannelComboBox->setCurrentItem(iMidiChannel);
 
1965
+       // MIDI instrument map...
 
1966
+       int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap());
 
1967
+       // When new, try to suggest a sensible MIDI map...
 
1968
+       if (iMidiMap < 0)
 
1969
+               iMidiMap = 0;
 
1970
+       const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap);
 
1971
+       if (!sMapName.isEmpty())
 
1972
+               MidiMapComboBox->setCurrentText(sMapName);
 
1973
+       // It might be no maps around...
 
1974
+       bool bMidiMapEnabled = (MidiMapComboBox->count() > 0);
 
1975
+       MidiMapTextLabel->setEnabled(bMidiMapEnabled);
 
1976
+       MidiMapComboBox->setEnabled(bMidiMapEnabled);
 
1977
 
 
1978
        // Audio output device...
 
1979
-       qsamplerDevice audioDevice(m_pChannel->mainForm(),
 
1980
-               qsamplerDevice::Audio, m_pChannel->audioDevice());
 
1981
+       qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice());
 
1982
        // Audio output driver...
 
1983
        QString sAudioDriver = audioDevice.driverName();
 
1984
        if (sAudioDriver.isEmpty() || bNew)
 
1985
@@ -198,7 +219,13 @@
 
1986
        if (m_pChannel == NULL)
 
1987
                return;
 
1988
 
 
1989
-       qsamplerOptions *pOptions = m_pChannel->options();
 
1990
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
1991
+       if (pMainForm == NULL)
 
1992
+               return;
 
1993
+       if (pMainForm->client() == NULL)
 
1994
+               return;
 
1995
+
 
1996
+       qsamplerOptions *pOptions = pMainForm->options();
 
1997
        if (pOptions == NULL)
 
1998
                return;
 
1999
 
 
2000
@@ -252,7 +279,13 @@
 
2001
                if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
 
2002
                        iErrors++;
 
2003
                // Instrument file and index...
 
2004
-               if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem()))
 
2005
+               const QString& sPath = InstrumentFileComboBox->currentText();
 
2006
+               if (!sPath.isEmpty() && QFileInfo(sPath).exists()) {
 
2007
+                       if (!m_pChannel->loadInstrument(sPath, InstrumentNrComboBox->currentItem()))
 
2008
+                               iErrors++;
 
2009
+               }
 
2010
+               // MIDI intrument map...
 
2011
+               if (!m_pChannel->setMidiMap(MidiMapComboBox->currentItem()))
 
2012
                        iErrors++;
 
2013
                // Show error messages?
 
2014
                if (iErrors > 0)
 
2015
@@ -264,6 +297,7 @@
 
2016
        pOptions->sEngineName  = EngineNameComboBox->currentText();
 
2017
        pOptions->sAudioDriver = AudioDriverComboBox->currentText();
 
2018
        pOptions->sMidiDriver  = MidiDriverComboBox->currentText();
 
2019
+       pOptions->iMidiMap     = MidiMapComboBox->currentItem();
 
2020
        pOptions->saveComboBoxHistory(InstrumentFileComboBox);
 
2021
 
 
2022
        // Just go with dialog acceptance.
 
2023
@@ -290,6 +324,7 @@
 
2024
                        break;
 
2025
                default:    // Cancel.
 
2026
                        bReject = false;
 
2027
+                       break;
 
2028
                }
 
2029
        }
 
2030
 
 
2031
@@ -301,7 +336,13 @@
 
2032
 // Browse and open an instrument file.
 
2033
 void qsamplerChannelForm::openInstrumentFile (void)
 
2034
 {
 
2035
-       qsamplerOptions *pOptions = m_pChannel->options();
 
2036
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2037
+       if (pMainForm == NULL)
 
2038
+               return;
 
2039
+       if (pMainForm->client() == NULL)
 
2040
+               return;
 
2041
+
 
2042
+       qsamplerOptions *pOptions = pMainForm->options();
 
2043
        if (pOptions == NULL)
 
2044
                return;
 
2045
 
 
2046
@@ -325,7 +366,13 @@
 
2047
 // Refresh the actual instrument name.
 
2048
 void qsamplerChannelForm::updateInstrumentName (void)
 
2049
 {
 
2050
-       qsamplerOptions *pOptions = m_pChannel->options();
 
2051
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2052
+       if (pMainForm == NULL)
 
2053
+               return;
 
2054
+       if (pMainForm->client() == NULL)
 
2055
+               return;
 
2056
+
 
2057
+       qsamplerOptions *pOptions = pMainForm->options();
 
2058
        if (pOptions == NULL)
 
2059
                return;
 
2060
 
 
2061
@@ -341,16 +388,22 @@
 
2062
        optionsChanged();
 
2063
 }
 
2064
 
 
2065
+
 
2066
 // Show device options dialog.
 
2067
 void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice,
 
2068
        qsamplerDevice::qsamplerDeviceType deviceTypeMode,
 
2069
        const QString& sDriverName )
 
2070
 {
 
2071
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2072
+       if (pMainForm == NULL)
 
2073
+               return;
 
2074
+       if (pMainForm->client() == NULL)
 
2075
+               return;
 
2076
+
 
2077
        // Create the device form if not already...
 
2078
        if (m_pDeviceForm == NULL) {
 
2079
                m_pDeviceForm = new qsamplerDeviceForm(this, 0,
 
2080
                        WType_Dialog | WShowModal);
 
2081
-               m_pDeviceForm->setMainForm(m_pChannel->mainForm());
 
2082
                QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
 
2083
                        this, SLOT(updateDevices()));
 
2084
        }
 
2085
@@ -358,7 +411,7 @@
 
2086
        // Refresh the device form with selected data.
 
2087
        if (m_pDeviceForm) {
 
2088
                m_pDeviceForm->setDeviceTypeMode(deviceTypeMode);
 
2089
-               m_pDeviceForm->setClient(m_pChannel->client()); // -> refreshDevices();
 
2090
+               m_pDeviceForm->refreshDevices();
 
2091
                m_pDeviceForm->setDevice(pDevice);
 
2092
                m_pDeviceForm->setDriverName(sDriverName);
 
2093
                m_pDeviceForm->show();
 
2094
@@ -369,6 +422,12 @@
 
2095
 // Refresh MIDI driver item devices.
 
2096
 void qsamplerChannelForm::selectMidiDriverItem ( const QString& sMidiDriver )
 
2097
 {
 
2098
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2099
+       if (pMainForm == NULL)
 
2100
+               return;
 
2101
+       if (pMainForm->client() == NULL)
 
2102
+               return;
 
2103
+
 
2104
        const QString sDriverName = sMidiDriver.upper();
 
2105
 
 
2106
        // Save current device id.
 
2107
@@ -383,11 +442,10 @@
 
2108
 
 
2109
        // Populate with the current ones...
 
2110
        const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png");
 
2111
-       int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),
 
2112
+       int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
 
2113
                qsamplerDevice::Midi);
 
2114
        for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
 
2115
-               pDevice = new qsamplerDevice(m_pChannel->mainForm(),
 
2116
-                       qsamplerDevice::Midi, piDeviceIDs[i]);
 
2117
+               pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]);
 
2118
                if (pDevice->driverName().upper() == sDriverName) {
 
2119
                        MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName());
 
2120
                        m_midiDevices.append(pDevice);
 
2121
@@ -468,6 +526,12 @@
 
2122
 // Refresh Audio driver item devices.
 
2123
 void qsamplerChannelForm::selectAudioDriverItem ( const QString& sAudioDriver )
 
2124
 {
 
2125
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2126
+       if (pMainForm == NULL)
 
2127
+               return;
 
2128
+       if (pMainForm->client() == NULL)
 
2129
+               return;
 
2130
+
 
2131
        const QString sDriverName = sAudioDriver.upper();
 
2132
 
 
2133
        // Save current device id.
 
2134
@@ -482,11 +546,10 @@
 
2135
 
 
2136
        // Populate with the current ones...
 
2137
        const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png");
 
2138
-       int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(),
 
2139
+       int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
 
2140
                qsamplerDevice::Audio);
 
2141
        for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
 
2142
-               pDevice = new qsamplerDevice(m_pChannel->mainForm(),
 
2143
-                       qsamplerDevice::Audio, piDeviceIDs[i]);
 
2144
+               pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]);
 
2145
                if (pDevice->driverName().upper() == sDriverName) {
 
2146
                        AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName());
 
2147
                        m_audioDevices.append(pDevice);
 
2148
@@ -613,8 +676,12 @@
 
2149
 // Stabilize current form state.
 
2150
 void qsamplerChannelForm::stabilizeForm (void)
 
2151
 {
 
2152
-       const QString& sFilename = InstrumentFileComboBox->currentText();
 
2153
-       OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());
 
2154
+       bool bValid = true;
 
2155
+#if 0
 
2156
+       const QString& sPath = InstrumentFileComboBox->currentText();
 
2157
+       bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
 
2158
+#endif
 
2159
+       OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);
 
2160
 }
 
2161
 
 
2162
 
 
2163
Index: qsampler/src/qsamplerChannelStrip.ui
 
2164
diff -u qsampler/src/qsamplerChannelStrip.ui:1.22 qsampler/src/qsamplerChannelStrip.ui:1.26
 
2165
--- qsampler/src/qsamplerChannelStrip.ui:1.22   Sun Aug 28 17:56:05 2005
 
2166
+++ qsampler/src/qsamplerChannelStrip.ui        Wed Jan 10 20:39:00 2007
 
2167
@@ -2,7 +2,7 @@
 
2168
 <class>qsamplerChannelStrip</class>
 
2169
 <comment>qsampler - A LinuxSampler Qt GUI Interface.
 
2170
 
 
2171
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
2172
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
2173
 
 
2174
    This program is free software; you can redistribute it and/or
 
2175
    modify it under the terms of the GNU General Public License
 
2176
@@ -14,9 +14,9 @@
 
2177
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2178
    GNU General Public License for more details.
 
2179
 
 
2180
-   You should have received a copy of the GNU General Public License
 
2181
-   along with this program; if not, write to the Free Software
 
2182
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
2183
+   You should have received a copy of the GNU General Public License along
 
2184
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
2185
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
2186
 
 
2187
 </comment>
 
2188
 <author>rncbc aka Rui Nuno Capela</author>
 
2189
@@ -28,8 +28,8 @@
 
2190
         <rect>
 
2191
             <x>0</x>
 
2192
             <y>0</y>
 
2193
-            <width>737</width>
 
2194
-            <height>46</height>
 
2195
+            <width>720</width>
 
2196
+            <height>48</height>
 
2197
         </rect>
 
2198
     </property>
 
2199
     <property name="sizePolicy">
 
2200
@@ -209,13 +209,13 @@
 
2201
                         <enum>ParentOrigin</enum>
 
2202
                     </property>
 
2203
                     <property name="text">
 
2204
-                        <string>--/--</string>
 
2205
+                        <string>-- / --</string>
 
2206
                     </property>
 
2207
                     <property name="alignment">
 
2208
                         <set>AlignTop|AlignHCenter</set>
 
2209
                     </property>
 
2210
                     <property name="toolTip" stdset="0">
 
2211
-                        <string>MIDI Port/Channel</string>
 
2212
+                        <string>MIDI port / channel</string>
 
2213
                     </property>
 
2214
                 </widget>
 
2215
                 <widget class="QLabel" row="1" column="1">
 
2216
Index: qsampler/src/qsamplerChannelStrip.ui.h
 
2217
diff -u qsampler/src/qsamplerChannelStrip.ui.h:1.32 qsampler/src/qsamplerChannelStrip.ui.h:1.37
 
2218
--- qsampler/src/qsamplerChannelStrip.ui.h:1.32 Fri Aug 19 19:10:16 2005
 
2219
+++ qsampler/src/qsamplerChannelStrip.ui.h      Mon Jan 15 20:11:58 2007
 
2220
@@ -2,7 +2,7 @@
 
2221
 //
 
2222
 // ui.h extension file, included from the uic-generated form implementation.
 
2223
 /****************************************************************************
 
2224
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
2225
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
2226
 
 
2227
    This program is free software; you can redistribute it and/or
 
2228
    modify it under the terms of the GNU General Public License
 
2229
@@ -14,9 +14,9 @@
 
2230
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2231
    GNU General Public License for more details.
 
2232
 
 
2233
-   You should have received a copy of the GNU General Public License
 
2234
-   along with this program; if not, write to the Free Software
 
2235
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
2236
+   You should have received a copy of the GNU General Public License along
 
2237
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
2238
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
2239
 
 
2240
 *****************************************************************************/
 
2241
 
 
2242
@@ -324,8 +324,9 @@
 
2243
     ChannelSetupPushButton->setText(sText);
 
2244
 
 
2245
     // Check if we're up and connected.
 
2246
-    if (m_pChannel->client() == NULL)
 
2247
-        return false;
 
2248
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2249
+       if (pMainForm->client() == NULL)
 
2250
+               return false;
 
2251
 
 
2252
     // Read actual channel information.
 
2253
     m_pChannel->updateChannelInfo();
 
2254
@@ -340,10 +341,12 @@
 
2255
        updateInstrumentName(false);
 
2256
 
 
2257
     // MIDI Port/Channel...
 
2258
-    if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
 
2259
-        MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_pChannel->midiPort()));
 
2260
-    else
 
2261
-        MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_pChannel->midiPort()).arg(m_pChannel->midiChannel() + 1));
 
2262
+       QString sMidiPortChannel = QString::number(m_pChannel->midiPort()) + " / ";
 
2263
+       if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
 
2264
+               sMidiPortChannel += tr("All");
 
2265
+       else
 
2266
+               sMidiPortChannel += QString::number(m_pChannel->midiChannel() + 1);
 
2267
+       MidiPortChannelTextLabel->setText(sMidiPortChannel);
 
2268
 
 
2269
     // Instrument status...
 
2270
     int iInstrumentStatus = m_pChannel->instrumentStatus();
 
2271
@@ -362,10 +365,10 @@
 
2272
     // Mute/Solo button state coloring...
 
2273
     const QColor& rgbNormal = ChannelSetupPushButton->paletteBackgroundColor();
 
2274
     bool bMute = m_pChannel->channelMute();
 
2275
-    ChannelMutePushButton->setPaletteBackgroundColor(bMute ? Qt::red : rgbNormal);
 
2276
+    ChannelMutePushButton->setPaletteBackgroundColor(bMute ? Qt::yellow : rgbNormal);
 
2277
     ChannelMutePushButton->setDown(bMute);
 
2278
     bool bSolo = m_pChannel->channelSolo();
 
2279
-    ChannelSoloPushButton->setPaletteBackgroundColor(bSolo ? Qt::yellow : rgbNormal);
 
2280
+    ChannelSoloPushButton->setPaletteBackgroundColor(bSolo ? Qt::cyan : rgbNormal);
 
2281
     ChannelSoloPushButton->setDown(bSolo);
 
2282
 #else
 
2283
        ChannelMutePushButton->setEnabled(false);
 
2284
@@ -383,21 +386,23 @@
 
2285
 {
 
2286
     if (m_pChannel == NULL)
 
2287
         return false;
 
2288
-    if (m_pChannel->client() == NULL)
 
2289
-        return false;
 
2290
+
 
2291
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2292
+       if (pMainForm->client() == NULL)
 
2293
+               return false;
 
2294
 
 
2295
        // This only makes sense on fully loaded channels...
 
2296
        if (m_pChannel->instrumentStatus() < 100)
 
2297
            return false;
 
2298
 
 
2299
     // Get current channel voice count.
 
2300
-    int iVoiceCount  = ::lscp_get_channel_voice_count(m_pChannel->client(), m_pChannel->channelID());
 
2301
+    int iVoiceCount  = ::lscp_get_channel_voice_count(pMainForm->client(), m_pChannel->channelID());
 
2302
     // Get current stream count.
 
2303
-    int iStreamCount = ::lscp_get_channel_stream_count(m_pChannel->client(), m_pChannel->channelID());
 
2304
+    int iStreamCount = ::lscp_get_channel_stream_count(pMainForm->client(), m_pChannel->channelID());
 
2305
     // Get current channel buffer fill usage.
 
2306
     // As benno has suggested this is the percentage usage
 
2307
     // of the least filled buffer stream...
 
2308
-    int iStreamUsage = ::lscp_get_channel_stream_usage(m_pChannel->client(), m_pChannel->channelID());;
 
2309
+    int iStreamUsage = ::lscp_get_channel_stream_usage(pMainForm->client(), m_pChannel->channelID());;
 
2310
 
 
2311
     // Update the GUI elements...
 
2312
     StreamUsageProgressBar->setProgress(iStreamUsage);
 
2313
Index: qsampler/src/qsamplerDevice.cpp
 
2314
diff -u qsampler/src/qsamplerDevice.cpp:1.25 qsampler/src/qsamplerDevice.cpp:1.28
 
2315
--- qsampler/src/qsamplerDevice.cpp:1.25        Sun Aug 28 13:44:10 2005
 
2316
+++ qsampler/src/qsamplerDevice.cpp     Sun Dec 17 23:29:29 2006
 
2317
@@ -1,7 +1,7 @@
 
2318
 // qsamplerDevice.cpp
 
2319
 //
 
2320
 /****************************************************************************
 
2321
-   Copyright (C) 2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
2322
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
2323
 
 
2324
    This program is free software; you can redistribute it and/or
 
2325
    modify it under the terms of the GNU General Public License
 
2326
@@ -13,9 +13,9 @@
 
2327
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2328
    GNU General Public License for more details.
 
2329
 
 
2330
-   You should have received a copy of the GNU General Public License
 
2331
-   along with this program; if not, write to the Free Software
 
2332
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
2333
+   You should have received a copy of the GNU General Public License along
 
2334
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
2335
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
2336
 
 
2337
 *****************************************************************************/
 
2338
 
 
2339
@@ -103,11 +103,8 @@
 
2340
 //
 
2341
 
 
2342
 // Constructor.
 
2343
-qsamplerDevice::qsamplerDevice ( qsamplerMainForm *pMainForm,
 
2344
-       qsamplerDeviceType deviceType, int iDeviceID )
 
2345
+qsamplerDevice::qsamplerDevice ( qsamplerDeviceType deviceType, int iDeviceID )
 
2346
 {
 
2347
-       m_pMainForm = pMainForm;
 
2348
-
 
2349
        m_ports.setAutoDelete(true);
 
2350
 
 
2351
        setDevice(deviceType, iDeviceID);
 
2352
@@ -122,7 +119,6 @@
 
2353
 qsamplerDevice::qsamplerDevice ( const qsamplerDevice& device )
 
2354
        : m_params(device.m_params), m_ports(m_ports)
 
2355
 {
 
2356
-       m_pMainForm   = device.m_pMainForm;
 
2357
        m_iDeviceID   = device.m_iDeviceID;
 
2358
        m_deviceType  = device.m_deviceType;
 
2359
        m_sDeviceType = device.m_sDeviceType;
 
2360
@@ -134,6 +130,12 @@
 
2361
 // Initializer.
 
2362
 void qsamplerDevice::setDevice ( qsamplerDeviceType deviceType, int iDeviceID )
 
2363
 {
 
2364
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2365
+       if (pMainForm == NULL)
 
2366
+               return;
 
2367
+       if (pMainForm->client() == NULL)
 
2368
+               return;
 
2369
+
 
2370
        // Device id and type should be always set.
 
2371
        m_iDeviceID  = iDeviceID;
 
2372
        m_deviceType = deviceType;
 
2373
@@ -148,13 +150,13 @@
 
2374
        case qsamplerDevice::Audio:
 
2375
                m_sDeviceType = QObject::tr("Audio");
 
2376
                if (m_iDeviceID >= 0 && (pDeviceInfo = ::lscp_get_audio_device_info(
 
2377
-                               client(), m_iDeviceID)) == NULL)
 
2378
+                               pMainForm->client(), m_iDeviceID)) == NULL)
 
2379
                        appendMessagesClient("lscp_get_audio_device_info");
 
2380
                break;
 
2381
        case qsamplerDevice::Midi:
 
2382
                m_sDeviceType = QObject::tr("MIDI");
 
2383
                if (m_iDeviceID >= 0 && (pDeviceInfo = ::lscp_get_midi_device_info(
 
2384
-                               client(), m_iDeviceID)) == NULL)
 
2385
+                               pMainForm->client(), m_iDeviceID)) == NULL)
 
2386
                        appendMessagesClient("lscp_get_midi_device_info");
 
2387
                break;
 
2388
        case qsamplerDevice::None:
 
2389
@@ -179,12 +181,12 @@
 
2390
                lscp_param_info_t *pParamInfo = NULL;
 
2391
                switch (deviceType) {
 
2392
                case qsamplerDevice::Audio:
 
2393
-                       if ((pParamInfo = ::lscp_get_audio_driver_param_info(client(),
 
2394
+                       if ((pParamInfo = ::lscp_get_audio_driver_param_info(pMainForm->client(),
 
2395
                                        m_sDriverName.latin1(), sParam.latin1(), NULL)) == NULL)
 
2396
                                appendMessagesClient("lscp_get_audio_driver_param_info");
 
2397
                        break;
 
2398
                case qsamplerDevice::Midi:
 
2399
-                       if ((pParamInfo = ::lscp_get_midi_driver_param_info(client(),
 
2400
+                       if ((pParamInfo = ::lscp_get_midi_driver_param_info(pMainForm->client(),
 
2401
                                        m_sDriverName.latin1(), sParam.latin1(), NULL)) == NULL)
 
2402
                                appendMessagesClient("lscp_get_midi_driver_param_info");
 
2403
                        break;
 
2404
@@ -207,6 +209,12 @@
 
2405
 // Driver name initializer/settler.
 
2406
 void qsamplerDevice::setDriver ( const QString& sDriverName )
 
2407
 {
 
2408
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2409
+       if (pMainForm == NULL)
 
2410
+               return;
 
2411
+       if (pMainForm->client() == NULL)
 
2412
+               return;
 
2413
+
 
2414
        // Valid only for scratch devices.
 
2415
        if (m_sDriverName == sDriverName)
 
2416
                return;
 
2417
@@ -219,12 +227,12 @@
 
2418
        lscp_driver_info_t *pDriverInfo = NULL;
 
2419
        switch (m_deviceType) {
 
2420
        case qsamplerDevice::Audio:
 
2421
-               if ((pDriverInfo = ::lscp_get_audio_driver_info(client(),
 
2422
+               if ((pDriverInfo = ::lscp_get_audio_driver_info(pMainForm->client(),
 
2423
                                sDriverName.latin1())) == NULL)
 
2424
                        appendMessagesClient("lscp_get_audio_driver_info");
 
2425
                break;
 
2426
        case qsamplerDevice::Midi:
 
2427
-               if ((pDriverInfo = ::lscp_get_midi_driver_info(client(),
 
2428
+               if ((pDriverInfo = ::lscp_get_midi_driver_info(pMainForm->client(),
 
2429
                                sDriverName.latin1())) == NULL)
 
2430
                        appendMessagesClient("lscp_get_midi_driver_info");
 
2431
                break;
 
2432
@@ -245,12 +253,12 @@
 
2433
                lscp_param_info_t *pParamInfo = NULL;
 
2434
                switch (m_deviceType) {
 
2435
                case qsamplerDevice::Audio:
 
2436
-                       if ((pParamInfo = ::lscp_get_audio_driver_param_info(client(),
 
2437
+                       if ((pParamInfo = ::lscp_get_audio_driver_param_info(pMainForm->client(),
 
2438
                                        sDriverName.latin1(), sParam.latin1(), NULL)) == NULL)
 
2439
                                appendMessagesClient("lscp_get_audio_driver_param_info");
 
2440
                        break;
 
2441
                case qsamplerDevice::Midi:
 
2442
-                       if ((pParamInfo = ::lscp_get_midi_driver_param_info(client(),
 
2443
+                       if ((pParamInfo = ::lscp_get_midi_driver_param_info(pMainForm->client(),
 
2444
                                        sDriverName.latin1(), sParam.latin1(), NULL)) == NULL)
 
2445
                                appendMessagesClient("lscp_get_midi_driver_param_info");
 
2446
                        break;
 
2447
@@ -270,16 +278,6 @@
 
2448
 }
 
2449
 
 
2450
 
 
2451
-// The client descriptor delegated property.
 
2452
-lscp_client_t *qsamplerDevice::client (void) const
 
2453
-{
 
2454
-       if (m_pMainForm == NULL)
 
2455
-               return NULL;
 
2456
-
 
2457
-       return m_pMainForm->client();
 
2458
-}
 
2459
-
 
2460
-
 
2461
 // Device property accessors.
 
2462
 int qsamplerDevice::deviceID (void) const
 
2463
 {
 
2464
@@ -315,6 +313,12 @@
 
2465
 bool qsamplerDevice::setParam ( const QString& sParam,
 
2466
        const QString& sValue )
 
2467
 {
 
2468
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2469
+       if (pMainForm == NULL)
 
2470
+               return false;
 
2471
+       if (pMainForm->client() == NULL)
 
2472
+               return false;
 
2473
+
 
2474
        // Set proper device parameter.
 
2475
        m_params[sParam.upper()].value = sValue;
 
2476
 
 
2477
@@ -330,13 +334,13 @@
 
2478
                switch (m_deviceType) {
 
2479
                case qsamplerDevice::Audio:
 
2480
                    if (sParam == "CHANNELS") iRefresh++;
 
2481
-                       if ((ret = ::lscp_set_audio_device_param(client(),
 
2482
+                       if ((ret = ::lscp_set_audio_device_param(pMainForm->client(),
 
2483
                                        m_iDeviceID, &param)) != LSCP_OK)
 
2484
                                appendMessagesClient("lscp_set_audio_device_param");
 
2485
                        break;
 
2486
                case qsamplerDevice::Midi:
 
2487
                    if (sParam == "PORTS") iRefresh++;
 
2488
-                       if ((ret = ::lscp_set_midi_device_param(client(),
 
2489
+                       if ((ret = ::lscp_set_midi_device_param(pMainForm->client(),
 
2490
                                        m_iDeviceID, &param)) != LSCP_OK)
 
2491
                                appendMessagesClient("lscp_set_midi_device_param");
 
2492
                        break;
 
2493
@@ -379,7 +383,10 @@
 
2494
 // Create a new device, as a copy of this current one.
 
2495
 bool qsamplerDevice::createDevice (void)
 
2496
 {
 
2497
-       if (client() == NULL)
 
2498
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2499
+       if (pMainForm == NULL)
 
2500
+               return false;
 
2501
+       if (pMainForm->client() == NULL)
 
2502
                return false;
 
2503
 
 
2504
        // Build the parameter list...
 
2505
@@ -398,12 +405,12 @@
 
2506
        // Now it depends on the device type...
 
2507
        switch (m_deviceType) {
 
2508
        case qsamplerDevice::Audio:
 
2509
-               if ((m_iDeviceID = ::lscp_create_audio_device(client(),
 
2510
+               if ((m_iDeviceID = ::lscp_create_audio_device(pMainForm->client(),
 
2511
                                m_sDriverName.latin1(), pParams)) < 0)
 
2512
                        appendMessagesClient("lscp_create_audio_device");
 
2513
                break;
 
2514
        case qsamplerDevice::Midi:
 
2515
-               if ((m_iDeviceID = ::lscp_create_midi_device(client(),
 
2516
+               if ((m_iDeviceID = ::lscp_create_midi_device(pMainForm->client(),
 
2517
                                m_sDriverName.latin1(), pParams)) < 0)
 
2518
                        appendMessagesClient("lscp_create_midi_device");
 
2519
                break;
 
2520
@@ -431,16 +438,22 @@
 
2521
 // Destroy existing device.
 
2522
 bool qsamplerDevice::deleteDevice (void)
 
2523
 {
 
2524
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2525
+       if (pMainForm == NULL)
 
2526
+               return false;
 
2527
+       if (pMainForm->client() == NULL)
 
2528
+               return false;
 
2529
+
 
2530
        // Now it depends on the device type...
 
2531
        lscp_status_t ret = LSCP_FAILED;
 
2532
        switch (m_deviceType) {
 
2533
        case qsamplerDevice::Audio:
 
2534
-               if ((ret = ::lscp_destroy_audio_device(client(),
 
2535
+               if ((ret = ::lscp_destroy_audio_device(pMainForm->client(),
 
2536
                                m_iDeviceID)) != LSCP_OK)
 
2537
                        appendMessagesClient("lscp_destroy_audio_device");
 
2538
                break;
 
2539
        case qsamplerDevice::Midi:
 
2540
-               if ((ret = ::lscp_destroy_midi_device(client(),
 
2541
+               if ((ret = ::lscp_destroy_midi_device(pMainForm->client(),
 
2542
                                m_iDeviceID)) != LSCP_OK)
 
2543
                        appendMessagesClient("lscp_destroy_midi_device");
 
2544
                break;
 
2545
@@ -526,6 +539,12 @@
 
2546
 // Refresh/set given parameter based on driver supplied dependencies.
 
2547
 int qsamplerDevice::refreshParam ( const QString& sParam )
 
2548
 {
 
2549
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2550
+       if (pMainForm == NULL)
 
2551
+               return 0;
 
2552
+       if (pMainForm->client() == NULL)
 
2553
+               return 0;
 
2554
+
 
2555
        // Check if we have dependencies...
 
2556
        qsamplerDeviceParam& param = m_params[sParam.upper()];
 
2557
        if (param.depends.isEmpty())
 
2558
@@ -556,12 +575,12 @@
 
2559
        lscp_param_info_t *pParamInfo = NULL;
 
2560
        switch (m_deviceType) {
 
2561
        case qsamplerDevice::Audio:
 
2562
-               if ((pParamInfo = ::lscp_get_audio_driver_param_info(client(),
 
2563
+               if ((pParamInfo = ::lscp_get_audio_driver_param_info(pMainForm->client(),
 
2564
                                m_sDriverName.latin1(), sParam.latin1(), pDepends)) == NULL)
 
2565
                        appendMessagesClient("lscp_get_audio_driver_param_info");
 
2566
                break;
 
2567
        case qsamplerDevice::Midi:
 
2568
-               if ((pParamInfo = ::lscp_get_midi_driver_param_info(client(),
 
2569
+               if ((pParamInfo = ::lscp_get_midi_driver_param_info(pMainForm->client(),
 
2570
                                m_sDriverName.latin1(), sParam.latin1(), pDepends)) == NULL)
 
2571
                        appendMessagesClient("lscp_get_midi_driver_param_info");
 
2572
                break;
 
2573
@@ -584,33 +603,38 @@
 
2574
 // Redirected messages output methods.
 
2575
 void qsamplerDevice::appendMessages( const QString& s ) const
 
2576
 {
 
2577
-       if (m_pMainForm)
 
2578
-               m_pMainForm->appendMessages(deviceName() + ' ' + s);
 
2579
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2580
+       if (pMainForm)
 
2581
+               pMainForm->appendMessages(deviceName() + ' ' + s);
 
2582
 }
 
2583
 
 
2584
 void qsamplerDevice::appendMessagesColor( const QString& s,
 
2585
        const QString& c ) const
 
2586
 {
 
2587
-       if (m_pMainForm)
 
2588
-               m_pMainForm->appendMessagesColor(deviceName() + ' ' + s, c);
 
2589
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2590
+       if (pMainForm)
 
2591
+               pMainForm->appendMessagesColor(deviceName() + ' ' + s, c);
 
2592
 }
 
2593
 
 
2594
 void qsamplerDevice::appendMessagesText( const QString& s ) const
 
2595
 {
 
2596
-       if (m_pMainForm)
 
2597
-               m_pMainForm->appendMessagesText(deviceName() + ' ' + s);
 
2598
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2599
+       if (pMainForm)
 
2600
+               pMainForm->appendMessagesText(deviceName() + ' ' + s);
 
2601
 }
 
2602
 
 
2603
 void qsamplerDevice::appendMessagesError( const QString& s ) const
 
2604
 {
 
2605
-       if (m_pMainForm)
 
2606
-               m_pMainForm->appendMessagesError(deviceName() + "\n\n" + s);
 
2607
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2608
+       if (pMainForm)
 
2609
+               pMainForm->appendMessagesError(deviceName() + "\n\n" + s);
 
2610
 }
 
2611
 
 
2612
 void qsamplerDevice::appendMessagesClient( const QString& s ) const
 
2613
 {
 
2614
-       if (m_pMainForm)
 
2615
-               m_pMainForm->appendMessagesClient(deviceName() + ' ' + s);
 
2616
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2617
+       if (pMainForm)
 
2618
+               pMainForm->appendMessagesClient(deviceName() + ' ' + s);
 
2619
 }
 
2620
 
 
2621
 
 
2622
@@ -651,7 +675,7 @@
 
2623
                break;
 
2624
        }
 
2625
 
 
2626
-       for (int iDriver = 0; ppszDrivers[iDriver]; iDriver++)
 
2627
+       for (int iDriver = 0; ppszDrivers && ppszDrivers[iDriver]; iDriver++)
 
2628
                drivers.append(ppszDrivers[iDriver]);
 
2629
 
 
2630
        return drivers;
 
2631
@@ -678,6 +702,12 @@
 
2632
 // Initializer.
 
2633
 void qsamplerDevicePort::setDevicePort ( int iPortID )
 
2634
 {
 
2635
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2636
+       if (pMainForm == NULL)
 
2637
+               return;
 
2638
+       if (pMainForm->client() == NULL)
 
2639
+               return;
 
2640
+
 
2641
        // Device port id should be always set.
 
2642
        m_iPortID = iPortID;
 
2643
 
 
2644
@@ -688,12 +718,12 @@
 
2645
        lscp_device_port_info_t *pPortInfo = NULL;
 
2646
        switch (m_device.deviceType()) {
 
2647
        case qsamplerDevice::Audio:
 
2648
-               if ((pPortInfo = ::lscp_get_audio_channel_info(m_device.client(),
 
2649
+               if ((pPortInfo = ::lscp_get_audio_channel_info(pMainForm->client(),
 
2650
                                m_device.deviceID(), m_iPortID)) == NULL)
 
2651
                        m_device.appendMessagesClient("lscp_get_audio_channel_info");
 
2652
                break;
 
2653
        case qsamplerDevice::Midi:
 
2654
-               if ((pPortInfo = ::lscp_get_midi_port_info(m_device.client(),
 
2655
+               if ((pPortInfo = ::lscp_get_midi_port_info(pMainForm->client(),
 
2656
                                m_device.deviceID(), m_iPortID)) == NULL)
 
2657
                        m_device.appendMessagesClient("lscp_get_midi_port_info");
 
2658
                break;
 
2659
@@ -718,13 +748,13 @@
 
2660
                switch (m_device.deviceType()) {
 
2661
                case qsamplerDevice::Audio:
 
2662
                        if ((pParamInfo = ::lscp_get_audio_channel_param_info(
 
2663
-                                       m_device.client(), m_device.deviceID(),
 
2664
+                                       pMainForm->client(), m_device.deviceID(),
 
2665
                                        m_iPortID, sParam.latin1())) == NULL)
 
2666
                                m_device.appendMessagesClient("lscp_get_audio_channel_param_info");
 
2667
                        break;
 
2668
                case qsamplerDevice::Midi:
 
2669
                        if ((pParamInfo = ::lscp_get_midi_port_param_info(
 
2670
-                                       m_device.client(), m_device.deviceID(),
 
2671
+                                       pMainForm->client(), m_device.deviceID(),
 
2672
                                        m_iPortID, sParam.latin1())) == NULL)
 
2673
                                m_device.appendMessagesClient("lscp_get_midi_port_param_info");
 
2674
                        break;
 
2675
@@ -761,6 +791,12 @@
 
2676
 bool qsamplerDevicePort::setParam ( const QString& sParam,
 
2677
        const QString& sValue )
 
2678
 {
 
2679
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2680
+       if (pMainForm == NULL)
 
2681
+               return false;
 
2682
+       if (pMainForm->client() == NULL)
 
2683
+               return false;
 
2684
+
 
2685
        // Set proper port/channel parameter.
 
2686
        m_params[sParam.upper()].value = sValue;
 
2687
 
 
2688
@@ -775,12 +811,12 @@
 
2689
                lscp_status_t ret = LSCP_FAILED;
 
2690
                switch (m_device.deviceType()) {
 
2691
                case qsamplerDevice::Audio:
 
2692
-                       if ((ret = ::lscp_set_audio_channel_param(m_device.client(),
 
2693
+                       if ((ret = ::lscp_set_audio_channel_param(pMainForm->client(),
 
2694
                                        m_device.deviceID(), m_iPortID, &param)) != LSCP_OK)
 
2695
                                m_device.appendMessagesClient("lscp_set_audio_channel_param");
 
2696
                        break;
 
2697
                case qsamplerDevice::Midi:
 
2698
-                       if ((ret = ::lscp_set_midi_port_param(m_device.client(),
 
2699
+                       if ((ret = ::lscp_set_midi_port_param(pMainForm->client(),
 
2700
                                        m_device.deviceID(), m_iPortID, &param)) != LSCP_OK)
 
2701
                                m_device.appendMessagesClient("lscp_set_midi_port_param");
 
2702
                        break;
 
2703
@@ -810,8 +846,8 @@
 
2704
 
 
2705
 // Constructors.
 
2706
 qsamplerDeviceItem::qsamplerDeviceItem ( QListView *pListView,
 
2707
-       qsamplerMainForm *pMainForm, qsamplerDevice::qsamplerDeviceType deviceType )
 
2708
-       : QListViewItem(pListView), m_device(pMainForm, deviceType)
 
2709
+       qsamplerDevice::qsamplerDeviceType deviceType )
 
2710
+       : QListViewItem(pListView), m_device(deviceType)
 
2711
 {
 
2712
        switch(m_device.deviceType()) {
 
2713
        case qsamplerDevice::Audio:
 
2714
@@ -828,9 +864,9 @@
 
2715
 }
 
2716
 
 
2717
 qsamplerDeviceItem::qsamplerDeviceItem ( QListViewItem *pItem,
 
2718
-       qsamplerMainForm *pMainForm, qsamplerDevice::qsamplerDeviceType deviceType,
 
2719
+       qsamplerDevice::qsamplerDeviceType deviceType,
 
2720
        int iDeviceID )
 
2721
-       : QListViewItem(pItem), m_device(pMainForm, deviceType, iDeviceID)
 
2722
+       : QListViewItem(pItem), m_device(deviceType, iDeviceID)
 
2723
 {
 
2724
        switch(m_device.deviceType()) {
 
2725
        case qsamplerDevice::Audio:
 
2726
Index: qsampler/src/qsamplerDevice.h
 
2727
diff -u qsampler/src/qsamplerDevice.h:1.13 qsampler/src/qsamplerDevice.h:1.15
 
2728
--- qsampler/src/qsamplerDevice.h:1.13  Sat Apr  2 14:23:18 2005
 
2729
+++ qsampler/src/qsamplerDevice.h       Sun Dec  3 19:26:13 2006
 
2730
@@ -1,7 +1,7 @@
 
2731
 // qsamplerDevice.h
 
2732
 //
 
2733
 /****************************************************************************
 
2734
-   Copyright (C) 2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
2735
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
2736
 
 
2737
    This program is free software; you can redistribute it and/or
 
2738
    modify it under the terms of the GNU General Public License
 
2739
@@ -13,9 +13,9 @@
 
2740
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2741
    GNU General Public License for more details.
 
2742
 
 
2743
-   You should have received a copy of the GNU General Public License
 
2744
-   along with this program; if not, write to the Free Software
 
2745
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
2746
+   You should have received a copy of the GNU General Public License along
 
2747
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
2748
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
2749
 
 
2750
 *****************************************************************************/
 
2751
 
 
2752
@@ -90,8 +90,7 @@
 
2753
        enum qsamplerDeviceType { None, Midi, Audio };
 
2754
 
 
2755
        // Constructor.
 
2756
-       qsamplerDevice(qsamplerMainForm *pMainForm,
 
2757
-               qsamplerDeviceType deviceType, int iDeviceID = -1);
 
2758
+       qsamplerDevice(qsamplerDeviceType deviceType, int iDeviceID = -1);
 
2759
        // Copy constructor.
 
2760
     qsamplerDevice(const qsamplerDevice& device);
 
2761
        // Default destructor.
 
2762
@@ -103,9 +102,6 @@
 
2763
        // Driver name initializer.
 
2764
        void setDriver(const QString& sDriverName);
 
2765
 
 
2766
-       // LSCP client descriptor accessor.
 
2767
-       lscp_client_t *client() const;
 
2768
-
 
2769
        // Device property accessors.
 
2770
        int                 deviceID()   const;
 
2771
        qsamplerDeviceType  deviceType() const;
 
2772
@@ -221,9 +217,9 @@
 
2773
 public:
 
2774
 
 
2775
        // Constructors.
 
2776
-       qsamplerDeviceItem(QListView *pListView, qsamplerMainForm *pMainForm,
 
2777
+       qsamplerDeviceItem(QListView *pListView,
 
2778
                qsamplerDevice::qsamplerDeviceType deviceType);
 
2779
-       qsamplerDeviceItem(QListViewItem *pItem, qsamplerMainForm *pMainForm,
 
2780
+       qsamplerDeviceItem(QListViewItem *pItem,
 
2781
                qsamplerDevice::qsamplerDeviceType deviceType, int iDeviceID);
 
2782
        // Default destructor.
 
2783
        ~qsamplerDeviceItem();
 
2784
Index: qsampler/src/qsamplerDeviceForm.ui
 
2785
diff -u qsampler/src/qsamplerDeviceForm.ui:1.20 qsampler/src/qsamplerDeviceForm.ui:1.22
 
2786
--- qsampler/src/qsamplerDeviceForm.ui:1.20     Sun Aug 28 02:31:34 2005
 
2787
+++ qsampler/src/qsamplerDeviceForm.ui  Sun Dec  3 19:26:13 2006
 
2788
@@ -2,7 +2,7 @@
 
2789
 <class>qsamplerDeviceForm</class>
 
2790
 <comment>qsampler - A LinuxSampler Qt GUI Interface.
 
2791
 
 
2792
-   Copyright (C) 2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
2793
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
2794
 
 
2795
    This program is free software; you can redistribute it and/or
 
2796
    modify it under the terms of the GNU General Public License
 
2797
@@ -14,9 +14,9 @@
 
2798
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2799
    GNU General Public License for more details.
 
2800
 
 
2801
-   You should have received a copy of the GNU General Public License
 
2802
-   along with this program; if not, write to the Free Software
 
2803
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
2804
+   You should have received a copy of the GNU General Public License along
 
2805
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
2806
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
2807
 
 
2808
 </comment>
 
2809
 <author>rncbc aka Rui Nuno Capela</author>
 
2810
@@ -459,9 +459,7 @@
 
2811
     <function access="private" specifier="non virtual">destroy()</function>
 
2812
     <function access="private" specifier="non virtual">showEvent( QShowEvent * pShowEvent )</function>
 
2813
     <function access="private" specifier="non virtual">hideEvent( QHideEvent * pHideEvent )</function>
 
2814
-    <function specifier="non virtual">setMainForm( qsamplerMainForm *pMainForm )</function>
 
2815
     <function specifier="non virtual">setDeviceTypeMode( qsamplerDevice::qsamplerDeviceType deviceType )</function>
 
2816
-    <function specifier="non virtual">setClient( lscp_client_t *pClient )</function>
 
2817
     <function specifier="non virtual">setDriverName( const QString &amp; sDriverName )</function>
 
2818
     <function specifier="non virtual">setDevice( qsamplerDevice *pDevice )</function>
 
2819
 </functions>
 
2820
Index: qsampler/src/qsamplerDeviceForm.ui.h
 
2821
diff -u qsampler/src/qsamplerDeviceForm.ui.h:1.23 qsampler/src/qsamplerDeviceForm.ui.h:1.25
 
2822
--- qsampler/src/qsamplerDeviceForm.ui.h:1.23   Sat Aug 27 01:04:32 2005
 
2823
+++ qsampler/src/qsamplerDeviceForm.ui.h        Sun Dec  3 19:26:13 2006
 
2824
@@ -2,7 +2,7 @@
 
2825
 //
 
2826
 // ui.h extension file, included from the uic-generated form implementation.
 
2827
 /****************************************************************************
 
2828
-   Copyright (C) 2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
2829
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
2830
 
 
2831
    This program is free software; you can redistribute it and/or
 
2832
    modify it under the terms of the GNU General Public License
 
2833
@@ -14,9 +14,9 @@
 
2834
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
2835
    GNU General Public License for more details.
 
2836
 
 
2837
-   You should have received a copy of the GNU General Public License
 
2838
-   along with this program; if not, write to the Free Software
 
2839
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
2840
+   You should have received a copy of the GNU General Public License along
 
2841
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
2842
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
2843
 
 
2844
 *****************************************************************************/
 
2845
 
 
2846
@@ -35,8 +35,6 @@
 
2847
 void qsamplerDeviceForm::init (void)
 
2848
 {
 
2849
        // Initialize locals.
 
2850
-       m_pMainForm   = NULL;
 
2851
-       m_pClient     = NULL;
 
2852
        m_iDirtySetup = 0;
 
2853
        m_iDirtyCount = 0;
 
2854
        m_bNewDevice  = false;
 
2855
@@ -68,8 +66,9 @@
 
2856
 // Notify our parent that we're emerging.
 
2857
 void qsamplerDeviceForm::showEvent ( QShowEvent *pShowEvent )
 
2858
 {
 
2859
-       if (m_pMainForm)
 
2860
-               m_pMainForm->stabilizeForm();
 
2861
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2862
+       if (pMainForm)
 
2863
+               pMainForm->stabilizeForm();
 
2864
 
 
2865
        stabilizeForm();
 
2866
 
 
2867
@@ -82,8 +81,9 @@
 
2868
 {
 
2869
        QWidget::hideEvent(pHideEvent);
 
2870
 
 
2871
-       if (m_pMainForm)
 
2872
-               m_pMainForm->stabilizeForm();
 
2873
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2874
+       if (pMainForm)
 
2875
+               pMainForm->stabilizeForm();
 
2876
 
 
2877
        // Signal special whether we changed the device set.
 
2878
        if (m_iDirtyCount > 0) {
 
2879
@@ -93,13 +93,6 @@
 
2880
 }
 
2881
 
 
2882
 
 
2883
-// Application main form settler (life depends on it).
 
2884
-void qsamplerDeviceForm::setMainForm ( qsamplerMainForm *pMainForm )
 
2885
-{
 
2886
-       m_pMainForm = pMainForm;
 
2887
-}
 
2888
-
 
2889
-
 
2890
 // Set device type spacial exclusive mode.
 
2891
 void qsamplerDeviceForm::setDeviceTypeMode (
 
2892
        qsamplerDevice::qsamplerDeviceType deviceTypeMode )
 
2893
@@ -115,21 +108,6 @@
 
2894
 }
 
2895
 
 
2896
 
 
2897
-// Device configuration dialog setup formal initializer.
 
2898
-void qsamplerDeviceForm::setClient ( lscp_client_t *pClient )
 
2899
-{
 
2900
-       // If it has not changed, do nothing.
 
2901
-       if (m_pClient && m_pClient == pClient)
 
2902
-               return;
 
2903
-
 
2904
-       // Set new reference.
 
2905
-       m_pClient = pClient;
 
2906
-
 
2907
-       // OK. Do a whole refresh around.
 
2908
-       refreshDevices();
 
2909
-}
 
2910
-
 
2911
-
 
2912
 // Device driver name setup formal initializer.
 
2913
 void qsamplerDeviceForm::setDriverName ( const QString& sDriverName )
 
2914
 {
 
2915
@@ -190,7 +168,8 @@
 
2916
 // Create a new device from current table view.
 
2917
 void qsamplerDeviceForm::createDevice (void)
 
2918
 {
 
2919
-       if (m_pMainForm == NULL)
 
2920
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2921
+       if (pMainForm == NULL)
 
2922
                return;
 
2923
 
 
2924
        QListViewItem *pItem = DeviceListView->selectedItem();
 
2925
@@ -214,11 +193,11 @@
 
2926
                }
 
2927
                // Append the new device item.
 
2928
                qsamplerDeviceItem *pDeviceItem = new qsamplerDeviceItem(pRootItem,
 
2929
-                       m_pMainForm, device.deviceType(), device.deviceID());
 
2930
+                       device.deviceType(), device.deviceID());
 
2931
                // Just make it the new selection...
 
2932
                DeviceListView->setSelected(pDeviceItem, true);
 
2933
                // Main session should be marked dirty.
 
2934
-               m_pMainForm->sessionDirty();
 
2935
+               pMainForm->sessionDirty();
 
2936
                m_iDirtyCount++;
 
2937
        }
 
2938
 }
 
2939
@@ -227,7 +206,8 @@
 
2940
 // Delete current device in table view.
 
2941
 void qsamplerDeviceForm::deleteDevice (void)
 
2942
 {
 
2943
-       if (m_pMainForm == NULL)
 
2944
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2945
+       if (pMainForm == NULL)
 
2946
                return;
 
2947
 
 
2948
        QListViewItem *pItem = DeviceListView->selectedItem();
 
2949
@@ -237,7 +217,7 @@
 
2950
        qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
 
2951
 
 
2952
        // Prompt user if this is for real...
 
2953
-       qsamplerOptions *pOptions = m_pMainForm->options();
 
2954
+       qsamplerOptions *pOptions = pMainForm->options();
 
2955
        if (pOptions && pOptions->bConfirmRemove) {
 
2956
                if (QMessageBox::warning(this,
 
2957
                        QSAMPLER_TITLE ": " + tr("Warning"),
 
2958
@@ -254,7 +234,7 @@
 
2959
                // Remove it from the device view...
 
2960
                delete pItem;
 
2961
                // Main session should be marked dirty.
 
2962
-               m_pMainForm->sessionDirty();
 
2963
+               pMainForm->sessionDirty();
 
2964
                m_iDirtyCount++;
 
2965
        }
 
2966
 }
 
2967
@@ -263,7 +243,8 @@
 
2968
 // Refresh all device list and views.
 
2969
 void qsamplerDeviceForm::refreshDevices (void)
 
2970
 {
 
2971
-       if (m_pMainForm == NULL)
 
2972
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
2973
+       if (pMainForm == NULL)
 
2974
                return;
 
2975
 
 
2976
        // Avoid nested changes.
 
2977
@@ -275,18 +256,19 @@
 
2978
        m_pAudioItems = NULL;
 
2979
        m_pMidiItems = NULL;
 
2980
        DeviceListView->clear();
 
2981
-       if (m_pClient) {
 
2982
+       if (pMainForm->client()) {
 
2983
                int *piDeviceIDs;
 
2984
                // Grab and pop Audio devices...
 
2985
                if (m_deviceTypeMode == qsamplerDevice::None ||
 
2986
                        m_deviceTypeMode == qsamplerDevice::Audio) {
 
2987
                        m_pAudioItems = new qsamplerDeviceItem(DeviceListView,
 
2988
-                               m_pMainForm, qsamplerDevice::Audio);
 
2989
+                               qsamplerDevice::Audio);
 
2990
                }
 
2991
                if (m_pAudioItems) {
 
2992
-                       piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
 
2993
+                       piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
 
2994
+                               qsamplerDevice::Audio);
 
2995
                        for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
 
2996
-                               new qsamplerDeviceItem(m_pAudioItems, m_pMainForm,
 
2997
+                               new qsamplerDeviceItem(m_pAudioItems,
 
2998
                                        qsamplerDevice::Audio, piDeviceIDs[i]);
 
2999
                        }
 
3000
                        m_pAudioItems->setOpen(true);
 
3001
@@ -295,12 +277,13 @@
 
3002
                if (m_deviceTypeMode == qsamplerDevice::None ||
 
3003
                        m_deviceTypeMode == qsamplerDevice::Midi) {
 
3004
                        m_pMidiItems = new qsamplerDeviceItem(DeviceListView,
 
3005
-                               m_pMainForm, qsamplerDevice::Midi);
 
3006
+                               qsamplerDevice::Midi);
 
3007
                }
 
3008
                if (m_pMidiItems) {
 
3009
-                       piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
 
3010
+                       piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(),
 
3011
+                               qsamplerDevice::Midi);
 
3012
                        for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) {
 
3013
-                               new qsamplerDeviceItem(m_pMidiItems, m_pMainForm,
 
3014
+                               new qsamplerDeviceItem(m_pMidiItems,
 
3015
                                        qsamplerDevice::Midi, piDeviceIDs[i]);
 
3016
                        }
 
3017
                        m_pMidiItems->setOpen(true);
 
3018
@@ -346,6 +329,10 @@
 
3019
 // Device selection slot.
 
3020
 void qsamplerDeviceForm::selectDevice (void)
 
3021
 {
 
3022
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3023
+       if (pMainForm == NULL)
 
3024
+               return;
 
3025
+
 
3026
        if (m_iDirtySetup > 0)
 
3027
                return;
 
3028
 
 
3029
@@ -379,7 +366,7 @@
 
3030
        if (device.deviceType() != m_deviceType) {
 
3031
                DriverNameComboBox->clear();
 
3032
                DriverNameComboBox->insertStringList(
 
3033
-                       qsamplerDevice::getDrivers(m_pClient, device.deviceType()));
 
3034
+                       qsamplerDevice::getDrivers(pMainForm->client(), device.deviceType()));
 
3035
                m_deviceType = device.deviceType();
 
3036
        }
 
3037
        // Do we need a driver name?
 
3038
@@ -468,8 +455,6 @@
 
3039
 // Device parameter value change slot.
 
3040
 void qsamplerDeviceForm::changeDeviceParam ( int iRow, int iCol )
 
3041
 {
 
3042
-       if (m_pMainForm == NULL)
 
3043
-               return;
 
3044
        if (m_iDirtySetup > 0)
 
3045
                return;
 
3046
        if (iRow < 0 || iCol < 0)
 
3047
@@ -494,16 +479,17 @@
 
3048
        } else {
 
3049
                stabilizeForm();
 
3050
        }
 
3051
+
 
3052
        // Main session should be dirtier...
 
3053
-       m_pMainForm->sessionDirty();
 
3054
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3055
+       if (pMainForm)
 
3056
+               pMainForm->sessionDirty();
 
3057
 }
 
3058
 
 
3059
 
 
3060
 // Device port/channel parameter value change slot.
 
3061
 void qsamplerDeviceForm::changeDevicePortParam ( int iRow, int iCol )
 
3062
 {
 
3063
-       if (m_pMainForm == NULL)
 
3064
-               return;
 
3065
        if (m_iDirtySetup > 0)
 
3066
                return;
 
3067
        if (iRow < 0 || iCol < 0)
 
3068
@@ -531,20 +517,27 @@
 
3069
        pPort->setParam(sParam, sValue);
 
3070
        // Done.
 
3071
        stabilizeForm();
 
3072
+
 
3073
        // Main session should be dirtier...
 
3074
-       m_pMainForm->sessionDirty();
 
3075
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3076
+       if (pMainForm)
 
3077
+               pMainForm->sessionDirty();
 
3078
 }
 
3079
 
 
3080
 
 
3081
 // Device list view context menu handler.
 
3082
 void qsamplerDeviceForm::contextMenu ( QListViewItem *pItem, const QPoint& pos, int )
 
3083
 {
 
3084
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3085
+       if (pMainForm == NULL)
 
3086
+               return;
 
3087
+
 
3088
        int iItemID;
 
3089
 
 
3090
        // Build the device context menu...
 
3091
        QPopupMenu* pContextMenu = new QPopupMenu(this);
 
3092
 
 
3093
-       bool bClient = (m_pClient != NULL);
 
3094
+       bool bClient = (pMainForm->client() != NULL);
 
3095
        bool bEnabled = (pItem != NULL);
 
3096
        iItemID = pContextMenu->insertItem(
 
3097
                QIconSet(QPixmap::fromMimeSource("deviceCreate.png")),
 
3098
@@ -569,8 +562,9 @@
 
3099
 // Stabilize current form state.
 
3100
 void qsamplerDeviceForm::stabilizeForm (void)
 
3101
 {
 
3102
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3103
        QListViewItem *pItem = DeviceListView->selectedItem();
 
3104
-       bool bClient = (m_pClient != NULL);
 
3105
+       bool bClient = (pMainForm && pMainForm->client() != NULL);
 
3106
        bool bEnabled = (pItem != NULL);
 
3107
        DeviceNameTextLabel->setEnabled(bEnabled && !m_bNewDevice);
 
3108
        DriverNameTextLabel->setEnabled(bEnabled &&  m_bNewDevice);
 
3109
Index: qsampler/src/qsamplerInstrument.cpp
 
3110
diff -u /dev/null qsampler/src/qsamplerInstrument.cpp:1.4
 
3111
--- /dev/null   Tue Feb  6 13:36:33 2007
 
3112
+++ qsampler/src/qsamplerInstrument.cpp Tue Dec 19 12:19:55 2006
 
3113
@@ -0,0 +1,364 @@
 
3114
+// qsamplerInstrument.cpp
 
3115
+//
 
3116
+/****************************************************************************
 
3117
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
3118
+
 
3119
+   This program is free software; you can redistribute it and/or
 
3120
+   modify it under the terms of the GNU General Public License
 
3121
+   as published by the Free Software Foundation; either version 2
 
3122
+   of the License, or (at your option) any later version.
 
3123
+
 
3124
+   This program is distributed in the hope that it will be useful,
 
3125
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3126
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3127
+   GNU General Public License for more details.
 
3128
+
 
3129
+   You should have received a copy of the GNU General Public License along
 
3130
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
3131
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
3132
+
 
3133
+*****************************************************************************/
 
3134
+
 
3135
+#include "qsamplerAbout.h"
 
3136
+#include "qsamplerInstrument.h"
 
3137
+
 
3138
+#include "qsamplerMainForm.h"
 
3139
+
 
3140
+
 
3141
+//-------------------------------------------------------------------------
 
3142
+// qsamplerInstrument - MIDI instrument map structure.
 
3143
+//
 
3144
+
 
3145
+// Constructor.
 
3146
+qsamplerInstrument::qsamplerInstrument ( int iMap, int iBank, int iProg )
 
3147
+{
 
3148
+       m_iMap          = iMap;
 
3149
+       m_iBank         = iBank;
 
3150
+       m_iProg         = iProg;
 
3151
+       m_iInstrumentNr = 0;;
 
3152
+       m_fVolume       = 1.0f;
 
3153
+       m_iLoadMode     = 0;
 
3154
+}
 
3155
+
 
3156
+// Default destructor.
 
3157
+qsamplerInstrument::~qsamplerInstrument (void)
 
3158
+{
 
3159
+}
 
3160
+
 
3161
+
 
3162
+// Instrument accessors.
 
3163
+void qsamplerInstrument::setMap ( int iMap )
 
3164
+{
 
3165
+       m_iMap = iMap;
 
3166
+}
 
3167
+
 
3168
+int qsamplerInstrument::map (void) const
 
3169
+{
 
3170
+       return m_iMap;
 
3171
+}
 
3172
+
 
3173
+
 
3174
+void qsamplerInstrument::setBank ( int iBank )
 
3175
+{
 
3176
+       m_iBank = iBank;
 
3177
+}
 
3178
+
 
3179
+int qsamplerInstrument::bank (void) const
 
3180
+{
 
3181
+       return m_iBank;
 
3182
+}
 
3183
+
 
3184
+
 
3185
+void qsamplerInstrument::setProg ( int iProg )
 
3186
+{
 
3187
+       m_iProg = iProg;
 
3188
+}
 
3189
+
 
3190
+int qsamplerInstrument::prog (void) const
 
3191
+{
 
3192
+       return m_iProg;
 
3193
+}
 
3194
+
 
3195
+
 
3196
+void qsamplerInstrument::setName ( const QString& sName )
 
3197
+{
 
3198
+       m_sName = sName;
 
3199
+}
 
3200
+
 
3201
+const QString& qsamplerInstrument::name (void) const
 
3202
+{
 
3203
+       return m_sName;
 
3204
+}
 
3205
+
 
3206
+
 
3207
+void qsamplerInstrument::setEngineName ( const QString& sEngineName )
 
3208
+{
 
3209
+       m_sEngineName = sEngineName;
 
3210
+}
 
3211
+
 
3212
+const QString& qsamplerInstrument::engineName (void) const
 
3213
+{
 
3214
+       return m_sEngineName;
 
3215
+}
 
3216
+
 
3217
+
 
3218
+void qsamplerInstrument::setInstrumentFile ( const QString& sInstrumentFile )
 
3219
+{
 
3220
+       m_sInstrumentFile = sInstrumentFile;
 
3221
+}
 
3222
+
 
3223
+const QString& qsamplerInstrument::instrumentFile (void) const
 
3224
+{
 
3225
+       return m_sInstrumentFile;
 
3226
+}
 
3227
+
 
3228
+
 
3229
+const QString& qsamplerInstrument::instrumentName (void) const
 
3230
+{
 
3231
+       return m_sInstrumentName;
 
3232
+}
 
3233
+
 
3234
+
 
3235
+void qsamplerInstrument::setInstrumentNr ( int iInstrumentNr )
 
3236
+{
 
3237
+       m_iInstrumentNr = iInstrumentNr;
 
3238
+}
 
3239
+
 
3240
+int qsamplerInstrument::instrumentNr (void) const
 
3241
+{
 
3242
+       return m_iInstrumentNr;
 
3243
+}
 
3244
+
 
3245
+
 
3246
+void qsamplerInstrument::setVolume ( float fVolume )
 
3247
+{
 
3248
+       m_fVolume = fVolume;
 
3249
+}
 
3250
+
 
3251
+float qsamplerInstrument::volume (void) const
 
3252
+{
 
3253
+       return m_fVolume;
 
3254
+}
 
3255
+
 
3256
+
 
3257
+void qsamplerInstrument::setLoadMode ( int iLoadMode )
 
3258
+{
 
3259
+       m_iLoadMode = iLoadMode;
 
3260
+}
 
3261
+
 
3262
+int qsamplerInstrument::loadMode (void) const
 
3263
+{
 
3264
+       return m_iLoadMode;
 
3265
+}
 
3266
+
 
3267
+
 
3268
+// Sync methods.
 
3269
+bool qsamplerInstrument::mapInstrument (void)
 
3270
+{
 
3271
+#ifdef CONFIG_MIDI_INSTRUMENT
 
3272
+
 
3273
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3274
+       if (pMainForm == NULL)
 
3275
+               return false;
 
3276
+       if (pMainForm->client() == NULL)
 
3277
+               return false;
 
3278
+
 
3279
+       if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
 
3280
+               return false;
 
3281
+
 
3282
+       lscp_midi_instrument_t instr;
 
3283
+
 
3284
+       instr.map  = m_iMap;
 
3285
+       instr.bank = (m_iBank & 0x0fff);
 
3286
+       instr.prog = (m_iProg & 0x7f);
 
3287
+
 
3288
+       lscp_load_mode_t load_mode;
 
3289
+       switch (m_iLoadMode) {
 
3290
+               case 3:
 
3291
+                       load_mode = LSCP_LOAD_PERSISTENT;
 
3292
+                       break;
 
3293
+               case 2:
 
3294
+                       load_mode = LSCP_LOAD_ON_DEMAND_HOLD;
 
3295
+                       break;
 
3296
+               case 1:
 
3297
+                       load_mode = LSCP_LOAD_ON_DEMAND;
 
3298
+                       break;
 
3299
+               case 0:
 
3300
+               default:
 
3301
+                       load_mode = LSCP_LOAD_DEFAULT;
 
3302
+                       break;
 
3303
+       }
 
3304
+
 
3305
+       if (::lscp_map_midi_instrument(pMainForm->client(), &instr,
 
3306
+                       m_sEngineName.latin1(),
 
3307
+                       m_sInstrumentFile.latin1(),
 
3308
+                       m_iInstrumentNr,
 
3309
+                       m_fVolume,
 
3310
+                       load_mode,
 
3311
+                       m_sName.latin1()) != LSCP_OK) {
 
3312
+               pMainForm->appendMessagesClient("lscp_map_midi_instrument");
 
3313
+               return false;
 
3314
+       }
 
3315
+
 
3316
+       return true;
 
3317
+
 
3318
+#else
 
3319
+
 
3320
+       return false;
 
3321
+
 
3322
+#endif
 
3323
+}
 
3324
+
 
3325
+
 
3326
+bool qsamplerInstrument::unmapInstrument (void)
 
3327
+{
 
3328
+#ifdef CONFIG_MIDI_INSTRUMENT
 
3329
+
 
3330
+       if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
 
3331
+               return false;
 
3332
+
 
3333
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3334
+       if (pMainForm == NULL)
 
3335
+               return false;
 
3336
+       if (pMainForm->client() == NULL)
 
3337
+               return false;
 
3338
+
 
3339
+       lscp_midi_instrument_t instr;
 
3340
+
 
3341
+       instr.map  = m_iMap;
 
3342
+       instr.bank = (m_iBank & 0x0fff);
 
3343
+       instr.prog = (m_iProg & 0x7f);
 
3344
+
 
3345
+       if (::lscp_unmap_midi_instrument(pMainForm->client(), &instr) != LSCP_OK) {
 
3346
+               pMainForm->appendMessagesClient("lscp_unmap_midi_instrument");
 
3347
+               return false;
 
3348
+       }
 
3349
+
 
3350
+       return true;
 
3351
+
 
3352
+#else
 
3353
+
 
3354
+       return false;
 
3355
+
 
3356
+#endif
 
3357
+}
 
3358
+
 
3359
+
 
3360
+bool qsamplerInstrument::getInstrument (void)
 
3361
+{
 
3362
+#ifdef CONFIG_MIDI_INSTRUMENT
 
3363
+
 
3364
+       if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
 
3365
+               return false;
 
3366
+
 
3367
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3368
+       if (pMainForm == NULL)
 
3369
+               return false;
 
3370
+       if (pMainForm->client() == NULL)
 
3371
+               return false;
 
3372
+
 
3373
+       lscp_midi_instrument_t instr;
 
3374
+
 
3375
+       instr.map  = m_iMap;
 
3376
+       instr.bank = (m_iBank & 0x0fff);
 
3377
+       instr.prog = (m_iProg & 0x7f);
 
3378
+
 
3379
+       lscp_midi_instrument_info_t *pInstrInfo
 
3380
+               = ::lscp_get_midi_instrument_info(pMainForm->client(), &instr);
 
3381
+       if (pInstrInfo == NULL) {
 
3382
+               pMainForm->appendMessagesClient("lscp_get_midi_instrument_info");
 
3383
+               return false;
 
3384
+       }
 
3385
+
 
3386
+       m_sName           = pInstrInfo->name;
 
3387
+       m_sEngineName     = pInstrInfo->engine_name;
 
3388
+       m_sInstrumentName = pInstrInfo->instrument_name;
 
3389
+       m_sInstrumentFile = pInstrInfo->instrument_file;
 
3390
+       m_iInstrumentNr   = pInstrInfo->instrument_nr;
 
3391
+       m_fVolume         = pInstrInfo->volume;
 
3392
+
 
3393
+       switch (pInstrInfo->load_mode) {
 
3394
+               case LSCP_LOAD_PERSISTENT:
 
3395
+                       m_iLoadMode = 3;
 
3396
+                       break;
 
3397
+               case LSCP_LOAD_ON_DEMAND_HOLD:
 
3398
+                       m_iLoadMode = 2;
 
3399
+                       break;
 
3400
+               case LSCP_LOAD_ON_DEMAND:
 
3401
+                       m_iLoadMode = 1;
 
3402
+                       break;
 
3403
+               case LSCP_LOAD_DEFAULT:
 
3404
+               default:
 
3405
+                       m_iLoadMode = 0;
 
3406
+                       break;
 
3407
+       }
 
3408
+
 
3409
+       // Fix something.
 
3410
+       if (m_sName.isEmpty())
 
3411
+               m_sName = m_sInstrumentName;
 
3412
+
 
3413
+       return true;
 
3414
+
 
3415
+#else
 
3416
+
 
3417
+       return false;
 
3418
+
 
3419
+#endif
 
3420
+}
 
3421
+
 
3422
+
 
3423
+// Instrument map name enumerator.
 
3424
+QStringList qsamplerInstrument::getMapNames (void)
 
3425
+{
 
3426
+       QStringList maps;
 
3427
+
 
3428
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3429
+       if (pMainForm == NULL)
 
3430
+               return maps;
 
3431
+       if (pMainForm->client() == NULL)
 
3432
+               return maps;
 
3433
+
 
3434
+#ifdef CONFIG_MIDI_INSTRUMENT
 
3435
+       int *piMaps = ::lscp_list_midi_instrument_maps(pMainForm->client());
 
3436
+       if (piMaps == NULL) {
 
3437
+               if (::lscp_client_get_errno(pMainForm->client()))
 
3438
+                       pMainForm->appendMessagesClient("lscp_list_midi_instruments");
 
3439
+       } else {
 
3440
+               for (int iMap = 0; piMaps[iMap] >= 0; iMap++) {
 
3441
+                       const QString& sMapName = getMapName(piMaps[iMap]);
 
3442
+                       if (!sMapName.isEmpty())
 
3443
+                               maps.append(sMapName);
 
3444
+               }
 
3445
+       }
 
3446
+#endif
 
3447
+
 
3448
+       return maps;
 
3449
+}
 
3450
+
 
3451
+// Instrument map name enumerator.
 
3452
+QString qsamplerInstrument::getMapName ( int iMidiMap )
 
3453
+{
 
3454
+       QString sMapName;
 
3455
+
 
3456
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
3457
+       if (pMainForm == NULL)
 
3458
+               return sMapName;
 
3459
+       if (pMainForm->client() == NULL)
 
3460
+               return sMapName;
 
3461
+
 
3462
+#ifdef CONFIG_MIDI_INSTRUMENT
 
3463
+       const char *pszMapName
 
3464
+               = ::lscp_get_midi_instrument_map_name(pMainForm->client(), iMidiMap);
 
3465
+       if (pszMapName == NULL) {
 
3466
+               pszMapName = " -";
 
3467
+               if (::lscp_client_get_errno(pMainForm->client()))
 
3468
+                       pMainForm->appendMessagesClient("lscp_get_midi_instrument_name");
 
3469
+       }
 
3470
+       sMapName = QString("%1 - %2").arg(iMidiMap).arg(pszMapName);
 
3471
+#endif
 
3472
+
 
3473
+       return sMapName;
 
3474
+}
 
3475
+
 
3476
+
 
3477
+// end of qsamplerInstrument.cpp
 
3478
Index: qsampler/src/qsamplerInstrument.h
 
3479
diff -u /dev/null qsampler/src/qsamplerInstrument.h:1.2
 
3480
--- /dev/null   Tue Feb  6 13:36:33 2007
 
3481
+++ qsampler/src/qsamplerInstrument.h   Sun Dec 17 23:29:29 2006
 
3482
@@ -0,0 +1,101 @@
 
3483
+// qsamplerInstrument.h
 
3484
+//
 
3485
+/****************************************************************************
 
3486
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
3487
+
 
3488
+   This program is free software; you can redistribute it and/or
 
3489
+   modify it under the terms of the GNU General Public License
 
3490
+   as published by the Free Software Foundation; either version 2
 
3491
+   of the License, or (at your option) any later version.
 
3492
+
 
3493
+   This program is distributed in the hope that it will be useful,
 
3494
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3495
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3496
+   GNU General Public License for more details.
 
3497
+
 
3498
+   You should have received a copy of the GNU General Public License along
 
3499
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
3500
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
3501
+
 
3502
+*****************************************************************************/
 
3503
+
 
3504
+#ifndef __qsamplerInstrument_h
 
3505
+#define __qsamplerInstrument_h
 
3506
+
 
3507
+#include <qstringlist.h>
 
3508
+
 
3509
+
 
3510
+//-------------------------------------------------------------------------
 
3511
+// qsamplerInstrument - MIDI instrument map structure.
 
3512
+//
 
3513
+
 
3514
+class qsamplerInstrument
 
3515
+{
 
3516
+public:
 
3517
+
 
3518
+       // Constructor.
 
3519
+       qsamplerInstrument(int iMap = 0, int iBank = -1, int iProg = -1);
 
3520
+
 
3521
+       // Default destructor.
 
3522
+       ~qsamplerInstrument();
 
3523
+
 
3524
+       // Instrument accessors.
 
3525
+       void setMap(int iMap);
 
3526
+       int map() const;
 
3527
+
 
3528
+       void setBank(int iBank);
 
3529
+       int bank() const;
 
3530
+
 
3531
+       void setProg(int iProg);
 
3532
+       int prog() const;
 
3533
+
 
3534
+       void setName(const QString& sName);
 
3535
+       const QString& name() const;
 
3536
+
 
3537
+       void setEngineName(const QString& sEngineName);
 
3538
+       const QString& engineName() const;
 
3539
+
 
3540
+       void setInstrumentFile(const QString& sInstrumentFile);
 
3541
+       const QString& instrumentFile() const;
 
3542
+
 
3543
+       const QString& instrumentName() const;
 
3544
+
 
3545
+       void setInstrumentNr(int InstrumentNr);
 
3546
+       int instrumentNr() const;
 
3547
+
 
3548
+       void setVolume(float fVolume);
 
3549
+       float volume() const;
 
3550
+
 
3551
+       void setLoadMode(int iLoadMode);
 
3552
+       int loadMode() const;
 
3553
+
 
3554
+       // Sync methods.
 
3555
+       bool getInstrument();
 
3556
+       bool mapInstrument();
 
3557
+       bool unmapInstrument();
 
3558
+
 
3559
+       // Instrument map names initialization...
 
3560
+       static QStringList getMapNames();
 
3561
+       static QString     getMapName(int iMidiMap);
 
3562
+
 
3563
+private:
 
3564
+
 
3565
+       // Instance variables.
 
3566
+       int     m_iMap;
 
3567
+       int     m_iBank;
 
3568
+       int     m_iProg;
 
3569
+       QString m_sName;
 
3570
+       QString m_sEngineName;
 
3571
+       QString m_sInstrumentFile;
 
3572
+       QString m_sInstrumentName;
 
3573
+       int     m_iInstrumentNr;
 
3574
+       float   m_fVolume;
 
3575
+       int     m_iLoadMode;
 
3576
+
 
3577
+};
 
3578
+
 
3579
+
 
3580
+#endif  // __qsamplerInstrument_h
 
3581
+
 
3582
+
 
3583
+// end of qsamplerInstrument.h
 
3584
Index: qsampler/src/qsamplerInstrumentForm.ui
 
3585
diff -u /dev/null qsampler/src/qsamplerInstrumentForm.ui:1.5
 
3586
--- /dev/null   Tue Feb  6 13:36:33 2007
 
3587
+++ qsampler/src/qsamplerInstrumentForm.ui      Mon Jan  8 17:52:48 2007
 
3588
@@ -0,0 +1,576 @@
 
3589
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
 
3590
+<class>qsamplerInstrumentForm</class>
 
3591
+<comment>qsampler - A LinuxSampler Qt GUI Interface.
 
3592
+
 
3593
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
3594
+
 
3595
+   This program is free software; you can redistribute it and/or
 
3596
+   modify it under the terms of the GNU General Public License
 
3597
+   as published by the Free Software Foundation; either version 2
 
3598
+   of the License, or (at your option) any later version.
 
3599
+
 
3600
+   This program is distributed in the hope that it will be useful,
 
3601
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
3602
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
3603
+   GNU General Public License for more details.
 
3604
+
 
3605
+   You should have received a copy of the GNU General Public License along
 
3606
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
3607
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
3608
+
 
3609
+</comment>
 
3610
+<author>rncbc aka Rui Nuno Capela</author>
 
3611
+<widget class="QDialog">
 
3612
+    <property name="name">
 
3613
+        <cstring>qsamplerInstrumentForm</cstring>
 
3614
+    </property>
 
3615
+    <property name="geometry">
 
3616
+        <rect>
 
3617
+            <x>0</x>
 
3618
+            <y>0</y>
 
3619
+            <width>452</width>
 
3620
+            <height>226</height>
 
3621
+        </rect>
 
3622
+    </property>
 
3623
+    <property name="sizePolicy">
 
3624
+        <sizepolicy>
 
3625
+            <hsizetype>7</hsizetype>
 
3626
+            <vsizetype>1</vsizetype>
 
3627
+            <horstretch>0</horstretch>
 
3628
+            <verstretch>0</verstretch>
 
3629
+        </sizepolicy>
 
3630
+    </property>
 
3631
+    <property name="caption">
 
3632
+        <string>Qsampler: MIDI Instrument</string>
 
3633
+    </property>
 
3634
+    <property name="focusPolicy">
 
3635
+        <enum>StrongFocus</enum>
 
3636
+    </property>
 
3637
+    <vbox>
 
3638
+        <property name="name">
 
3639
+            <cstring>unnamed</cstring>
 
3640
+        </property>
 
3641
+        <widget class="QLayoutWidget">
 
3642
+            <property name="name">
 
3643
+                <cstring>layout5</cstring>
 
3644
+            </property>
 
3645
+            <grid>
 
3646
+                <property name="name">
 
3647
+                    <cstring>unnamed</cstring>
 
3648
+                </property>
 
3649
+                <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="9">
 
3650
+                    <property name="name">
 
3651
+                        <cstring>EngineNameComboBox</cstring>
 
3652
+                    </property>
 
3653
+                    <property name="sizePolicy">
 
3654
+                        <sizepolicy>
 
3655
+                            <hsizetype>7</hsizetype>
 
3656
+                            <vsizetype>0</vsizetype>
 
3657
+                            <horstretch>0</horstretch>
 
3658
+                            <verstretch>0</verstretch>
 
3659
+                        </sizepolicy>
 
3660
+                    </property>
 
3661
+                    <property name="toolTip" stdset="0">
 
3662
+                        <string>Engine name</string>
 
3663
+                    </property>
 
3664
+                </widget>
 
3665
+                <widget class="QLabel" row="2" column="0">
 
3666
+                    <property name="name">
 
3667
+                        <cstring>EngineNameTextLabel</cstring>
 
3668
+                    </property>
 
3669
+                    <property name="text">
 
3670
+                        <string>&amp;Engine:</string>
 
3671
+                    </property>
 
3672
+                    <property name="alignment">
 
3673
+                        <set>AlignVCenter|AlignRight</set>
 
3674
+                    </property>
 
3675
+                    <property name="buddy" stdset="0">
 
3676
+                        <cstring>EngineNameComboBox</cstring>
 
3677
+                    </property>
 
3678
+                </widget>
 
3679
+                <widget class="QLabel" row="0" column="7">
 
3680
+                    <property name="name">
 
3681
+                        <cstring>ProgTextLabel</cstring>
 
3682
+                    </property>
 
3683
+                    <property name="text">
 
3684
+                        <string>&amp;Prog:</string>
 
3685
+                    </property>
 
3686
+                    <property name="alignment">
 
3687
+                        <set>AlignVCenter|AlignRight</set>
 
3688
+                    </property>
 
3689
+                    <property name="buddy" stdset="0">
 
3690
+                        <cstring>ProgSpinBox</cstring>
 
3691
+                    </property>
 
3692
+                </widget>
 
3693
+                <widget class="QSpinBox" row="0" column="8" rowspan="1" colspan="2">
 
3694
+                    <property name="name">
 
3695
+                        <cstring>ProgSpinBox</cstring>
 
3696
+                    </property>
 
3697
+                    <property name="maxValue">
 
3698
+                        <number>128</number>
 
3699
+                    </property>
 
3700
+                    <property name="minValue">
 
3701
+                        <number>1</number>
 
3702
+                    </property>
 
3703
+                    <property name="toolTip" stdset="0">
 
3704
+                        <string>Program (0-127)</string>
 
3705
+                    </property>
 
3706
+                </widget>
 
3707
+                <widget class="QLabel" row="5" column="0">
 
3708
+                    <property name="name">
 
3709
+                        <cstring>VolumeTextLabel</cstring>
 
3710
+                    </property>
 
3711
+                    <property name="text">
 
3712
+                        <string>Vol&amp;ume:</string>
 
3713
+                    </property>
 
3714
+                    <property name="alignment">
 
3715
+                        <set>AlignVCenter|AlignRight</set>
 
3716
+                    </property>
 
3717
+                    <property name="buddy" stdset="0">
 
3718
+                        <cstring>VolumeSpinBox</cstring>
 
3719
+                    </property>
 
3720
+                </widget>
 
3721
+                <widget class="QLabel" row="0" column="0">
 
3722
+                    <property name="name">
 
3723
+                        <cstring>MapTextLabel</cstring>
 
3724
+                    </property>
 
3725
+                    <property name="text">
 
3726
+                        <string>&amp;Map:</string>
 
3727
+                    </property>
 
3728
+                    <property name="alignment">
 
3729
+                        <set>AlignVCenter|AlignRight</set>
 
3730
+                    </property>
 
3731
+                    <property name="buddy" stdset="0">
 
3732
+                        <cstring>MapComboBox</cstring>
 
3733
+                    </property>
 
3734
+                </widget>
 
3735
+                <widget class="QLabel" row="0" column="3" rowspan="1" colspan="2">
 
3736
+                    <property name="name">
 
3737
+                        <cstring>BankTextLabel</cstring>
 
3738
+                    </property>
 
3739
+                    <property name="text">
 
3740
+                        <string>&amp;Bank:</string>
 
3741
+                    </property>
 
3742
+                    <property name="alignment">
 
3743
+                        <set>AlignVCenter|AlignRight</set>
 
3744
+                    </property>
 
3745
+                    <property name="buddy" stdset="0">
 
3746
+                        <cstring>BankSpinBox</cstring>
 
3747
+                    </property>
 
3748
+                </widget>
 
3749
+                <widget class="QSpinBox" row="0" column="5" rowspan="1" colspan="2">
 
3750
+                    <property name="name">
 
3751
+                        <cstring>BankSpinBox</cstring>
 
3752
+                    </property>
 
3753
+                    <property name="maxValue">
 
3754
+                        <number>16383</number>
 
3755
+                    </property>
 
3756
+                    <property name="toolTip" stdset="0">
 
3757
+                        <string>Bank (0-16383)</string>
 
3758
+                    </property>
 
3759
+                </widget>
 
3760
+                <widget class="QComboBox" row="3" column="1" rowspan="1" colspan="8">
 
3761
+                    <property name="name">
 
3762
+                        <cstring>InstrumentFileComboBox</cstring>
 
3763
+                    </property>
 
3764
+                    <property name="sizePolicy">
 
3765
+                        <sizepolicy>
 
3766
+                            <hsizetype>7</hsizetype>
 
3767
+                            <vsizetype>0</vsizetype>
 
3768
+                            <horstretch>0</horstretch>
 
3769
+                            <verstretch>0</verstretch>
 
3770
+                        </sizepolicy>
 
3771
+                    </property>
 
3772
+                    <property name="minimumSize">
 
3773
+                        <size>
 
3774
+                            <width>320</width>
 
3775
+                            <height>0</height>
 
3776
+                        </size>
 
3777
+                    </property>
 
3778
+                    <property name="editable">
 
3779
+                        <bool>true</bool>
 
3780
+                    </property>
 
3781
+                    <property name="toolTip" stdset="0">
 
3782
+                        <string>Instrument filename</string>
 
3783
+                    </property>
 
3784
+                </widget>
 
3785
+                <widget class="QLabel" row="5" column="4" rowspan="1" colspan="2">
 
3786
+                    <property name="name">
 
3787
+                        <cstring>LoadModeNameTextLabel</cstring>
 
3788
+                    </property>
 
3789
+                    <property name="text">
 
3790
+                        <string>M&amp;ode:</string>
 
3791
+                    </property>
 
3792
+                    <property name="alignment">
 
3793
+                        <set>AlignVCenter|AlignRight</set>
 
3794
+                    </property>
 
3795
+                    <property name="buddy" stdset="0">
 
3796
+                        <cstring>LoadModeComboBox</cstring>
 
3797
+                    </property>
 
3798
+                </widget>
 
3799
+                <spacer row="5" column="2" rowspan="1" colspan="2">
 
3800
+                    <property name="name">
 
3801
+                        <cstring>spacer2</cstring>
 
3802
+                    </property>
 
3803
+                    <property name="orientation">
 
3804
+                        <enum>Horizontal</enum>
 
3805
+                    </property>
 
3806
+                    <property name="sizeType">
 
3807
+                        <enum>Expanding</enum>
 
3808
+                    </property>
 
3809
+                    <property name="sizeHint">
 
3810
+                        <size>
 
3811
+                            <width>119</width>
 
3812
+                            <height>8</height>
 
3813
+                        </size>
 
3814
+                    </property>
 
3815
+                </spacer>
 
3816
+                <widget class="QLabel" row="3" column="0">
 
3817
+                    <property name="name">
 
3818
+                        <cstring>InstrumentFileTextLabel</cstring>
 
3819
+                    </property>
 
3820
+                    <property name="text">
 
3821
+                        <string>&amp;Filename:</string>
 
3822
+                    </property>
 
3823
+                    <property name="alignment">
 
3824
+                        <set>AlignVCenter|AlignRight</set>
 
3825
+                    </property>
 
3826
+                    <property name="buddy" stdset="0">
 
3827
+                        <cstring>InstrumentFileComboBox</cstring>
 
3828
+                    </property>
 
3829
+                </widget>
 
3830
+                <widget class="QLabel" row="1" column="0">
 
3831
+                    <property name="name">
 
3832
+                        <cstring>NameTextLabe</cstring>
 
3833
+                    </property>
 
3834
+                    <property name="text">
 
3835
+                        <string>&amp;Name:</string>
 
3836
+                    </property>
 
3837
+                    <property name="alignment">
 
3838
+                        <set>AlignVCenter|AlignRight</set>
 
3839
+                    </property>
 
3840
+                    <property name="buddy" stdset="0">
 
3841
+                        <cstring>NameLineEdit</cstring>
 
3842
+                    </property>
 
3843
+                </widget>
 
3844
+                <widget class="QComboBox" row="0" column="1" rowspan="1" colspan="2">
 
3845
+                    <property name="name">
 
3846
+                        <cstring>MapComboBox</cstring>
 
3847
+                    </property>
 
3848
+                    <property name="sizePolicy">
 
3849
+                        <sizepolicy>
 
3850
+                            <hsizetype>7</hsizetype>
 
3851
+                            <vsizetype>0</vsizetype>
 
3852
+                            <horstretch>0</horstretch>
 
3853
+                            <verstretch>0</verstretch>
 
3854
+                        </sizepolicy>
 
3855
+                    </property>
 
3856
+                    <property name="toolTip" stdset="0">
 
3857
+                        <string>Instrument map</string>
 
3858
+                    </property>
 
3859
+                </widget>
 
3860
+                <widget class="QLabel" row="4" column="0">
 
3861
+                    <property name="name">
 
3862
+                        <cstring>InstrumentNrTextLabel</cstring>
 
3863
+                    </property>
 
3864
+                    <property name="text">
 
3865
+                        <string>&amp;Instrument:</string>
 
3866
+                    </property>
 
3867
+                    <property name="alignment">
 
3868
+                        <set>AlignVCenter|AlignRight</set>
 
3869
+                    </property>
 
3870
+                    <property name="buddy" stdset="0">
 
3871
+                        <cstring>InstrumentNrComboBox</cstring>
 
3872
+                    </property>
 
3873
+                </widget>
 
3874
+                <widget class="QComboBox" row="4" column="1" rowspan="1" colspan="9">
 
3875
+                    <property name="name">
 
3876
+                        <cstring>InstrumentNrComboBox</cstring>
 
3877
+                    </property>
 
3878
+                    <property name="sizePolicy">
 
3879
+                        <sizepolicy>
 
3880
+                            <hsizetype>7</hsizetype>
 
3881
+                            <vsizetype>0</vsizetype>
 
3882
+                            <horstretch>0</horstretch>
 
3883
+                            <verstretch>0</verstretch>
 
3884
+                        </sizepolicy>
 
3885
+                    </property>
 
3886
+                    <property name="minimumSize">
 
3887
+                        <size>
 
3888
+                            <width>320</width>
 
3889
+                            <height>0</height>
 
3890
+                        </size>
 
3891
+                    </property>
 
3892
+                    <property name="toolTip" stdset="0">
 
3893
+                        <string>Instrument name</string>
 
3894
+                    </property>
 
3895
+                </widget>
 
3896
+                <widget class="QSpinBox" row="5" column="1">
 
3897
+                    <property name="name">
 
3898
+                        <cstring>VolumeSpinBox</cstring>
 
3899
+                    </property>
 
3900
+                    <property name="suffix">
 
3901
+                        <string> %</string>
 
3902
+                    </property>
 
3903
+                    <property name="maxValue">
 
3904
+                        <number>100</number>
 
3905
+                    </property>
 
3906
+                    <property name="toolTip" stdset="0">
 
3907
+                        <string>Volume (%)</string>
 
3908
+                    </property>
 
3909
+                </widget>
 
3910
+                <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="9">
 
3911
+                    <property name="name">
 
3912
+                        <cstring>NameLineEdit</cstring>
 
3913
+                    </property>
 
3914
+                    <property name="toolTip" stdset="0">
 
3915
+                        <string>Name</string>
 
3916
+                    </property>
 
3917
+                </widget>
 
3918
+                <widget class="QComboBox" row="5" column="6" rowspan="1" colspan="4">
 
3919
+                    <item>
 
3920
+                        <property name="text">
 
3921
+                            <string>Default</string>
 
3922
+                        </property>
 
3923
+                    </item>
 
3924
+                    <item>
 
3925
+                        <property name="text">
 
3926
+                            <string>On Demand</string>
 
3927
+                        </property>
 
3928
+                    </item>
 
3929
+                    <item>
 
3930
+                        <property name="text">
 
3931
+                            <string>On Demand Hold</string>
 
3932
+                        </property>
 
3933
+                    </item>
 
3934
+                    <item>
 
3935
+                        <property name="text">
 
3936
+                            <string>Persistent</string>
 
3937
+                        </property>
 
3938
+                    </item>
 
3939
+                    <property name="name">
 
3940
+                        <cstring>LoadModeComboBox</cstring>
 
3941
+                    </property>
 
3942
+                    <property name="sizePolicy">
 
3943
+                        <sizepolicy>
 
3944
+                            <hsizetype>7</hsizetype>
 
3945
+                            <vsizetype>0</vsizetype>
 
3946
+                            <horstretch>0</horstretch>
 
3947
+                            <verstretch>0</verstretch>
 
3948
+                        </sizepolicy>
 
3949
+                    </property>
 
3950
+                    <property name="toolTip" stdset="0">
 
3951
+                        <string>Load mode</string>
 
3952
+                    </property>
 
3953
+                </widget>
 
3954
+                <widget class="QToolButton" row="3" column="9">
 
3955
+                    <property name="name">
 
3956
+                        <cstring>InstrumentFileToolButton</cstring>
 
3957
+                    </property>
 
3958
+                    <property name="sizePolicy">
 
3959
+                        <sizepolicy>
 
3960
+                            <hsizetype>0</hsizetype>
 
3961
+                            <vsizetype>0</vsizetype>
 
3962
+                            <horstretch>0</horstretch>
 
3963
+                            <verstretch>0</verstretch>
 
3964
+                        </sizepolicy>
 
3965
+                    </property>
 
3966
+                    <property name="minimumSize">
 
3967
+                        <size>
 
3968
+                            <width>24</width>
 
3969
+                            <height>24</height>
 
3970
+                        </size>
 
3971
+                    </property>
 
3972
+                    <property name="maximumSize">
 
3973
+                        <size>
 
3974
+                            <width>26</width>
 
3975
+                            <height>26</height>
 
3976
+                        </size>
 
3977
+                    </property>
 
3978
+                    <property name="focusPolicy">
 
3979
+                        <enum>TabFocus</enum>
 
3980
+                    </property>
 
3981
+                    <property name="text">
 
3982
+                        <string></string>
 
3983
+                    </property>
 
3984
+                    <property name="iconSet">
 
3985
+                        <iconset>fileOpen.png</iconset>
 
3986
+                    </property>
 
3987
+                    <property name="toolTip" stdset="0">
 
3988
+                        <string>Browse for instrument filename</string>
 
3989
+                    </property>
 
3990
+                </widget>
 
3991
+            </grid>
 
3992
+        </widget>
 
3993
+        <widget class="QLayoutWidget">
 
3994
+            <property name="name">
 
3995
+                <cstring>layout2</cstring>
 
3996
+            </property>
 
3997
+            <hbox>
 
3998
+                <property name="name">
 
3999
+                    <cstring>unnamed</cstring>
 
4000
+                </property>
 
4001
+                <spacer>
 
4002
+                    <property name="name">
 
4003
+                        <cstring>spacer3</cstring>
 
4004
+                    </property>
 
4005
+                    <property name="orientation">
 
4006
+                        <enum>Horizontal</enum>
 
4007
+                    </property>
 
4008
+                    <property name="sizeType">
 
4009
+                        <enum>Expanding</enum>
 
4010
+                    </property>
 
4011
+                    <property name="sizeHint">
 
4012
+                        <size>
 
4013
+                            <width>8</width>
 
4014
+                            <height>8</height>
 
4015
+                        </size>
 
4016
+                    </property>
 
4017
+                </spacer>
 
4018
+                <widget class="QPushButton">
 
4019
+                    <property name="name">
 
4020
+                        <cstring>OkPushButton</cstring>
 
4021
+                    </property>
 
4022
+                    <property name="text">
 
4023
+                        <string>O&amp;K</string>
 
4024
+                    </property>
 
4025
+                    <property name="accel">
 
4026
+                        <string>Alt+K</string>
 
4027
+                    </property>
 
4028
+                    <property name="iconSet">
 
4029
+                        <iconset>formAccept.png</iconset>
 
4030
+                    </property>
 
4031
+                </widget>
 
4032
+                <widget class="QPushButton">
 
4033
+                    <property name="name">
 
4034
+                        <cstring>CancelPushButton</cstring>
 
4035
+                    </property>
 
4036
+                    <property name="text">
 
4037
+                        <string>C&amp;ancel</string>
 
4038
+                    </property>
 
4039
+                    <property name="accel">
 
4040
+                        <string>Alt+A</string>
 
4041
+                    </property>
 
4042
+                    <property name="iconSet">
 
4043
+                        <iconset>formReject.png</iconset>
 
4044
+                    </property>
 
4045
+                </widget>
 
4046
+            </hbox>
 
4047
+        </widget>
 
4048
+    </vbox>
 
4049
+</widget>
 
4050
+<connections>
 
4051
+    <connection>
 
4052
+        <sender>MapComboBox</sender>
 
4053
+        <signal>activated(int)</signal>
 
4054
+        <receiver>qsamplerInstrumentForm</receiver>
 
4055
+        <slot>changed()</slot>
 
4056
+    </connection>
 
4057
+    <connection>
 
4058
+        <sender>BankSpinBox</sender>
 
4059
+        <signal>valueChanged(int)</signal>
 
4060
+        <receiver>qsamplerInstrumentForm</receiver>
 
4061
+        <slot>changed()</slot>
 
4062
+    </connection>
 
4063
+    <connection>
 
4064
+        <sender>ProgSpinBox</sender>
 
4065
+        <signal>valueChanged(int)</signal>
 
4066
+        <receiver>qsamplerInstrumentForm</receiver>
 
4067
+        <slot>changed()</slot>
 
4068
+    </connection>
 
4069
+    <connection>
 
4070
+        <sender>NameLineEdit</sender>
 
4071
+        <signal>textChanged(const QString&amp;)</signal>
 
4072
+        <receiver>qsamplerInstrumentForm</receiver>
 
4073
+        <slot>nameChanged(const QString&amp;)</slot>
 
4074
+    </connection>
 
4075
+    <connection>
 
4076
+        <sender>EngineNameComboBox</sender>
 
4077
+        <signal>activated(int)</signal>
 
4078
+        <receiver>qsamplerInstrumentForm</receiver>
 
4079
+        <slot>changed()</slot>
 
4080
+    </connection>
 
4081
+    <connection>
 
4082
+        <sender>InstrumentFileComboBox</sender>
 
4083
+        <signal>activated(const QString&amp;)</signal>
 
4084
+        <receiver>qsamplerInstrumentForm</receiver>
 
4085
+        <slot>updateInstrumentName()</slot>
 
4086
+    </connection>
 
4087
+    <connection>
 
4088
+        <sender>InstrumentFileToolButton</sender>
 
4089
+        <signal>clicked()</signal>
 
4090
+        <receiver>qsamplerInstrumentForm</receiver>
 
4091
+        <slot>openInstrumentFile()</slot>
 
4092
+    </connection>
 
4093
+    <connection>
 
4094
+        <sender>InstrumentNrComboBox</sender>
 
4095
+        <signal>activated(int)</signal>
 
4096
+        <receiver>qsamplerInstrumentForm</receiver>
 
4097
+        <slot>instrumentNrChanged()</slot>
 
4098
+    </connection>
 
4099
+    <connection>
 
4100
+        <sender>VolumeSpinBox</sender>
 
4101
+        <signal>valueChanged(int)</signal>
 
4102
+        <receiver>qsamplerInstrumentForm</receiver>
 
4103
+        <slot>changed()</slot>
 
4104
+    </connection>
 
4105
+    <connection>
 
4106
+        <sender>LoadModeComboBox</sender>
 
4107
+        <signal>activated(int)</signal>
 
4108
+        <receiver>qsamplerInstrumentForm</receiver>
 
4109
+        <slot>changed()</slot>
 
4110
+    </connection>
 
4111
+    <connection>
 
4112
+        <sender>OkPushButton</sender>
 
4113
+        <signal>clicked()</signal>
 
4114
+        <receiver>qsamplerInstrumentForm</receiver>
 
4115
+        <slot>accept()</slot>
 
4116
+    </connection>
 
4117
+    <connection>
 
4118
+        <sender>CancelPushButton</sender>
 
4119
+        <signal>clicked()</signal>
 
4120
+        <receiver>qsamplerInstrumentForm</receiver>
 
4121
+        <slot>reject()</slot>
 
4122
+    </connection>
 
4123
+</connections>
 
4124
+<tabstops>
 
4125
+    <tabstop>MapComboBox</tabstop>
 
4126
+    <tabstop>BankSpinBox</tabstop>
 
4127
+    <tabstop>ProgSpinBox</tabstop>
 
4128
+    <tabstop>NameLineEdit</tabstop>
 
4129
+    <tabstop>EngineNameComboBox</tabstop>
 
4130
+    <tabstop>InstrumentFileComboBox</tabstop>
 
4131
+    <tabstop>InstrumentFileToolButton</tabstop>
 
4132
+    <tabstop>InstrumentNrComboBox</tabstop>
 
4133
+    <tabstop>VolumeSpinBox</tabstop>
 
4134
+    <tabstop>LoadModeComboBox</tabstop>
 
4135
+    <tabstop>OkPushButton</tabstop>
 
4136
+    <tabstop>CancelPushButton</tabstop>
 
4137
+</tabstops>
 
4138
+<forwards>
 
4139
+    <forward>class qsamplerInstrument;</forward>
 
4140
+</forwards>
 
4141
+<variables>
 
4142
+    <variable access="private">qsamplerInstrument *m_pInstrument;</variable>
 
4143
+    <variable access="private">int m_iDirtySetup;</variable>
 
4144
+    <variable access="private">int m_iDirtyCount;</variable>
 
4145
+    <variable access="private">int m_iDirtyName;</variable>
 
4146
+</variables>
 
4147
+<slots>
 
4148
+    <slot specifier="non virtual">nameChanged( const QString&amp; sName )</slot>
 
4149
+    <slot specifier="non virtual">openInstrumentFile()</slot>
 
4150
+    <slot specifier="non virtual">updateInstrumentName()</slot>
 
4151
+    <slot specifier="non virtual">instrumentNrChanged()</slot>
 
4152
+    <slot specifier="non virtual">accept()</slot>
 
4153
+    <slot specifier="non virtual">reject()</slot>
 
4154
+    <slot specifier="non virtual">changed()</slot>
 
4155
+    <slot specifier="non virtual">stabilizeForm()</slot>
 
4156
+</slots>
 
4157
+<functions>
 
4158
+    <function access="private" specifier="non virtual">init()</function>
 
4159
+    <function access="private" specifier="non virtual">destroy()</function>
 
4160
+    <function specifier="non virtual">setup( qsamplerInstrument *pInstrument )</function>
 
4161
+</functions>
 
4162
+<pixmapinproject/>
 
4163
+<layoutdefaults spacing="4" margin="4"/>
 
4164
+</UI>
 
4165
Index: qsampler/src/qsamplerInstrumentForm.ui.h
 
4166
diff -u /dev/null qsampler/src/qsamplerInstrumentForm.ui.h:1.6
 
4167
--- /dev/null   Tue Feb  6 13:36:34 2007
 
4168
+++ qsampler/src/qsamplerInstrumentForm.ui.h    Mon Jan  8 17:52:48 2007
 
4169
@@ -0,0 +1,362 @@
 
4170
+// qsamplerInstrumentForm.ui.h
 
4171
+//
 
4172
+// ui.h extension file, included from the uic-generated form implementation.
 
4173
+/****************************************************************************
 
4174
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
4175
+
 
4176
+   This program is free software; you can redistribute it and/or
 
4177
+   modify it under the terms of the GNU General Public License
 
4178
+   as published by the Free Software Foundation; either version 2
 
4179
+   of the License, or (at your option) any later version.
 
4180
+
 
4181
+   This program is distributed in the hope that it will be useful,
 
4182
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
4183
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
4184
+   GNU General Public License for more details.
 
4185
+
 
4186
+   You should have received a copy of the GNU General Public License along
 
4187
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
4188
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
4189
+
 
4190
+*****************************************************************************/
 
4191
+
 
4192
+#include "qsamplerAbout.h"
 
4193
+#include "qsamplerInstrument.h"
 
4194
+
 
4195
+#include "qsamplerOptions.h"
 
4196
+#include "qsamplerChannel.h"
 
4197
+
 
4198
+#include "qsamplerMainForm.h"
 
4199
+
 
4200
+#include <qmessagebox.h>
 
4201
+#include <qfiledialog.h>
 
4202
+#include <qfileinfo.h>
 
4203
+#include <qlistbox.h>
 
4204
+
 
4205
+// Needed for lroundf()
 
4206
+#include <math.h>
 
4207
+
 
4208
+#ifndef CONFIG_ROUND
 
4209
+static inline long lroundf ( float x )
 
4210
+{
 
4211
+       if (x >= 0.0f)
 
4212
+               return long(x + 0.5f);
 
4213
+       else
 
4214
+               return long(x - 0.5f);
 
4215
+}
 
4216
+#endif
 
4217
+
 
4218
+
 
4219
+// Kind of constructor.
 
4220
+void qsamplerInstrumentForm::init (void)
 
4221
+{
 
4222
+       // Initialize locals.
 
4223
+       m_pInstrument = NULL;
 
4224
+
 
4225
+       m_iDirtySetup = 0;
 
4226
+       m_iDirtyCount = 0;
 
4227
+       m_iDirtyName  = 0;
 
4228
+
 
4229
+       // Try to restore normal window positioning.
 
4230
+       adjustSize();
 
4231
+}
 
4232
+
 
4233
+
 
4234
+// Kind of destructor.
 
4235
+void qsamplerInstrumentForm::destroy (void)
 
4236
+{
 
4237
+}
 
4238
+
 
4239
+
 
4240
+// Channel dialog setup formal initializer.
 
4241
+void qsamplerInstrumentForm::setup ( qsamplerInstrument *pInstrument )
 
4242
+{
 
4243
+       m_pInstrument = pInstrument;
 
4244
+
 
4245
+       m_iDirtySetup = 0;
 
4246
+       m_iDirtyCount = 0;
 
4247
+       m_iDirtyName  = 0;
 
4248
+
 
4249
+       if (m_pInstrument == NULL)
 
4250
+               return;
 
4251
+
 
4252
+       // Check if we're up and connected.
 
4253
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
4254
+       if (pMainForm == NULL)
 
4255
+               return;
 
4256
+       if (pMainForm->client() == NULL)
 
4257
+               return;
 
4258
+
 
4259
+       qsamplerOptions *pOptions = pMainForm->options();
 
4260
+       if (pOptions == NULL)
 
4261
+               return;
 
4262
+
 
4263
+       // It can be a brand new channel, remember?
 
4264
+       bool bNew = (m_pInstrument->bank() < 0 || m_pInstrument->prog() < 0);
 
4265
+       if (!bNew) {
 
4266
+               m_pInstrument->getInstrument();
 
4267
+               m_iDirtyName++;
 
4268
+       }
 
4269
+
 
4270
+       // Avoid nested changes.
 
4271
+       m_iDirtySetup++;
 
4272
+
 
4273
+       // Load combo box history...
 
4274
+       pOptions->loadComboBoxHistory(InstrumentFileComboBox);
 
4275
+
 
4276
+       // Populate maps list.
 
4277
+       MapComboBox->clear();
 
4278
+       MapComboBox->insertStringList(qsamplerInstrument::getMapNames());
 
4279
+
 
4280
+       // Populate Engines list.
 
4281
+       const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client());
 
4282
+       if (ppszEngines) {
 
4283
+               EngineNameComboBox->clear();
 
4284
+               for (int iEngine = 0; ppszEngines[iEngine]; iEngine++)
 
4285
+                       EngineNameComboBox->insertItem(ppszEngines[iEngine]);
 
4286
+       }
 
4287
+       else pMainForm->appendMessagesClient("lscp_list_available_engines");
 
4288
+
 
4289
+       // Read proper instrument information,
 
4290
+       // and populate the instrument form fields.
 
4291
+
 
4292
+       // Instrument map name...
 
4293
+       int iMap = (bNew ? pOptions->iMidiMap : m_pInstrument->map());
 
4294
+       if (iMap < 0)
 
4295
+               iMap = 0;
 
4296
+       const QString& sMapName = qsamplerInstrument::getMapName(iMap);
 
4297
+       if (!sMapName.isEmpty())
 
4298
+               MapComboBox->setCurrentText(sMapName);
 
4299
+       // It might be no maps around...
 
4300
+       bool bMapEnabled = (MapComboBox->count() > 0);
 
4301
+       MapTextLabel->setEnabled(bMapEnabled);
 
4302
+       MapComboBox->setEnabled(bMapEnabled);
 
4303
+
 
4304
+       // Instrument bank/program...
 
4305
+       int iBank = (bNew ? pOptions->iMidiBank : m_pInstrument->bank());
 
4306
+       int iProg = (bNew ? pOptions->iMidiProg : m_pInstrument->prog()) + 1;
 
4307
+       if (bNew && iProg > 128) {
 
4308
+               iProg = 1;
 
4309
+               iBank++;
 
4310
+       }
 
4311
+       BankSpinBox->setValue(iBank);
 
4312
+       ProgSpinBox->setValue(iProg);
 
4313
+
 
4314
+       // Instrument name...
 
4315
+       NameLineEdit->setText(m_pInstrument->name());
 
4316
+
 
4317
+       // Engine name...
 
4318
+       QString sEngineName = m_pInstrument->engineName();
 
4319
+       if (sEngineName.isEmpty() || bNew)
 
4320
+               sEngineName = pOptions->sEngineName;
 
4321
+       if (sEngineName.isEmpty())
 
4322
+               sEngineName = qsamplerChannel::noEngineName();
 
4323
+       if (EngineNameComboBox->listBox()->findItem(sEngineName,
 
4324
+                       Qt::ExactMatch | Qt::CaseSensitive) == NULL) {
 
4325
+               EngineNameComboBox->insertItem(sEngineName);
 
4326
+       }
 
4327
+       EngineNameComboBox->setCurrentText(sEngineName);
 
4328
+       // Instrument filename and index...
 
4329
+       QString sInstrumentFile = m_pInstrument->instrumentFile();
 
4330
+       if (sInstrumentFile.isEmpty())
 
4331
+               sInstrumentFile = qsamplerChannel::noInstrumentName();
 
4332
+       InstrumentFileComboBox->setCurrentText(sInstrumentFile);
 
4333
+       InstrumentNrComboBox->clear();
 
4334
+       InstrumentNrComboBox->insertStringList(
 
4335
+               qsamplerChannel::getInstrumentList(sInstrumentFile,
 
4336
+               pOptions->bInstrumentNames));
 
4337
+       InstrumentNrComboBox->setCurrentItem(m_pInstrument->instrumentNr());
 
4338
+
 
4339
+       // Instrument volume....
 
4340
+       int iVolume = (bNew ? pOptions->iVolume :
 
4341
+               ::lroundf(100.0f * m_pInstrument->volume()));
 
4342
+       VolumeSpinBox->setValue(iVolume);
 
4343
+
 
4344
+       // Instrument load mode...
 
4345
+       int iLoadMode = (bNew ? pOptions->iLoadMode :
 
4346
+               m_pInstrument->loadMode());
 
4347
+       LoadModeComboBox->setCurrentItem(iLoadMode);
 
4348
+
 
4349
+       // Done.
 
4350
+       m_iDirtySetup--;
 
4351
+       stabilizeForm();
 
4352
+
 
4353
+       // Done.
 
4354
+       m_iDirtySetup--;
 
4355
+       stabilizeForm();
 
4356
+}
 
4357
+
 
4358
+
 
4359
+// Special case for name change,
 
4360
+void qsamplerInstrumentForm::nameChanged ( const QString& /* sName */ )
 
4361
+{
 
4362
+       if (m_iDirtySetup > 0)
 
4363
+               return;
 
4364
+
 
4365
+       m_iDirtyName++;
 
4366
+       changed();
 
4367
+}
 
4368
+
 
4369
+
 
4370
+// Browse and open an instrument file.
 
4371
+void qsamplerInstrumentForm::openInstrumentFile (void)
 
4372
+{
 
4373
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
4374
+       if (pMainForm == NULL)
 
4375
+               return;
 
4376
+
 
4377
+       qsamplerOptions *pOptions = pMainForm->options();
 
4378
+       if (pOptions == NULL)
 
4379
+               return;
 
4380
+
 
4381
+       // FIXME: the instrument file filters should be restricted,
 
4382
+       // depending on the current engine.
 
4383
+       QString sInstrumentFile = QFileDialog::getOpenFileName(
 
4384
+               pOptions->sInstrumentDir,                   // Start here.
 
4385
+               tr("Instrument files") + " (*.gig *.dls)",  // Filter (GIG and DLS files)
 
4386
+               this, 0,                                    // Parent and name (none)
 
4387
+               QSAMPLER_TITLE ": " + tr("Instrument files")// Caption.
 
4388
+       );
 
4389
+
 
4390
+       if (sInstrumentFile.isEmpty())
 
4391
+               return;
 
4392
+
 
4393
+       InstrumentFileComboBox->setCurrentText(sInstrumentFile);
 
4394
+       updateInstrumentName();
 
4395
+}
 
4396
+
 
4397
+
 
4398
+// Refresh the actual instrument name.
 
4399
+void qsamplerInstrumentForm::updateInstrumentName (void)
 
4400
+{
 
4401
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
4402
+       if (pMainForm == NULL)
 
4403
+               return;
 
4404
+
 
4405
+       qsamplerOptions *pOptions = pMainForm->options();
 
4406
+       if (pOptions == NULL)
 
4407
+               return;
 
4408
+
 
4409
+       // TODO: this better idea would be to use libgig
 
4410
+       // to retrieve the REAL instrument names.
 
4411
+       InstrumentNrComboBox->clear();
 
4412
+       InstrumentNrComboBox->insertStringList(
 
4413
+               qsamplerChannel::getInstrumentList(
 
4414
+                       InstrumentFileComboBox->currentText(),
 
4415
+                       pOptions->bInstrumentNames)
 
4416
+       );
 
4417
+
 
4418
+       instrumentNrChanged();
 
4419
+}
 
4420
+
 
4421
+
 
4422
+// Special case for instrumnet index change,
 
4423
+void qsamplerInstrumentForm::instrumentNrChanged (void)
 
4424
+{
 
4425
+       if (m_iDirtySetup > 0)
 
4426
+               return;
 
4427
+
 
4428
+       if (NameLineEdit->text().isEmpty() || m_iDirtyName == 0) {
 
4429
+               NameLineEdit->setText(InstrumentNrComboBox->currentText());
 
4430
+               m_iDirtyName = 0;
 
4431
+       }
 
4432
+
 
4433
+       changed();
 
4434
+}
 
4435
+
 
4436
+
 
4437
+// Accept settings (OK button slot).
 
4438
+void qsamplerInstrumentForm::accept (void)
 
4439
+{
 
4440
+       if (m_pInstrument == NULL)
 
4441
+               return;
 
4442
+
 
4443
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
4444
+       if (pMainForm == NULL)
 
4445
+               return;
 
4446
+       if (pMainForm->client() == NULL)
 
4447
+               return;
 
4448
+
 
4449
+       qsamplerOptions *pOptions = pMainForm->options();
 
4450
+       if (pOptions == NULL)
 
4451
+               return;
 
4452
+
 
4453
+       if (m_iDirtyCount > 0) {
 
4454
+               m_pInstrument->setMap(MapComboBox->currentItem());
 
4455
+               m_pInstrument->setBank(BankSpinBox->value());
 
4456
+               m_pInstrument->setProg(ProgSpinBox->value() - 1);
 
4457
+               m_pInstrument->setName(NameLineEdit->text());
 
4458
+               m_pInstrument->setEngineName(EngineNameComboBox->currentText());
 
4459
+               m_pInstrument->setInstrumentFile(InstrumentFileComboBox->currentText());
 
4460
+               m_pInstrument->setInstrumentNr(InstrumentNrComboBox->currentItem());
 
4461
+               m_pInstrument->setVolume(0.01f * float(VolumeSpinBox->value()));
 
4462
+               m_pInstrument->setLoadMode(LoadModeComboBox->currentItem());
 
4463
+       }
 
4464
+
 
4465
+       // Save default engine name, instrument directory and history...
 
4466
+       pOptions->sInstrumentDir = QFileInfo(InstrumentFileComboBox->currentText()).dirPath(true);
 
4467
+       pOptions->sEngineName = EngineNameComboBox->currentText();
 
4468
+       pOptions->iMidiMap  = MapComboBox->currentItem();
 
4469
+       pOptions->iMidiBank = BankSpinBox->value();
 
4470
+       pOptions->iMidiProg = ProgSpinBox->value();
 
4471
+       pOptions->iVolume   = VolumeSpinBox->value();
 
4472
+       pOptions->iLoadMode = LoadModeComboBox->currentItem();
 
4473
+       pOptions->saveComboBoxHistory(InstrumentFileComboBox);
 
4474
+
 
4475
+       // Just go with dialog acceptance.
 
4476
+       QDialog::accept();
 
4477
+}
 
4478
+
 
4479
+
 
4480
+// Reject settings (Cancel button slot).
 
4481
+void qsamplerInstrumentForm::reject (void)
 
4482
+{
 
4483
+       bool bReject = true;
 
4484
+
 
4485
+       // Check if there's any pending changes...
 
4486
+       if (m_iDirtyCount > 0 && OkPushButton->isEnabled()) {
 
4487
+               switch (QMessageBox::warning(this,
 
4488
+                       QSAMPLER_TITLE ": " + tr("Warning"),
 
4489
+                       tr("Some channel settings have been changed.\n\n"
 
4490
+                       "Do you want to apply the changes?"),
 
4491
+                       tr("Apply"), tr("Discard"), tr("Cancel"))) {
 
4492
+               case 0:     // Apply...
 
4493
+                       accept();
 
4494
+                       return;
 
4495
+               case 1:     // Discard
 
4496
+                       break;
 
4497
+               default:    // Cancel.
 
4498
+                       bReject = false;
 
4499
+                       break;
 
4500
+               }
 
4501
+       }
 
4502
+
 
4503
+       if (bReject)
 
4504
+               QDialog::reject();
 
4505
+}
 
4506
+
 
4507
+
 
4508
+// Dirty up settings.
 
4509
+void qsamplerInstrumentForm::changed (void)
 
4510
+{
 
4511
+       if (m_iDirtySetup > 0)
 
4512
+               return;
 
4513
+
 
4514
+       m_iDirtyCount++;
 
4515
+       stabilizeForm();
 
4516
+}
 
4517
+
 
4518
+
 
4519
+// Stabilize current form state.
 
4520
+void qsamplerInstrumentForm::stabilizeForm (void)
 
4521
+{
 
4522
+       bool bValid =!NameLineEdit->text().isEmpty();
 
4523
+
 
4524
+       const QString& sPath = InstrumentFileComboBox->currentText();
 
4525
+       bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
 
4526
+
 
4527
+       OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);
 
4528
+}
 
4529
+
 
4530
+
 
4531
+// end of qsamplerInstrumentForm.ui.h
 
4532
Index: qsampler/src/qsamplerInstrumentList.cpp
 
4533
diff -u /dev/null qsampler/src/qsamplerInstrumentList.cpp:1.9
 
4534
--- /dev/null   Tue Feb  6 13:36:34 2007
 
4535
+++ qsampler/src/qsamplerInstrumentList.cpp     Mon Jan  8 23:04:33 2007
 
4536
@@ -0,0 +1,726 @@
 
4537
+// qsamplerInstrumentList.cpp
 
4538
+//
 
4539
+/****************************************************************************
 
4540
+   Copyright (C) 2003-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
4541
+
 
4542
+   This program is free software; you can redistribute it and/or
 
4543
+   modify it under the terms of the GNU General Public License
 
4544
+   as published by the Free Software Foundation; either version 2
 
4545
+   of the License, or (at your option) any later version.
 
4546
+
 
4547
+   This program is distributed in the hope that it will be useful,
 
4548
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
4549
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
4550
+   GNU General Public License for more details.
 
4551
+
 
4552
+   You should have received a copy of the GNU General Public License
 
4553
+   along with this program; if not, write to the Free Software
 
4554
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
4555
+
 
4556
+*****************************************************************************/
 
4557
+
 
4558
+#include "qsamplerAbout.h"
 
4559
+#include "qsamplerInstrumentList.h"
 
4560
+
 
4561
+#include "qsamplerInstrument.h"
 
4562
+#include "qsamplerInstrumentForm.h"
 
4563
+
 
4564
+#include "qsamplerOptions.h"
 
4565
+#include "qsamplerMainForm.h"
 
4566
+
 
4567
+#include <qapplication.h>
 
4568
+#include <qmessagebox.h>
 
4569
+#include <qeventloop.h>
 
4570
+#include <qaction.h>
 
4571
+#include <qcursor.h>
 
4572
+#include <qfileinfo.h>
 
4573
+#include <qpopupmenu.h>
 
4574
+
 
4575
+// Needed for lroundf()
 
4576
+#include <math.h>
 
4577
+
 
4578
+#ifndef CONFIG_ROUND
 
4579
+static inline long lroundf ( float x )
 
4580
+{
 
4581
+       if (x >= 0.0f)
 
4582
+               return long(x + 0.5f);
 
4583
+       else
 
4584
+               return long(x - 0.5f);
 
4585
+}
 
4586
+#endif
 
4587
+
 
4588
+
 
4589
+//----------------------------------------------------------------------
 
4590
+// class qsamplerInstrumentGroup -- custom group list view item.
 
4591
+//
 
4592
+
 
4593
+// Constructors.
 
4594
+qsamplerInstrumentGroup::qsamplerInstrumentGroup (
 
4595
+       qsamplerInstrumentList *pListView, const QString& sName,
 
4596
+       QListViewItem *pItemAfter )
 
4597
+       : QListViewItem(pListView, pItemAfter ? pItemAfter : pListView->lastItem())
 
4598
+{
 
4599
+       QListViewItem::setRenameEnabled(0, true);
 
4600
+
 
4601
+       QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));
 
4602
+       QListViewItem::setText(0, sName);
 
4603
+}
 
4604
+
 
4605
+
 
4606
+qsamplerInstrumentGroup::qsamplerInstrumentGroup (
 
4607
+       qsamplerInstrumentGroup *pGroupItem, const QString& sName )
 
4608
+       : QListViewItem(pGroupItem, sName)
 
4609
+{
 
4610
+       QListViewItem::setRenameEnabled(0, true);
 
4611
+
 
4612
+       QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));
 
4613
+}
 
4614
+
 
4615
+
 
4616
+// Default destructor.
 
4617
+qsamplerInstrumentGroup::~qsamplerInstrumentGroup (void)
 
4618
+{
 
4619
+}
 
4620
+
 
4621
+
 
4622
+// Instance accessors.
 
4623
+void qsamplerInstrumentGroup::setName ( const QString& sName )
 
4624
+{
 
4625
+       QListViewItem::setText(0, sName);
 
4626
+}
 
4627
+
 
4628
+
 
4629
+QString qsamplerInstrumentGroup::name (void) const
 
4630
+{
 
4631
+       return QListViewItem::text(0);
 
4632
+}
 
4633
+
 
4634
+
 
4635
+qsamplerInstrumentGroup *qsamplerInstrumentGroup::groupItem (void) const
 
4636
+{
 
4637
+       QListViewItem *pParent = QListViewItem::parent();
 
4638
+       while (pParent && pParent->rtti() != qsamplerInstrumentList::Group)
 
4639
+               pParent = pParent->parent();
 
4640
+       return static_cast<qsamplerInstrumentGroup *> (pParent);
 
4641
+}
 
4642
+
 
4643
+
 
4644
+qsamplerInstrumentList *qsamplerInstrumentGroup::listView (void) const
 
4645
+{
 
4646
+       return static_cast<qsamplerInstrumentList *> (QListViewItem::listView());
 
4647
+}
 
4648
+
 
4649
+
 
4650
+// To show up whether its open or not.
 
4651
+void qsamplerInstrumentGroup::setOpen ( bool bOpen )
 
4652
+{
 
4653
+       // Set the proper pixmap of this...
 
4654
+       if (rtti() == qsamplerInstrumentList::Group) {
 
4655
+               QListViewItem::setPixmap(0, QPixmap::fromMimeSource(
 
4656
+                       bOpen ? "itemGroupOpen.png" : "itemGroup.png"));
 
4657
+       }
 
4658
+       // Open it up...
 
4659
+       QListViewItem::setOpen(bOpen);
 
4660
+
 
4661
+       // All ancestors should be also visible.
 
4662
+       if (bOpen && QListViewItem::parent())
 
4663
+               QListViewItem::parent()->setOpen(true);
 
4664
+}
 
4665
+
 
4666
+
 
4667
+// To virtually distinguish between list view items.
 
4668
+int qsamplerInstrumentGroup::rtti (void) const
 
4669
+{
 
4670
+       return qsamplerInstrumentList::Group;
 
4671
+}
 
4672
+
 
4673
+
 
4674
+//----------------------------------------------------------------------
 
4675
+// class qsamplerInstrumentItem -- custom file list view item.
 
4676
+//
 
4677
+
 
4678
+// Constructors.
 
4679
+qsamplerInstrumentItem::qsamplerInstrumentItem (
 
4680
+       qsamplerInstrumentList *pListView,
 
4681
+       qsamplerInstrument *pInstrument,
 
4682
+       QListViewItem *pItemAfter )
 
4683
+       : qsamplerInstrumentGroup(pListView, pInstrument->name(), pItemAfter)
 
4684
+{
 
4685
+       m_pInstrument = pInstrument;
 
4686
+
 
4687
+       update();
 
4688
+}
 
4689
+
 
4690
+qsamplerInstrumentItem::qsamplerInstrumentItem (
 
4691
+       qsamplerInstrumentGroup *pGroupItem,
 
4692
+       qsamplerInstrument *pInstrument )
 
4693
+       : qsamplerInstrumentGroup(pGroupItem, pInstrument->name())
 
4694
+{
 
4695
+       m_pInstrument = pInstrument;
 
4696
+
 
4697
+       update();
 
4698
+}
 
4699
+
 
4700
+
 
4701
+// Default destructor.
 
4702
+qsamplerInstrumentItem::~qsamplerInstrumentItem (void)
 
4703
+{
 
4704
+       if (m_pInstrument)
 
4705
+               delete m_pInstrument;
 
4706
+}
 
4707
+
 
4708
+
 
4709
+// To virtually distinguish between list view items.
 
4710
+int qsamplerInstrumentItem::rtti (void) const
 
4711
+{
 
4712
+       return qsamplerInstrumentList::Item;
 
4713
+}
 
4714
+
 
4715
+
 
4716
+// Payload accessor.
 
4717
+qsamplerInstrument *qsamplerInstrumentItem::instrument (void) const
 
4718
+{
 
4719
+       return m_pInstrument;
 
4720
+}
 
4721
+
 
4722
+
 
4723
+// Item refreshment.
 
4724
+void qsamplerInstrumentItem::update (void)
 
4725
+{
 
4726
+       QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemFile.png"));
 
4727
+
 
4728
+       const QString s = "-";
 
4729
+       if (m_pInstrument) {
 
4730
+               setText(0, m_pInstrument->name());
 
4731
+               setText(1, QString::number(m_pInstrument->map()));
 
4732
+               setText(2, QString::number(m_pInstrument->bank()));
 
4733
+               setText(3, QString::number(m_pInstrument->prog() + 1));
 
4734
+               setText(4, m_pInstrument->engineName());
 
4735
+               setText(5, QFileInfo(m_pInstrument->instrumentFile()).fileName());
 
4736
+               setText(6, QString::number(m_pInstrument->instrumentNr()));
 
4737
+               setText(7, QString::number(::lroundf(100.0f * m_pInstrument->volume())));
 
4738
+               QString sLoadMode = s;
 
4739
+               switch (m_pInstrument->loadMode()) {
 
4740
+               case 3:
 
4741
+                       sLoadMode = QObject::tr("Persistent");
 
4742
+                       break;
 
4743
+               case 2:
 
4744
+                       sLoadMode = QObject::tr("On Demand Hold");
 
4745
+                       break;
 
4746
+               case 1:
 
4747
+                       sLoadMode = QObject::tr("On Demand");
 
4748
+                       break;
 
4749
+               }
 
4750
+               setText(8, sLoadMode);
 
4751
+       } else {
 
4752
+               for (int i = 0; i < listView()->columns(); i++)
 
4753
+                       setText(i, s);
 
4754
+       }
 
4755
+}
 
4756
+
 
4757
+
 
4758
+//----------------------------------------------------------------------------
 
4759
+// qsamplerInstrumentList -- MIDI instrument list view.
 
4760
+//
 
4761
+
 
4762
+// Constructor.
 
4763
+qsamplerInstrumentList::qsamplerInstrumentList (
 
4764
+       QWidget *pParent, const char *pszName )
 
4765
+       : QListView(pParent, pszName)
 
4766
+{
 
4767
+       m_iMidiMap = LSCP_MIDI_MAP_ALL;
 
4768
+
 
4769
+//  QListView::setRootIsDecorated(true);
 
4770
+       QListView::setAllColumnsShowFocus(true);
 
4771
+       QListView::setResizeMode(QListView::NoColumn);
 
4772
+//     QListView::setAcceptDrops(true);
 
4773
+       QListView::setDragAutoScroll(true);
 
4774
+       QListView::setSizePolicy(
 
4775
+               QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
 
4776
+//     QListView::setShowToolTips(false);
 
4777
+       QListView::setSortColumn(-1);
 
4778
+
 
4779
+       QListView::addColumn(tr("Name"));
 
4780
+       QListView::addColumn(tr("Map"));
 
4781
+       QListView::addColumn(tr("Bank"));
 
4782
+       QListView::addColumn(tr("Prog"));
 
4783
+       QListView::addColumn(tr("Engine"));
 
4784
+       QListView::addColumn(tr("File"));
 
4785
+       QListView::addColumn(tr("Nr"));
 
4786
+       QListView::addColumn(tr("Vol"));
 
4787
+       QListView::addColumn(tr("Mode"));
 
4788
+
 
4789
+       QListView::setColumnAlignment(1, Qt::AlignHCenter);     // Map
 
4790
+       QListView::setColumnAlignment(2, Qt::AlignHCenter);     // Bank
 
4791
+       QListView::setColumnAlignment(3, Qt::AlignHCenter);     // Prog
 
4792
+       QListView::setColumnAlignment(6, Qt::AlignHCenter);     // Nr
 
4793
+       QListView::setColumnAlignment(7, Qt::AlignHCenter);     // Vol
 
4794
+
 
4795
+       QListView::setColumnWidth(0, 120);      // Name
 
4796
+       QListView::setColumnWidth(5, 240);      // File
 
4797
+
 
4798
+       m_pNewGroupAction = new QAction(
 
4799
+               QIconSet(QPixmap::fromMimeSource("itemGroupNew.png")),
 
4800
+               tr("New &Group"), tr("Ctrl+G"), this);
 
4801
+       m_pNewItemAction  = new QAction(
 
4802
+               QIconSet(QPixmap::fromMimeSource("itemNew.png")),
 
4803
+               tr("New &Instrument..."), tr("Ins"), this);
 
4804
+       m_pEditItemAction = new QAction(
 
4805
+               QIconSet(QPixmap::fromMimeSource("formEdit.png")),
 
4806
+               tr("&Edit..."), tr("Enter"), this);
 
4807
+       m_pRenameAction   = new QAction(tr("&Rename"), tr("F2"), this);
 
4808
+       m_pDeleteAction   = new QAction(
 
4809
+               QIconSet(QPixmap::fromMimeSource("formRemove.png")),
 
4810
+               tr("&Delete"), tr("Del"), this);
 
4811
+       m_pRefreshAction  = new QAction(
 
4812
+               QIconSet(QPixmap::fromMimeSource("formRefresh.png")),
 
4813
+               tr("Re&fresh"), tr("F5"), this);
 
4814
+
 
4815
+       m_pNewGroupAction->setToolTip(tr("New Group"));
 
4816
+       m_pNewItemAction->setToolTip(tr("New Instrument"));
 
4817
+       m_pEditItemAction->setToolTip(tr("Edit"));
 
4818
+       m_pRenameAction->setToolTip(tr("Rename"));
 
4819
+       m_pDeleteAction->setToolTip(tr("Delete"));
 
4820
+       m_pRefreshAction->setToolTip(tr("Refresh"));
 
4821
+
 
4822
+       QObject::connect(m_pNewGroupAction,
 
4823
+               SIGNAL(activated()),
 
4824
+               SLOT(newGroupSlot()));
 
4825
+       QObject::connect(m_pNewItemAction,
 
4826
+               SIGNAL(activated()),
 
4827
+               SLOT(newItemSlot()));
 
4828
+       QObject::connect(m_pEditItemAction,
 
4829
+               SIGNAL(activated()),
 
4830
+               SLOT(editItemSlot()));
 
4831
+       QObject::connect(m_pRenameAction,
 
4832
+               SIGNAL(activated()),
 
4833
+               SLOT(renameSlot()));
 
4834
+       QObject::connect(m_pDeleteAction,
 
4835
+               SIGNAL(activated()),
 
4836
+               SLOT(deleteSlot()));
 
4837
+       QObject::connect(m_pRefreshAction,
 
4838
+               SIGNAL(activated()),
 
4839
+               SLOT(refresh()));
 
4840
+
 
4841
+       QObject::connect(this,
 
4842
+               SIGNAL(selectionChanged()),
 
4843
+               SLOT(selectionChangedSlot()));
 
4844
+       QObject::connect(this,
 
4845
+               SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)),
 
4846
+               SLOT(activatedSlot(QListViewItem*)));
 
4847
+       QObject::connect(this,
 
4848
+               SIGNAL(returnPressed(QListViewItem*)),
 
4849
+               SLOT(activatedSlot(QListViewItem*)));
 
4850
+       QObject::connect(this,
 
4851
+               SIGNAL(itemRenamed(QListViewItem*,int)),
 
4852
+               SLOT(renamedSlot(QListViewItem*)));
 
4853
+
 
4854
+       selectionChangedSlot();
 
4855
+}
 
4856
+
 
4857
+
 
4858
+// Default destructor.
 
4859
+qsamplerInstrumentList::~qsamplerInstrumentList (void)
 
4860
+{
 
4861
+       delete m_pNewGroupAction;
 
4862
+       delete m_pNewItemAction;
 
4863
+       delete m_pEditItemAction;
 
4864
+       delete m_pRenameAction;
 
4865
+       delete m_pDeleteAction;
 
4866
+}
 
4867
+
 
4868
+
 
4869
+// Add a new instrument item, optionally under a given group.
 
4870
+qsamplerInstrumentItem *qsamplerInstrumentList::addItem (
 
4871
+       qsamplerInstrument *pInstrument,
 
4872
+       qsamplerInstrumentGroup *pParentGroup )
 
4873
+{
 
4874
+       // Check it there's already one instrument item
 
4875
+       // with the very same key (bank, program);
 
4876
+       // if yes, just remove it without prejudice...
 
4877
+       qsamplerInstrumentItem *pItem = findItem(pInstrument);
 
4878
+       if (pItem) {
 
4879
+               // If exactly the same, just update view and bail out...
 
4880
+               if (pItem->instrument() == pInstrument) {
 
4881
+                       pItem->update();
 
4882
+                       return pItem;
 
4883
+               }
 
4884
+               // Remove it, as instrument keys must be unique.
 
4885
+               delete pItem;
 
4886
+       }
 
4887
+
 
4888
+       // Add the new item under proper group one, if any...
 
4889
+       if (pParentGroup) {
 
4890
+               pParentGroup->setOpen(true);
 
4891
+               pItem = new qsamplerInstrumentItem(pParentGroup, pInstrument);
 
4892
+       } else {
 
4893
+               pItem = new qsamplerInstrumentItem(this, pInstrument);
 
4894
+       }
 
4895
+
 
4896
+       // Set it as current selection...
 
4897
+       QListView::setSelected(pItem, true);
 
4898
+
 
4899
+       return pItem;
 
4900
+}
 
4901
+
 
4902
+
 
4903
+// Add a new instrument group, optionally under another group.
 
4904
+qsamplerInstrumentGroup *qsamplerInstrumentList::addGroup (
 
4905
+       const QString& sName, qsamplerInstrumentGroup *pParentGroup )
 
4906
+{
 
4907
+       qsamplerInstrumentGroup *pGroup = findGroup(sName);
 
4908
+       if (pGroup == NULL) {
 
4909
+               if (pParentGroup) {
 
4910
+                       pParentGroup->setOpen(true);
 
4911
+                       pGroup = new qsamplerInstrumentGroup(pParentGroup, sName);
 
4912
+               } else {
 
4913
+                       pGroup = new qsamplerInstrumentGroup(this, sName);
 
4914
+               }
 
4915
+       }
 
4916
+       QListView::setSelected(pGroup, true);
 
4917
+       return pGroup;
 
4918
+}
 
4919
+
 
4920
+
 
4921
+// Find a group item, given its name.
 
4922
+qsamplerInstrumentGroup *qsamplerInstrumentList::findGroup (
 
4923
+       const QString& sName ) const
 
4924
+{
 
4925
+       // Iterate all over the place to search for the group.
 
4926
+       QListViewItemIterator iter((QListView *) this);
 
4927
+       while (iter.current()) {
 
4928
+               QListViewItem *pItem = iter.current();
 
4929
+               if (pItem->rtti() == Group && pItem->text(0) == sName)
 
4930
+                       return static_cast<qsamplerInstrumentGroup *> (pItem);
 
4931
+               ++iter;
 
4932
+       }
 
4933
+       // Not found.
 
4934
+       return NULL;
 
4935
+}
 
4936
+
 
4937
+
 
4938
+// Find a file item, given its name.
 
4939
+qsamplerInstrumentItem *qsamplerInstrumentList::findItem (
 
4940
+       qsamplerInstrument *pInstrument ) const
 
4941
+{
 
4942
+       if (pInstrument == NULL)
 
4943
+               return NULL;
 
4944
+
 
4945
+       // Iterate all over the place to search for the group.
 
4946
+       QListViewItemIterator iter((QListView *) this);
 
4947
+       while (iter.current()) {
 
4948
+               QListViewItem *pListItem = iter.current();
 
4949
+               if (pListItem->rtti() == Item) {
 
4950
+                       qsamplerInstrumentItem *pItem
 
4951
+                               = static_cast<qsamplerInstrumentItem *> (pListItem);
 
4952
+                       if (pItem && pItem->instrument()
 
4953
+                               && pItem->instrument()->map()  == pInstrument->map()
 
4954
+                               && pItem->instrument()->bank() == pInstrument->bank()
 
4955
+                               && pItem->instrument()->prog() == pInstrument->prog())
 
4956
+                               return pItem;
 
4957
+               }
 
4958
+               ++iter;
 
4959
+       }
 
4960
+       // Not found.
 
4961
+       return NULL;
 
4962
+}
 
4963
+
 
4964
+
 
4965
+// Find and return the nearest group item...
 
4966
+qsamplerInstrumentGroup *qsamplerInstrumentList::groupItem (
 
4967
+       QListViewItem *pItem ) const
 
4968
+{
 
4969
+       while (pItem && pItem->rtti() != Group)
 
4970
+               pItem = pItem->parent();
 
4971
+       return static_cast<qsamplerInstrumentGroup *> (pItem);
 
4972
+}
 
4973
+
 
4974
+
 
4975
+// Add a new group item below the current one.
 
4976
+void qsamplerInstrumentList::newGroupSlot (void)
 
4977
+{
 
4978
+       qsamplerInstrumentGroup *pNewGroup
 
4979
+               = addGroup(tr("New Group"), groupItem(QListView::selectedItem()));
 
4980
+       if (pNewGroup)
 
4981
+               pNewGroup->startRename(0);
 
4982
+
 
4983
+       selectionChangedSlot();
 
4984
+}
 
4985
+
 
4986
+
 
4987
+// Map selector.
 
4988
+void qsamplerInstrumentList::setMidiMap ( int iMidiMap )
 
4989
+{
 
4990
+       if (iMidiMap < 0)
 
4991
+               iMidiMap = LSCP_MIDI_MAP_ALL;
 
4992
+
 
4993
+       m_iMidiMap = iMidiMap;
 
4994
+}
 
4995
+
 
4996
+int qsamplerInstrumentList::midiMap (void) const
 
4997
+{
 
4998
+       return m_iMidiMap;
 
4999
+}
 
5000
+
 
5001
+
 
5002
+// List actions accessors.
 
5003
+QAction *qsamplerInstrumentList::newGroupAction (void) const
 
5004
+{
 
5005
+       return m_pNewGroupAction;
 
5006
+}
 
5007
+
 
5008
+QAction *qsamplerInstrumentList::newItemAction (void) const
 
5009
+{
 
5010
+       return m_pNewItemAction;
 
5011
+}
 
5012
+
 
5013
+QAction *qsamplerInstrumentList::editItemAction (void) const
 
5014
+{
 
5015
+       return m_pEditItemAction;
 
5016
+}
 
5017
+
 
5018
+QAction *qsamplerInstrumentList::renameAction (void) const
 
5019
+{
 
5020
+       return m_pRenameAction;
 
5021
+}
 
5022
+
 
5023
+QAction *qsamplerInstrumentList::deleteAction (void) const
 
5024
+{
 
5025
+       return m_pDeleteAction;
 
5026
+}
 
5027
+
 
5028
+QAction *qsamplerInstrumentList::refreshAction (void) const
 
5029
+{
 
5030
+       return m_pRefreshAction;
 
5031
+}
 
5032
+
 
5033
+
 
5034
+// Add a new instrument item below the current one.
 
5035
+void qsamplerInstrumentList::newItemSlot (void)
 
5036
+{
 
5037
+       qsamplerInstrument *pInstrument = new qsamplerInstrument();
 
5038
+
 
5039
+       qsamplerInstrumentForm form(this);
 
5040
+       form.setup(pInstrument);
 
5041
+       if (!form.exec()) {
 
5042
+               delete pInstrument;
 
5043
+               return;
 
5044
+       }
 
5045
+
 
5046
+       // Commit...
 
5047
+       pInstrument->mapInstrument();
 
5048
+       // add new item to the tree...
 
5049
+       addItem(pInstrument, groupItem(QListView::selectedItem()));
 
5050
+       // Notify we've changes...
 
5051
+       emit instrumentsChanged();
 
5052
+
 
5053
+       selectionChangedSlot();
 
5054
+}
 
5055
+
 
5056
+
 
5057
+// Edit current item below the current one.
 
5058
+void qsamplerInstrumentList::editItemSlot (void)
 
5059
+{
 
5060
+       QListViewItem *pListItem = QListView::selectedItem();
 
5061
+       if (pListItem == NULL)
 
5062
+               return;
 
5063
+       if (pListItem->rtti() == Item) {
 
5064
+               qsamplerInstrument *pInstrument = NULL;
 
5065
+               qsamplerInstrumentItem *pItem
 
5066
+                       = static_cast<qsamplerInstrumentItem *> (pListItem);
 
5067
+               if (pItem)
 
5068
+                       pInstrument = pItem->instrument();
 
5069
+               if (pInstrument) {
 
5070
+                       // Save current key values...
 
5071
+                       qsamplerInstrument oldInstrument(*pInstrument);
 
5072
+                       // Do the edit dance...
 
5073
+                       qsamplerInstrumentForm form(this);
 
5074
+                       form.setup(pInstrument);
 
5075
+                       if (form.exec()) {
 
5076
+                               // Commit...
 
5077
+                               pInstrument->mapInstrument();
 
5078
+                               // Check whether we changed instrument key...
 
5079
+                               if (oldInstrument.map()  == pInstrument->map()  &&
 
5080
+                                       oldInstrument.bank() == pInstrument->bank() &&
 
5081
+                                       oldInstrument.prog() == pInstrument->prog()) {
 
5082
+                                       // just update tree item...
 
5083
+                                       pItem->update();
 
5084
+                               } else {
 
5085
+                                       // Unmap old instance...
 
5086
+                                       oldInstrument.unmapInstrument();
 
5087
+                                       // Change item tree, whether applicable...
 
5088
+                                       if (m_iMidiMap < 0 || m_iMidiMap == pInstrument->map()) {
 
5089
+                                               // Add new brand item into view...
 
5090
+                                               addItem(pInstrument, groupItem(pListItem));
 
5091
+                                       } else {
 
5092
+                                               // Just remove/hide old one.
 
5093
+                                               delete pItem;
 
5094
+                                       }
 
5095
+                               }
 
5096
+                               // Notify we've changes...
 
5097
+                               emit instrumentsChanged();
 
5098
+                       }
 
5099
+               }
 
5100
+       }
 
5101
+
 
5102
+       selectionChangedSlot();
 
5103
+}
 
5104
+
 
5105
+
 
5106
+// Rename current group/item.
 
5107
+void qsamplerInstrumentList::renameSlot (void)
 
5108
+{
 
5109
+       QListViewItem *pListItem = QListView::selectedItem();
 
5110
+       if (pListItem)
 
5111
+               pListItem->startRename(0);
 
5112
+
 
5113
+       selectionChangedSlot();
 
5114
+}
 
5115
+
 
5116
+
 
5117
+// Remove current group/item.
 
5118
+void qsamplerInstrumentList::deleteSlot (void)
 
5119
+{
 
5120
+       QListViewItem *pListItem = QListView::selectedItem();
 
5121
+       if (pListItem == NULL)
 
5122
+               return;
 
5123
+
 
5124
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
5125
+       if (pMainForm == NULL)
 
5126
+               return;
 
5127
+
 
5128
+       // Prompt user if this is for real...
 
5129
+       qsamplerOptions *pOptions = pMainForm->options();
 
5130
+       if (pOptions && pOptions->bConfirmRemove) {
 
5131
+               if (QMessageBox::warning(this,
 
5132
+                       QSAMPLER_TITLE ": " + tr("Warning"),
 
5133
+                       tr("Delete %1:\n\n"
 
5134
+                       "%2\n\n"
 
5135
+                       "Are you sure?")
 
5136
+                       .arg(pListItem->rtti() == Item ? tr("instrument") : tr("group"))
 
5137
+                       .arg(pListItem->text(0)),
 
5138
+                       tr("OK"), tr("Cancel")) > 0)
 
5139
+                       return;
 
5140
+       }
 
5141
+
 
5142
+       // Unmap instrument entry...
 
5143
+       if (pListItem->rtti() == Item) {
 
5144
+               qsamplerInstrumentItem *pItem
 
5145
+                       = static_cast<qsamplerInstrumentItem *> (pListItem);
 
5146
+               if (pItem && pItem->instrument()) {
 
5147
+                       pItem->instrument()->unmapInstrument();
 
5148
+                       emit instrumentsChanged();
 
5149
+               }
 
5150
+       }
 
5151
+
 
5152
+       // Do it for real...
 
5153
+       delete pListItem;
 
5154
+
 
5155
+       selectionChangedSlot();
 
5156
+}
 
5157
+
 
5158
+
 
5159
+// In-place selection slot.
 
5160
+void qsamplerInstrumentList::selectionChangedSlot (void)
 
5161
+{
 
5162
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
5163
+       QListViewItem *pListItem = QListView::selectedItem();
 
5164
+       bool bEnabled = (pMainForm && pMainForm->client());
 
5165
+       m_pNewItemAction->setEnabled(bEnabled);
 
5166
+       bEnabled = (bEnabled && pListItem != NULL);
 
5167
+       m_pEditItemAction->setEnabled(bEnabled && pListItem->rtti() == Item);
 
5168
+       m_pRenameAction->setEnabled(bEnabled);
 
5169
+       m_pDeleteAction->setEnabled(bEnabled);
 
5170
+}
 
5171
+
 
5172
+
 
5173
+// In-place activation slot.
 
5174
+void qsamplerInstrumentList::activatedSlot ( QListViewItem *pListItem )
 
5175
+{
 
5176
+       // FIXME: Hope the list view item is the one selected.
 
5177
+       if (pListItem->rtti() == Item)
 
5178
+               editItemSlot();
 
5179
+}
 
5180
+
 
5181
+
 
5182
+// In-place aliasing slot.
 
5183
+void qsamplerInstrumentList::renamedSlot ( QListViewItem *pListItem )
 
5184
+{
 
5185
+       if (pListItem->rtti() == Item) {
 
5186
+               qsamplerInstrumentItem *pItem
 
5187
+                       = static_cast<qsamplerInstrumentItem *> (pListItem);
 
5188
+               if (pItem && pItem->instrument()) {
 
5189
+                       pItem->instrument()->setName(pListItem->text(0));
 
5190
+                       pItem->instrument()->mapInstrument();
 
5191
+                       emit instrumentsChanged();
 
5192
+                       pItem->update();
 
5193
+               }
 
5194
+       }
 
5195
+}
 
5196
+
 
5197
+
 
5198
+// Context menu request event handler.
 
5199
+void qsamplerInstrumentList::contextMenuEvent (
 
5200
+       QContextMenuEvent *pContextMenuEvent )
 
5201
+{
 
5202
+       if (!m_pNewItemAction->isEnabled())
 
5203
+               return;
 
5204
+
 
5205
+       QPopupMenu menu(this);
 
5206
+
 
5207
+       // Construct context menu.
 
5208
+       m_pNewItemAction->addTo(&menu);
 
5209
+//     m_pNewGroupAction->addTo(&menu);
 
5210
+       menu.insertSeparator();
 
5211
+       m_pEditItemAction->addTo(&menu);
 
5212
+       m_pRenameAction->addTo(&menu);
 
5213
+       m_pDeleteAction->addTo(&menu);
 
5214
+       menu.insertSeparator();
 
5215
+       m_pRefreshAction->addTo(&menu);
 
5216
+
 
5217
+       menu.exec(pContextMenuEvent->globalPos());
 
5218
+}
 
5219
+
 
5220
+
 
5221
+// General reloader.
 
5222
+void qsamplerInstrumentList::refresh (void)
 
5223
+{
 
5224
+       clear();
 
5225
+
 
5226
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
5227
+       if (pMainForm == NULL)
 
5228
+               return;
 
5229
+       if (pMainForm->client() == NULL)
 
5230
+               return;
 
5231
+
 
5232
+       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 
5233
+
 
5234
+       // Load the whole bunch of instrument items...
 
5235
+       qsamplerInstrumentItem *pItem = NULL;
 
5236
+       lscp_midi_instrument_t *pInstrs
 
5237
+               = ::lscp_list_midi_instruments(pMainForm->client(), m_iMidiMap);
 
5238
+       for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; ++iInstr) {
 
5239
+               int iMap  = pInstrs[iInstr].map;
 
5240
+               int iBank = pInstrs[iInstr].bank;
 
5241
+               int iProg = pInstrs[iInstr].prog;
 
5242
+               qsamplerInstrument *pInstrument
 
5243
+                       = new qsamplerInstrument(iMap, iBank, iProg);
 
5244
+               if (pInstrument->getInstrument())
 
5245
+                       pItem = new qsamplerInstrumentItem(this, pInstrument, pItem);
 
5246
+               // Try to keep it snappy :)
 
5247
+               QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
5248
+       }
 
5249
+
 
5250
+       QApplication::restoreOverrideCursor();
 
5251
+
 
5252
+       if (pInstrs == NULL && ::lscp_client_get_errno(pMainForm->client())) {
 
5253
+               pMainForm->appendMessagesClient("lscp_list_midi_instruments");
 
5254
+               pMainForm->appendMessagesError(tr("Could not get current list of MIDI instrument mappings.\n\nSorry."));
 
5255
+       }
 
5256
+
 
5257
+       selectionChangedSlot();
 
5258
+}
 
5259
+
 
5260
+
 
5261
+// end of qsamplerInstrumentList.cpp
 
5262
+
 
5263
Index: qsampler/src/qsamplerInstrumentList.h
 
5264
diff -u /dev/null qsampler/src/qsamplerInstrumentList.h:1.3
 
5265
--- /dev/null   Tue Feb  6 13:36:34 2007
 
5266
+++ qsampler/src/qsamplerInstrumentList.h       Mon Jan  8 17:52:48 2007
 
5267
@@ -0,0 +1,201 @@
 
5268
+// qsamplerInstrumentList.h
 
5269
+//
 
5270
+/****************************************************************************
 
5271
+   Copyright (C) 2003-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
5272
+
 
5273
+   This program is free software; you can redistribute it and/or
 
5274
+   modify it under the terms of the GNU General Public License
 
5275
+   as published by the Free Software Foundation; either version 2
 
5276
+   of the License, or (at your option) any later version.
 
5277
+
 
5278
+   This program is distributed in the hope that it will be useful,
 
5279
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5280
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5281
+   GNU General Public License for more details.
 
5282
+
 
5283
+   You should have received a copy of the GNU General Public License
 
5284
+   along with this program; if not, write to the Free Software
 
5285
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
5286
+
 
5287
+*****************************************************************************/
 
5288
+
 
5289
+#ifndef __qsamplerInstrumentList_h
 
5290
+#define __qsamplerInstrumentList_h
 
5291
+
 
5292
+#include <qlistview.h>
 
5293
+#include <qheader.h>
 
5294
+
 
5295
+#include <lscp/client.h>
 
5296
+
 
5297
+
 
5298
+// Forward declarations.
 
5299
+class qsamplerInstrument;
 
5300
+class qsamplerInstrumentList;
 
5301
+
 
5302
+class QAction;
 
5303
+
 
5304
+
 
5305
+//----------------------------------------------------------------------
 
5306
+// class qsamplerInstrumentGroup -- custom group list view item.
 
5307
+//
 
5308
+
 
5309
+class qsamplerInstrumentGroup : public QListViewItem
 
5310
+{
 
5311
+public:
 
5312
+
 
5313
+       // Constructors.
 
5314
+       qsamplerInstrumentGroup(qsamplerInstrumentList *pListView,
 
5315
+               const QString& sName, QListViewItem *pItemAfter = NULL);
 
5316
+       qsamplerInstrumentGroup(qsamplerInstrumentGroup *pGroupItem,
 
5317
+               const QString& sName);
 
5318
+       // Default destructor.
 
5319
+       virtual ~qsamplerInstrumentGroup();
 
5320
+
 
5321
+       // Instance accessors.
 
5322
+       void setName(const QString& sName);
 
5323
+       QString name() const;
 
5324
+
 
5325
+       qsamplerInstrumentList  *listView() const;
 
5326
+       qsamplerInstrumentGroup *groupItem() const;
 
5327
+
 
5328
+       // To show up whether its open or not.
 
5329
+       virtual void setOpen(bool bOpen);
 
5330
+
 
5331
+       // To virtually distinguish between list view items.
 
5332
+       virtual int rtti() const;
 
5333
+};
 
5334
+
 
5335
+
 
5336
+//----------------------------------------------------------------------
 
5337
+// class qsamplerInstrumentItem -- custom file list view item.
 
5338
+//
 
5339
+
 
5340
+class qsamplerInstrumentItem : public qsamplerInstrumentGroup
 
5341
+{
 
5342
+public:
 
5343
+
 
5344
+       // Constructors.
 
5345
+       qsamplerInstrumentItem(qsamplerInstrumentList *pListView,
 
5346
+               qsamplerInstrument *pInstrument,
 
5347
+               QListViewItem *pItemAfter = NULL);
 
5348
+       qsamplerInstrumentItem(qsamplerInstrumentGroup *pGroupItem,
 
5349
+               qsamplerInstrument *pInstrument);
 
5350
+       // Default destructor.
 
5351
+       virtual ~qsamplerInstrumentItem();
 
5352
+
 
5353
+       // To virtually distinguish between list view items.
 
5354
+       virtual int rtti() const;
 
5355
+
 
5356
+       // Payload accessor.
 
5357
+       qsamplerInstrument *instrument() const;
 
5358
+
 
5359
+       // View refreshment.
 
5360
+       void update();
 
5361
+
 
5362
+private:
 
5363
+
 
5364
+       // File item full path.
 
5365
+       qsamplerInstrument *m_pInstrument;
 
5366
+};
 
5367
+
 
5368
+
 
5369
+//----------------------------------------------------------------------------
 
5370
+// qsamplerInstrumentList -- MIDI instrument list view.
 
5371
+//
 
5372
+
 
5373
+class qsamplerInstrumentList : public QListView
 
5374
+{
 
5375
+       Q_OBJECT
 
5376
+
 
5377
+public:
 
5378
+
 
5379
+       // Constructor.
 
5380
+       qsamplerInstrumentList(QWidget *pParent, const char *pszName = NULL);
 
5381
+       // Default destructor.
 
5382
+       ~qsamplerInstrumentList();
 
5383
+
 
5384
+       // QListViewItem::rtti() return values.
 
5385
+       enum ItemType { Group = 1001, Item = 1002 };
 
5386
+
 
5387
+       // Add a new group/file item, optionally under a given group.
 
5388
+       qsamplerInstrumentGroup *addGroup(const QString& sName,
 
5389
+               qsamplerInstrumentGroup *pParentGroup = NULL);
 
5390
+       qsamplerInstrumentItem *addItem(
 
5391
+               qsamplerInstrument *pInstrument,
 
5392
+               qsamplerInstrumentGroup *pParentGroup = NULL);
 
5393
+
 
5394
+       // Find a group/file item, given its name.
 
5395
+       qsamplerInstrumentGroup *findGroup(const QString& sName) const;
 
5396
+       qsamplerInstrumentItem  *findItem(
 
5397
+               qsamplerInstrument *pInstrument) const;
 
5398
+
 
5399
+       // Map selector.
 
5400
+       void setMidiMap(int iMidiMap);
 
5401
+       int midiMap() const;
 
5402
+
 
5403
+       // List actions accessors.
 
5404
+       QAction *newGroupAction() const;
 
5405
+       QAction *newItemAction() const;
 
5406
+       QAction *editItemAction() const;
 
5407
+       QAction *renameAction() const;
 
5408
+       QAction *deleteAction() const;
 
5409
+       QAction *refreshAction() const;
 
5410
+
 
5411
+signals:
 
5412
+
 
5413
+       // Instrument map/session change signal.
 
5414
+       void instrumentsChanged();
 
5415
+
 
5416
+public slots:
 
5417
+
 
5418
+       // General reloader.
 
5419
+       void refresh();
 
5420
+
 
5421
+protected slots:
 
5422
+
 
5423
+       // Add a new group item below the current one.
 
5424
+       void newGroupSlot();
 
5425
+       // Add a instrument item below the current one.
 
5426
+       void newItemSlot();
 
5427
+       // Change current instrument item.
 
5428
+       void editItemSlot();
 
5429
+       // Rename current group/item.
 
5430
+       void renameSlot();
 
5431
+       // Remove current group/item.
 
5432
+       void deleteSlot();
 
5433
+
 
5434
+       // In-place selection slot.
 
5435
+       void selectionChangedSlot();
 
5436
+
 
5437
+       // In-place activation slot.
 
5438
+       void activatedSlot(QListViewItem *pListItem);
 
5439
+
 
5440
+       // In-place aliasing slot.
 
5441
+       void renamedSlot(QListViewItem *pItem);
 
5442
+
 
5443
+protected:
 
5444
+
 
5445
+       // Find and return the nearest group item...
 
5446
+       qsamplerInstrumentGroup *groupItem(QListViewItem *pListItem) const;
 
5447
+
 
5448
+       // Context menu request event handler.
 
5449
+       void contextMenuEvent(QContextMenuEvent *pContextMenuEvent);
 
5450
+
 
5451
+private:
 
5452
+
 
5453
+       // List view actions.
 
5454
+       QAction *m_pNewGroupAction;
 
5455
+       QAction *m_pNewItemAction;
 
5456
+       QAction *m_pEditItemAction;
 
5457
+       QAction *m_pRenameAction;
 
5458
+       QAction *m_pDeleteAction;
 
5459
+       QAction *m_pRefreshAction;
 
5460
+
 
5461
+       // Current map selection.
 
5462
+       int m_iMidiMap;
 
5463
+};
 
5464
+
 
5465
+
 
5466
+#endif  // __qsamplerInstrumentList_h
 
5467
+
 
5468
+// end of qsamplerInstrumentList.h
 
5469
Index: qsampler/src/qsamplerInstrumentListForm.ui
 
5470
diff -u /dev/null qsampler/src/qsamplerInstrumentListForm.ui:1.2
 
5471
--- /dev/null   Tue Feb  6 13:36:34 2007
 
5472
+++ qsampler/src/qsamplerInstrumentListForm.ui  Mon Jan  8 17:52:48 2007
 
5473
@@ -0,0 +1,114 @@
 
5474
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
 
5475
+<class>qsamplerInstrumentListForm</class>
 
5476
+<comment>qsampler - A LinuxSampler Qt GUI Interface.
 
5477
+
 
5478
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
5479
+
 
5480
+   This program is free software; you can redistribute it and/or
 
5481
+   modify it under the terms of the GNU General Public License
 
5482
+   as published by the Free Software Foundation; either version 2
 
5483
+   of the License, or (at your option) any later version.
 
5484
+
 
5485
+   This program is distributed in the hope that it will be useful,
 
5486
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5487
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5488
+   GNU General Public License for more details.
 
5489
+
 
5490
+   You should have received a copy of the GNU General Public License along
 
5491
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
5492
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
5493
+
 
5494
+</comment>
 
5495
+<author>rncbc aka Rui Nuno Capela</author>
 
5496
+<widget class="QMainWindow">
 
5497
+    <property name="name">
 
5498
+        <cstring>qsamplerInstrumentListForm</cstring>
 
5499
+    </property>
 
5500
+    <property name="geometry">
 
5501
+        <rect>
 
5502
+            <x>0</x>
 
5503
+            <y>0</y>
 
5504
+            <width>720</width>
 
5505
+            <height>340</height>
 
5506
+        </rect>
 
5507
+    </property>
 
5508
+    <property name="caption">
 
5509
+        <string>Qsampler: Instruments</string>
 
5510
+    </property>
 
5511
+    <property name="icon">
 
5512
+        <pixmap>qsamplerInstrument.png</pixmap>
 
5513
+    </property>
 
5514
+    <vbox>
 
5515
+        <property name="name">
 
5516
+            <cstring>unnamed</cstring>
 
5517
+        </property>
 
5518
+        <widget class="qsamplerInstrumentList">
 
5519
+            <property name="name">
 
5520
+                <cstring>InstrumentList</cstring>
 
5521
+            </property>
 
5522
+            <property name="sizePolicy">
 
5523
+                <sizepolicy>
 
5524
+                    <hsizetype>7</hsizetype>
 
5525
+                    <vsizetype>7</vsizetype>
 
5526
+                    <horstretch>0</horstretch>
 
5527
+                    <verstretch>0</verstretch>
 
5528
+                </sizepolicy>
 
5529
+            </property>
 
5530
+            <property name="minimumSize">
 
5531
+                <size>
 
5532
+                    <width>120</width>
 
5533
+                    <height>40</height>
 
5534
+                </size>
 
5535
+            </property>
 
5536
+        </widget>
 
5537
+    </vbox>
 
5538
+</widget>
 
5539
+<toolbars>
 
5540
+    <toolbar dock="2">
 
5541
+        <property name="name">
 
5542
+            <cstring>InstrumentToolbar</cstring>
 
5543
+        </property>
 
5544
+        <property name="label">
 
5545
+            <string>Instruments Toolbar</string>
 
5546
+        </property>
 
5547
+    </toolbar>
 
5548
+</toolbars>
 
5549
+<customwidgets>
 
5550
+    <customwidget>
 
5551
+        <class>qsamplerInstrumentList</class>
 
5552
+        <header location="local">qsamplerInstrumentList.h</header>
 
5553
+        <sizehint>
 
5554
+            <width>320</width>
 
5555
+            <height>120</height>
 
5556
+        </sizehint>
 
5557
+        <container>0</container>
 
5558
+        <sizepolicy>
 
5559
+            <hordata>7</hordata>
 
5560
+            <verdata>5</verdata>
 
5561
+            <horstretch>0</horstretch>
 
5562
+            <verstretch>0</verstretch>
 
5563
+        </sizepolicy>
 
5564
+    </customwidget>
 
5565
+</customwidgets>
 
5566
+<tabstops>
 
5567
+    <tabstop>InstrumentList</tabstop>
 
5568
+</tabstops>
 
5569
+<forwards>
 
5570
+    <forward>class QComboBox;</forward>
 
5571
+</forwards>
 
5572
+<variables>
 
5573
+    <variable access="private">QComboBox *m_pMapComboBox;</variable>
 
5574
+</variables>
 
5575
+<slots>
 
5576
+    <slot specifier="non virtual">refreshInstruments()</slot>
 
5577
+    <slot specifier="non virtual">activateMap(int)</slot>
 
5578
+</slots>
 
5579
+<functions>
 
5580
+    <function access="private" specifier="non virtual">init()</function>
 
5581
+    <function access="private" specifier="non virtual">destroy()</function>
 
5582
+    <function access="private" specifier="non virtual">showEvent( QShowEvent * pShowEvent )</function>
 
5583
+    <function access="private" specifier="non virtual">hideEvent( QHideEvent * pHideEvent )</function>
 
5584
+</functions>
 
5585
+<pixmapinproject/>
 
5586
+<layoutdefaults spacing="0" margin="0"/>
 
5587
+</UI>
 
5588
Index: qsampler/src/qsamplerInstrumentListForm.ui.h
 
5589
diff -u /dev/null qsampler/src/qsamplerInstrumentListForm.ui.h:1.3
 
5590
--- /dev/null   Tue Feb  6 13:36:34 2007
 
5591
+++ qsampler/src/qsamplerInstrumentListForm.ui.h        Mon Jan  8 20:10:41 2007
 
5592
@@ -0,0 +1,135 @@
 
5593
+// qsamplerInstrumentListForm.ui.h
 
5594
+//
 
5595
+// ui.h extension file, included from the uic-generated form implementation.
 
5596
+/****************************************************************************
 
5597
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
5598
+
 
5599
+   This program is free software; you can redistribute it and/or
 
5600
+   modify it under the terms of the GNU General Public License
 
5601
+   as published by the Free Software Foundation; either version 2
 
5602
+   of the License, or (at your option) any later version.
 
5603
+
 
5604
+   This program is distributed in the hope that it will be useful,
 
5605
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
5606
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5607
+   GNU General Public License for more details.
 
5608
+
 
5609
+   You should have received a copy of the GNU General Public License along
 
5610
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
5611
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
5612
+
 
5613
+*****************************************************************************/
 
5614
+
 
5615
+#include "qsamplerInstrument.h"
 
5616
+
 
5617
+#include "qsamplerMainForm.h"
 
5618
+#include "qsamplerOptions.h"
 
5619
+
 
5620
+#include <qcombobox.h>
 
5621
+#include <qtooltip.h>
 
5622
+
 
5623
+
 
5624
+// Kind of constructor.
 
5625
+void qsamplerInstrumentListForm::init (void)
 
5626
+{
 
5627
+       // Setup toolbar widgets.
 
5628
+       m_pMapComboBox = new QComboBox(InstrumentToolbar);
 
5629
+       m_pMapComboBox->setMinimumWidth(120);
 
5630
+       m_pMapComboBox->setEnabled(false);
 
5631
+       QToolTip::add(m_pMapComboBox, tr("Instrument Map"));
 
5632
+
 
5633
+       InstrumentToolbar->addSeparator();
 
5634
+//     InstrumentList->newGroupAction()->addTo(InstrumentToolbar);
 
5635
+       InstrumentList->newItemAction()->addTo(InstrumentToolbar);
 
5636
+       InstrumentList->editItemAction()->addTo(InstrumentToolbar);
 
5637
+       InstrumentList->deleteAction()->addTo(InstrumentToolbar);
 
5638
+       InstrumentToolbar->addSeparator();
 
5639
+       InstrumentList->refreshAction()->addTo(InstrumentToolbar);
 
5640
+
 
5641
+       QObject::connect(m_pMapComboBox,
 
5642
+               SIGNAL(activated(int)),
 
5643
+               SLOT(activateMap(int)));
 
5644
+}
 
5645
+
 
5646
+
 
5647
+// Kind of destructor.
 
5648
+void qsamplerInstrumentListForm::destroy (void)
 
5649
+{
 
5650
+       delete m_pMapComboBox;
 
5651
+}
 
5652
+
 
5653
+
 
5654
+// Notify our parent that we're emerging.
 
5655
+void qsamplerInstrumentListForm::showEvent ( QShowEvent *pShowEvent )
 
5656
+{
 
5657
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
5658
+       if (pMainForm)
 
5659
+               pMainForm->stabilizeForm();
 
5660
+
 
5661
+       QWidget::showEvent(pShowEvent);
 
5662
+}
 
5663
+
 
5664
+
 
5665
+// Notify our parent that we're closing.
 
5666
+void qsamplerInstrumentListForm::hideEvent ( QHideEvent *pHideEvent )
 
5667
+{
 
5668
+       QWidget::hideEvent(pHideEvent);
 
5669
+
 
5670
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
5671
+       if (pMainForm)
 
5672
+               pMainForm->stabilizeForm();
 
5673
+}
 
5674
+
 
5675
+
 
5676
+// Refresh all instrument list and views.
 
5677
+void qsamplerInstrumentListForm::refreshInstruments (void)
 
5678
+{
 
5679
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
5680
+       if (pMainForm == NULL)
 
5681
+               return;
 
5682
+               
 
5683
+       qsamplerOptions *pOptions = pMainForm->options();
 
5684
+       if (pOptions == NULL)
 
5685
+               return;
 
5686
+
 
5687
+       // Get/save current map selection...
 
5688
+       int iMap = m_pMapComboBox->currentItem();
 
5689
+       if (iMap < 0 || m_pMapComboBox->count() < 2)
 
5690
+               iMap = pOptions->iMidiMap + 1;
 
5691
 
5692
+       // Populate maps list.
 
5693
+       m_pMapComboBox->clear();
 
5694
+       m_pMapComboBox->insertItem(tr("(All)"));
 
5695
+       m_pMapComboBox->insertStringList(qsamplerInstrument::getMapNames());
 
5696
+
 
5697
+       // Adjust to saved selection...
 
5698
+       if (iMap < 0 || iMap >= m_pMapComboBox->count())
 
5699
+               iMap = 0;
 
5700
+       m_pMapComboBox->setCurrentItem(iMap);
 
5701
+       m_pMapComboBox->setEnabled(m_pMapComboBox->count() > 1);
 
5702
+
 
5703
+       activateMap(iMap);
 
5704
+}
 
5705
+
 
5706
+
 
5707
+// Refresh instrument maps selector.
 
5708
+void qsamplerInstrumentListForm::activateMap ( int iMap )
 
5709
+{
 
5710
+       qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
 
5711
+       if (pMainForm == NULL)
 
5712
+               return;
 
5713
+               
 
5714
+       qsamplerOptions *pOptions = pMainForm->options();
 
5715
+       if (pOptions == NULL)
 
5716
+               return;
 
5717
+
 
5718
+       int iMidiMap = iMap - 1;
 
5719
+       if (iMidiMap >= 0)
 
5720
+               pOptions->iMidiMap = iMidiMap;
 
5721
+
 
5722
+       InstrumentList->setMidiMap(iMidiMap);
 
5723
+       InstrumentList->refresh();
 
5724
+}
 
5725
+
 
5726
+
 
5727
+// end of qsamplerInstrumentListForm.ui.h
 
5728
Index: qsampler/src/qsamplerMainForm.ui
 
5729
diff -u qsampler/src/qsamplerMainForm.ui:1.22 qsampler/src/qsamplerMainForm.ui:1.28
 
5730
--- qsampler/src/qsamplerMainForm.ui:1.22       Sat Aug 27 01:04:32 2005
 
5731
+++ qsampler/src/qsamplerMainForm.ui    Mon Jan 15 17:21:01 2007
 
5732
@@ -2,7 +2,7 @@
 
5733
 <class>qsamplerMainForm</class>
 
5734
 <comment>qsampler - A LinuxSampler Qt GUI Interface.
 
5735
 
 
5736
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
5737
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
5738
 
 
5739
    This program is free software; you can redistribute it and/or
 
5740
    modify it under the terms of the GNU General Public License
 
5741
@@ -14,9 +14,9 @@
 
5742
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5743
    GNU General Public License for more details.
 
5744
 
 
5745
-   You should have received a copy of the GNU General Public License
 
5746
-   along with this program; if not, write to the Free Software
 
5747
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
5748
+   You should have received a copy of the GNU General Public License along
 
5749
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
5750
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
5751
 
 
5752
 </comment>
 
5753
 <author>rncbc aka Rui Nuno Capela</author>
 
5754
@@ -83,6 +83,7 @@
 
5755
         <action name="viewStatusbarAction"/>
 
5756
         <separator/>
 
5757
         <action name="viewMessagesAction"/>
 
5758
+        <action name="viewInstrumentsAction"/>
 
5759
         <action name="viewDevicesAction"/>
 
5760
         <separator/>
 
5761
         <action name="viewOptionsAction"/>
 
5762
@@ -112,6 +113,7 @@
 
5763
         <action name="fileResetAction"/>
 
5764
         <action name="fileRestartAction"/>
 
5765
         <separator/>
 
5766
+        <action name="viewInstrumentsAction"/>
 
5767
         <action name="viewDevicesAction"/>
 
5768
     </toolbar>
 
5769
     <toolbar dock="2">
 
5770
@@ -498,6 +500,32 @@
 
5771
     </action>
 
5772
     <action>
 
5773
         <property name="name">
 
5774
+            <cstring>viewInstrumentsAction</cstring>
 
5775
+        </property>
 
5776
+        <property name="iconSet">
 
5777
+            <iconset>qsamplerInstrument.png</iconset>
 
5778
+        </property>
 
5779
+        <property name="toggleAction">
 
5780
+            <bool>true</bool>
 
5781
+        </property>
 
5782
+        <property name="text">
 
5783
+            <string>Instruments</string>
 
5784
+        </property>
 
5785
+        <property name="menuText">
 
5786
+            <string>&amp;Instruments</string>
 
5787
+        </property>
 
5788
+        <property name="toolTip">
 
5789
+            <string>MIDI instruments configuration</string>
 
5790
+        </property>
 
5791
+        <property name="statusTip">
 
5792
+            <string>Show/hide the MIDI instruments configuration window</string>
 
5793
+        </property>
 
5794
+        <property name="accel">
 
5795
+            <string>F10</string>
 
5796
+        </property>
 
5797
+    </action>
 
5798
+    <action>
 
5799
+        <property name="name">
 
5800
             <cstring>viewDevicesAction</cstring>
 
5801
         </property>
 
5802
         <property name="iconSet">
 
5803
@@ -565,7 +593,7 @@
 
5804
             <string>Line up all channel strips</string>
 
5805
         </property>
 
5806
         <property name="accel">
 
5807
-            <string>F10</string>
 
5808
+            <string>F5</string>
 
5809
         </property>
 
5810
     </action>
 
5811
     <action>
 
5812
@@ -724,6 +752,12 @@
 
5813
         <slot>viewMessages(bool)</slot>
 
5814
     </connection>
 
5815
     <connection>
 
5816
+        <sender>viewInstrumentsAction</sender>
 
5817
+        <signal>activated()</signal>
 
5818
+        <receiver>qsamplerMainForm</receiver>
 
5819
+        <slot>viewInstruments()</slot>
 
5820
+    </connection>
 
5821
+    <connection>
 
5822
         <sender>viewDevicesAction</sender>
 
5823
         <signal>activated()</signal>
 
5824
         <receiver>qsamplerMainForm</receiver>
 
5825
@@ -767,11 +801,14 @@
 
5826
 <forwards>
 
5827
     <forward>class QWorkspace;</forward>
 
5828
     <forward>class QProcess;</forward>
 
5829
+    <forward>class QSlider;</forward>
 
5830
+    <forward>class QSpinBox;</forward>
 
5831
     <forward>class QLabel;</forward>
 
5832
     <forward>class qsamplerOptions;</forward>
 
5833
     <forward>class qsamplerChannel;</forward>
 
5834
     <forward>class qsamplerMessages;</forward>
 
5835
     <forward>class qsamplerChannelStrip;</forward>
 
5836
+    <forward>class qsamplerInstrumentListForm;</forward>
 
5837
     <forward>class qsamplerDeviceForm;</forward>
 
5838
 </forwards>
 
5839
 <variables>
 
5840
@@ -785,11 +822,16 @@
 
5841
     <variable access="private">QProcess *m_pServer;</variable>
 
5842
     <variable access="private">int m_iStartDelay;</variable>
 
5843
     <variable access="private">int m_iTimerDelay;</variable>
 
5844
-    <variable access="private">int m_iTimerSlot;</variable>
 
5845
+    <variable access="private">int m_iTimerSlot;</variable>    
 
5846
     <variable access="private">QLabel *m_statusItem[5];</variable>
 
5847
     <variable access="private">QPopupMenu *m_pRecentFilesMenu;</variable>
 
5848
     <variable access="private">QPtrList&lt;qsamplerChannelStrip&gt; m_changedStrips;</variable>
 
5849
+    <variable access="private">qsamplerInstrumentListForm *m_pInstrumentListForm;</variable>
 
5850
     <variable access="private">qsamplerDeviceForm *m_pDeviceForm;</variable>
 
5851
+    <variable access="private">static qsamplerMainForm *g_pMainForm;</variable>
 
5852
+    <variable access="private">QSlider *m_pVolumeSlider;</variable>
 
5853
+    <variable access="private">QSpinBox *m_pVolumeSpinBox;</variable>
 
5854
+    <variable access="private">int m_iVolumeChanging;</variable>
 
5855
 </variables>
 
5856
 <slots>
 
5857
     <slot specifier="non virtual">fileNew( void )</slot>
 
5858
@@ -809,6 +851,7 @@
 
5859
     <slot specifier="non virtual">viewToolbar( bool bOn )</slot>
 
5860
     <slot specifier="non virtual">viewStatusbar( bool bOn )</slot>
 
5861
     <slot specifier="non virtual">viewMessages( bool bOn )</slot>
 
5862
+    <slot specifier="non virtual">viewInstruments( void )</slot>
 
5863
     <slot specifier="non virtual">viewDevices( void )</slot>
 
5864
     <slot specifier="non virtual">viewOptions( void )</slot>
 
5865
     <slot specifier="non virtual">channelsArrange( void )</slot>
 
5866
@@ -817,6 +860,7 @@
 
5867
     <slot specifier="non virtual">helpAbout( void )</slot>
 
5868
     <slot specifier="non virtual">sessionDirty( void )</slot>
 
5869
     <slot specifier="non virtual">stabilizeForm( void )</slot>
 
5870
+    <slot specifier="non virtual">volumeChanged( int iVolume )</slot>
 
5871
     <slot specifier="non virtual">channelStripChanged( qsamplerChannelStrip *pChannelStrip )</slot>
 
5872
     <slot specifier="non virtual">channelsMenuAboutToShow()</slot>
 
5873
     <slot specifier="non virtual">channelsMenuActivated( int iChannel )</slot>
 
5874
@@ -869,6 +913,7 @@
 
5875
     <function access="private" specifier="non virtual">stopServer( void )</function>
 
5876
     <function access="private" specifier="non virtual" returnType="bool">startClient( void )</function>
 
5877
     <function access="private" specifier="non virtual">stopClient( void )</function>
 
5878
+    <function specifier="non virtual" returnType="static qsamplerMainForm *">getInstance( void )</function>
 
5879
 </functions>
 
5880
 <pixmapinproject/>
 
5881
 <layoutdefaults spacing="4" margin="8"/>
 
5882
Index: qsampler/src/qsamplerMainForm.ui.h
 
5883
diff -u qsampler/src/qsamplerMainForm.ui.h:1.64 qsampler/src/qsamplerMainForm.ui.h:1.82
 
5884
--- qsampler/src/qsamplerMainForm.ui.h:1.64     Thu Jun  1 11:32:01 2006
 
5885
+++ qsampler/src/qsamplerMainForm.ui.h  Mon Jan 15 20:11:58 2007
 
5886
@@ -2,7 +2,7 @@
 
5887
 //
 
5888
 // ui.h extension file, included from the uic-generated form implementation.
 
5889
 /****************************************************************************
 
5890
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
5891
+   Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
 
5892
 
 
5893
    This program is free software; you can redistribute it and/or
 
5894
    modify it under the terms of the GNU General Public License
 
5895
@@ -14,9 +14,9 @@
 
5896
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
5897
    GNU General Public License for more details.
 
5898
 
 
5899
-   You should have received a copy of the GNU General Public License
 
5900
-   along with this program; if not, write to the Free Software
 
5901
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
5902
+   You should have received a copy of the GNU General Public License along
 
5903
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
5904
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
5905
 
 
5906
 *****************************************************************************/
 
5907
 
 
5908
@@ -32,8 +32,11 @@
 
5909
 #include <qfile.h>
 
5910
 #include <qtextstream.h>
 
5911
 #include <qstatusbar.h>
 
5912
+#include <qslider.h>
 
5913
+#include <qspinbox.h>
 
5914
 #include <qlabel.h>
 
5915
 #include <qtimer.h>
 
5916
+#include <qtooltip.h>
 
5917
 
 
5918
 #include "qsamplerAbout.h"
 
5919
 #include "qsamplerOptions.h"
 
5920
@@ -41,7 +44,9 @@
 
5921
 #include "qsamplerMessages.h"
 
5922
 
 
5923
 #include "qsamplerChannelStrip.h"
 
5924
+#include "qsamplerInstrumentList.h"
 
5925
 
 
5926
+#include "qsamplerInstrumentListForm.h"
 
5927
 #include "qsamplerDeviceForm.h"
 
5928
 #include "qsamplerOptionsForm.h"
 
5929
 
 
5930
@@ -53,6 +58,19 @@
 
5931
 #include <gig.h>
 
5932
 #endif
 
5933
 
 
5934
+// Needed for lroundf()
 
5935
+#include <math.h>
 
5936
+
 
5937
+#ifndef CONFIG_ROUND
 
5938
+static inline long lroundf ( float x )
 
5939
+{
 
5940
+       if (x >= 0.0f)
 
5941
+               return long(x + 0.5f);
 
5942
+       else
 
5943
+               return long(x - 0.5f);
 
5944
+}
 
5945
+#endif
 
5946
+
 
5947
 // Timer constant stuff.
 
5948
 #define QSAMPLER_TIMER_MSECS    200
 
5949
 
 
5950
@@ -102,14 +120,22 @@
 
5951
 //-------------------------------------------------------------------------
 
5952
 // qsamplerMainForm -- Main window form implementation.
 
5953
 
 
5954
+// Kind of singleton reference.
 
5955
+qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL;
 
5956
+
 
5957
+
 
5958
 // Kind of constructor.
 
5959
 void qsamplerMainForm::init (void)
 
5960
 {
 
5961
+       // Pseudo-singleton reference setup.
 
5962
+       g_pMainForm = this;
 
5963
+
 
5964
     // Initialize some pointer references.
 
5965
     m_pOptions = NULL;
 
5966
 
 
5967
     // All child forms are to be created later, not earlier than setup.
 
5968
-    m_pMessages   = NULL;
 
5969
+    m_pMessages = NULL;
 
5970
+    m_pInstrumentListForm = NULL;
 
5971
     m_pDeviceForm = NULL;
 
5972
 
 
5973
     // We'll start clean.
 
5974
@@ -129,11 +155,43 @@
 
5975
        ::signal(SIGPIPE, SIG_IGN);
 
5976
 #endif
 
5977
 
 
5978
+#ifdef CONFIG_VOLUME
 
5979
+    // Make some extras into the toolbar...
 
5980
+       const QString& sVolumeText = tr("Master volume");
 
5981
+       m_iVolumeChanging = 0;
 
5982
+       // Volume slider...
 
5983
+       channelsToolbar->addSeparator();
 
5984
+       m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar);
 
5985
+       m_pVolumeSlider->setTickmarks(QSlider::Below);
 
5986
+       m_pVolumeSlider->setTickInterval(10);
 
5987
+       m_pVolumeSlider->setPageStep(10);
 
5988
+       m_pVolumeSlider->setRange(0, 100);
 
5989
+       m_pVolumeSlider->setMaximumHeight(22);
 
5990
+       m_pVolumeSlider->setMinimumWidth(160);
 
5991
+       QToolTip::add(m_pVolumeSlider, sVolumeText);
 
5992
+       QObject::connect(m_pVolumeSlider,
 
5993
+               SIGNAL(valueChanged(int)),
 
5994
+               SLOT(volumeChanged(int)));
 
5995
+       channelsToolbar->setHorizontallyStretchable(true);
 
5996
+       channelsToolbar->setStretchableWidget(m_pVolumeSlider);
 
5997
+       // Volume spin-box
 
5998
+       channelsToolbar->addSeparator();
 
5999
+       m_pVolumeSpinBox = new QSpinBox(channelsToolbar);
 
6000
+       m_pVolumeSpinBox->setSuffix(" %");
 
6001
+       m_pVolumeSpinBox->setRange(0, 100);
 
6002
+       QToolTip::add(m_pVolumeSpinBox, sVolumeText);
 
6003
+       QObject::connect(m_pVolumeSpinBox,
 
6004
+               SIGNAL(valueChanged(int)),
 
6005
+               SLOT(volumeChanged(int)));
 
6006
+#endif
 
6007
+
 
6008
     // Make it an MDI workspace.
 
6009
     m_pWorkspace = new QWorkspace(this);
 
6010
     m_pWorkspace->setScrollBarsEnabled(true);
 
6011
-    // Set the activation connection.
 
6012
-    QObject::connect(m_pWorkspace, SIGNAL(windowActivated(QWidget *)), this, SLOT(stabilizeForm()));
 
6013
+       // Set the activation connection.
 
6014
+       QObject::connect(m_pWorkspace,
 
6015
+               SIGNAL(windowActivated(QWidget *)),
 
6016
+               SLOT(stabilizeForm()));
 
6017
     // Make it shine :-)
 
6018
     setCentralWidget(m_pWorkspace);
 
6019
 
 
6020
@@ -186,6 +244,8 @@
 
6021
     // Finally drop any widgets around...
 
6022
     if (m_pDeviceForm)
 
6023
         delete m_pDeviceForm;
 
6024
+    if (m_pInstrumentListForm)
 
6025
+        delete m_pInstrumentListForm;
 
6026
     if (m_pMessages)
 
6027
         delete m_pMessages;
 
6028
     if (m_pWorkspace)
 
6029
@@ -201,9 +261,17 @@
 
6030
     if (m_statusItem[QSAMPLER_STATUS_SESSION])
 
6031
         delete m_statusItem[QSAMPLER_STATUS_SESSION];
 
6032
 
 
6033
+#ifdef CONFIG_VOLUME
 
6034
+       delete m_pVolumeSpinBox;
 
6035
+       delete m_pVolumeSlider;
 
6036
+#endif
 
6037
+
 
6038
     // Delete recentfiles menu.
 
6039
     if (m_pRecentFilesMenu)
 
6040
         delete m_pRecentFilesMenu;
 
6041
+
 
6042
+       // Pseudo-singleton reference shut-down.
 
6043
+       g_pMainForm = NULL;
 
6044
 }
 
6045
 
 
6046
 
 
6047
@@ -214,19 +282,33 @@
 
6048
     m_pOptions = pOptions;
 
6049
 
 
6050
     // What style do we create these forms?
 
6051
-    WFlags wflags = Qt::WType_TopLevel;
 
6052
+       Qt::WFlags wflags = Qt::WStyle_Customize
 
6053
+               | Qt::WStyle_NormalBorder
 
6054
+               | Qt::WStyle_Title
 
6055
+               | Qt::WStyle_SysMenu
 
6056
+               | Qt::WStyle_MinMax
 
6057
+               | Qt::WType_TopLevel;
 
6058
     if (m_pOptions->bKeepOnTop)
 
6059
         wflags |= Qt::WStyle_Tool;
 
6060
     // Some child forms are to be created right now.
 
6061
     m_pMessages = new qsamplerMessages(this);
 
6062
     m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);
 
6063
-    m_pDeviceForm->setMainForm(this); // An important life immutable!
 
6064
+#ifdef CONFIG_MIDI_INSTRUMENT
 
6065
+    m_pInstrumentListForm = new qsamplerInstrumentListForm(this, 0, wflags);
 
6066
+       QObject::connect(m_pInstrumentListForm->InstrumentList,
 
6067
+               SIGNAL(instrumentsChanged()),
 
6068
+               SLOT(sessionDirty()));
 
6069
+#else
 
6070
+       viewInstrumentsAction->setEnabled(false);
 
6071
+#endif
 
6072
     // Set message defaults...
 
6073
     updateMessagesFont();
 
6074
     updateMessagesLimit();
 
6075
     updateMessagesCapture();
 
6076
     // Set the visibility signal.
 
6077
-    QObject::connect(m_pMessages, SIGNAL(visibilityChanged(bool)), this, SLOT(stabilizeForm()));
 
6078
+       QObject::connect(m_pMessages,
 
6079
+               SIGNAL(visibilityChanged(bool)),
 
6080
+               SLOT(stabilizeForm()));
 
6081
 
 
6082
     // Initial decorations toggle state.
 
6083
     viewMenubarAction->setOn(m_pOptions->bMenubar);
 
6084
@@ -251,9 +333,11 @@
 
6085
     }
 
6086
     // Try to restore old window positioning and initial visibility.
 
6087
     m_pOptions->loadWidgetGeometry(this);
 
6088
+    m_pOptions->loadWidgetGeometry(m_pInstrumentListForm);
 
6089
     m_pOptions->loadWidgetGeometry(m_pDeviceForm);
 
6090
 
 
6091
     // Final startup stabilization...
 
6092
+    updateMaxVolume();
 
6093
     updateRecentFilesMenu();
 
6094
     stabilizeForm();
 
6095
 
 
6096
@@ -291,8 +375,11 @@
 
6097
             m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);
 
6098
             // And the children, and the main windows state,.
 
6099
                        m_pOptions->saveWidgetGeometry(m_pDeviceForm);
 
6100
+                       m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
 
6101
                        m_pOptions->saveWidgetGeometry(this);
 
6102
                        // Close popup widgets.
 
6103
+                       if (m_pInstrumentListForm)
 
6104
+                               m_pInstrumentListForm->close();
 
6105
                        if (m_pDeviceForm)
 
6106
                                m_pDeviceForm->close();
 
6107
             // Stop client and/or server, gracefully.
 
6108
@@ -351,7 +438,7 @@
 
6109
                const QString& sPath = *iter;
 
6110
                if (qsamplerChannel::isInstrumentFile(sPath)) {
 
6111
                        // Try to create a new channel from instrument file...
 
6112
-                       qsamplerChannel *pChannel = new qsamplerChannel(this);
 
6113
+                       qsamplerChannel *pChannel = new qsamplerChannel();
 
6114
                        if (pChannel == NULL)
 
6115
                                return;
 
6116
                        // Start setting the instrument filename...
 
6117
@@ -371,8 +458,10 @@
 
6118
                        m_iDirtyCount++;
 
6119
                        stabilizeForm();
 
6120
                }   // Otherwise, load an usual session file (LSCP script)...
 
6121
-               else if (closeSession(true))
 
6122
+               else if (closeSession(true)) {
 
6123
                        loadSessionFile(sPath);
 
6124
+                       break;
 
6125
+               }
 
6126
                // Make it look responsive...:)
 
6127
                QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6128
        }
 
6129
@@ -417,6 +506,7 @@
 
6130
     return m_pOptions;
 
6131
 }
 
6132
 
 
6133
+
 
6134
 // The LSCP client descriptor property.
 
6135
 lscp_client_t *qsamplerMainForm::client (void)
 
6136
 {
 
6137
@@ -424,6 +514,13 @@
 
6138
 }
 
6139
 
 
6140
 
 
6141
+// The pseudo-singleton instance accessor.
 
6142
+qsamplerMainForm *qsamplerMainForm::getInstance (void)
 
6143
+{
 
6144
+       return g_pMainForm;
 
6145
+}
 
6146
+
 
6147
+
 
6148
 //-------------------------------------------------------------------------
 
6149
 // qsamplerMainForm -- Session file stuff.
 
6150
 
 
6151
@@ -595,22 +692,29 @@
 
6152
         return false;
 
6153
     }
 
6154
 
 
6155
+       // Tell the world we'll take some time...
 
6156
+       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 
6157
+
 
6158
     // Read the file.
 
6159
+       int iLine = 0;
 
6160
     int iErrors = 0;
 
6161
     QTextStream ts(&file);
 
6162
     while (!ts.atEnd()) {
 
6163
         // Read the line.
 
6164
         QString sCommand = ts.readLine().stripWhiteSpace();
 
6165
+               iLine++;
 
6166
         // If not empty, nor a comment, call the server...
 
6167
         if (!sCommand.isEmpty() && sCommand[0] != '#') {
 
6168
-            appendMessagesColor(sCommand, "#996633");
 
6169
-            // Remember that, no matter what,
 
6170
-            // all LSCP commands are CR/LF terminated.
 
6171
-            sCommand += "\r\n";
 
6172
-            if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {
 
6173
-                appendMessagesClient("lscp_client_query");
 
6174
-                iErrors++;
 
6175
-            }
 
6176
+                       // Remember that, no matter what,
 
6177
+                       // all LSCP commands are CR/LF terminated.
 
6178
+                       sCommand += "\r\n";
 
6179
+                       if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {
 
6180
+                               appendMessagesColor(QString("%1(%2): %3")
 
6181
+                                       .arg(QFileInfo(sFilename).fileName()).arg(iLine)
 
6182
+                                       .arg(sCommand.simplifyWhiteSpace()), "#996633");
 
6183
+                               appendMessagesClient("lscp_client_query");
 
6184
+                               iErrors++;
 
6185
+                       }
 
6186
         }
 
6187
         // Try to make it snappy :)
 
6188
         QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6189
@@ -622,6 +726,9 @@
 
6190
        // Now we'll try to create (update) the whole GUI session.
 
6191
        updateSession();
 
6192
 
 
6193
+       // We're fornerly done.
 
6194
+       QApplication::restoreOverrideCursor();
 
6195
+
 
6196
        // Have we any errors?
 
6197
        if (iErrors > 0)
 
6198
                appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename));
 
6199
@@ -645,6 +752,15 @@
 
6200
 // Save current session to specific file path.
 
6201
 bool qsamplerMainForm::saveSessionFile ( const QString& sFilename )
 
6202
 {
 
6203
+       if (m_pClient == NULL)
 
6204
+               return false;
 
6205
+
 
6206
+       // Check whether server is apparently OK...
 
6207
+       if (::lscp_get_channels(m_pClient) < 0) {
 
6208
+               appendMessagesClient("lscp_get_channels");
 
6209
+               return false;
 
6210
+       }
 
6211
+
 
6212
     // Open and write into real file.
 
6213
     QFile file(sFilename);
 
6214
     if (!file.open(IO_WriteOnly | IO_Truncate)) {
 
6215
@@ -652,6 +768,9 @@
 
6216
         return false;
 
6217
     }
 
6218
 
 
6219
+       // Tell the world we'll take some time...
 
6220
+       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 
6221
+
 
6222
     // Write the file.
 
6223
     int  iErrors = 0;
 
6224
     QTextStream ts(&file);
 
6225
@@ -668,17 +787,19 @@
 
6226
        << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;
 
6227
     ts << "#"  << endl;
 
6228
     ts << endl;
 
6229
+
 
6230
        // It is assumed that this new kind of device+session file
 
6231
-       // will be loaded from a complete
 
6232
+       // will be loaded from a complete initialized server...
 
6233
        int *piDeviceIDs;
 
6234
        int  iDevice;
 
6235
        ts << "RESET" << endl;
 
6236
+
 
6237
        // Audio device mapping.
 
6238
        QMap<int, int> audioDeviceMap;
 
6239
        piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
 
6240
        for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
 
6241
                ts << endl;
 
6242
-               qsamplerDevice device(this, qsamplerDevice::Audio, piDeviceIDs[iDevice]);
 
6243
+               qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]);
 
6244
                // Audio device specification...
 
6245
                ts << "# " << device.deviceTypeName() << " " << device.driverName()
 
6246
                        << " " << tr("Device") << " " << iDevice << endl;
 
6247
@@ -710,15 +831,16 @@
 
6248
                }
 
6249
                // Audio device index/id mapping.
 
6250
                audioDeviceMap[device.deviceID()] = iDevice;
 
6251
-        // Try to keep it snappy :)
 
6252
-        QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6253
+               // Try to keep it snappy :)
 
6254
+               QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6255
        }
 
6256
+
 
6257
        // MIDI device mapping.
 
6258
        QMap<int, int> midiDeviceMap;
 
6259
        piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
 
6260
        for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
 
6261
                ts << endl;
 
6262
-               qsamplerDevice device(this, qsamplerDevice::Midi, piDeviceIDs[iDevice]);
 
6263
+               qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]);
 
6264
                // MIDI device specification...
 
6265
                ts << "# " << device.deviceTypeName() << " " << device.driverName()
 
6266
                        << " " << tr("Device") << " " << iDevice << endl;
 
6267
@@ -750,14 +872,87 @@
 
6268
                }
 
6269
                // MIDI device index/id mapping.
 
6270
                midiDeviceMap[device.deviceID()] = iDevice;
 
6271
-        // Try to keep it snappy :)
 
6272
-        QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6273
+               // Try to keep it snappy :)
 
6274
+               QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6275
        }
 
6276
        ts << endl;
 
6277
+
 
6278
+#ifdef CONFIG_MIDI_INSTRUMENT
 
6279
+       // MIDI instrument mapping...
 
6280
+       QMap<int, int> midiInstrumentMap;
 
6281
+       int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient);
 
6282
+       for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) {
 
6283
+               int iMidiMap = piMaps[iMap];
 
6284
+               const char *pszMapName
 
6285
+                       = ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap);
 
6286
+               ts << "# " << tr("MIDI instrument map") << " " << iMap;
 
6287
+               if (pszMapName)
 
6288
+                       ts << " - " << pszMapName;
 
6289
+               ts << endl;
 
6290
+               ts << "ADD MIDI_INSTRUMENT_MAP";
 
6291
+               if (pszMapName)
 
6292
+                       ts << " '" << pszMapName << "'";
 
6293
+               ts << endl;
 
6294
+               // MIDI instrument mapping...
 
6295
+               lscp_midi_instrument_t *pInstrs
 
6296
+                       = ::lscp_list_midi_instruments(m_pClient, iMidiMap);
 
6297
+               for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; iInstr++) {
 
6298
+                       lscp_midi_instrument_info_t *pInstrInfo
 
6299
+                               = ::lscp_get_midi_instrument_info(m_pClient, &pInstrs[iInstr]);
 
6300
+                       if (pInstrInfo) {
 
6301
+                               ts << "MAP MIDI_INSTRUMENT "
 
6302
+                                       << iMap                        << " "
 
6303
+                                       << pInstrs[iInstr].bank        << " "
 
6304
+                                       << pInstrs[iInstr].prog        << " "
 
6305
+                                       << pInstrInfo->engine_name     << " '" 
 
6306
+                                       << pInstrInfo->instrument_file << "' "
 
6307
+                                       << pInstrInfo->instrument_nr   << " "
 
6308
+                                       << pInstrInfo->volume          << " ";
 
6309
+                               switch (pInstrInfo->load_mode) {
 
6310
+                                       case LSCP_LOAD_PERSISTENT:
 
6311
+                                               ts << "PERSISTENT";
 
6312
+                                               break;
 
6313
+                                       case LSCP_LOAD_ON_DEMAND_HOLD:
 
6314
+                                               ts << "ON_DEMAND_HOLD";
 
6315
+                                               break;
 
6316
+                                       case LSCP_LOAD_ON_DEMAND:
 
6317
+                                       case LSCP_LOAD_DEFAULT:
 
6318
+                                       default:
 
6319
+                                               ts << "ON_DEMAND";
 
6320
+                                               break;
 
6321
+                               }
 
6322
+                               if (pInstrInfo->name)
 
6323
+                                       ts << " '" << pInstrInfo->name << "'";
 
6324
+                               ts << endl;
 
6325
+                       }       // Check for errors...
 
6326
+                       else if (::lscp_client_get_errno(m_pClient)) {
 
6327
+                               appendMessagesClient("lscp_get_midi_instrument_info");
 
6328
+                               iErrors++;
 
6329
+                       }
 
6330
+                       // Try to keep it snappy :)
 
6331
+                       QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6332
+               }
 
6333
+               ts << endl;
 
6334
+               // Check for errors...
 
6335
+               if (pInstrs == NULL && ::lscp_client_get_errno(m_pClient)) {
 
6336
+                       appendMessagesClient("lscp_list_midi_instruments");
 
6337
+                       iErrors++;
 
6338
+               }
 
6339
+               // MIDI strument index/id mapping.
 
6340
+               midiInstrumentMap[iMidiMap] = iMap;
 
6341
+       }
 
6342
+       // Check for errors...
 
6343
+       if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {
 
6344
+               appendMessagesClient("lscp_list_midi_instrument_maps");
 
6345
+               iErrors++;
 
6346
+       }
 
6347
+#endif // CONFIG_MIDI_INSTRUMENT
 
6348
+
 
6349
        // Sampler channel mapping.
 
6350
     QWidgetList wlist = m_pWorkspace->windowList();
 
6351
     for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
 
6352
-        qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
 
6353
+        qsamplerChannelStrip *pChannelStrip
 
6354
+                       = static_cast<qsamplerChannelStrip *> (wlist.at(iChannel));
 
6355
         if (pChannelStrip) {
 
6356
             qsamplerChannel *pChannel = pChannelStrip->channel();
 
6357
             if (pChannel) {
 
6358
@@ -786,7 +981,9 @@
 
6359
                     ts << pChannel->midiChannel();
 
6360
                 ts << endl;
 
6361
                 ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;
 
6362
-                ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannel << endl;
 
6363
+                               if (pChannel->instrumentStatus() < 100) ts << "# ";
 
6364
+                               ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' "
 
6365
+                                       << pChannel->instrumentNr() << " " << iChannel << endl;
 
6366
                                qsamplerChannelRoutingMap::ConstIterator audioRoute;
 
6367
                                for (audioRoute = pChannel->audioRouting().begin();
 
6368
                                                audioRoute != pChannel->audioRouting().end();
 
6369
@@ -795,11 +992,54 @@
 
6370
                                                << " " << audioRoute.key()
 
6371
                                                << " " << audioRoute.data() << endl;
 
6372
                                }
 
6373
-                ts << "SET CHANNEL VOLUME " << iChannel << " " << pChannel->volume() << endl;
 
6374
+                               ts << "SET CHANNEL VOLUME " << iChannel
 
6375
+                                       << " " << pChannel->volume() << endl;
 
6376
                                if (pChannel->channelMute())
 
6377
                                        ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;
 
6378
                                if (pChannel->channelSolo())
 
6379
                                        ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;
 
6380
+#ifdef CONFIG_MIDI_INSTRUMENT
 
6381
+                               if (pChannel->midiMap() >= 0) {
 
6382
+                                       ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel
 
6383
+                                               << " " << midiInstrumentMap[pChannel->midiMap()] << endl;
 
6384
+                               }
 
6385
+#endif
 
6386
+#ifdef CONFIG_FXSEND
 
6387
+                               int iChannelID = pChannel->channelID();
 
6388
+                               int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);
 
6389
+                               for (int iFxSend = 0;
 
6390
+                                               piFxSends && piFxSends[iFxSend] >= 0;
 
6391
+                                                       iFxSend++) {
 
6392
+                                       lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info(
 
6393
+                                               m_pClient, iChannelID, piFxSends[iFxSend]);
 
6394
+                                       if (pFxSendInfo) {
 
6395
+                                               ts << "CREATE FX_SEND " << iChannel
 
6396
+                                                       << " " << pFxSendInfo->midi_controller;
 
6397
+                                               if (pFxSendInfo->name)
 
6398
+                                                       ts << " '" << pFxSendInfo->name << "'";
 
6399
+                                               ts << endl;
 
6400
+                                               int *piRouting = pFxSendInfo->audio_routing;
 
6401
+                                               for (int iAudioSrc = 0;
 
6402
+                                                               piRouting && piRouting[iAudioSrc] >= 0;
 
6403
+                                                                       iAudioSrc++) {
 
6404
+                                                       ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL "
 
6405
+                                                               << iChannel
 
6406
+                                                               << " " << iFxSend
 
6407
+                                                               << " " << iAudioSrc
 
6408
+                                                               << " " << piRouting[iAudioSrc] << endl;
 
6409
+                                               }
 
6410
+#ifdef CONFIG_FXSEND_LEVEL
 
6411
+                                               ts << "SET FX_SEND LEVEL " << iChannel
 
6412
+                                                       << " " << iFxSend
 
6413
+                                                       << " " << pFxSendInfo->level << endl;                                                   
 
6414
+#endif
 
6415
+                                       }       // Check for errors...
 
6416
+                                       else if (::lscp_client_get_errno(m_pClient)) {
 
6417
+                                               appendMessagesClient("lscp_get_fxsend_info");
 
6418
+                                               iErrors++;
 
6419
+                                       }
 
6420
+                               }
 
6421
+#endif
 
6422
                 ts << endl;
 
6423
             }
 
6424
         }
 
6425
@@ -807,9 +1047,18 @@
 
6426
         QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6427
     }
 
6428
 
 
6429
+#ifdef CONFIG_VOLUME
 
6430
+       ts << "# " << tr("Global volume level") << endl;
 
6431
+       ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl;
 
6432
+       ts << endl;
 
6433
+#endif
 
6434
+
 
6435
     // Ok. we've wrote it.
 
6436
     file.close();
 
6437
 
 
6438
+       // We're fornerly done.
 
6439
+       QApplication::restoreOverrideCursor();
 
6440
+
 
6441
     // Have we any errors?
 
6442
     if (iErrors > 0)
 
6443
         appendMessagesError(tr("Some settings could not be saved\nto \"%1\" session file.\n\nSorry.").arg(sFilename));
 
6444
@@ -901,12 +1150,17 @@
 
6445
         tr("Reset"), tr("Cancel")) > 0)
 
6446
         return;
 
6447
 
 
6448
+       // Trye closing the current session, first...
 
6449
+       if (!closeSession(true))
 
6450
+               return;
 
6451
+
 
6452
     // Just do the reset, after closing down current session...
 
6453
-    if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) {
 
6454
-        appendMessagesClient("lscp_reset_sampler");
 
6455
-        appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));
 
6456
-        return;
 
6457
-    }
 
6458
+       // Do the actual sampler reset...
 
6459
+       if (::lscp_reset_sampler(m_pClient) != LSCP_OK) {
 
6460
+               appendMessagesClient("lscp_reset_sampler");
 
6461
+               appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));
 
6462
+               return;
 
6463
+       }
 
6464
 
 
6465
     // Log this.
 
6466
     appendMessages(tr("Sampler reset."));
 
6467
@@ -965,7 +1219,7 @@
 
6468
         return;
 
6469
 
 
6470
     // Just create the channel instance...
 
6471
-    qsamplerChannel *pChannel = new qsamplerChannel(this);
 
6472
+    qsamplerChannel *pChannel = new qsamplerChannel();
 
6473
     if (pChannel == NULL)
 
6474
         return;
 
6475
 
 
6476
@@ -1128,6 +1382,25 @@
 
6477
 }
 
6478
 
 
6479
 
 
6480
+// Show/hide the MIDI instrument list-view form.
 
6481
+void qsamplerMainForm::viewInstruments (void)
 
6482
+{
 
6483
+       if (m_pOptions == NULL)
 
6484
+               return;
 
6485
+
 
6486
+       if (m_pInstrumentListForm) {
 
6487
+               m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
 
6488
+               if (m_pInstrumentListForm->isVisible()) {
 
6489
+                       m_pInstrumentListForm->hide();
 
6490
+               } else {
 
6491
+                       m_pInstrumentListForm->show();
 
6492
+                       m_pInstrumentListForm->raise();
 
6493
+                       m_pInstrumentListForm->setActiveWindow();
 
6494
+               }
 
6495
+       }
 
6496
+}
 
6497
+
 
6498
+
 
6499
 // Show/hide the device configurator form.
 
6500
 void qsamplerMainForm::viewDevices (void)
 
6501
 {
 
6502
@@ -1136,7 +1409,6 @@
 
6503
 
 
6504
        if (m_pDeviceForm) {
 
6505
                m_pOptions->saveWidgetGeometry(m_pDeviceForm);
 
6506
-               m_pDeviceForm->setClient(m_pClient);
 
6507
                if (m_pDeviceForm->isVisible()) {
 
6508
                        m_pDeviceForm->hide();
 
6509
                } else {
 
6510
@@ -1322,6 +1594,26 @@
 
6511
     sText += tr("Sampler channel Mute/Solo support disabled.");
 
6512
     sText += "</font></small><br />";
 
6513
 #endif
 
6514
+#ifndef CONFIG_AUDIO_ROUTING
 
6515
+    sText += "<small><font color=\"red\">";
 
6516
+    sText += tr("LSCP (liblscp) audio_routing support disabled.");
 
6517
+    sText += "</font></small><br />";
 
6518
+#endif
 
6519
+#ifndef CONFIG_FXSEND
 
6520
+    sText += "<small><font color=\"red\">";
 
6521
+    sText += tr("Sampler channel Effect Sends support disabled.");
 
6522
+    sText += "</font></small><br />";
 
6523
+#endif
 
6524
+#ifndef CONFIG_VOLUME
 
6525
+    sText += "<small><font color=\"red\">";
 
6526
+    sText += tr("Global volume support disabled.");
 
6527
+    sText += "</font></small><br />";
 
6528
+#endif
 
6529
+#ifndef CONFIG_MIDI_INSTRUMENT
 
6530
+    sText += "<small><font color=\"red\">";
 
6531
+    sText += tr("MIDI instrument mapping support disabled.");
 
6532
+    sText += "</font></small><br />";
 
6533
+#endif
 
6534
     sText += "<br />\n";
 
6535
     sText += tr("Using") + ": ";
 
6536
     sText += ::lscp_client_package();
 
6537
@@ -1376,10 +1668,22 @@
 
6538
     editResetChannelAction->setEnabled(bHasChannel);
 
6539
     editResetAllChannelsAction->setEnabled(bHasChannel);
 
6540
     viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
 
6541
-    viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible());
 
6542
+#ifdef CONFIG_MIDI_INSTRUMENT
 
6543
+       viewInstrumentsAction->setOn(m_pInstrumentListForm
 
6544
+               && m_pInstrumentListForm->isVisible());
 
6545
+       viewInstrumentsAction->setEnabled(bHasClient);
 
6546
+#endif
 
6547
+       viewDevicesAction->setOn(m_pDeviceForm
 
6548
+               && m_pDeviceForm->isVisible());
 
6549
     viewDevicesAction->setEnabled(bHasClient);
 
6550
     channelsArrangeAction->setEnabled(bHasChannel);
 
6551
 
 
6552
+#ifdef CONFIG_VOLUME
 
6553
+       // Toolbar widgets are also affected...
 
6554
+    m_pVolumeSlider->setEnabled(bHasClient);
 
6555
+    m_pVolumeSpinBox->setEnabled(bHasClient);
 
6556
+#endif
 
6557
+
 
6558
     // Client/Server status...
 
6559
     if (bHasClient) {
 
6560
         m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));
 
6561
@@ -1408,6 +1712,38 @@
 
6562
 }
 
6563
 
 
6564
 
 
6565
+// Global volume change receiver slot.
 
6566
+void qsamplerMainForm::volumeChanged ( int iVolume )
 
6567
+{
 
6568
+#ifdef CONFIG_VOLUME
 
6569
+
 
6570
+       if (m_iVolumeChanging > 0)
 
6571
+               return;
 
6572
+       
 
6573
+       m_iVolumeChanging++;
 
6574
+
 
6575
+       // Update the toolbar widgets...
 
6576
+       if (m_pVolumeSlider->value()  != iVolume)
 
6577
+               m_pVolumeSlider->setValue(iVolume);
 
6578
+       if (m_pVolumeSpinBox->value() != iVolume)
 
6579
+               m_pVolumeSpinBox->setValue(iVolume);
 
6580
+
 
6581
+       // Do it as commanded...
 
6582
+       float fVolume = 0.01f * float(iVolume);
 
6583
+       if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK)
 
6584
+               appendMessages(QObject::tr("Volume: %1.").arg(fVolume));
 
6585
+       else
 
6586
+               appendMessagesClient("lscp_set_volume");
 
6587
+
 
6588
+       m_iVolumeChanging--;
 
6589
+
 
6590
+       m_iDirtyCount++;
 
6591
+       stabilizeForm();
 
6592
+
 
6593
+#endif
 
6594
+}
 
6595
+
 
6596
+
 
6597
 // Channel change receiver slot.
 
6598
 void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )
 
6599
 {
 
6600
@@ -1427,6 +1763,24 @@
 
6601
 // Grab and restore current sampler channels session.
 
6602
 void qsamplerMainForm::updateSession (void)
 
6603
 {
 
6604
+#ifdef CONFIG_VOLUME
 
6605
+       int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient));
 
6606
+       m_iVolumeChanging++;
 
6607
+       m_pVolumeSlider->setValue(iVolume);
 
6608
+       m_pVolumeSpinBox->setValue(iVolume);
 
6609
+       m_iVolumeChanging--;
 
6610
+#endif
 
6611
+#ifdef CONFIG_MIDI_INSTRUMENT
 
6612
+       // FIXME: Make some room for default instrument maps...
 
6613
+       int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);
 
6614
+       if (iMaps < 0)
 
6615
+               appendMessagesClient("lscp_get_midi_instrument_maps");
 
6616
+       else if (iMaps < 1) {
 
6617
+               ::lscp_add_midi_instrument_map(m_pClient, tr("Chromatic").latin1());
 
6618
+               ::lscp_add_midi_instrument_map(m_pClient, tr("Drum Kits").latin1());
 
6619
+       }
 
6620
+#endif
 
6621
+
 
6622
        // Retrieve the current channel list.
 
6623
        int *piChannelIDs = ::lscp_list_channels(m_pClient);
 
6624
        if (piChannelIDs == NULL) {
 
6625
@@ -1434,21 +1788,24 @@
 
6626
                        appendMessagesClient("lscp_list_channels");
 
6627
                        appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));
 
6628
                }
 
6629
-               return;
 
6630
+       } else {
 
6631
+               // Try to (re)create each channel.
 
6632
+               m_pWorkspace->setUpdatesEnabled(false);
 
6633
+               for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
 
6634
+                       // Check if theres already a channel strip for this one...
 
6635
+                       if (!channelStrip(piChannelIDs[iChannel]))
 
6636
+                               createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));
 
6637
+               }
 
6638
+               m_pWorkspace->setUpdatesEnabled(true);
 
6639
        }
 
6640
 
 
6641
-       // Try to (re)create each channel.
 
6642
-       m_pWorkspace->setUpdatesEnabled(false);
 
6643
-       for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
 
6644
-               // Check if theres already a channel strip for this one...
 
6645
-               if (!channelStrip(piChannelIDs[iChannel]))
 
6646
-                       createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));
 
6647
-               // Make it visibly responsive...
 
6648
-               QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6649
-       }
 
6650
-       m_pWorkspace->setUpdatesEnabled(true);
 
6651
-       
 
6652
-       // Remember to refresh devices
 
6653
+    // Do we auto-arrange?
 
6654
+    if (m_pOptions && m_pOptions->bAutoArrange)
 
6655
+        channelsArrange();
 
6656
+
 
6657
+       // Remember to refresh devices and instruments...
 
6658
+       if (m_pInstrumentListForm)
 
6659
+           m_pInstrumentListForm->refreshInstruments();
 
6660
        if (m_pDeviceForm)
 
6661
            m_pDeviceForm->refreshDevices();
 
6662
 }
 
6663
@@ -1573,6 +1930,13 @@
 
6664
     if (m_pOptions == NULL)
 
6665
         return;
 
6666
 
 
6667
+#ifdef CONFIG_VOLUME
 
6668
+       m_iVolumeChanging++;
 
6669
+       m_pVolumeSlider->setMaxValue(m_pOptions->iMaxVolume);
 
6670
+       m_pVolumeSpinBox->setMaxValue(m_pOptions->iMaxVolume);
 
6671
+       m_iVolumeChanging--;
 
6672
+#endif
 
6673
+
 
6674
     // Full channel list update...
 
6675
     QWidgetList wlist = m_pWorkspace->windowList();
 
6676
     if (wlist.isEmpty())
 
6677
@@ -1621,6 +1985,9 @@
 
6678
 
 
6679
     appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");
 
6680
 
 
6681
+       // Make it look responsive...:)
 
6682
+       QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6683
+
 
6684
     QMessageBox::critical(this,
 
6685
                QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));
 
6686
 }
 
6687
@@ -1635,6 +2002,9 @@
 
6688
     appendMessagesColor(s + QString(": %1 (errno=%2)")
 
6689
         .arg(::lscp_client_get_result(m_pClient))
 
6690
         .arg(::lscp_client_get_errno(m_pClient)), "#996666");
 
6691
+
 
6692
+       // Make it look responsive...:)
 
6693
+       QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
 
6694
 }
 
6695
 
 
6696
 
 
6697
@@ -1709,7 +2079,9 @@
 
6698
 
 
6699
     // Actual channel strip setup...
 
6700
     pChannelStrip->setup(pChannel);
 
6701
-    QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
 
6702
+       QObject::connect(pChannelStrip,
 
6703
+               SIGNAL(channelChanged(qsamplerChannelStrip *)),
 
6704
+               SLOT(channelStripChanged(qsamplerChannelStrip *)));
 
6705
     // Set some initial aesthetic options...
 
6706
     if (m_pOptions) {
 
6707
         // Background display effect...
 
6708
@@ -1916,13 +2288,20 @@
 
6709
     m_pServer = new QProcess(this);
 
6710
 
 
6711
     // Setup stdout/stderr capture...
 
6712
-    //if (m_pOptions->bStdoutCapture) {
 
6713
-        m_pServer->setCommunication(QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr);
 
6714
-        QObject::connect(m_pServer, SIGNAL(readyReadStdout()), this, SLOT(readServerStdout()));
 
6715
-        QObject::connect(m_pServer, SIGNAL(readyReadStderr()), this, SLOT(readServerStdout()));
 
6716
-    //}
 
6717
-    // The unforgiveable signal communication...
 
6718
-    QObject::connect(m_pServer, SIGNAL(processExited()), this, SLOT(processServerExit()));
 
6719
+       //      if (m_pOptions->bStdoutCapture) {
 
6720
+               m_pServer->setCommunication(
 
6721
+                       QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr);
 
6722
+               QObject::connect(m_pServer,
 
6723
+                       SIGNAL(readyReadStdout()),
 
6724
+                       SLOT(readServerStdout()));
 
6725
+               QObject::connect(m_pServer,
 
6726
+                       SIGNAL(readyReadStderr()),
 
6727
+                       SLOT(readServerStdout()));
 
6728
+       //      }
 
6729
+       // The unforgiveable signal communication...
 
6730
+       QObject::connect(m_pServer,
 
6731
+               SIGNAL(processExited()),
 
6732
+               SLOT(processServerExit()));
 
6733
 
 
6734
     // Build process arguments...
 
6735
     m_pServer->setArguments(QStringList::split(' ', m_pOptions->sServerCmdLine));
 
6736
@@ -2067,10 +2446,12 @@
 
6737
     // Log success here.
 
6738
     appendMessages(tr("Client connected."));
 
6739
 
 
6740
-       // Hard-notify device configuration form,
 
6741
+       // Hard-notify instrumnet and device configuration forms,
 
6742
        // if visible, that we're ready...
 
6743
-       if (m_pDeviceForm && m_pDeviceForm->isVisible())
 
6744
-           m_pDeviceForm->setClient(m_pClient);
 
6745
+       if (m_pInstrumentListForm)
 
6746
+           m_pInstrumentListForm->refreshInstruments();
 
6747
+       if (m_pDeviceForm)
 
6748
+           m_pDeviceForm->refreshDevices();
 
6749
 
 
6750
     // Is any session pending to be loaded?
 
6751
     if (!m_pOptions->sSessionFile.isEmpty()) {
 
6752
@@ -2092,11 +2473,6 @@
 
6753
     if (m_pClient == NULL)
 
6754
         return;
 
6755
 
 
6756
-       // Hard-notify device configuration form,
 
6757
-       // if visible, that we're running out...
 
6758
-       if (m_pDeviceForm && m_pDeviceForm->isVisible())
 
6759
-           m_pDeviceForm->setClient(NULL);
 
6760
-
 
6761
     // Log prepare here.
 
6762
     appendMessages(tr("Client disconnecting..."));
 
6763
 
 
6764
@@ -2117,6 +2493,13 @@
 
6765
     ::lscp_client_destroy(m_pClient);
 
6766
     m_pClient = NULL;
 
6767
 
 
6768
+       // Hard-notify instrumnet and device configuration forms,
 
6769
+       // if visible, that we're running out...
 
6770
+       if (m_pInstrumentListForm)
 
6771
+           m_pInstrumentListForm->refreshInstruments();
 
6772
+       if (m_pDeviceForm)
 
6773
+           m_pDeviceForm->refreshDevices();
 
6774
+
 
6775
     // Log final here.
 
6776
     appendMessages(tr("Client disconnected."));
 
6777
 
 
6778
Index: qsampler/src/qsamplerMessages.cpp
 
6779
diff -u qsampler/src/qsamplerMessages.cpp:1.6 qsampler/src/qsamplerMessages.cpp:1.7
 
6780
--- qsampler/src/qsamplerMessages.cpp:1.6       Tue Sep 13 16:00:22 2005
 
6781
+++ qsampler/src/qsamplerMessages.cpp   Sun Sep 24 14:47:51 2006
 
6782
@@ -1,7 +1,7 @@
 
6783
 // qsamplerMessages.cpp
 
6784
 //
 
6785
 /****************************************************************************
 
6786
-   Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
6787
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
6788
 
 
6789
    This program is free software; you can redistribute it and/or
 
6790
    modify it under the terms of the GNU General Public License
 
6791
@@ -13,9 +13,9 @@
 
6792
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6793
    GNU General Public License for more details.
 
6794
 
 
6795
-   You should have received a copy of the GNU General Public License
 
6796
-   along with this program; if not, write to the Free Software
 
6797
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
6798
+   You should have received a copy of the GNU General Public License along
 
6799
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
6800
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
6801
 
 
6802
 *****************************************************************************/
 
6803
 
 
6804
Index: qsampler/src/qsamplerMessages.h
 
6805
diff -u qsampler/src/qsamplerMessages.h:1.3 qsampler/src/qsamplerMessages.h:1.4
 
6806
--- qsampler/src/qsamplerMessages.h:1.3 Wed Jan 12 11:43:37 2005
 
6807
+++ qsampler/src/qsamplerMessages.h     Sun Sep 24 14:47:51 2006
 
6808
@@ -1,7 +1,7 @@
 
6809
 // qsamplerMessages.h
 
6810
 //
 
6811
 /****************************************************************************
 
6812
-   Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
6813
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
6814
 
 
6815
    This program is free software; you can redistribute it and/or
 
6816
    modify it under the terms of the GNU General Public License
 
6817
@@ -13,9 +13,9 @@
 
6818
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6819
    GNU General Public License for more details.
 
6820
 
 
6821
-   You should have received a copy of the GNU General Public License
 
6822
-   along with this program; if not, write to the Free Software
 
6823
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
6824
+   You should have received a copy of the GNU General Public License along
 
6825
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
6826
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
6827
 
 
6828
 *****************************************************************************/
 
6829
 
 
6830
Index: qsampler/src/qsamplerOptions.cpp
 
6831
diff -u qsampler/src/qsamplerOptions.cpp:1.12 qsampler/src/qsamplerOptions.cpp:1.14
 
6832
--- qsampler/src/qsamplerOptions.cpp:1.12       Wed Aug 24 19:44:04 2005
 
6833
+++ qsampler/src/qsamplerOptions.cpp    Sun Dec 17 23:29:29 2006
 
6834
@@ -1,7 +1,7 @@
 
6835
 // qsamplerOptions.cpp
 
6836
 //
 
6837
 /****************************************************************************
 
6838
-   Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
6839
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
6840
 
 
6841
    This program is free software; you can redistribute it and/or
 
6842
    modify it under the terms of the GNU General Public License
 
6843
@@ -13,9 +13,9 @@
 
6844
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6845
    GNU General Public License for more details.
 
6846
 
 
6847
-   You should have received a copy of the GNU General Public License
 
6848
-   along with this program; if not, write to the Free Software
 
6849
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
6850
+   You should have received a copy of the GNU General Public License along
 
6851
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
6852
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
6853
 
 
6854
 *****************************************************************************/
 
6855
 
 
6856
@@ -99,6 +99,11 @@
 
6857
     sEngineName    = m_settings.readEntry("/EngineName", QString::null);
 
6858
     sAudioDriver   = m_settings.readEntry("/AudioDriver", QString::null);
 
6859
     sMidiDriver    = m_settings.readEntry("/MidiDriver", QString::null);
 
6860
+    iMidiMap       = m_settings.readNumEntry("/MidiMap", 0);
 
6861
+    iMidiBank      = m_settings.readNumEntry("/MidiBank", 0);
 
6862
+    iMidiProg      = m_settings.readNumEntry("/MidiProg", 0);
 
6863
+    iVolume        = m_settings.readNumEntry("/Volume", 100);
 
6864
+    iLoadMode      = m_settings.readNumEntry("/Loadmode", 0);
 
6865
     m_settings.endGroup();
 
6866
 }
 
6867
 
 
6868
@@ -165,6 +170,11 @@
 
6869
     m_settings.writeEntry("/EngineName", sEngineName);
 
6870
     m_settings.writeEntry("/AudioDriver", sAudioDriver);
 
6871
     m_settings.writeEntry("/MidiDriver", sMidiDriver);
 
6872
+    m_settings.writeEntry("/MidiMap", iMidiMap);
 
6873
+    m_settings.writeEntry("/MidiBank", iMidiBank);
 
6874
+    m_settings.writeEntry("/MidiProg", iMidiProg);
 
6875
+    m_settings.writeEntry("/Volume", iVolume);
 
6876
+    m_settings.writeEntry("/Loadmode", iLoadMode);
 
6877
     m_settings.endGroup();
 
6878
 
 
6879
     m_settings.endGroup();
 
6880
Index: qsampler/src/qsamplerOptions.h
 
6881
diff -u qsampler/src/qsamplerOptions.h:1.6 qsampler/src/qsamplerOptions.h:1.8
 
6882
--- qsampler/src/qsamplerOptions.h:1.6  Mon Mar 14 11:59:57 2005
 
6883
+++ qsampler/src/qsamplerOptions.h      Sun Dec 17 23:29:29 2006
 
6884
@@ -1,7 +1,7 @@
 
6885
 // qsamplerOptions.h
 
6886
 //
 
6887
 /****************************************************************************
 
6888
-   Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
6889
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
6890
 
 
6891
    This program is free software; you can redistribute it and/or
 
6892
    modify it under the terms of the GNU General Public License
 
6893
@@ -13,9 +13,9 @@
 
6894
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6895
    GNU General Public License for more details.
 
6896
 
 
6897
-   You should have received a copy of the GNU General Public License
 
6898
-   along with this program; if not, write to the Free Software
 
6899
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
6900
+   You should have received a copy of the GNU General Public License along
 
6901
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
6902
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
6903
 
 
6904
 *****************************************************************************/
 
6905
 
 
6906
@@ -87,6 +87,11 @@
 
6907
     QString sEngineName;
 
6908
     QString sAudioDriver;
 
6909
     QString sMidiDriver;
 
6910
+       int     iMidiMap;
 
6911
+       int     iMidiBank;
 
6912
+       int     iMidiProg;
 
6913
+       int     iVolume;
 
6914
+       int     iLoadMode;
 
6915
 
 
6916
     // Recent file list.
 
6917
     int     iMaxRecentFiles;
 
6918
Index: qsampler/src/qsamplerOptionsForm.ui
 
6919
diff -u qsampler/src/qsamplerOptionsForm.ui:1.7 qsampler/src/qsamplerOptionsForm.ui:1.10
 
6920
--- qsampler/src/qsamplerOptionsForm.ui:1.7     Sat Aug 27 01:04:32 2005
 
6921
+++ qsampler/src/qsamplerOptionsForm.ui Tue Dec 19 12:19:55 2006
 
6922
@@ -2,7 +2,7 @@
 
6923
 <class>qsamplerOptionsForm</class>
 
6924
 <comment>qsampler - A LinuxSampler Qt GUI Interface.
 
6925
 
 
6926
-   Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
 
6927
+   Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
 
6928
 
 
6929
    This program is free software; you can redistribute it and/or
 
6930
    modify it under the terms of the GNU General Public License
 
6931
@@ -14,9 +14,9 @@
 
6932
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6933
    GNU General Public License for more details.
 
6934
 
 
6935
-   You should have received a copy of the GNU General Public License
 
6936
-   along with this program; if not, write to the Free Software
 
6937
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
6938
+   You should have received a copy of the GNU General Public License along
 
6939
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
6940
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
6941
 
 
6942
 </comment>
 
6943
 <author>rncbc aka Rui Nuno Capela</author>
 
6944
@@ -28,8 +28,8 @@
 
6945
         <rect>
 
6946
             <x>0</x>
 
6947
             <y>0</y>
 
6948
-            <width>520</width>
 
6949
-            <height>323</height>
 
6950
+            <width>512</width>
 
6951
+            <height>320</height>
 
6952
         </rect>
 
6953
     </property>
 
6954
     <property name="sizePolicy">
 
6955
@@ -938,13 +938,13 @@
 
6956
                                             </font>
 
6957
                                         </property>
 
6958
                                         <property name="text">
 
6959
-                                            <string>&amp;Confirm channel and device removal</string>
 
6960
+                                            <string>&amp;Confirm removals</string>
 
6961
                                         </property>
 
6962
                                         <property name="accel">
 
6963
                                             <string>Alt+C</string>
 
6964
                                         </property>
 
6965
                                         <property name="toolTip" stdset="0">
 
6966
-                                            <string>Whether to ask for confirmation on channel or device removal</string>
 
6967
+                                            <string>Whether to ask for confirmation on removals</string>
 
6968
                                         </property>
 
6969
                                     </widget>
 
6970
                                            <widget class="QCheckBox">
 
6971
Index: qsampler/src/qsamplerOptionsForm.ui.h
 
6972
diff -u qsampler/src/qsamplerOptionsForm.ui.h:1.7 qsampler/src/qsamplerOptionsForm.ui.h:1.8
 
6973
--- qsampler/src/qsamplerOptionsForm.ui.h:1.7   Thu Jun  1 11:32:01 2006
 
6974
+++ qsampler/src/qsamplerOptionsForm.ui.h       Sun Sep 24 14:47:51 2006
 
6975
@@ -14,9 +14,9 @@
 
6976
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
6977
    GNU General Public License for more details.
 
6978
 
 
6979
-   You should have received a copy of the GNU General Public License
 
6980
-   along with this program; if not, write to the Free Software
 
6981
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
6982
+   You should have received a copy of the GNU General Public License along
 
6983
+   with this program; if not, write to the Free Software Foundation, Inc.,
 
6984
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
6985
 
 
6986
 *****************************************************************************/
 
6987
 
 
6988
Index: qsampler/win32/config.h
 
6989
diff -u qsampler/win32/config.h:1.3 qsampler/win32/config.h:1.23
 
6990
--- qsampler/win32/config.h:1.3 Wed Aug 24 19:44:04 2005
 
6991
+++ qsampler/win32/config.h     Mon Jan 15 20:11:59 2007
 
6992
@@ -1,12 +1,19 @@
 
6993
 
 
6994
 #define PACKAGE_NAME    "Qsampler"
 
6995
-#define PACKAGE_VERSION "0.1.3"
 
6996
+#define PACKAGE_VERSION "0.1.3.25"
 
6997
 
 
6998
 #define CONFIG_PREFIX   "."
 
6999
 #define CONFIG_DEBUG    1
 
7000
 
 
7001
+#undef  CONFIG_ROUND
 
7002
+
 
7003
 #define CONFIG_INSTRUMENT_NAME  1
 
7004
 #define CONFIG_MUTE_SOLO        1
 
7005
+#define CONFIG_MIDI_INSTRUMENT  1
 
7006
+#define CONFIG_AUDIO_ROUTING    1
 
7007
+#define CONFIG_FXSEND           1
 
7008
+#define CONFIG_FXSEND_LEVEL     1
 
7009
+#define CONFIG_VOLUME           1
 
7010
 
 
7011
 #undef  HAVE_SIGNAL_H
 
7012
 
 
7013
Index: qsampler/win32/qsampler.pro
 
7014
diff -u qsampler/win32/qsampler.pro:1.6 qsampler/win32/qsampler.pro:1.8
 
7015
--- qsampler/win32/qsampler.pro:1.6     Fri Aug 19 19:10:16 2005
 
7016
+++ qsampler/win32/qsampler.pro Mon Jan  8 17:52:48 2007
 
7017
@@ -1,25 +1,32 @@
 
7018
 INCLUDEPATH    += ../src ../../liblscp
 
7019
 
 
7020
-SOURCES         += ../src/main.cpp \
 
7021
-                       ../src/qsamplerOptions.cpp \
 
7022
-                       ../src/qsamplerChannel.cpp \
 
7023
-                       ../src/qsamplerMessages.cpp \
 
7024
-                       ../src/qsamplerDevice.cpp
 
7025
-
 
7026
 HEADERS         += ../src/qsamplerAbout.h \
 
7027
                        ../src/qsamplerOptions.h \
 
7028
                        ../src/qsamplerChannel.h \
 
7029
                        ../src/qsamplerMessages.h \
 
7030
+                       ../src/qsamplerInstrument.h \
 
7031
+                       ../src/qsamplerInstrumentList.h \
 
7032
                        ../src/qsamplerDevice.h
 
7033
 
 
7034
+SOURCES         += ../src/main.cpp \
 
7035
+                       ../src/qsamplerOptions.cpp \
 
7036
+                       ../src/qsamplerChannel.cpp \
 
7037
+                       ../src/qsamplerMessages.cpp \
 
7038
+                       ../src/qsamplerInstrument.cpp \
 
7039
+                       ../src/qsamplerInstrumentList.cpp \
 
7040
+                       ../src/qsamplerDevice.cpp
 
7041
+
 
7042
 FORMS    = ../src/qsamplerMainForm.ui \
 
7043
                        ../src/qsamplerChannelStrip.ui \
 
7044
                        ../src/qsamplerChannelForm.ui \
 
7045
                        ../src/qsamplerOptionsForm.ui \
 
7046
+                       ../src/qsamplerInstrumentForm.ui \
 
7047
+                       ../src/qsamplerInstrumentListForm.ui \
 
7048
                        ../src/qsamplerDeviceForm.ui
 
7049
 
 
7050
 IMAGES   = ../icons/qsampler.png \
 
7051
                        ../icons/qsamplerChannel.png \
 
7052
+                       ../icons/qsamplerInstrument.png \
 
7053
                        ../icons/qsamplerDevice.png \
 
7054
                        ../icons/fileNew.png \
 
7055
                        ../icons/fileOpen.png \
 
7056
@@ -32,10 +39,17 @@
 
7057
                        ../icons/editResetChannel.png \
 
7058
                        ../icons/editResetAllChannels.png \
 
7059
                        ../icons/channelsArrange.png \
 
7060
+                       ../icons/itemGroup.png \
 
7061
+                       ../icons/itemGroupOpen.png \
 
7062
+                       ../icons/itemGroupNew.png \
 
7063
+                       ../icons/itemNew.png \
 
7064
+                       ../icons/itemFile.png \
 
7065
+                       ../icons/formEdit.png \
 
7066
+                       ../icons/formRemove.png \
 
7067
                        ../icons/formAccept.png \
 
7068
                        ../icons/formReject.png \
 
7069
-                       ../icons/displaybg1.png \
 
7070
                        ../icons/formRefresh.png \
 
7071
+                       ../icons/displaybg1.png \
 
7072
                        ../icons/deviceCreate.png \
 
7073
                        ../icons/deviceDelete.png \
 
7074
                        ../icons/midi1.png \
 
7075
@@ -44,7 +58,7 @@
 
7076
                        ../icons/audio2.png
 
7077
 
 
7078
 TEMPLATE = app
 
7079
-CONFIG  += qt warn_on debug
 
7080
+CONFIG  += qt warn_on debug console
 
7081
 LANGUAGE = C++
 
7082
 
 
7083
 LIBS    += ../../liblscp/win32/liblscp.lib