2
## 10cvs-snapshot.dpatch by Free Ekanayaka <freee@debian.org>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Apply all CVS changes since the latest release
8
echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
12
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
13
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
16
-patch) patch -p1 ${patch_opts} < $0;;
17
-unpatch) patch -R -p1 ${patch_opts} < $0;;
19
echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
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
31
GNU GENERAL PUBLIC LICENSE
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.
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
49
When we speak of free software, we are referring to freedom, not
52
The precise terms and conditions for copying, distribution and
56
GNU GENERAL PUBLIC LICENSE
57
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
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.)
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
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.
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
79
This section is intended to make thoroughly clear what is believed to
80
be a consequence of the rest of this License.
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
87
POSSIBILITY OF SUCH DAMAGES.
89
END OF TERMS AND CONDITIONS
92
How to Apply These Terms to Your New Programs
94
If you develop a new program, and you want it to be of the greatest
96
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97
GNU General Public License for more details.
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
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.
107
Also add information on how to contact you by electronic and paper mail.
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
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.
128
+* Master sampler volume slider/spinbox combo is now featured.
130
+* Initial support for sampler channel FX sends, while saving
131
+ the session state, only at code-level.
133
+* Sampler channel setup dialog does not mandate for valid nor
134
+ existing instrument file name.
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.
143
+* Most top-level widgets were missing the normal-widget flag,
144
+ which were causing some sticky size behavior while on some
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.
152
+* GPL address update.
155
0.1.3 2006-06-01 Its been a long year isn't it?
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
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 \
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
194
-Plenty still, after all this is early alpha software ;)
195
+Plenty still, after all this is alpha software ;)
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
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)
211
AC_DEFINE(CONFIG_MUTE_SOLO, 1, [Define if mute/solo is available.])
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.])
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],
224
+ AC_TRY_COMPILE([#include "lscp/client.h"], [
225
+ lscp_fxsend_info_t info;
227
+ ], ac_fxsend_level="yes", ac_fxsend_level="no")
229
+ if test "x$ac_fxsend_level" = "xyes"; then
230
+ AC_DEFINE(CONFIG_FXSEND_LEVEL, 1, [Define if FX send level is available.])
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")
241
+if test "x$ac_audio_routing" = "xyes"; then
242
+ AC_DEFINE(CONFIG_AUDIO_ROUTING, 1, [Define if audio_routing is an integer array.])
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.])
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"])
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.])
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
273
-SOURCES += src/main.cpp \
274
- src/qsamplerOptions.cpp \
275
- src/qsamplerChannel.cpp \
276
- src/qsamplerMessages.cpp \
277
- src/qsamplerDevice.cpp
279
-HEADERS += src/qsamplerAbout.h \
280
- src/qsamplerOptions.h \
281
- src/qsamplerChannel.h \
282
- src/qsamplerMessages.h \
283
- src/qsamplerDevice.h
285
-FORMS = src/qsamplerMainForm.ui \
286
- src/qsamplerChannelStrip.ui \
287
- src/qsamplerChannelForm.ui \
288
- src/qsamplerOptionsForm.ui \
289
- src/qsamplerDeviceForm.ui
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 \
317
-CONFIG += qt @ac_thread@ warn_on @ac_debug@
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
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
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
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 \
377
+CONFIG += qt @ac_thread@ warn_on @ac_debug@
381
-INCPATH += @ac_incpath@
383
+INCPATH += @ac_incpath@
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
390
%define name @PACKAGE_TARNAME@
391
%define version @PACKAGE_VERSION@
394
%define prefix /usr/local
396
Summary: A LinuxSampler Qt GUI interface.
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
405
QSampler is a LinuxSampler GUI front-end application written in C++ around
407
%{prefix}/share/icons/qsampler.png
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
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.
439
This program is free software; you can redistribute it and/or
440
modify it under the terms of the GNU General Public License
442
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
443
GNU General Public License for more details.
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.
452
*****************************************************************************/
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
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.
465
This program is free software; you can redistribute it and/or
466
modify it under the terms of the GNU General Public License
468
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
469
GNU General Public License for more details.
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.
478
*****************************************************************************/
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."
487
#endif // __qsamplerAbout_h
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
494
// qsamplerChannel.cpp
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.
500
This program is free software; you can redistribute it and/or
501
modify it under the terms of the GNU General Public License
503
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
504
GNU General Public License for more details.
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.
513
*****************************************************************************/
519
-qsamplerChannel::qsamplerChannel ( qsamplerMainForm *pMainForm, int iChannelID )
520
+qsamplerChannel::qsamplerChannel ( int iChannelID )
522
- m_pMainForm = pMainForm;
523
m_iChannelID = iChannelID;
525
// m_sEngineName = noEngineName();
531
m_sAudioDriver = "ALSA";
538
-// Main application form accessor.
539
-qsamplerMainForm *qsamplerChannel::mainForm(void) const
541
- return m_pMainForm;
545
-// The global options settings delegated property.
546
-qsamplerOptions *qsamplerChannel::options (void) const
548
- if (m_pMainForm == NULL)
551
- return m_pMainForm->options();
555
-// The client descriptor delegated property.
556
-lscp_client_t *qsamplerChannel::client (void) const
558
- if (m_pMainForm == NULL)
561
- return m_pMainForm->client();
565
// Create a new sampler channel, if not already.
566
bool qsamplerChannel::addChannel (void)
568
- if (client() == NULL)
569
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
570
+ if (pMainForm == NULL)
572
+ if (pMainForm->client() == NULL)
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."));
588
// Remove sampler channel.
589
bool qsamplerChannel::removeChannel (void)
591
- if (client() == NULL)
592
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
593
+ if (pMainForm == NULL)
595
+ if (pMainForm->client() == NULL)
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."));
605
@@ -165,15 +145,19 @@
607
bool qsamplerChannel::loadEngine ( const QString& sEngineName )
609
- if (client() == NULL || m_iChannelID < 0)
610
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
611
+ if (pMainForm == NULL)
613
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
615
if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName)
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");
624
appendMessages(QObject::tr("Engine: %1.").arg(sEngineName));
626
m_sEngineName = sEngineName;
627
@@ -208,14 +192,17 @@
628
// Instrument file loader.
629
bool qsamplerChannel::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr )
631
- if (client() == NULL || m_iChannelID < 0)
632
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
633
+ if (pMainForm == NULL)
635
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
637
if (!isInstrumentFile(sInstrumentFile))
639
if (m_iInstrumentStatus == 100 && m_sInstrumentFile == sInstrumentFile && m_iInstrumentNr == iInstrumentNr)
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");
647
@@ -251,12 +238,15 @@
649
bool qsamplerChannel::setMidiDriver ( const QString& sMidiDriver )
651
- if (client() == NULL || m_iChannelID < 0)
652
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
653
+ if (pMainForm == NULL)
655
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
657
if (m_iInstrumentStatus == 100 && m_sMidiDriver == sMidiDriver)
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");
665
@@ -276,12 +266,15 @@
667
bool qsamplerChannel::setMidiDevice ( int iMidiDevice )
669
- if (client() == NULL || m_iChannelID < 0)
670
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
671
+ if (pMainForm == NULL)
673
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
675
if (m_iInstrumentStatus == 100 && m_iMidiDevice == iMidiDevice)
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");
683
@@ -301,12 +294,15 @@
685
bool qsamplerChannel::setMidiPort ( int iMidiPort )
687
- if (client() == NULL || m_iChannelID < 0)
688
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
689
+ if (pMainForm == NULL)
691
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
693
if (m_iInstrumentStatus == 100 && m_iMidiPort == iMidiPort)
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");
701
@@ -326,12 +322,15 @@
703
bool qsamplerChannel::setMidiChannel ( int iMidiChannel )
705
- if (client() == NULL || m_iChannelID < 0)
706
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
707
+ if (pMainForm == NULL)
709
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
711
if (m_iInstrumentStatus == 100 && m_iMidiChannel == iMidiChannel)
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");
723
+// MIDI instrument map accessor.
724
+int qsamplerChannel::midiMap (void) const
729
+bool qsamplerChannel::setMidiMap ( int iMidiMap )
731
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
732
+ if (pMainForm == NULL)
734
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
736
+ if (m_iInstrumentStatus == 100 && m_iMidiMap == iMidiMap)
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");
744
+ appendMessages(QObject::tr("MIDI map: %1.").arg(iMidiMap));
746
+ m_iMidiMap = iMidiMap;
751
// Audio device accessor.
752
int qsamplerChannel::audioDevice (void) const
754
@@ -351,12 +378,15 @@
756
bool qsamplerChannel::setAudioDevice ( int iAudioDevice )
758
- if (client() == NULL || m_iChannelID < 0)
759
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
760
+ if (pMainForm == NULL)
762
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
764
if (m_iInstrumentStatus == 100 && m_iAudioDevice == iAudioDevice)
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");
772
@@ -376,12 +406,15 @@
774
bool qsamplerChannel::setAudioDriver ( const QString& sAudioDriver )
776
- if (client() == NULL || m_iChannelID < 0)
777
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
778
+ if (pMainForm == NULL)
780
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
782
if (m_iInstrumentStatus == 100 && m_sAudioDriver == sAudioDriver)
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");
790
@@ -401,12 +434,15 @@
792
bool qsamplerChannel::setVolume ( float fVolume )
794
- if (client() == NULL || m_iChannelID < 0)
795
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
796
+ if (pMainForm == NULL)
798
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
800
if (m_iInstrumentStatus == 100 && m_fVolume == fVolume)
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");
808
@@ -426,13 +462,16 @@
810
bool qsamplerChannel::setChannelMute ( bool bMute )
812
- if (client() == NULL || m_iChannelID < 0)
813
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
814
+ if (pMainForm == NULL)
816
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
818
if (m_iInstrumentStatus == 100 && ((m_bMute && bMute) || (!m_bMute && !bMute)))
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");
827
@@ -453,13 +492,16 @@
829
bool qsamplerChannel::setChannelSolo ( bool bSolo )
831
- if (client() == NULL || m_iChannelID < 0)
832
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
833
+ if (pMainForm == NULL)
835
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
837
if (m_iInstrumentStatus == 100 && ((m_bSolo && bSolo) || (!m_bSolo && !bSolo)))
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");
846
@@ -480,13 +522,16 @@
848
bool qsamplerChannel::setAudioChannel ( int iAudioOut, int iAudioIn )
850
- if (client() == NULL || m_iChannelID < 0)
851
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
852
+ if (pMainForm == NULL)
854
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
856
if (m_iInstrumentStatus == 100 &&
857
m_audioRouting[iAudioOut] == iAudioIn)
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");
865
@@ -519,11 +564,14 @@
866
// Update whole channel info state.
867
bool qsamplerChannel::updateChannelInfo (void)
869
- if (client() == NULL || m_iChannelID < 0)
870
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
871
+ if (pMainForm == NULL)
873
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
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."));
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;
889
m_iAudioDevice = pChannelInfo->audio_device;
890
m_fVolume = pChannelInfo->volume;
891
#ifdef CONFIG_MUTE_SOLO
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;
902
m_sAudioDriver = pDeviceInfo->driver;
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 @@
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]);
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];
923
+ char **ppszAudioRouting = pChannelInfo->audio_routing;
924
+ for (int i = 0; ppszAudioRouting && ppszAudioRouting[i]; i++)
925
+ m_audioRouting[i] = ::atoi(ppszAudioRouting[i]);
930
@@ -600,10 +656,13 @@
931
// Reset channel method.
932
bool qsamplerChannel::channelReset (void)
934
- if (client() == NULL || m_iChannelID < 0)
935
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
936
+ if (pMainForm == NULL)
938
+ if (pMainForm->client() == NULL || m_iChannelID < 0)
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");
947
// Channel setup dialog form.
948
bool qsamplerChannel::channelSetup ( QWidget *pParent )
950
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
951
+ if (pMainForm == NULL)
954
bool bResult = false;
956
appendMessages(QObject::tr("setup..."));
957
@@ -635,41 +698,47 @@
958
// Redirected messages output methods.
959
void qsamplerChannel::appendMessages( const QString& s ) const
962
- m_pMainForm->appendMessages(channelName() + ' ' + s);
963
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
965
+ pMainForm->appendMessages(channelName() + ' ' + s);
968
void qsamplerChannel::appendMessagesColor( const QString& s,
969
const QString& c ) const
972
- m_pMainForm->appendMessagesColor(channelName() + ' ' + s, c);
973
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
975
+ pMainForm->appendMessagesColor(channelName() + ' ' + s, c);
978
void qsamplerChannel::appendMessagesText( const QString& s ) const
981
- m_pMainForm->appendMessagesText(channelName() + ' ' + s);
982
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
984
+ pMainForm->appendMessagesText(channelName() + ' ' + s);
987
void qsamplerChannel::appendMessagesError( const QString& s ) const
990
- m_pMainForm->appendMessagesError(channelName() + "\n\n" + s);
991
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
993
+ pMainForm->appendMessagesError(channelName() + "\n\n" + s);
996
void qsamplerChannel::appendMessagesClient( const QString& s ) const
999
- m_pMainForm->appendMessagesClient(channelName() + ' ' + s);
1000
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
1002
+ pMainForm->appendMessagesClient(channelName() + ' ' + s);
1006
// Context menu event handler.
1007
void qsamplerChannel::contextMenuEvent( QContextMenuEvent *pEvent )
1010
- m_pMainForm->contextMenuEvent(pEvent);
1011
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
1013
+ pMainForm->contextMenuEvent(pEvent);
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
1022
// qsamplerChannel.h
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.
1028
This program is free software; you can redistribute it and/or
1029
modify it under the terms of the GNU General Public License
1031
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1032
GNU General Public License for more details.
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.
1041
*****************************************************************************/
1044
#include "qsamplerOptions.h"
1046
class qsamplerDevice;
1047
-class qsamplerMainForm;
1055
- qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1);
1056
+ qsamplerChannel(int iChannelID = -1);
1057
// Default destructor.
1060
- // Main application form accessor.
1061
- qsamplerMainForm *mainForm() const;
1063
- // Main application options accessor.
1064
- qsamplerOptions *options() const;
1066
- // LSCP client descriptor accessor.
1067
- lscp_client_t * client() const;
1069
// Add/remove sampler channel methods.
1071
bool removeChannel();
1073
int midiChannel() const;
1074
bool setMidiChannel(int iMidiChannel);
1076
+ // MIDI instrument map.
1077
+ int midiMap() const;
1078
+ bool setMidiMap(int iMidiMap);
1080
// Audio output driver (DEPRECATED).
1081
const QString& audioDriver() const;
1082
bool setAudioDriver(const QString& sAudioDriver);
1087
- // Main application form reference.
1088
- qsamplerMainForm *m_pMainForm;
1090
// Unique channel identifier.
1098
QString m_sAudioDriver;
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
1106
<class>qsamplerChannelForm</class>
1107
<comment>qsampler - A LinuxSampler Qt GUI Interface.
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.
1112
This program is free software; you can redistribute it and/or
1113
modify it under the terms of the GNU General Public License
1115
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1116
GNU General Public License for more details.
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.
1126
<author>rncbc aka Rui Nuno Capela</author>
1131
- <width>491</width>
1132
- <height>417</height>
1133
+ <width>446</width>
1134
+ <height>436</height>
1137
<property name="sizePolicy">
1138
@@ -121,14 +121,14 @@
1142
- <property name="focusPolicy">
1143
- <enum>TabFocus</enum>
1145
+ <property name="focusPolicy">
1146
+ <enum>TabFocus</enum>
1148
<property name="text">
1151
- <property name="pixmap">
1152
- <pixmap>fileOpen.png</pixmap>
1153
+ <property name="iconSet">
1154
+ <iconset>fileOpen.png</iconset>
1156
<property name="toolTip" stdset="0">
1157
<string>Browse for instrument filename</string>
1158
@@ -159,27 +159,235 @@
1159
<string>Instrument filename</string>
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>
1169
+ <property name="name">
1170
+ <cstring>unnamed</cstring>
1173
+ <property name="name">
1174
+ <cstring>spacer4</cstring>
1176
+ <property name="orientation">
1177
+ <enum>Horizontal</enum>
1179
+ <property name="sizeType">
1180
+ <enum>Expanding</enum>
1182
+ <property name="sizeHint">
1185
+ <height>8</height>
1189
+ <widget class="QPushButton">
1190
+ <property name="name">
1191
+ <cstring>OkPushButton</cstring>
1193
+ <property name="text">
1194
+ <string>OK</string>
1196
+ <property name="iconSet">
1197
+ <iconset>formAccept.png</iconset>
1200
+ <widget class="QPushButton">
1201
+ <property name="name">
1202
+ <cstring>CancelPushButton</cstring>
1204
+ <property name="text">
1205
+ <string>Cancel</string>
1207
+ <property name="iconSet">
1208
+ <iconset>formReject.png</iconset>
1213
+ <widget class="QGroupBox" row="4" column="1" rowspan="1" colspan="2">
1214
+ <property name="name">
1215
+ <cstring>AudioGroupBox</cstring>
1217
<property name="sizePolicy">
1219
<hsizetype>7</hsizetype>
1220
- <vsizetype>0</vsizetype>
1221
+ <vsizetype>5</vsizetype>
1222
<horstretch>0</horstretch>
1223
<verstretch>0</verstretch>
1226
- <property name="minimumSize">
1228
- <width>320</width>
1229
- <height>0</height>
1231
+ <property name="title">
1232
+ <string>Audio / Output</string>
1234
- <property name="toolTip" stdset="0">
1235
- <string>Instrument name</string>
1236
+ <property name="alignment">
1237
+ <set>AlignAuto</set>
1240
+ <property name="name">
1241
+ <cstring>unnamed</cstring>
1243
+ <property name="margin">
1244
+ <number>8</number>
1246
+ <property name="spacing">
1247
+ <number>8</number>
1249
+ <widget class="QLabel" row="0" column="0">
1250
+ <property name="name">
1251
+ <cstring>AudioDriverTextLabel</cstring>
1253
+ <property name="text">
1254
+ <string>&Type:</string>
1256
+ <property name="alignment">
1257
+ <set>AlignVCenter</set>
1259
+ <property name="buddy" stdset="0">
1260
+ <cstring>AudioDriverComboBox</cstring>
1263
+ <widget class="QLayoutWidget" row="0" column="1">
1264
+ <property name="name">
1265
+ <cstring>layout21</cstring>
1268
+ <property name="name">
1269
+ <cstring>unnamed</cstring>
1271
+ <widget class="QComboBox">
1272
+ <property name="name">
1273
+ <cstring>AudioDriverComboBox</cstring>
1275
+ <property name="sizePolicy">
1277
+ <hsizetype>5</hsizetype>
1278
+ <vsizetype>0</vsizetype>
1279
+ <horstretch>0</horstretch>
1280
+ <verstretch>0</verstretch>
1283
+ <property name="toolTip" stdset="0">
1284
+ <string>Audio output driver type</string>
1288
+ <property name="name">
1289
+ <cstring>spacer3</cstring>
1291
+ <property name="orientation">
1292
+ <enum>Horizontal</enum>
1294
+ <property name="sizeType">
1295
+ <enum>Expanding</enum>
1297
+ <property name="sizeHint">
1300
+ <height>20</height>
1306
+ <widget class="QLayoutWidget" row="1" column="1">
1307
+ <property name="name">
1308
+ <cstring>layout22</cstring>
1311
+ <property name="name">
1312
+ <cstring>unnamed</cstring>
1314
+ <widget class="QComboBox">
1315
+ <property name="name">
1316
+ <cstring>AudioDeviceComboBox</cstring>
1318
+ <property name="sizePolicy">
1320
+ <hsizetype>7</hsizetype>
1321
+ <vsizetype>0</vsizetype>
1322
+ <horstretch>0</horstretch>
1323
+ <verstretch>0</verstretch>
1326
+ <property name="toolTip" stdset="0">
1327
+ <string>Audio output device</string>
1330
+ <widget class="QToolButton">
1331
+ <property name="name">
1332
+ <cstring>AudioDeviceToolButton</cstring>
1334
+ <property name="sizePolicy">
1336
+ <hsizetype>0</hsizetype>
1337
+ <vsizetype>0</vsizetype>
1338
+ <horstretch>0</horstretch>
1339
+ <verstretch>0</verstretch>
1342
+ <property name="minimumSize">
1345
+ <height>24</height>
1348
+ <property name="maximumSize">
1351
+ <height>26</height>
1354
+ <property name="focusPolicy">
1355
+ <enum>TabFocus</enum>
1357
+ <property name="text">
1360
+ <property name="iconSet">
1361
+ <iconset>audio1.png</iconset>
1363
+ <property name="toolTip" stdset="0">
1364
+ <string>Audio output device setup</string>
1369
+ <widget class="QLabel" row="1" column="0">
1370
+ <property name="name">
1371
+ <cstring>AudioDeviceTextLabel</cstring>
1373
+ <property name="text">
1374
+ <string>&Device:</string>
1376
+ <property name="alignment">
1377
+ <set>AlignVCenter</set>
1379
+ <property name="buddy" stdset="0">
1380
+ <cstring>AudioDeviceComboBox</cstring>
1383
+ <widget class="qsamplerChannelRoutingTable" row="2" column="1">
1384
+ <property name="name">
1385
+ <cstring>AudioRoutingTable</cstring>
1387
+ <property name="minimumSize">
1390
+ <height>100</height>
1393
+ <property name="focusPolicy">
1394
+ <enum>StrongFocus</enum>
1396
+ <property name="toolTip" stdset="0">
1397
+ <string>Audio output channel routing</string>
1402
<widget class="QLabel" row="2" column="0">
1403
<property name="name">
1404
@@ -195,6 +403,28 @@
1405
<cstring>InstrumentNrComboBox</cstring>
1408
+ <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="2">
1409
+ <property name="name">
1410
+ <cstring>InstrumentNrComboBox</cstring>
1412
+ <property name="sizePolicy">
1414
+ <hsizetype>7</hsizetype>
1415
+ <vsizetype>0</vsizetype>
1416
+ <horstretch>0</horstretch>
1417
+ <verstretch>0</verstretch>
1420
+ <property name="minimumSize">
1422
+ <width>320</width>
1423
+ <height>0</height>
1426
+ <property name="toolTip" stdset="0">
1427
+ <string>Instrument name</string>
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>
1436
<property name="buddy" stdset="0">
1437
- <cstring>MidiDriverComboBox</cstring>
1438
+ <cstring>MidiDriverComboBox</cstring>
1441
+ <widget class="QLayoutWidget" row="1" column="1">
1442
+ <property name="name">
1443
+ <cstring>layout12</cstring>
1446
+ <property name="name">
1447
+ <cstring>unnamed</cstring>
1449
+ <widget class="QComboBox">
1450
+ <property name="name">
1451
+ <cstring>MidiDeviceComboBox</cstring>
1453
+ <property name="sizePolicy">
1455
+ <hsizetype>7</hsizetype>
1456
+ <vsizetype>0</vsizetype>
1457
+ <horstretch>0</horstretch>
1458
+ <verstretch>0</verstretch>
1461
+ <property name="toolTip" stdset="0">
1462
+ <string>MIDI input device</string>
1465
+ <widget class="QToolButton">
1466
+ <property name="name">
1467
+ <cstring>MidiDeviceToolButton</cstring>
1469
+ <property name="sizePolicy">
1471
+ <hsizetype>0</hsizetype>
1472
+ <vsizetype>0</vsizetype>
1473
+ <horstretch>0</horstretch>
1474
+ <verstretch>0</verstretch>
1477
+ <property name="minimumSize">
1480
+ <height>24</height>
1483
+ <property name="maximumSize">
1486
+ <height>26</height>
1489
+ <property name="focusPolicy">
1490
+ <enum>TabFocus</enum>
1492
+ <property name="text">
1495
+ <property name="iconSet">
1496
+ <iconset>midi1.png</iconset>
1498
+ <property name="toolTip" stdset="0">
1499
+ <string>MIDI input device setup</string>
1504
+ <widget class="QLabel" row="1" column="0">
1505
+ <property name="name">
1506
+ <cstring>MidiDeviceTextLabel</cstring>
1508
+ <property name="text">
1509
+ <string>&Device:</string>
1511
+ <property name="alignment">
1512
+ <set>AlignVCenter</set>
1514
+ <property name="buddy" stdset="0">
1515
+ <cstring>MidiDeviceComboBox</cstring>
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>
1524
<property name="text">
1525
- <string>&Device:</string>
1526
+ <string>&Map:</string>
1528
<property name="alignment">
1529
- <set>AlignVCenter</set>
1530
+ <set>AlignVCenter|AlignRight</set>
1532
<property name="buddy" stdset="0">
1533
- <cstring>MidiDeviceComboBox</cstring>
1534
+ <cstring>MidiMapComboBox</cstring>
1537
<widget class="QLayoutWidget" row="0" column="1">
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>
1549
<property name="name">
1552
<widget class="QComboBox">
1553
<property name="name">
1554
- <cstring>MidiDeviceComboBox</cstring>
1555
+ <cstring>MidiMapComboBox</cstring>
1557
<property name="sizePolicy">
1559
@@ -441,168 +748,12 @@
1562
<property name="toolTip" stdset="0">
1563
- <string>MIDI input device</string>
1566
- <widget class="QToolButton">
1567
- <property name="name">
1568
- <cstring>MidiDeviceToolButton</cstring>
1570
- <property name="sizePolicy">
1572
- <hsizetype>0</hsizetype>
1573
- <vsizetype>0</vsizetype>
1574
- <horstretch>0</horstretch>
1575
- <verstretch>0</verstretch>
1578
- <property name="minimumSize">
1581
- <height>24</height>
1584
- <property name="maximumSize">
1587
- <height>26</height>
1590
- <property name="focusPolicy">
1591
- <enum>TabFocus</enum>
1593
- <property name="text">
1596
- <property name="pixmap">
1597
- <pixmap>midi1.png</pixmap>
1599
- <property name="toolTip" stdset="0">
1600
- <string>MIDI input device setup</string>
1607
- <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="3">
1608
- <property name="name">
1609
- <cstring>layout01</cstring>
1612
- <property name="name">
1613
- <cstring>unnamed</cstring>
1616
- <property name="name">
1617
- <cstring>spacer3</cstring>
1619
- <property name="orientation">
1620
- <enum>Horizontal</enum>
1622
- <property name="sizeType">
1623
- <enum>Expanding</enum>
1625
- <property name="sizeHint">
1628
- <height>8</height>
1632
- <widget class="QPushButton">
1633
- <property name="name">
1634
- <cstring>OkPushButton</cstring>
1636
- <property name="text">
1637
- <string>OK</string>
1639
- <property name="iconSet">
1640
- <iconset>formAccept.png</iconset>
1643
- <widget class="QPushButton">
1644
- <property name="name">
1645
- <cstring>CancelPushButton</cstring>
1647
- <property name="text">
1648
- <string>Cancel</string>
1650
- <property name="iconSet">
1651
- <iconset>formReject.png</iconset>
1656
- <widget class="QGroupBox" row="4" column="1" rowspan="1" colspan="2">
1657
- <property name="name">
1658
- <cstring>AudioGroupBox</cstring>
1660
- <property name="sizePolicy">
1662
- <hsizetype>7</hsizetype>
1663
- <vsizetype>5</vsizetype>
1664
- <horstretch>0</horstretch>
1665
- <verstretch>0</verstretch>
1668
- <property name="title">
1669
- <string>Audio / Output</string>
1671
- <property name="alignment">
1672
- <set>AlignAuto</set>
1675
- <property name="name">
1676
- <cstring>unnamed</cstring>
1678
- <property name="margin">
1679
- <number>8</number>
1681
- <property name="spacing">
1682
- <number>8</number>
1684
- <widget class="QLabel" row="0" column="0">
1685
- <property name="name">
1686
- <cstring>AudioDriverTextLabel</cstring>
1688
- <property name="text">
1689
- <string>&Type:</string>
1691
- <property name="alignment">
1692
- <set>AlignVCenter</set>
1694
- <property name="buddy" stdset="0">
1695
- <cstring>AudioDriverComboBox</cstring>
1698
- <widget class="QLayoutWidget" row="0" column="1">
1699
- <property name="name">
1700
- <cstring>layout21</cstring>
1703
- <property name="name">
1704
- <cstring>unnamed</cstring>
1706
- <widget class="QComboBox">
1707
- <property name="name">
1708
- <cstring>AudioDriverComboBox</cstring>
1710
- <property name="sizePolicy">
1712
- <hsizetype>5</hsizetype>
1713
- <vsizetype>0</vsizetype>
1714
- <horstretch>0</horstretch>
1715
- <verstretch>0</verstretch>
1718
- <property name="toolTip" stdset="0">
1719
- <string>Audio output driver type</string>
1720
+ <string>Instrument map</string>
1724
<property name="name">
1725
- <cstring>spacer2</cstring>
1726
+ <cstring>spacer1_2</cstring>
1728
<property name="orientation">
1729
<enum>Horizontal</enum>
1730
@@ -612,107 +763,13 @@
1732
<property name="sizeHint">
1735
+ <width>160</width>
1742
- <widget class="QLayoutWidget" row="1" column="1">
1743
- <property name="name">
1744
- <cstring>layout22</cstring>
1747
- <property name="name">
1748
- <cstring>unnamed</cstring>
1750
- <widget class="QComboBox">
1751
- <property name="name">
1752
- <cstring>AudioDeviceComboBox</cstring>
1754
- <property name="sizePolicy">
1756
- <hsizetype>7</hsizetype>
1757
- <vsizetype>0</vsizetype>
1758
- <horstretch>0</horstretch>
1759
- <verstretch>0</verstretch>
1762
- <property name="toolTip" stdset="0">
1763
- <string>Audio output device</string>
1766
- <widget class="QToolButton">
1767
- <property name="name">
1768
- <cstring>AudioDeviceToolButton</cstring>
1770
- <property name="sizePolicy">
1772
- <hsizetype>0</hsizetype>
1773
- <vsizetype>0</vsizetype>
1774
- <horstretch>0</horstretch>
1775
- <verstretch>0</verstretch>
1778
- <property name="minimumSize">
1781
- <height>24</height>
1784
- <property name="maximumSize">
1787
- <height>26</height>
1790
- <property name="focusPolicy">
1791
- <enum>TabFocus</enum>
1793
- <property name="text">
1796
- <property name="pixmap">
1797
- <pixmap>audio1.png</pixmap>
1799
- <property name="toolTip" stdset="0">
1800
- <string>Audio output device setup</string>
1805
- <widget class="QLabel" row="1" column="0">
1806
- <property name="name">
1807
- <cstring>AudioDeviceTextLabel</cstring>
1809
- <property name="text">
1810
- <string>&Device:</string>
1812
- <property name="alignment">
1813
- <set>AlignVCenter</set>
1815
- <property name="buddy" stdset="0">
1816
- <cstring>AudioDeviceComboBox</cstring>
1819
- <widget class="qsamplerChannelRoutingTable" row="2" column="1">
1820
- <property name="name">
1821
- <cstring>AudioRoutingTable</cstring>
1823
- <property name="minimumSize">
1826
- <height>100</height>
1829
- <property name="focusPolicy">
1830
- <enum>StrongFocus</enum>
1832
- <property name="toolTip" stdset="0">
1833
- <string>Audio output channel routing</string>
1839
@@ -784,6 +841,12 @@
1840
<slot>optionsChanged()</slot>
1843
+ <sender>MidiMapComboBox</sender>
1844
+ <signal>activated(int)</signal>
1845
+ <receiver>qsamplerChannelForm</receiver>
1846
+ <slot>optionsChanged()</slot>
1849
<sender>AudioDriverComboBox</sender>
1850
<signal>activated(const QString&)</signal>
1851
<receiver>qsamplerChannelForm</receiver>
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>
1863
<layoutdefaults spacing="4" margin="4"/>
1865
+ <includehint>qsamplerChannel.h</includehint>
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
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.
1879
This program is free software; you can redistribute it and/or
1880
modify it under the terms of the GNU General Public License
1882
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1883
GNU General Public License for more details.
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.
1892
*****************************************************************************/
1894
#include "qsamplerAbout.h"
1895
#include "qsamplerDeviceForm.h"
1897
+#include "qsamplerMainForm.h"
1898
+#include "qsamplerInstrument.h"
1901
#include <qvalidator.h>
1902
#include <qmessagebox.h>
1903
#include <qfiledialog.h>
1905
setCaption(QSAMPLER_TITLE ": " + m_pChannel->channelName());
1907
// Check if we're up and connected.
1908
- if (m_pChannel->client() == NULL)
1909
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
1910
+ if (pMainForm == NULL)
1912
+ if (pMainForm->client() == NULL)
1915
- qsamplerOptions *pOptions = m_pChannel->options();
1916
+ qsamplerOptions *pOptions = pMainForm->options();
1917
if (pOptions == NULL)
1921
this, SLOT(changeAudioRouting(int,int)));
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());
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));
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));
1942
+ // Populate Maps list.
1943
+ MidiMapComboBox->clear();
1944
+ MidiMapComboBox->insertStringList(qsamplerInstrument::getMapNames());
1946
// Read proper channel information,
1947
// and populate the channel form fields.
1949
InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr());
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...
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);
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)
1989
- qsamplerOptions *pOptions = m_pChannel->options();
1990
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
1991
+ if (pMainForm == NULL)
1993
+ if (pMainForm->client() == NULL)
1996
+ qsamplerOptions *pOptions = pMainForm->options();
1997
if (pOptions == NULL)
2000
@@ -252,7 +279,13 @@
2001
if (!m_pChannel->loadEngine(EngineNameComboBox->currentText()))
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()))
2010
+ // MIDI intrument map...
2011
+ if (!m_pChannel->setMidiMap(MidiMapComboBox->currentItem()))
2013
// Show error messages?
2016
pOptions->sEngineName = EngineNameComboBox->currentText();
2017
pOptions->sAudioDriver = AudioDriverComboBox->currentText();
2018
pOptions->sMidiDriver = MidiDriverComboBox->currentText();
2019
+ pOptions->iMidiMap = MidiMapComboBox->currentItem();
2020
pOptions->saveComboBoxHistory(InstrumentFileComboBox);
2022
// Just go with dialog acceptance.
2031
@@ -301,7 +336,13 @@
2032
// Browse and open an instrument file.
2033
void qsamplerChannelForm::openInstrumentFile (void)
2035
- qsamplerOptions *pOptions = m_pChannel->options();
2036
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2037
+ if (pMainForm == NULL)
2039
+ if (pMainForm->client() == NULL)
2042
+ qsamplerOptions *pOptions = pMainForm->options();
2043
if (pOptions == NULL)
2046
@@ -325,7 +366,13 @@
2047
// Refresh the actual instrument name.
2048
void qsamplerChannelForm::updateInstrumentName (void)
2050
- qsamplerOptions *pOptions = m_pChannel->options();
2051
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2052
+ if (pMainForm == NULL)
2054
+ if (pMainForm->client() == NULL)
2057
+ qsamplerOptions *pOptions = pMainForm->options();
2058
if (pOptions == NULL)
2061
@@ -341,16 +388,22 @@
2066
// Show device options dialog.
2067
void qsamplerChannelForm::setupDevice ( qsamplerDevice *pDevice,
2068
qsamplerDevice::qsamplerDeviceType deviceTypeMode,
2069
const QString& sDriverName )
2071
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2072
+ if (pMainForm == NULL)
2074
+ if (pMainForm->client() == NULL)
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()));
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 )
2098
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2099
+ if (pMainForm == NULL)
2101
+ if (pMainForm->client() == NULL)
2104
const QString sDriverName = sMidiDriver.upper();
2106
// Save current device id.
2107
@@ -383,11 +442,10 @@
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 )
2125
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2126
+ if (pMainForm == NULL)
2128
+ if (pMainForm->client() == NULL)
2131
const QString sDriverName = sAudioDriver.upper();
2133
// Save current device id.
2134
@@ -482,11 +546,10 @@
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)
2152
- const QString& sFilename = InstrumentFileComboBox->currentText();
2153
- OkPushButton->setEnabled(m_iDirtyCount > 0 && !sFilename.isEmpty() && QFileInfo(sFilename).exists());
2154
+ bool bValid = true;
2156
+ const QString& sPath = InstrumentFileComboBox->currentText();
2157
+ bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
2159
+ OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);
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
2168
<class>qsamplerChannelStrip</class>
2169
<comment>qsampler - A LinuxSampler Qt GUI Interface.
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.
2174
This program is free software; you can redistribute it and/or
2175
modify it under the terms of the GNU General Public License
2177
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2178
GNU General Public License for more details.
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.
2188
<author>rncbc aka Rui Nuno Capela</author>
2193
- <width>737</width>
2194
- <height>46</height>
2195
+ <width>720</width>
2196
+ <height>48</height>
2199
<property name="sizePolicy">
2200
@@ -209,13 +209,13 @@
2201
<enum>ParentOrigin</enum>
2203
<property name="text">
2204
- <string>--/--</string>
2205
+ <string>-- / --</string>
2207
<property name="alignment">
2208
<set>AlignTop|AlignHCenter</set>
2210
<property name="toolTip" stdset="0">
2211
- <string>MIDI Port/Channel</string>
2212
+ <string>MIDI port / channel</string>
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
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.
2227
This program is free software; you can redistribute it and/or
2228
modify it under the terms of the GNU General Public License
2230
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2231
GNU General Public License for more details.
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.
2240
*****************************************************************************/
2243
ChannelSetupPushButton->setText(sText);
2245
// Check if we're up and connected.
2246
- if (m_pChannel->client() == NULL)
2248
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2249
+ if (pMainForm->client() == NULL)
2252
// Read actual channel information.
2253
m_pChannel->updateChannelInfo();
2254
@@ -340,10 +341,12 @@
2255
updateInstrumentName(false);
2257
// MIDI Port/Channel...
2258
- if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
2259
- MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_pChannel->midiPort()));
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");
2266
+ sMidiPortChannel += QString::number(m_pChannel->midiChannel() + 1);
2267
+ MidiPortChannelTextLabel->setText(sMidiPortChannel);
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);
2283
ChannelMutePushButton->setEnabled(false);
2284
@@ -383,21 +386,23 @@
2286
if (m_pChannel == NULL)
2288
- if (m_pChannel->client() == NULL)
2291
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2292
+ if (pMainForm->client() == NULL)
2295
// This only makes sense on fully loaded channels...
2296
if (m_pChannel->instrumentStatus() < 100)
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());;
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
2318
// qsamplerDevice.cpp
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.
2324
This program is free software; you can redistribute it and/or
2325
modify it under the terms of the GNU General Public License
2327
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2328
GNU General Public License for more details.
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.
2337
*****************************************************************************/
2339
@@ -103,11 +103,8 @@
2343
-qsamplerDevice::qsamplerDevice ( qsamplerMainForm *pMainForm,
2344
- qsamplerDeviceType deviceType, int iDeviceID )
2345
+qsamplerDevice::qsamplerDevice ( qsamplerDeviceType deviceType, int iDeviceID )
2347
- m_pMainForm = pMainForm;
2349
m_ports.setAutoDelete(true);
2351
setDevice(deviceType, iDeviceID);
2353
qsamplerDevice::qsamplerDevice ( const qsamplerDevice& device )
2354
: m_params(device.m_params), m_ports(m_ports)
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 @@
2362
void qsamplerDevice::setDevice ( qsamplerDeviceType deviceType, int iDeviceID )
2364
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2365
+ if (pMainForm == NULL)
2367
+ if (pMainForm->client() == NULL)
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");
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");
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");
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");
2404
@@ -207,6 +209,12 @@
2405
// Driver name initializer/settler.
2406
void qsamplerDevice::setDriver ( const QString& sDriverName )
2408
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2409
+ if (pMainForm == NULL)
2411
+ if (pMainForm->client() == NULL)
2414
// Valid only for scratch devices.
2415
if (m_sDriverName == sDriverName)
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");
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");
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");
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");
2447
@@ -270,16 +278,6 @@
2451
-// The client descriptor delegated property.
2452
-lscp_client_t *qsamplerDevice::client (void) const
2454
- if (m_pMainForm == NULL)
2457
- return m_pMainForm->client();
2461
// Device property accessors.
2462
int qsamplerDevice::deviceID (void) const
2464
@@ -315,6 +313,12 @@
2465
bool qsamplerDevice::setParam ( const QString& sParam,
2466
const QString& sValue )
2468
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2469
+ if (pMainForm == NULL)
2471
+ if (pMainForm->client() == NULL)
2474
// Set proper device parameter.
2475
m_params[sParam.upper()].value = sValue;
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, ¶m)) != LSCP_OK)
2484
appendMessagesClient("lscp_set_audio_device_param");
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, ¶m)) != LSCP_OK)
2491
appendMessagesClient("lscp_set_midi_device_param");
2493
@@ -379,7 +383,10 @@
2494
// Create a new device, as a copy of this current one.
2495
bool qsamplerDevice::createDevice (void)
2497
- if (client() == NULL)
2498
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2499
+ if (pMainForm == NULL)
2501
+ if (pMainForm->client() == NULL)
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");
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");
2520
@@ -431,16 +438,22 @@
2521
// Destroy existing device.
2522
bool qsamplerDevice::deleteDevice (void)
2524
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2525
+ if (pMainForm == NULL)
2527
+ if (pMainForm->client() == NULL)
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");
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");
2545
@@ -526,6 +539,12 @@
2546
// Refresh/set given parameter based on driver supplied dependencies.
2547
int qsamplerDevice::refreshParam ( const QString& sParam )
2549
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2550
+ if (pMainForm == NULL)
2552
+ if (pMainForm->client() == NULL)
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");
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");
2573
@@ -584,33 +603,38 @@
2574
// Redirected messages output methods.
2575
void qsamplerDevice::appendMessages( const QString& s ) const
2578
- m_pMainForm->appendMessages(deviceName() + ' ' + s);
2579
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2581
+ pMainForm->appendMessages(deviceName() + ' ' + s);
2584
void qsamplerDevice::appendMessagesColor( const QString& s,
2585
const QString& c ) const
2588
- m_pMainForm->appendMessagesColor(deviceName() + ' ' + s, c);
2589
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2591
+ pMainForm->appendMessagesColor(deviceName() + ' ' + s, c);
2594
void qsamplerDevice::appendMessagesText( const QString& s ) const
2597
- m_pMainForm->appendMessagesText(deviceName() + ' ' + s);
2598
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2600
+ pMainForm->appendMessagesText(deviceName() + ' ' + s);
2603
void qsamplerDevice::appendMessagesError( const QString& s ) const
2606
- m_pMainForm->appendMessagesError(deviceName() + "\n\n" + s);
2607
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2609
+ pMainForm->appendMessagesError(deviceName() + "\n\n" + s);
2612
void qsamplerDevice::appendMessagesClient( const QString& s ) const
2615
- m_pMainForm->appendMessagesClient(deviceName() + ' ' + s);
2616
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2618
+ pMainForm->appendMessagesClient(deviceName() + ' ' + s);
2626
- for (int iDriver = 0; ppszDrivers[iDriver]; iDriver++)
2627
+ for (int iDriver = 0; ppszDrivers && ppszDrivers[iDriver]; iDriver++)
2628
drivers.append(ppszDrivers[iDriver]);
2631
@@ -678,6 +702,12 @@
2633
void qsamplerDevicePort::setDevicePort ( int iPortID )
2635
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2636
+ if (pMainForm == NULL)
2638
+ if (pMainForm->client() == NULL)
2641
// Device port id should be always set.
2642
m_iPortID = iPortID;
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");
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");
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");
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");
2675
@@ -761,6 +791,12 @@
2676
bool qsamplerDevicePort::setParam ( const QString& sParam,
2677
const QString& sValue )
2679
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2680
+ if (pMainForm == NULL)
2682
+ if (pMainForm->client() == NULL)
2685
// Set proper port/channel parameter.
2686
m_params[sParam.upper()].value = sValue;
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, ¶m)) != LSCP_OK)
2695
m_device.appendMessagesClient("lscp_set_audio_channel_param");
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, ¶m)) != LSCP_OK)
2701
m_device.appendMessagesClient("lscp_set_midi_port_param");
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)
2712
switch(m_device.deviceType()) {
2713
case qsamplerDevice::Audio:
2717
qsamplerDeviceItem::qsamplerDeviceItem ( QListViewItem *pItem,
2718
- qsamplerMainForm *pMainForm, qsamplerDevice::qsamplerDeviceType deviceType,
2719
+ qsamplerDevice::qsamplerDeviceType deviceType,
2721
- : QListViewItem(pItem), m_device(pMainForm, deviceType, iDeviceID)
2722
+ : QListViewItem(pItem), m_device(deviceType, iDeviceID)
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
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.
2737
This program is free software; you can redistribute it and/or
2738
modify it under the terms of the GNU General Public License
2740
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2741
GNU General Public License for more details.
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.
2750
*****************************************************************************/
2753
enum qsamplerDeviceType { None, Midi, Audio };
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.
2763
// Driver name initializer.
2764
void setDriver(const QString& sDriverName);
2766
- // LSCP client descriptor accessor.
2767
- lscp_client_t *client() const;
2769
// Device property accessors.
2770
int deviceID() const;
2771
qsamplerDeviceType deviceType() const;
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
2789
<class>qsamplerDeviceForm</class>
2790
<comment>qsampler - A LinuxSampler Qt GUI Interface.
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.
2795
This program is free software; you can redistribute it and/or
2796
modify it under the terms of the GNU General Public License
2798
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2799
GNU General Public License for more details.
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.
2809
<author>rncbc aka Rui Nuno Capela</author>
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 & sDriverName )</function>
2818
<function specifier="non virtual">setDevice( qsamplerDevice *pDevice )</function>
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
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.
2831
This program is free software; you can redistribute it and/or
2832
modify it under the terms of the GNU General Public License
2834
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2835
GNU General Public License for more details.
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.
2844
*****************************************************************************/
2847
void qsamplerDeviceForm::init (void)
2849
// Initialize locals.
2850
- m_pMainForm = NULL;
2854
m_bNewDevice = false;
2856
// Notify our parent that we're emerging.
2857
void qsamplerDeviceForm::showEvent ( QShowEvent *pShowEvent )
2860
- m_pMainForm->stabilizeForm();
2861
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2863
+ pMainForm->stabilizeForm();
2869
QWidget::hideEvent(pHideEvent);
2872
- m_pMainForm->stabilizeForm();
2873
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2875
+ pMainForm->stabilizeForm();
2877
// Signal special whether we changed the device set.
2878
if (m_iDirtyCount > 0) {
2883
-// Application main form settler (life depends on it).
2884
-void qsamplerDeviceForm::setMainForm ( qsamplerMainForm *pMainForm )
2886
- m_pMainForm = pMainForm;
2890
// Set device type spacial exclusive mode.
2891
void qsamplerDeviceForm::setDeviceTypeMode (
2892
qsamplerDevice::qsamplerDeviceType deviceTypeMode )
2893
@@ -115,21 +108,6 @@
2897
-// Device configuration dialog setup formal initializer.
2898
-void qsamplerDeviceForm::setClient ( lscp_client_t *pClient )
2900
- // If it has not changed, do nothing.
2901
- if (m_pClient && m_pClient == pClient)
2904
- // Set new reference.
2905
- m_pClient = pClient;
2907
- // OK. Do a whole refresh around.
2912
// Device driver name setup formal initializer.
2913
void qsamplerDeviceForm::setDriverName ( const QString& sDriverName )
2916
// Create a new device from current table view.
2917
void qsamplerDeviceForm::createDevice (void)
2919
- if (m_pMainForm == NULL)
2920
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2921
+ if (pMainForm == NULL)
2924
QListViewItem *pItem = DeviceListView->selectedItem();
2925
@@ -214,11 +193,11 @@
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();
2940
// Delete current device in table view.
2941
void qsamplerDeviceForm::deleteDevice (void)
2943
- if (m_pMainForm == NULL)
2944
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2945
+ if (pMainForm == NULL)
2948
QListViewItem *pItem = DeviceListView->selectedItem();
2950
qsamplerDevice& device = ((qsamplerDeviceItem *) pItem)->device();
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"),
2959
// Remove it from the device view...
2961
// Main session should be marked dirty.
2962
- m_pMainForm->sessionDirty();
2963
+ pMainForm->sessionDirty();
2968
// Refresh all device list and views.
2969
void qsamplerDeviceForm::refreshDevices (void)
2971
- if (m_pMainForm == NULL)
2972
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
2973
+ if (pMainForm == NULL)
2976
// Avoid nested changes.
2977
@@ -275,18 +256,19 @@
2978
m_pAudioItems = NULL;
2979
m_pMidiItems = NULL;
2980
DeviceListView->clear();
2982
+ if (pMainForm->client()) {
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);
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]);
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);
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]);
3017
m_pMidiItems->setOpen(true);
3018
@@ -346,6 +329,10 @@
3019
// Device selection slot.
3020
void qsamplerDeviceForm::selectDevice (void)
3022
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3023
+ if (pMainForm == NULL)
3026
if (m_iDirtySetup > 0)
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();
3037
// Do we need a driver name?
3039
// Device parameter value change slot.
3040
void qsamplerDeviceForm::changeDeviceParam ( int iRow, int iCol )
3042
- if (m_pMainForm == NULL)
3044
if (m_iDirtySetup > 0)
3046
if (iRow < 0 || iCol < 0)
3047
@@ -494,16 +479,17 @@
3052
// Main session should be dirtier...
3053
- m_pMainForm->sessionDirty();
3054
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3056
+ pMainForm->sessionDirty();
3060
// Device port/channel parameter value change slot.
3061
void qsamplerDeviceForm::changeDevicePortParam ( int iRow, int iCol )
3063
- if (m_pMainForm == NULL)
3065
if (m_iDirtySetup > 0)
3067
if (iRow < 0 || iCol < 0)
3068
@@ -531,20 +517,27 @@
3069
pPort->setParam(sParam, sValue);
3073
// Main session should be dirtier...
3074
- m_pMainForm->sessionDirty();
3075
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3077
+ pMainForm->sessionDirty();
3081
// Device list view context menu handler.
3082
void qsamplerDeviceForm::contextMenu ( QListViewItem *pItem, const QPoint& pos, int )
3084
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3085
+ if (pMainForm == NULL)
3090
// Build the device context menu...
3091
QPopupMenu* pContextMenu = new QPopupMenu(this);
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")),
3099
// Stabilize current form state.
3100
void qsamplerDeviceForm::stabilizeForm (void)
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
3114
+// qsamplerInstrument.cpp
3116
+/****************************************************************************
3117
+ Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
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.
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.
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.
3133
+*****************************************************************************/
3135
+#include "qsamplerAbout.h"
3136
+#include "qsamplerInstrument.h"
3138
+#include "qsamplerMainForm.h"
3141
+//-------------------------------------------------------------------------
3142
+// qsamplerInstrument - MIDI instrument map structure.
3146
+qsamplerInstrument::qsamplerInstrument ( int iMap, int iBank, int iProg )
3151
+ m_iInstrumentNr = 0;;
3156
+// Default destructor.
3157
+qsamplerInstrument::~qsamplerInstrument (void)
3162
+// Instrument accessors.
3163
+void qsamplerInstrument::setMap ( int iMap )
3168
+int qsamplerInstrument::map (void) const
3174
+void qsamplerInstrument::setBank ( int iBank )
3179
+int qsamplerInstrument::bank (void) const
3185
+void qsamplerInstrument::setProg ( int iProg )
3190
+int qsamplerInstrument::prog (void) const
3196
+void qsamplerInstrument::setName ( const QString& sName )
3201
+const QString& qsamplerInstrument::name (void) const
3207
+void qsamplerInstrument::setEngineName ( const QString& sEngineName )
3209
+ m_sEngineName = sEngineName;
3212
+const QString& qsamplerInstrument::engineName (void) const
3214
+ return m_sEngineName;
3218
+void qsamplerInstrument::setInstrumentFile ( const QString& sInstrumentFile )
3220
+ m_sInstrumentFile = sInstrumentFile;
3223
+const QString& qsamplerInstrument::instrumentFile (void) const
3225
+ return m_sInstrumentFile;
3229
+const QString& qsamplerInstrument::instrumentName (void) const
3231
+ return m_sInstrumentName;
3235
+void qsamplerInstrument::setInstrumentNr ( int iInstrumentNr )
3237
+ m_iInstrumentNr = iInstrumentNr;
3240
+int qsamplerInstrument::instrumentNr (void) const
3242
+ return m_iInstrumentNr;
3246
+void qsamplerInstrument::setVolume ( float fVolume )
3248
+ m_fVolume = fVolume;
3251
+float qsamplerInstrument::volume (void) const
3257
+void qsamplerInstrument::setLoadMode ( int iLoadMode )
3259
+ m_iLoadMode = iLoadMode;
3262
+int qsamplerInstrument::loadMode (void) const
3264
+ return m_iLoadMode;
3269
+bool qsamplerInstrument::mapInstrument (void)
3271
+#ifdef CONFIG_MIDI_INSTRUMENT
3273
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3274
+ if (pMainForm == NULL)
3276
+ if (pMainForm->client() == NULL)
3279
+ if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
3282
+ lscp_midi_instrument_t instr;
3284
+ instr.map = m_iMap;
3285
+ instr.bank = (m_iBank & 0x0fff);
3286
+ instr.prog = (m_iProg & 0x7f);
3288
+ lscp_load_mode_t load_mode;
3289
+ switch (m_iLoadMode) {
3291
+ load_mode = LSCP_LOAD_PERSISTENT;
3294
+ load_mode = LSCP_LOAD_ON_DEMAND_HOLD;
3297
+ load_mode = LSCP_LOAD_ON_DEMAND;
3301
+ load_mode = LSCP_LOAD_DEFAULT;
3305
+ if (::lscp_map_midi_instrument(pMainForm->client(), &instr,
3306
+ m_sEngineName.latin1(),
3307
+ m_sInstrumentFile.latin1(),
3311
+ m_sName.latin1()) != LSCP_OK) {
3312
+ pMainForm->appendMessagesClient("lscp_map_midi_instrument");
3326
+bool qsamplerInstrument::unmapInstrument (void)
3328
+#ifdef CONFIG_MIDI_INSTRUMENT
3330
+ if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
3333
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3334
+ if (pMainForm == NULL)
3336
+ if (pMainForm->client() == NULL)
3339
+ lscp_midi_instrument_t instr;
3341
+ instr.map = m_iMap;
3342
+ instr.bank = (m_iBank & 0x0fff);
3343
+ instr.prog = (m_iProg & 0x7f);
3345
+ if (::lscp_unmap_midi_instrument(pMainForm->client(), &instr) != LSCP_OK) {
3346
+ pMainForm->appendMessagesClient("lscp_unmap_midi_instrument");
3360
+bool qsamplerInstrument::getInstrument (void)
3362
+#ifdef CONFIG_MIDI_INSTRUMENT
3364
+ if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
3367
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3368
+ if (pMainForm == NULL)
3370
+ if (pMainForm->client() == NULL)
3373
+ lscp_midi_instrument_t instr;
3375
+ instr.map = m_iMap;
3376
+ instr.bank = (m_iBank & 0x0fff);
3377
+ instr.prog = (m_iProg & 0x7f);
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");
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;
3393
+ switch (pInstrInfo->load_mode) {
3394
+ case LSCP_LOAD_PERSISTENT:
3397
+ case LSCP_LOAD_ON_DEMAND_HOLD:
3400
+ case LSCP_LOAD_ON_DEMAND:
3403
+ case LSCP_LOAD_DEFAULT:
3410
+ if (m_sName.isEmpty())
3411
+ m_sName = m_sInstrumentName;
3423
+// Instrument map name enumerator.
3424
+QStringList qsamplerInstrument::getMapNames (void)
3428
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3429
+ if (pMainForm == NULL)
3431
+ if (pMainForm->client() == NULL)
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");
3440
+ for (int iMap = 0; piMaps[iMap] >= 0; iMap++) {
3441
+ const QString& sMapName = getMapName(piMaps[iMap]);
3442
+ if (!sMapName.isEmpty())
3443
+ maps.append(sMapName);
3451
+// Instrument map name enumerator.
3452
+QString qsamplerInstrument::getMapName ( int iMidiMap )
3456
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
3457
+ if (pMainForm == NULL)
3459
+ if (pMainForm->client() == NULL)
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");
3470
+ sMapName = QString("%1 - %2").arg(iMidiMap).arg(pszMapName);
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
3483
+// qsamplerInstrument.h
3485
+/****************************************************************************
3486
+ Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
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.
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.
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.
3502
+*****************************************************************************/
3504
+#ifndef __qsamplerInstrument_h
3505
+#define __qsamplerInstrument_h
3507
+#include <qstringlist.h>
3510
+//-------------------------------------------------------------------------
3511
+// qsamplerInstrument - MIDI instrument map structure.
3514
+class qsamplerInstrument
3519
+ qsamplerInstrument(int iMap = 0, int iBank = -1, int iProg = -1);
3521
+ // Default destructor.
3522
+ ~qsamplerInstrument();
3524
+ // Instrument accessors.
3525
+ void setMap(int iMap);
3528
+ void setBank(int iBank);
3531
+ void setProg(int iProg);
3534
+ void setName(const QString& sName);
3535
+ const QString& name() const;
3537
+ void setEngineName(const QString& sEngineName);
3538
+ const QString& engineName() const;
3540
+ void setInstrumentFile(const QString& sInstrumentFile);
3541
+ const QString& instrumentFile() const;
3543
+ const QString& instrumentName() const;
3545
+ void setInstrumentNr(int InstrumentNr);
3546
+ int instrumentNr() const;
3548
+ void setVolume(float fVolume);
3549
+ float volume() const;
3551
+ void setLoadMode(int iLoadMode);
3552
+ int loadMode() const;
3555
+ bool getInstrument();
3556
+ bool mapInstrument();
3557
+ bool unmapInstrument();
3559
+ // Instrument map names initialization...
3560
+ static QStringList getMapNames();
3561
+ static QString getMapName(int iMidiMap);
3565
+ // Instance variables.
3570
+ QString m_sEngineName;
3571
+ QString m_sInstrumentFile;
3572
+ QString m_sInstrumentName;
3573
+ int m_iInstrumentNr;
3580
+#endif // __qsamplerInstrument_h
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
3589
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
3590
+<class>qsamplerInstrumentForm</class>
3591
+<comment>qsampler - A LinuxSampler Qt GUI Interface.
3593
+ Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
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.
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.
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.
3610
+<author>rncbc aka Rui Nuno Capela</author>
3611
+<widget class="QDialog">
3612
+ <property name="name">
3613
+ <cstring>qsamplerInstrumentForm</cstring>
3615
+ <property name="geometry">
3619
+ <width>452</width>
3620
+ <height>226</height>
3623
+ <property name="sizePolicy">
3625
+ <hsizetype>7</hsizetype>
3626
+ <vsizetype>1</vsizetype>
3627
+ <horstretch>0</horstretch>
3628
+ <verstretch>0</verstretch>
3631
+ <property name="caption">
3632
+ <string>Qsampler: MIDI Instrument</string>
3634
+ <property name="focusPolicy">
3635
+ <enum>StrongFocus</enum>
3638
+ <property name="name">
3639
+ <cstring>unnamed</cstring>
3641
+ <widget class="QLayoutWidget">
3642
+ <property name="name">
3643
+ <cstring>layout5</cstring>
3646
+ <property name="name">
3647
+ <cstring>unnamed</cstring>
3649
+ <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="9">
3650
+ <property name="name">
3651
+ <cstring>EngineNameComboBox</cstring>
3653
+ <property name="sizePolicy">
3655
+ <hsizetype>7</hsizetype>
3656
+ <vsizetype>0</vsizetype>
3657
+ <horstretch>0</horstretch>
3658
+ <verstretch>0</verstretch>
3661
+ <property name="toolTip" stdset="0">
3662
+ <string>Engine name</string>
3665
+ <widget class="QLabel" row="2" column="0">
3666
+ <property name="name">
3667
+ <cstring>EngineNameTextLabel</cstring>
3669
+ <property name="text">
3670
+ <string>&Engine:</string>
3672
+ <property name="alignment">
3673
+ <set>AlignVCenter|AlignRight</set>
3675
+ <property name="buddy" stdset="0">
3676
+ <cstring>EngineNameComboBox</cstring>
3679
+ <widget class="QLabel" row="0" column="7">
3680
+ <property name="name">
3681
+ <cstring>ProgTextLabel</cstring>
3683
+ <property name="text">
3684
+ <string>&Prog:</string>
3686
+ <property name="alignment">
3687
+ <set>AlignVCenter|AlignRight</set>
3689
+ <property name="buddy" stdset="0">
3690
+ <cstring>ProgSpinBox</cstring>
3693
+ <widget class="QSpinBox" row="0" column="8" rowspan="1" colspan="2">
3694
+ <property name="name">
3695
+ <cstring>ProgSpinBox</cstring>
3697
+ <property name="maxValue">
3698
+ <number>128</number>
3700
+ <property name="minValue">
3701
+ <number>1</number>
3703
+ <property name="toolTip" stdset="0">
3704
+ <string>Program (0-127)</string>
3707
+ <widget class="QLabel" row="5" column="0">
3708
+ <property name="name">
3709
+ <cstring>VolumeTextLabel</cstring>
3711
+ <property name="text">
3712
+ <string>Vol&ume:</string>
3714
+ <property name="alignment">
3715
+ <set>AlignVCenter|AlignRight</set>
3717
+ <property name="buddy" stdset="0">
3718
+ <cstring>VolumeSpinBox</cstring>
3721
+ <widget class="QLabel" row="0" column="0">
3722
+ <property name="name">
3723
+ <cstring>MapTextLabel</cstring>
3725
+ <property name="text">
3726
+ <string>&Map:</string>
3728
+ <property name="alignment">
3729
+ <set>AlignVCenter|AlignRight</set>
3731
+ <property name="buddy" stdset="0">
3732
+ <cstring>MapComboBox</cstring>
3735
+ <widget class="QLabel" row="0" column="3" rowspan="1" colspan="2">
3736
+ <property name="name">
3737
+ <cstring>BankTextLabel</cstring>
3739
+ <property name="text">
3740
+ <string>&Bank:</string>
3742
+ <property name="alignment">
3743
+ <set>AlignVCenter|AlignRight</set>
3745
+ <property name="buddy" stdset="0">
3746
+ <cstring>BankSpinBox</cstring>
3749
+ <widget class="QSpinBox" row="0" column="5" rowspan="1" colspan="2">
3750
+ <property name="name">
3751
+ <cstring>BankSpinBox</cstring>
3753
+ <property name="maxValue">
3754
+ <number>16383</number>
3756
+ <property name="toolTip" stdset="0">
3757
+ <string>Bank (0-16383)</string>
3760
+ <widget class="QComboBox" row="3" column="1" rowspan="1" colspan="8">
3761
+ <property name="name">
3762
+ <cstring>InstrumentFileComboBox</cstring>
3764
+ <property name="sizePolicy">
3766
+ <hsizetype>7</hsizetype>
3767
+ <vsizetype>0</vsizetype>
3768
+ <horstretch>0</horstretch>
3769
+ <verstretch>0</verstretch>
3772
+ <property name="minimumSize">
3774
+ <width>320</width>
3775
+ <height>0</height>
3778
+ <property name="editable">
3781
+ <property name="toolTip" stdset="0">
3782
+ <string>Instrument filename</string>
3785
+ <widget class="QLabel" row="5" column="4" rowspan="1" colspan="2">
3786
+ <property name="name">
3787
+ <cstring>LoadModeNameTextLabel</cstring>
3789
+ <property name="text">
3790
+ <string>M&ode:</string>
3792
+ <property name="alignment">
3793
+ <set>AlignVCenter|AlignRight</set>
3795
+ <property name="buddy" stdset="0">
3796
+ <cstring>LoadModeComboBox</cstring>
3799
+ <spacer row="5" column="2" rowspan="1" colspan="2">
3800
+ <property name="name">
3801
+ <cstring>spacer2</cstring>
3803
+ <property name="orientation">
3804
+ <enum>Horizontal</enum>
3806
+ <property name="sizeType">
3807
+ <enum>Expanding</enum>
3809
+ <property name="sizeHint">
3811
+ <width>119</width>
3812
+ <height>8</height>
3816
+ <widget class="QLabel" row="3" column="0">
3817
+ <property name="name">
3818
+ <cstring>InstrumentFileTextLabel</cstring>
3820
+ <property name="text">
3821
+ <string>&Filename:</string>
3823
+ <property name="alignment">
3824
+ <set>AlignVCenter|AlignRight</set>
3826
+ <property name="buddy" stdset="0">
3827
+ <cstring>InstrumentFileComboBox</cstring>
3830
+ <widget class="QLabel" row="1" column="0">
3831
+ <property name="name">
3832
+ <cstring>NameTextLabe</cstring>
3834
+ <property name="text">
3835
+ <string>&Name:</string>
3837
+ <property name="alignment">
3838
+ <set>AlignVCenter|AlignRight</set>
3840
+ <property name="buddy" stdset="0">
3841
+ <cstring>NameLineEdit</cstring>
3844
+ <widget class="QComboBox" row="0" column="1" rowspan="1" colspan="2">
3845
+ <property name="name">
3846
+ <cstring>MapComboBox</cstring>
3848
+ <property name="sizePolicy">
3850
+ <hsizetype>7</hsizetype>
3851
+ <vsizetype>0</vsizetype>
3852
+ <horstretch>0</horstretch>
3853
+ <verstretch>0</verstretch>
3856
+ <property name="toolTip" stdset="0">
3857
+ <string>Instrument map</string>
3860
+ <widget class="QLabel" row="4" column="0">
3861
+ <property name="name">
3862
+ <cstring>InstrumentNrTextLabel</cstring>
3864
+ <property name="text">
3865
+ <string>&Instrument:</string>
3867
+ <property name="alignment">
3868
+ <set>AlignVCenter|AlignRight</set>
3870
+ <property name="buddy" stdset="0">
3871
+ <cstring>InstrumentNrComboBox</cstring>
3874
+ <widget class="QComboBox" row="4" column="1" rowspan="1" colspan="9">
3875
+ <property name="name">
3876
+ <cstring>InstrumentNrComboBox</cstring>
3878
+ <property name="sizePolicy">
3880
+ <hsizetype>7</hsizetype>
3881
+ <vsizetype>0</vsizetype>
3882
+ <horstretch>0</horstretch>
3883
+ <verstretch>0</verstretch>
3886
+ <property name="minimumSize">
3888
+ <width>320</width>
3889
+ <height>0</height>
3892
+ <property name="toolTip" stdset="0">
3893
+ <string>Instrument name</string>
3896
+ <widget class="QSpinBox" row="5" column="1">
3897
+ <property name="name">
3898
+ <cstring>VolumeSpinBox</cstring>
3900
+ <property name="suffix">
3901
+ <string> %</string>
3903
+ <property name="maxValue">
3904
+ <number>100</number>
3906
+ <property name="toolTip" stdset="0">
3907
+ <string>Volume (%)</string>
3910
+ <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="9">
3911
+ <property name="name">
3912
+ <cstring>NameLineEdit</cstring>
3914
+ <property name="toolTip" stdset="0">
3915
+ <string>Name</string>
3918
+ <widget class="QComboBox" row="5" column="6" rowspan="1" colspan="4">
3920
+ <property name="text">
3921
+ <string>Default</string>
3925
+ <property name="text">
3926
+ <string>On Demand</string>
3930
+ <property name="text">
3931
+ <string>On Demand Hold</string>
3935
+ <property name="text">
3936
+ <string>Persistent</string>
3939
+ <property name="name">
3940
+ <cstring>LoadModeComboBox</cstring>
3942
+ <property name="sizePolicy">
3944
+ <hsizetype>7</hsizetype>
3945
+ <vsizetype>0</vsizetype>
3946
+ <horstretch>0</horstretch>
3947
+ <verstretch>0</verstretch>
3950
+ <property name="toolTip" stdset="0">
3951
+ <string>Load mode</string>
3954
+ <widget class="QToolButton" row="3" column="9">
3955
+ <property name="name">
3956
+ <cstring>InstrumentFileToolButton</cstring>
3958
+ <property name="sizePolicy">
3960
+ <hsizetype>0</hsizetype>
3961
+ <vsizetype>0</vsizetype>
3962
+ <horstretch>0</horstretch>
3963
+ <verstretch>0</verstretch>
3966
+ <property name="minimumSize">
3969
+ <height>24</height>
3972
+ <property name="maximumSize">
3975
+ <height>26</height>
3978
+ <property name="focusPolicy">
3979
+ <enum>TabFocus</enum>
3981
+ <property name="text">
3984
+ <property name="iconSet">
3985
+ <iconset>fileOpen.png</iconset>
3987
+ <property name="toolTip" stdset="0">
3988
+ <string>Browse for instrument filename</string>
3993
+ <widget class="QLayoutWidget">
3994
+ <property name="name">
3995
+ <cstring>layout2</cstring>
3998
+ <property name="name">
3999
+ <cstring>unnamed</cstring>
4002
+ <property name="name">
4003
+ <cstring>spacer3</cstring>
4005
+ <property name="orientation">
4006
+ <enum>Horizontal</enum>
4008
+ <property name="sizeType">
4009
+ <enum>Expanding</enum>
4011
+ <property name="sizeHint">
4014
+ <height>8</height>
4018
+ <widget class="QPushButton">
4019
+ <property name="name">
4020
+ <cstring>OkPushButton</cstring>
4022
+ <property name="text">
4023
+ <string>O&K</string>
4025
+ <property name="accel">
4026
+ <string>Alt+K</string>
4028
+ <property name="iconSet">
4029
+ <iconset>formAccept.png</iconset>
4032
+ <widget class="QPushButton">
4033
+ <property name="name">
4034
+ <cstring>CancelPushButton</cstring>
4036
+ <property name="text">
4037
+ <string>C&ancel</string>
4039
+ <property name="accel">
4040
+ <string>Alt+A</string>
4042
+ <property name="iconSet">
4043
+ <iconset>formReject.png</iconset>
4052
+ <sender>MapComboBox</sender>
4053
+ <signal>activated(int)</signal>
4054
+ <receiver>qsamplerInstrumentForm</receiver>
4055
+ <slot>changed()</slot>
4058
+ <sender>BankSpinBox</sender>
4059
+ <signal>valueChanged(int)</signal>
4060
+ <receiver>qsamplerInstrumentForm</receiver>
4061
+ <slot>changed()</slot>
4064
+ <sender>ProgSpinBox</sender>
4065
+ <signal>valueChanged(int)</signal>
4066
+ <receiver>qsamplerInstrumentForm</receiver>
4067
+ <slot>changed()</slot>
4070
+ <sender>NameLineEdit</sender>
4071
+ <signal>textChanged(const QString&)</signal>
4072
+ <receiver>qsamplerInstrumentForm</receiver>
4073
+ <slot>nameChanged(const QString&)</slot>
4076
+ <sender>EngineNameComboBox</sender>
4077
+ <signal>activated(int)</signal>
4078
+ <receiver>qsamplerInstrumentForm</receiver>
4079
+ <slot>changed()</slot>
4082
+ <sender>InstrumentFileComboBox</sender>
4083
+ <signal>activated(const QString&)</signal>
4084
+ <receiver>qsamplerInstrumentForm</receiver>
4085
+ <slot>updateInstrumentName()</slot>
4088
+ <sender>InstrumentFileToolButton</sender>
4089
+ <signal>clicked()</signal>
4090
+ <receiver>qsamplerInstrumentForm</receiver>
4091
+ <slot>openInstrumentFile()</slot>
4094
+ <sender>InstrumentNrComboBox</sender>
4095
+ <signal>activated(int)</signal>
4096
+ <receiver>qsamplerInstrumentForm</receiver>
4097
+ <slot>instrumentNrChanged()</slot>
4100
+ <sender>VolumeSpinBox</sender>
4101
+ <signal>valueChanged(int)</signal>
4102
+ <receiver>qsamplerInstrumentForm</receiver>
4103
+ <slot>changed()</slot>
4106
+ <sender>LoadModeComboBox</sender>
4107
+ <signal>activated(int)</signal>
4108
+ <receiver>qsamplerInstrumentForm</receiver>
4109
+ <slot>changed()</slot>
4112
+ <sender>OkPushButton</sender>
4113
+ <signal>clicked()</signal>
4114
+ <receiver>qsamplerInstrumentForm</receiver>
4115
+ <slot>accept()</slot>
4118
+ <sender>CancelPushButton</sender>
4119
+ <signal>clicked()</signal>
4120
+ <receiver>qsamplerInstrumentForm</receiver>
4121
+ <slot>reject()</slot>
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>
4139
+ <forward>class qsamplerInstrument;</forward>
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>
4148
+ <slot specifier="non virtual">nameChanged( const QString& 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>
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>
4163
+<layoutdefaults spacing="4" margin="4"/>
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
4170
+// qsamplerInstrumentForm.ui.h
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.
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.
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.
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.
4190
+*****************************************************************************/
4192
+#include "qsamplerAbout.h"
4193
+#include "qsamplerInstrument.h"
4195
+#include "qsamplerOptions.h"
4196
+#include "qsamplerChannel.h"
4198
+#include "qsamplerMainForm.h"
4200
+#include <qmessagebox.h>
4201
+#include <qfiledialog.h>
4202
+#include <qfileinfo.h>
4203
+#include <qlistbox.h>
4205
+// Needed for lroundf()
4208
+#ifndef CONFIG_ROUND
4209
+static inline long lroundf ( float x )
4212
+ return long(x + 0.5f);
4214
+ return long(x - 0.5f);
4219
+// Kind of constructor.
4220
+void qsamplerInstrumentForm::init (void)
4222
+ // Initialize locals.
4223
+ m_pInstrument = NULL;
4225
+ m_iDirtySetup = 0;
4226
+ m_iDirtyCount = 0;
4229
+ // Try to restore normal window positioning.
4234
+// Kind of destructor.
4235
+void qsamplerInstrumentForm::destroy (void)
4240
+// Channel dialog setup formal initializer.
4241
+void qsamplerInstrumentForm::setup ( qsamplerInstrument *pInstrument )
4243
+ m_pInstrument = pInstrument;
4245
+ m_iDirtySetup = 0;
4246
+ m_iDirtyCount = 0;
4249
+ if (m_pInstrument == NULL)
4252
+ // Check if we're up and connected.
4253
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
4254
+ if (pMainForm == NULL)
4256
+ if (pMainForm->client() == NULL)
4259
+ qsamplerOptions *pOptions = pMainForm->options();
4260
+ if (pOptions == NULL)
4263
+ // It can be a brand new channel, remember?
4264
+ bool bNew = (m_pInstrument->bank() < 0 || m_pInstrument->prog() < 0);
4266
+ m_pInstrument->getInstrument();
4270
+ // Avoid nested changes.
4273
+ // Load combo box history...
4274
+ pOptions->loadComboBoxHistory(InstrumentFileComboBox);
4276
+ // Populate maps list.
4277
+ MapComboBox->clear();
4278
+ MapComboBox->insertStringList(qsamplerInstrument::getMapNames());
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]);
4287
+ else pMainForm->appendMessagesClient("lscp_list_available_engines");
4289
+ // Read proper instrument information,
4290
+ // and populate the instrument form fields.
4292
+ // Instrument map name...
4293
+ int iMap = (bNew ? pOptions->iMidiMap : m_pInstrument->map());
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);
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) {
4311
+ BankSpinBox->setValue(iBank);
4312
+ ProgSpinBox->setValue(iProg);
4314
+ // Instrument name...
4315
+ NameLineEdit->setText(m_pInstrument->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);
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());
4339
+ // Instrument volume....
4340
+ int iVolume = (bNew ? pOptions->iVolume :
4341
+ ::lroundf(100.0f * m_pInstrument->volume()));
4342
+ VolumeSpinBox->setValue(iVolume);
4344
+ // Instrument load mode...
4345
+ int iLoadMode = (bNew ? pOptions->iLoadMode :
4346
+ m_pInstrument->loadMode());
4347
+ LoadModeComboBox->setCurrentItem(iLoadMode);
4359
+// Special case for name change,
4360
+void qsamplerInstrumentForm::nameChanged ( const QString& /* sName */ )
4362
+ if (m_iDirtySetup > 0)
4370
+// Browse and open an instrument file.
4371
+void qsamplerInstrumentForm::openInstrumentFile (void)
4373
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
4374
+ if (pMainForm == NULL)
4377
+ qsamplerOptions *pOptions = pMainForm->options();
4378
+ if (pOptions == NULL)
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.
4390
+ if (sInstrumentFile.isEmpty())
4393
+ InstrumentFileComboBox->setCurrentText(sInstrumentFile);
4394
+ updateInstrumentName();
4398
+// Refresh the actual instrument name.
4399
+void qsamplerInstrumentForm::updateInstrumentName (void)
4401
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
4402
+ if (pMainForm == NULL)
4405
+ qsamplerOptions *pOptions = pMainForm->options();
4406
+ if (pOptions == NULL)
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)
4418
+ instrumentNrChanged();
4422
+// Special case for instrumnet index change,
4423
+void qsamplerInstrumentForm::instrumentNrChanged (void)
4425
+ if (m_iDirtySetup > 0)
4428
+ if (NameLineEdit->text().isEmpty() || m_iDirtyName == 0) {
4429
+ NameLineEdit->setText(InstrumentNrComboBox->currentText());
4437
+// Accept settings (OK button slot).
4438
+void qsamplerInstrumentForm::accept (void)
4440
+ if (m_pInstrument == NULL)
4443
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
4444
+ if (pMainForm == NULL)
4446
+ if (pMainForm->client() == NULL)
4449
+ qsamplerOptions *pOptions = pMainForm->options();
4450
+ if (pOptions == NULL)
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());
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);
4475
+ // Just go with dialog acceptance.
4476
+ QDialog::accept();
4480
+// Reject settings (Cancel button slot).
4481
+void qsamplerInstrumentForm::reject (void)
4483
+ bool bReject = true;
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...
4495
+ case 1: // Discard
4497
+ default: // Cancel.
4504
+ QDialog::reject();
4508
+// Dirty up settings.
4509
+void qsamplerInstrumentForm::changed (void)
4511
+ if (m_iDirtySetup > 0)
4519
+// Stabilize current form state.
4520
+void qsamplerInstrumentForm::stabilizeForm (void)
4522
+ bool bValid =!NameLineEdit->text().isEmpty();
4524
+ const QString& sPath = InstrumentFileComboBox->currentText();
4525
+ bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists();
4527
+ OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid);
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
4537
+// qsamplerInstrumentList.cpp
4539
+/****************************************************************************
4540
+ Copyright (C) 2003-2007, rncbc aka Rui Nuno Capela. All rights reserved.
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.
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.
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.
4556
+*****************************************************************************/
4558
+#include "qsamplerAbout.h"
4559
+#include "qsamplerInstrumentList.h"
4561
+#include "qsamplerInstrument.h"
4562
+#include "qsamplerInstrumentForm.h"
4564
+#include "qsamplerOptions.h"
4565
+#include "qsamplerMainForm.h"
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>
4575
+// Needed for lroundf()
4578
+#ifndef CONFIG_ROUND
4579
+static inline long lroundf ( float x )
4582
+ return long(x + 0.5f);
4584
+ return long(x - 0.5f);
4589
+//----------------------------------------------------------------------
4590
+// class qsamplerInstrumentGroup -- custom group list view item.
4594
+qsamplerInstrumentGroup::qsamplerInstrumentGroup (
4595
+ qsamplerInstrumentList *pListView, const QString& sName,
4596
+ QListViewItem *pItemAfter )
4597
+ : QListViewItem(pListView, pItemAfter ? pItemAfter : pListView->lastItem())
4599
+ QListViewItem::setRenameEnabled(0, true);
4601
+ QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));
4602
+ QListViewItem::setText(0, sName);
4606
+qsamplerInstrumentGroup::qsamplerInstrumentGroup (
4607
+ qsamplerInstrumentGroup *pGroupItem, const QString& sName )
4608
+ : QListViewItem(pGroupItem, sName)
4610
+ QListViewItem::setRenameEnabled(0, true);
4612
+ QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));
4616
+// Default destructor.
4617
+qsamplerInstrumentGroup::~qsamplerInstrumentGroup (void)
4622
+// Instance accessors.
4623
+void qsamplerInstrumentGroup::setName ( const QString& sName )
4625
+ QListViewItem::setText(0, sName);
4629
+QString qsamplerInstrumentGroup::name (void) const
4631
+ return QListViewItem::text(0);
4635
+qsamplerInstrumentGroup *qsamplerInstrumentGroup::groupItem (void) const
4637
+ QListViewItem *pParent = QListViewItem::parent();
4638
+ while (pParent && pParent->rtti() != qsamplerInstrumentList::Group)
4639
+ pParent = pParent->parent();
4640
+ return static_cast<qsamplerInstrumentGroup *> (pParent);
4644
+qsamplerInstrumentList *qsamplerInstrumentGroup::listView (void) const
4646
+ return static_cast<qsamplerInstrumentList *> (QListViewItem::listView());
4650
+// To show up whether its open or not.
4651
+void qsamplerInstrumentGroup::setOpen ( bool bOpen )
4653
+ // Set the proper pixmap of this...
4654
+ if (rtti() == qsamplerInstrumentList::Group) {
4655
+ QListViewItem::setPixmap(0, QPixmap::fromMimeSource(
4656
+ bOpen ? "itemGroupOpen.png" : "itemGroup.png"));
4659
+ QListViewItem::setOpen(bOpen);
4661
+ // All ancestors should be also visible.
4662
+ if (bOpen && QListViewItem::parent())
4663
+ QListViewItem::parent()->setOpen(true);
4667
+// To virtually distinguish between list view items.
4668
+int qsamplerInstrumentGroup::rtti (void) const
4670
+ return qsamplerInstrumentList::Group;
4674
+//----------------------------------------------------------------------
4675
+// class qsamplerInstrumentItem -- custom file list view item.
4679
+qsamplerInstrumentItem::qsamplerInstrumentItem (
4680
+ qsamplerInstrumentList *pListView,
4681
+ qsamplerInstrument *pInstrument,
4682
+ QListViewItem *pItemAfter )
4683
+ : qsamplerInstrumentGroup(pListView, pInstrument->name(), pItemAfter)
4685
+ m_pInstrument = pInstrument;
4690
+qsamplerInstrumentItem::qsamplerInstrumentItem (
4691
+ qsamplerInstrumentGroup *pGroupItem,
4692
+ qsamplerInstrument *pInstrument )
4693
+ : qsamplerInstrumentGroup(pGroupItem, pInstrument->name())
4695
+ m_pInstrument = pInstrument;
4701
+// Default destructor.
4702
+qsamplerInstrumentItem::~qsamplerInstrumentItem (void)
4704
+ if (m_pInstrument)
4705
+ delete m_pInstrument;
4709
+// To virtually distinguish between list view items.
4710
+int qsamplerInstrumentItem::rtti (void) const
4712
+ return qsamplerInstrumentList::Item;
4716
+// Payload accessor.
4717
+qsamplerInstrument *qsamplerInstrumentItem::instrument (void) const
4719
+ return m_pInstrument;
4723
+// Item refreshment.
4724
+void qsamplerInstrumentItem::update (void)
4726
+ QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemFile.png"));
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()) {
4741
+ sLoadMode = QObject::tr("Persistent");
4744
+ sLoadMode = QObject::tr("On Demand Hold");
4747
+ sLoadMode = QObject::tr("On Demand");
4750
+ setText(8, sLoadMode);
4752
+ for (int i = 0; i < listView()->columns(); i++)
4758
+//----------------------------------------------------------------------------
4759
+// qsamplerInstrumentList -- MIDI instrument list view.
4763
+qsamplerInstrumentList::qsamplerInstrumentList (
4764
+ QWidget *pParent, const char *pszName )
4765
+ : QListView(pParent, pszName)
4767
+ m_iMidiMap = LSCP_MIDI_MAP_ALL;
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);
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"));
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
4795
+ QListView::setColumnWidth(0, 120); // Name
4796
+ QListView::setColumnWidth(5, 240); // File
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);
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"));
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()),
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*)));
4854
+ selectionChangedSlot();
4858
+// Default destructor.
4859
+qsamplerInstrumentList::~qsamplerInstrumentList (void)
4861
+ delete m_pNewGroupAction;
4862
+ delete m_pNewItemAction;
4863
+ delete m_pEditItemAction;
4864
+ delete m_pRenameAction;
4865
+ delete m_pDeleteAction;
4869
+// Add a new instrument item, optionally under a given group.
4870
+qsamplerInstrumentItem *qsamplerInstrumentList::addItem (
4871
+ qsamplerInstrument *pInstrument,
4872
+ qsamplerInstrumentGroup *pParentGroup )
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);
4879
+ // If exactly the same, just update view and bail out...
4880
+ if (pItem->instrument() == pInstrument) {
4884
+ // Remove it, as instrument keys must be unique.
4888
+ // Add the new item under proper group one, if any...
4889
+ if (pParentGroup) {
4890
+ pParentGroup->setOpen(true);
4891
+ pItem = new qsamplerInstrumentItem(pParentGroup, pInstrument);
4893
+ pItem = new qsamplerInstrumentItem(this, pInstrument);
4896
+ // Set it as current selection...
4897
+ QListView::setSelected(pItem, true);
4903
+// Add a new instrument group, optionally under another group.
4904
+qsamplerInstrumentGroup *qsamplerInstrumentList::addGroup (
4905
+ const QString& sName, qsamplerInstrumentGroup *pParentGroup )
4907
+ qsamplerInstrumentGroup *pGroup = findGroup(sName);
4908
+ if (pGroup == NULL) {
4909
+ if (pParentGroup) {
4910
+ pParentGroup->setOpen(true);
4911
+ pGroup = new qsamplerInstrumentGroup(pParentGroup, sName);
4913
+ pGroup = new qsamplerInstrumentGroup(this, sName);
4916
+ QListView::setSelected(pGroup, true);
4921
+// Find a group item, given its name.
4922
+qsamplerInstrumentGroup *qsamplerInstrumentList::findGroup (
4923
+ const QString& sName ) const
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);
4938
+// Find a file item, given its name.
4939
+qsamplerInstrumentItem *qsamplerInstrumentList::findItem (
4940
+ qsamplerInstrument *pInstrument ) const
4942
+ if (pInstrument == NULL)
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())
4965
+// Find and return the nearest group item...
4966
+qsamplerInstrumentGroup *qsamplerInstrumentList::groupItem (
4967
+ QListViewItem *pItem ) const
4969
+ while (pItem && pItem->rtti() != Group)
4970
+ pItem = pItem->parent();
4971
+ return static_cast<qsamplerInstrumentGroup *> (pItem);
4975
+// Add a new group item below the current one.
4976
+void qsamplerInstrumentList::newGroupSlot (void)
4978
+ qsamplerInstrumentGroup *pNewGroup
4979
+ = addGroup(tr("New Group"), groupItem(QListView::selectedItem()));
4981
+ pNewGroup->startRename(0);
4983
+ selectionChangedSlot();
4988
+void qsamplerInstrumentList::setMidiMap ( int iMidiMap )
4991
+ iMidiMap = LSCP_MIDI_MAP_ALL;
4993
+ m_iMidiMap = iMidiMap;
4996
+int qsamplerInstrumentList::midiMap (void) const
4998
+ return m_iMidiMap;
5002
+// List actions accessors.
5003
+QAction *qsamplerInstrumentList::newGroupAction (void) const
5005
+ return m_pNewGroupAction;
5008
+QAction *qsamplerInstrumentList::newItemAction (void) const
5010
+ return m_pNewItemAction;
5013
+QAction *qsamplerInstrumentList::editItemAction (void) const
5015
+ return m_pEditItemAction;
5018
+QAction *qsamplerInstrumentList::renameAction (void) const
5020
+ return m_pRenameAction;
5023
+QAction *qsamplerInstrumentList::deleteAction (void) const
5025
+ return m_pDeleteAction;
5028
+QAction *qsamplerInstrumentList::refreshAction (void) const
5030
+ return m_pRefreshAction;
5034
+// Add a new instrument item below the current one.
5035
+void qsamplerInstrumentList::newItemSlot (void)
5037
+ qsamplerInstrument *pInstrument = new qsamplerInstrument();
5039
+ qsamplerInstrumentForm form(this);
5040
+ form.setup(pInstrument);
5041
+ if (!form.exec()) {
5042
+ delete pInstrument;
5047
+ pInstrument->mapInstrument();
5048
+ // add new item to the tree...
5049
+ addItem(pInstrument, groupItem(QListView::selectedItem()));
5050
+ // Notify we've changes...
5051
+ emit instrumentsChanged();
5053
+ selectionChangedSlot();
5057
+// Edit current item below the current one.
5058
+void qsamplerInstrumentList::editItemSlot (void)
5060
+ QListViewItem *pListItem = QListView::selectedItem();
5061
+ if (pListItem == NULL)
5063
+ if (pListItem->rtti() == Item) {
5064
+ qsamplerInstrument *pInstrument = NULL;
5065
+ qsamplerInstrumentItem *pItem
5066
+ = static_cast<qsamplerInstrumentItem *> (pListItem);
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()) {
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...
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));
5092
+ // Just remove/hide old one.
5096
+ // Notify we've changes...
5097
+ emit instrumentsChanged();
5102
+ selectionChangedSlot();
5106
+// Rename current group/item.
5107
+void qsamplerInstrumentList::renameSlot (void)
5109
+ QListViewItem *pListItem = QListView::selectedItem();
5111
+ pListItem->startRename(0);
5113
+ selectionChangedSlot();
5117
+// Remove current group/item.
5118
+void qsamplerInstrumentList::deleteSlot (void)
5120
+ QListViewItem *pListItem = QListView::selectedItem();
5121
+ if (pListItem == NULL)
5124
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
5125
+ if (pMainForm == NULL)
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"
5136
+ .arg(pListItem->rtti() == Item ? tr("instrument") : tr("group"))
5137
+ .arg(pListItem->text(0)),
5138
+ tr("OK"), tr("Cancel")) > 0)
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();
5152
+ // Do it for real...
5155
+ selectionChangedSlot();
5159
+// In-place selection slot.
5160
+void qsamplerInstrumentList::selectionChangedSlot (void)
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);
5173
+// In-place activation slot.
5174
+void qsamplerInstrumentList::activatedSlot ( QListViewItem *pListItem )
5176
+ // FIXME: Hope the list view item is the one selected.
5177
+ if (pListItem->rtti() == Item)
5182
+// In-place aliasing slot.
5183
+void qsamplerInstrumentList::renamedSlot ( QListViewItem *pListItem )
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();
5198
+// Context menu request event handler.
5199
+void qsamplerInstrumentList::contextMenuEvent (
5200
+ QContextMenuEvent *pContextMenuEvent )
5202
+ if (!m_pNewItemAction->isEnabled())
5205
+ QPopupMenu menu(this);
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);
5217
+ menu.exec(pContextMenuEvent->globalPos());
5221
+// General reloader.
5222
+void qsamplerInstrumentList::refresh (void)
5226
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
5227
+ if (pMainForm == NULL)
5229
+ if (pMainForm->client() == NULL)
5232
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
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);
5250
+ QApplication::restoreOverrideCursor();
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."));
5257
+ selectionChangedSlot();
5261
+// end of qsamplerInstrumentList.cpp
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
5268
+// qsamplerInstrumentList.h
5270
+/****************************************************************************
5271
+ Copyright (C) 2003-2007, rncbc aka Rui Nuno Capela. All rights reserved.
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.
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.
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.
5287
+*****************************************************************************/
5289
+#ifndef __qsamplerInstrumentList_h
5290
+#define __qsamplerInstrumentList_h
5292
+#include <qlistview.h>
5293
+#include <qheader.h>
5295
+#include <lscp/client.h>
5298
+// Forward declarations.
5299
+class qsamplerInstrument;
5300
+class qsamplerInstrumentList;
5305
+//----------------------------------------------------------------------
5306
+// class qsamplerInstrumentGroup -- custom group list view item.
5309
+class qsamplerInstrumentGroup : public QListViewItem
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();
5321
+ // Instance accessors.
5322
+ void setName(const QString& sName);
5323
+ QString name() const;
5325
+ qsamplerInstrumentList *listView() const;
5326
+ qsamplerInstrumentGroup *groupItem() const;
5328
+ // To show up whether its open or not.
5329
+ virtual void setOpen(bool bOpen);
5331
+ // To virtually distinguish between list view items.
5332
+ virtual int rtti() const;
5336
+//----------------------------------------------------------------------
5337
+// class qsamplerInstrumentItem -- custom file list view item.
5340
+class qsamplerInstrumentItem : public qsamplerInstrumentGroup
5345
+ qsamplerInstrumentItem(qsamplerInstrumentList *pListView,
5346
+ qsamplerInstrument *pInstrument,
5347
+ QListViewItem *pItemAfter = NULL);
5348
+ qsamplerInstrumentItem(qsamplerInstrumentGroup *pGroupItem,
5349
+ qsamplerInstrument *pInstrument);
5350
+ // Default destructor.
5351
+ virtual ~qsamplerInstrumentItem();
5353
+ // To virtually distinguish between list view items.
5354
+ virtual int rtti() const;
5356
+ // Payload accessor.
5357
+ qsamplerInstrument *instrument() const;
5359
+ // View refreshment.
5364
+ // File item full path.
5365
+ qsamplerInstrument *m_pInstrument;
5369
+//----------------------------------------------------------------------------
5370
+// qsamplerInstrumentList -- MIDI instrument list view.
5373
+class qsamplerInstrumentList : public QListView
5380
+ qsamplerInstrumentList(QWidget *pParent, const char *pszName = NULL);
5381
+ // Default destructor.
5382
+ ~qsamplerInstrumentList();
5384
+ // QListViewItem::rtti() return values.
5385
+ enum ItemType { Group = 1001, Item = 1002 };
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);
5394
+ // Find a group/file item, given its name.
5395
+ qsamplerInstrumentGroup *findGroup(const QString& sName) const;
5396
+ qsamplerInstrumentItem *findItem(
5397
+ qsamplerInstrument *pInstrument) const;
5400
+ void setMidiMap(int iMidiMap);
5401
+ int midiMap() const;
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;
5413
+ // Instrument map/session change signal.
5414
+ void instrumentsChanged();
5418
+ // General reloader.
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();
5434
+ // In-place selection slot.
5435
+ void selectionChangedSlot();
5437
+ // In-place activation slot.
5438
+ void activatedSlot(QListViewItem *pListItem);
5440
+ // In-place aliasing slot.
5441
+ void renamedSlot(QListViewItem *pItem);
5445
+ // Find and return the nearest group item...
5446
+ qsamplerInstrumentGroup *groupItem(QListViewItem *pListItem) const;
5448
+ // Context menu request event handler.
5449
+ void contextMenuEvent(QContextMenuEvent *pContextMenuEvent);
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;
5461
+ // Current map selection.
5466
+#endif // __qsamplerInstrumentList_h
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
5474
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
5475
+<class>qsamplerInstrumentListForm</class>
5476
+<comment>qsampler - A LinuxSampler Qt GUI Interface.
5478
+ Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
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.
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.
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.
5495
+<author>rncbc aka Rui Nuno Capela</author>
5496
+<widget class="QMainWindow">
5497
+ <property name="name">
5498
+ <cstring>qsamplerInstrumentListForm</cstring>
5500
+ <property name="geometry">
5504
+ <width>720</width>
5505
+ <height>340</height>
5508
+ <property name="caption">
5509
+ <string>Qsampler: Instruments</string>
5511
+ <property name="icon">
5512
+ <pixmap>qsamplerInstrument.png</pixmap>
5515
+ <property name="name">
5516
+ <cstring>unnamed</cstring>
5518
+ <widget class="qsamplerInstrumentList">
5519
+ <property name="name">
5520
+ <cstring>InstrumentList</cstring>
5522
+ <property name="sizePolicy">
5524
+ <hsizetype>7</hsizetype>
5525
+ <vsizetype>7</vsizetype>
5526
+ <horstretch>0</horstretch>
5527
+ <verstretch>0</verstretch>
5530
+ <property name="minimumSize">
5532
+ <width>120</width>
5533
+ <height>40</height>
5540
+ <toolbar dock="2">
5541
+ <property name="name">
5542
+ <cstring>InstrumentToolbar</cstring>
5544
+ <property name="label">
5545
+ <string>Instruments Toolbar</string>
5551
+ <class>qsamplerInstrumentList</class>
5552
+ <header location="local">qsamplerInstrumentList.h</header>
5554
+ <width>320</width>
5555
+ <height>120</height>
5557
+ <container>0</container>
5559
+ <hordata>7</hordata>
5560
+ <verdata>5</verdata>
5561
+ <horstretch>0</horstretch>
5562
+ <verstretch>0</verstretch>
5567
+ <tabstop>InstrumentList</tabstop>
5570
+ <forward>class QComboBox;</forward>
5573
+ <variable access="private">QComboBox *m_pMapComboBox;</variable>
5576
+ <slot specifier="non virtual">refreshInstruments()</slot>
5577
+ <slot specifier="non virtual">activateMap(int)</slot>
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>
5586
+<layoutdefaults spacing="0" margin="0"/>
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
5593
+// qsamplerInstrumentListForm.ui.h
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.
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.
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.
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.
5613
+*****************************************************************************/
5615
+#include "qsamplerInstrument.h"
5617
+#include "qsamplerMainForm.h"
5618
+#include "qsamplerOptions.h"
5620
+#include <qcombobox.h>
5621
+#include <qtooltip.h>
5624
+// Kind of constructor.
5625
+void qsamplerInstrumentListForm::init (void)
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"));
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);
5641
+ QObject::connect(m_pMapComboBox,
5642
+ SIGNAL(activated(int)),
5643
+ SLOT(activateMap(int)));
5647
+// Kind of destructor.
5648
+void qsamplerInstrumentListForm::destroy (void)
5650
+ delete m_pMapComboBox;
5654
+// Notify our parent that we're emerging.
5655
+void qsamplerInstrumentListForm::showEvent ( QShowEvent *pShowEvent )
5657
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
5659
+ pMainForm->stabilizeForm();
5661
+ QWidget::showEvent(pShowEvent);
5665
+// Notify our parent that we're closing.
5666
+void qsamplerInstrumentListForm::hideEvent ( QHideEvent *pHideEvent )
5668
+ QWidget::hideEvent(pHideEvent);
5670
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
5672
+ pMainForm->stabilizeForm();
5676
+// Refresh all instrument list and views.
5677
+void qsamplerInstrumentListForm::refreshInstruments (void)
5679
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
5680
+ if (pMainForm == NULL)
5683
+ qsamplerOptions *pOptions = pMainForm->options();
5684
+ if (pOptions == NULL)
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;
5692
+ // Populate maps list.
5693
+ m_pMapComboBox->clear();
5694
+ m_pMapComboBox->insertItem(tr("(All)"));
5695
+ m_pMapComboBox->insertStringList(qsamplerInstrument::getMapNames());
5697
+ // Adjust to saved selection...
5698
+ if (iMap < 0 || iMap >= m_pMapComboBox->count())
5700
+ m_pMapComboBox->setCurrentItem(iMap);
5701
+ m_pMapComboBox->setEnabled(m_pMapComboBox->count() > 1);
5703
+ activateMap(iMap);
5707
+// Refresh instrument maps selector.
5708
+void qsamplerInstrumentListForm::activateMap ( int iMap )
5710
+ qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
5711
+ if (pMainForm == NULL)
5714
+ qsamplerOptions *pOptions = pMainForm->options();
5715
+ if (pOptions == NULL)
5718
+ int iMidiMap = iMap - 1;
5719
+ if (iMidiMap >= 0)
5720
+ pOptions->iMidiMap = iMidiMap;
5722
+ InstrumentList->setMidiMap(iMidiMap);
5723
+ InstrumentList->refresh();
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
5733
<class>qsamplerMainForm</class>
5734
<comment>qsampler - A LinuxSampler Qt GUI Interface.
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.
5739
This program is free software; you can redistribute it and/or
5740
modify it under the terms of the GNU General Public License
5742
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5743
GNU General Public License for more details.
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.
5753
<author>rncbc aka Rui Nuno Capela</author>
5755
<action name="viewStatusbarAction"/>
5757
<action name="viewMessagesAction"/>
5758
+ <action name="viewInstrumentsAction"/>
5759
<action name="viewDevicesAction"/>
5761
<action name="viewOptionsAction"/>
5763
<action name="fileResetAction"/>
5764
<action name="fileRestartAction"/>
5766
+ <action name="viewInstrumentsAction"/>
5767
<action name="viewDevicesAction"/>
5770
@@ -498,6 +500,32 @@
5773
<property name="name">
5774
+ <cstring>viewInstrumentsAction</cstring>
5776
+ <property name="iconSet">
5777
+ <iconset>qsamplerInstrument.png</iconset>
5779
+ <property name="toggleAction">
5782
+ <property name="text">
5783
+ <string>Instruments</string>
5785
+ <property name="menuText">
5786
+ <string>&Instruments</string>
5788
+ <property name="toolTip">
5789
+ <string>MIDI instruments configuration</string>
5791
+ <property name="statusTip">
5792
+ <string>Show/hide the MIDI instruments configuration window</string>
5794
+ <property name="accel">
5795
+ <string>F10</string>
5799
+ <property name="name">
5800
<cstring>viewDevicesAction</cstring>
5802
<property name="iconSet">
5804
<string>Line up all channel strips</string>
5806
<property name="accel">
5807
- <string>F10</string>
5808
+ <string>F5</string>
5812
@@ -724,6 +752,12 @@
5813
<slot>viewMessages(bool)</slot>
5816
+ <sender>viewInstrumentsAction</sender>
5817
+ <signal>activated()</signal>
5818
+ <receiver>qsamplerMainForm</receiver>
5819
+ <slot>viewInstruments()</slot>
5822
<sender>viewDevicesAction</sender>
5823
<signal>activated()</signal>
5824
<receiver>qsamplerMainForm</receiver>
5825
@@ -767,11 +801,14 @@
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>
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<qsamplerChannelStrip> 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>
5857
<slot specifier="non virtual">fileNew( void )</slot>
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>
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>
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>
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
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.
5893
This program is free software; you can redistribute it and/or
5894
modify it under the terms of the GNU General Public License
5896
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5897
GNU General Public License for more details.
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.
5906
*****************************************************************************/
5910
#include <qtextstream.h>
5911
#include <qstatusbar.h>
5912
+#include <qslider.h>
5913
+#include <qspinbox.h>
5916
+#include <qtooltip.h>
5918
#include "qsamplerAbout.h"
5919
#include "qsamplerOptions.h"
5921
#include "qsamplerMessages.h"
5923
#include "qsamplerChannelStrip.h"
5924
+#include "qsamplerInstrumentList.h"
5926
+#include "qsamplerInstrumentListForm.h"
5927
#include "qsamplerDeviceForm.h"
5928
#include "qsamplerOptionsForm.h"
5934
+// Needed for lroundf()
5937
+#ifndef CONFIG_ROUND
5938
+static inline long lroundf ( float x )
5941
+ return long(x + 0.5f);
5943
+ return long(x - 0.5f);
5947
// Timer constant stuff.
5948
#define QSAMPLER_TIMER_MSECS 200
5950
@@ -102,14 +120,22 @@
5951
//-------------------------------------------------------------------------
5952
// qsamplerMainForm -- Main window form implementation.
5954
+// Kind of singleton reference.
5955
+qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL;
5958
// Kind of constructor.
5959
void qsamplerMainForm::init (void)
5961
+ // Pseudo-singleton reference setup.
5962
+ g_pMainForm = this;
5964
// Initialize some pointer references.
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;
5973
// We'll start clean.
5974
@@ -129,11 +155,43 @@
5975
::signal(SIGPIPE, SIG_IGN);
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)));
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);
6021
// Finally drop any widgets around...
6023
delete m_pDeviceForm;
6024
+ if (m_pInstrumentListForm)
6025
+ delete m_pInstrumentListForm;
6029
@@ -201,9 +261,17 @@
6030
if (m_statusItem[QSAMPLER_STATUS_SESSION])
6031
delete m_statusItem[QSAMPLER_STATUS_SESSION];
6033
+#ifdef CONFIG_VOLUME
6034
+ delete m_pVolumeSpinBox;
6035
+ delete m_pVolumeSlider;
6038
// Delete recentfiles menu.
6039
if (m_pRecentFilesMenu)
6040
delete m_pRecentFilesMenu;
6042
+ // Pseudo-singleton reference shut-down.
6043
+ g_pMainForm = NULL;
6047
@@ -214,19 +282,33 @@
6048
m_pOptions = pOptions;
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()));
6070
+ viewInstrumentsAction->setEnabled(false);
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()));
6082
// Initial decorations toggle state.
6083
viewMenubarAction->setOn(m_pOptions->bMenubar);
6084
@@ -251,9 +333,11 @@
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);
6091
// Final startup stabilization...
6092
+ updateMaxVolume();
6093
updateRecentFilesMenu();
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();
6106
m_pDeviceForm->close();
6107
// Stop client and/or server, gracefully.
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)
6116
// Start setting the instrument filename...
6117
@@ -371,8 +458,10 @@
6120
} // Otherwise, load an usual session file (LSCP script)...
6121
- else if (closeSession(true))
6122
+ else if (closeSession(true)) {
6123
loadSessionFile(sPath);
6126
// Make it look responsive...:)
6127
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
6134
// The LSCP client descriptor property.
6135
lscp_client_t *qsamplerMainForm::client (void)
6137
@@ -424,6 +514,13 @@
6141
+// The pseudo-singleton instance accessor.
6142
+qsamplerMainForm *qsamplerMainForm::getInstance (void)
6144
+ return g_pMainForm;
6148
//-------------------------------------------------------------------------
6149
// qsamplerMainForm -- Session file stuff.
6151
@@ -595,22 +692,29 @@
6155
+ // Tell the world we'll take some time...
6156
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
6161
QTextStream ts(&file);
6162
while (!ts.atEnd()) {
6164
QString sCommand = ts.readLine().stripWhiteSpace();
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");
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");
6187
// Try to make it snappy :)
6188
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
6190
// Now we'll try to create (update) the whole GUI session.
6193
+ // We're fornerly done.
6194
+ QApplication::restoreOverrideCursor();
6196
// Have we any errors?
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 )
6203
+ if (m_pClient == NULL)
6206
+ // Check whether server is apparently OK...
6207
+ if (::lscp_get_channels(m_pClient) < 0) {
6208
+ appendMessagesClient("lscp_get_channels");
6212
// Open and write into real file.
6213
QFile file(sFilename);
6214
if (!file.open(IO_WriteOnly | IO_Truncate)) {
6219
+ // Tell the world we'll take some time...
6220
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
6224
QTextStream ts(&file);
6225
@@ -668,17 +787,19 @@
6226
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl;
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...
6235
ts << "RESET" << endl;
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++) {
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 @@
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);
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++) {
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 @@
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);
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;
6288
+ ts << " - " << pszMapName;
6290
+ ts << "ADD MIDI_INSTRUMENT_MAP";
6292
+ ts << " '" << pszMapName << "'";
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]);
6301
+ ts << "MAP MIDI_INSTRUMENT "
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";
6313
+ case LSCP_LOAD_ON_DEMAND_HOLD:
6314
+ ts << "ON_DEMAND_HOLD";
6316
+ case LSCP_LOAD_ON_DEMAND:
6317
+ case LSCP_LOAD_DEFAULT:
6319
+ ts << "ON_DEMAND";
6322
+ if (pInstrInfo->name)
6323
+ ts << " '" << pInstrInfo->name << "'";
6325
+ } // Check for errors...
6326
+ else if (::lscp_client_get_errno(m_pClient)) {
6327
+ appendMessagesClient("lscp_get_midi_instrument_info");
6330
+ // Try to keep it snappy :)
6331
+ QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
6334
+ // Check for errors...
6335
+ if (pInstrs == NULL && ::lscp_client_get_errno(m_pClient)) {
6336
+ appendMessagesClient("lscp_list_midi_instruments");
6339
+ // MIDI strument index/id mapping.
6340
+ midiInstrumentMap[iMidiMap] = iMap;
6342
+ // Check for errors...
6343
+ if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {
6344
+ appendMessagesClient("lscp_list_midi_instrument_maps");
6347
+#endif // CONFIG_MIDI_INSTRUMENT
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();
6359
ts << pChannel->midiChannel();
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;
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;
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;
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 << "'";
6400
+ int *piRouting = pFxSendInfo->audio_routing;
6401
+ for (int iAudioSrc = 0;
6402
+ piRouting && piRouting[iAudioSrc] >= 0;
6404
+ ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL "
6407
+ << " " << iAudioSrc
6408
+ << " " << piRouting[iAudioSrc] << endl;
6410
+#ifdef CONFIG_FXSEND_LEVEL
6411
+ ts << "SET FX_SEND LEVEL " << iChannel
6413
+ << " " << pFxSendInfo->level << endl;
6415
+ } // Check for errors...
6416
+ else if (::lscp_client_get_errno(m_pClient)) {
6417
+ appendMessagesClient("lscp_get_fxsend_info");
6425
@@ -807,9 +1047,18 @@
6426
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
6429
+#ifdef CONFIG_VOLUME
6430
+ ts << "# " << tr("Global volume level") << endl;
6431
+ ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl;
6435
// Ok. we've wrote it.
6438
+ // We're fornerly done.
6439
+ QApplication::restoreOverrideCursor();
6441
// Have we any errors?
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)
6448
+ // Trye closing the current session, first...
6449
+ if (!closeSession(true))
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."));
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."));
6466
appendMessages(tr("Sampler reset."));
6467
@@ -965,7 +1219,7 @@
6470
// Just create the channel instance...
6471
- qsamplerChannel *pChannel = new qsamplerChannel(this);
6472
+ qsamplerChannel *pChannel = new qsamplerChannel();
6473
if (pChannel == NULL)
6476
@@ -1128,6 +1382,25 @@
6480
+// Show/hide the MIDI instrument list-view form.
6481
+void qsamplerMainForm::viewInstruments (void)
6483
+ if (m_pOptions == NULL)
6486
+ if (m_pInstrumentListForm) {
6487
+ m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
6488
+ if (m_pInstrumentListForm->isVisible()) {
6489
+ m_pInstrumentListForm->hide();
6491
+ m_pInstrumentListForm->show();
6492
+ m_pInstrumentListForm->raise();
6493
+ m_pInstrumentListForm->setActiveWindow();
6499
// Show/hide the device configurator form.
6500
void qsamplerMainForm::viewDevices (void)
6502
@@ -1136,7 +1409,6 @@
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();
6510
@@ -1322,6 +1594,26 @@
6511
sText += tr("Sampler channel Mute/Solo support disabled.");
6512
sText += "</font></small><br />";
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 />";
6519
+#ifndef CONFIG_FXSEND
6520
+ sText += "<small><font color=\"red\">";
6521
+ sText += tr("Sampler channel Effect Sends support disabled.");
6522
+ sText += "</font></small><br />";
6524
+#ifndef CONFIG_VOLUME
6525
+ sText += "<small><font color=\"red\">";
6526
+ sText += tr("Global volume support disabled.");
6527
+ sText += "</font></small><br />";
6529
+#ifndef CONFIG_MIDI_INSTRUMENT
6530
+ sText += "<small><font color=\"red\">";
6531
+ sText += tr("MIDI instrument mapping support disabled.");
6532
+ sText += "</font></small><br />";
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);
6547
+ viewDevicesAction->setOn(m_pDeviceForm
6548
+ && m_pDeviceForm->isVisible());
6549
viewDevicesAction->setEnabled(bHasClient);
6550
channelsArrangeAction->setEnabled(bHasChannel);
6552
+#ifdef CONFIG_VOLUME
6553
+ // Toolbar widgets are also affected...
6554
+ m_pVolumeSlider->setEnabled(bHasClient);
6555
+ m_pVolumeSpinBox->setEnabled(bHasClient);
6558
// Client/Server status...
6560
m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected"));
6561
@@ -1408,6 +1712,38 @@
6565
+// Global volume change receiver slot.
6566
+void qsamplerMainForm::volumeChanged ( int iVolume )
6568
+#ifdef CONFIG_VOLUME
6570
+ if (m_iVolumeChanging > 0)
6573
+ m_iVolumeChanging++;
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);
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));
6586
+ appendMessagesClient("lscp_set_volume");
6588
+ m_iVolumeChanging--;
6597
// Channel change receiver slot.
6598
void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip )
6600
@@ -1427,6 +1763,24 @@
6601
// Grab and restore current sampler channels session.
6602
void qsamplerMainForm::updateSession (void)
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--;
6611
+#ifdef CONFIG_MIDI_INSTRUMENT
6612
+ // FIXME: Make some room for default instrument maps...
6613
+ int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);
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());
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."));
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]));
6638
+ m_pWorkspace->setUpdatesEnabled(true);
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);
6650
- m_pWorkspace->setUpdatesEnabled(true);
6652
- // Remember to refresh devices
6653
+ // Do we auto-arrange?
6654
+ if (m_pOptions && m_pOptions->bAutoArrange)
6655
+ channelsArrange();
6657
+ // Remember to refresh devices and instruments...
6658
+ if (m_pInstrumentListForm)
6659
+ m_pInstrumentListForm->refreshInstruments();
6661
m_pDeviceForm->refreshDevices();
6663
@@ -1573,6 +1930,13 @@
6664
if (m_pOptions == NULL)
6667
+#ifdef CONFIG_VOLUME
6668
+ m_iVolumeChanging++;
6669
+ m_pVolumeSlider->setMaxValue(m_pOptions->iMaxVolume);
6670
+ m_pVolumeSpinBox->setMaxValue(m_pOptions->iMaxVolume);
6671
+ m_iVolumeChanging--;
6674
// Full channel list update...
6675
QWidgetList wlist = m_pWorkspace->windowList();
6676
if (wlist.isEmpty())
6677
@@ -1621,6 +1985,9 @@
6679
appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");
6681
+ // Make it look responsive...:)
6682
+ QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
6684
QMessageBox::critical(this,
6685
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));
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");
6692
+ // Make it look responsive...:)
6693
+ QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
6697
@@ -1709,7 +2079,9 @@
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...
6707
// Background display effect...
6708
@@ -1916,13 +2288,20 @@
6709
m_pServer = new QProcess(this);
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()));
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()));
6729
+ // The unforgiveable signal communication...
6730
+ QObject::connect(m_pServer,
6731
+ SIGNAL(processExited()),
6732
+ SLOT(processServerExit()));
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."));
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();
6750
// Is any session pending to be loaded?
6751
if (!m_pOptions->sSessionFile.isEmpty()) {
6752
@@ -2092,11 +2473,6 @@
6753
if (m_pClient == NULL)
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);
6761
// Log prepare here.
6762
appendMessages(tr("Client disconnecting..."));
6764
@@ -2117,6 +2493,13 @@
6765
::lscp_client_destroy(m_pClient);
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();
6776
appendMessages(tr("Client disconnected."));
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
6783
// qsamplerMessages.cpp
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.
6789
This program is free software; you can redistribute it and/or
6790
modify it under the terms of the GNU General Public License
6792
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6793
GNU General Public License for more details.
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.
6802
*****************************************************************************/
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
6809
// qsamplerMessages.h
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.
6815
This program is free software; you can redistribute it and/or
6816
modify it under the terms of the GNU General Public License
6818
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6819
GNU General Public License for more details.
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.
6828
*****************************************************************************/
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
6835
// qsamplerOptions.cpp
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.
6841
This program is free software; you can redistribute it and/or
6842
modify it under the terms of the GNU General Public License
6844
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6845
GNU General Public License for more details.
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.
6854
*****************************************************************************/
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();
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();
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
6885
// qsamplerOptions.h
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.
6891
This program is free software; you can redistribute it and/or
6892
modify it under the terms of the GNU General Public License
6894
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6895
GNU General Public License for more details.
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.
6904
*****************************************************************************/
6907
QString sEngineName;
6908
QString sAudioDriver;
6909
QString sMidiDriver;
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
6923
<class>qsamplerOptionsForm</class>
6924
<comment>qsampler - A LinuxSampler Qt GUI Interface.
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.
6929
This program is free software; you can redistribute it and/or
6930
modify it under the terms of the GNU General Public License
6932
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6933
GNU General Public License for more details.
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.
6943
<author>rncbc aka Rui Nuno Capela</author>
6948
- <width>520</width>
6949
- <height>323</height>
6950
+ <width>512</width>
6951
+ <height>320</height>
6954
<property name="sizePolicy">
6955
@@ -938,13 +938,13 @@
6958
<property name="text">
6959
- <string>&Confirm channel and device removal</string>
6960
+ <string>&Confirm removals</string>
6962
<property name="accel">
6963
<string>Alt+C</string>
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>
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
6976
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6977
GNU General Public License for more details.
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.
6986
*****************************************************************************/
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
6994
#define PACKAGE_NAME "Qsampler"
6995
-#define PACKAGE_VERSION "0.1.3"
6996
+#define PACKAGE_VERSION "0.1.3.25"
6998
#define CONFIG_PREFIX "."
6999
#define CONFIG_DEBUG 1
7001
+#undef CONFIG_ROUND
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
7011
#undef HAVE_SIGNAL_H
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
7018
INCLUDEPATH += ../src ../../liblscp
7020
-SOURCES += ../src/main.cpp \
7021
- ../src/qsamplerOptions.cpp \
7022
- ../src/qsamplerChannel.cpp \
7023
- ../src/qsamplerMessages.cpp \
7024
- ../src/qsamplerDevice.cpp
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
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
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
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 \
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 \
7079
-CONFIG += qt warn_on debug
7080
+CONFIG += qt warn_on debug console
7083
LIBS += ../../liblscp/win32/liblscp.lib