diff --git a/ChangeLog b/ChangeLog index afa4d253a..ab09cd1cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,88 @@ +2006-09-17 Tobias Doerffel + + * plugins/audio_file_processor/audio_file_processor.cpp: + * plugins/bit_invader/bit_invader.cpp: + * plugins/flp_import/flp_import.cpp: + * plugins/midi_import/midi_import.cpp: + * plugins/organic/organic.cpp: + * plugins/plucked_string_synth/plucked_string_synth.cpp: + * plugins/mallets/mallets.cpp: + * plugins/vestige/vestige.cpp: + * plugins/vibed/vibed.cpp: + extended plugin-descriptor by sub_plugin_features-field (for + non-effects likely NULL) + + * include/audio_port.h: + * include/effect.h: + * include/effect_chain.h: + * include/effect_label.h: + * include/effect_tab_widget.h: + * include/instrument.h: + * include/instrument_track.h: + * include/ladspa_browser.h: + * include/ladspa_manager.h: + * include/main_window.h: + * include/plugin.h: + * include/rack_plugin.h: + * include/rack_view.h: + * include/sample_track.h: + * src/lmms_single_source.cpp: + * src/audio/audio_port.cpp: + * src/core/effect.cpp: + * src/core/effect_chain.cp: + * src/core/effect_tab_widget.cpp: + * src/core/import_filter.cpp: + * src/core/ladspa_browser.cpp: + * src/core/main_window.cpp: + * src/core/mixer.cpp: + * src/core/plugin.cpp: + * src/core/plugin_browser.cpp: + * src/tracks/instrument_track.cpp: + * src/tracks/sample_track.cpp: + * src/widgets/effect_label.cpp: + * src/widgets/ladspa_control.cpp: + * src/widgets/rack_plugin.cpp: + * src/widgets/rack_view.cpp: + added generic effect-framework based on LADSPA-effect-code for using + arbitrary effects inside LMMS and using sub-plugins (such as + LADSPA-plugins) transparently at the same time, now writing of any + other effects an begin + + * plugins/ladspa_effect/ladspa_effect.h: + * plugins/ladspa_effect/ladspa_effect.cpp: + * plugins/ladspa_effect/ladspa_control_dialog.h: + * plugins/ladspa_effect/ladspa_control_dialog.cpp: + moved LADSPA-effect-support into separate plugin + + * include/dummy_effect.h: + * include/effect_control_dialog.h: + * include/effect_select_dialog.h: + * include/ladspa_base.h: + * include/ladspa_subplugin_features.h: + * src/core/effect_control_dialog.cpp: + * src/core/effect_select_dialog.cpp: + * src/core/ladspa_subplugin_features.cpp: + added (see description above) + + * include/ladspa_control_dialog.h: + * include/ladspa_description.h: + * include/ladspa_effect.h: + * include/select_ladspa_dialog.h: + * src/core/ladspa_control_dialog.cpp: + * src/core/ladspa_effect.cpp: + * src/core/select_ladspa_dialog.cpp: + removed + + * data/locale/de.ts: + updated German translation + + * configure.in: + - do not set wrong VST_SUPPORT-condition if winegcc was found and + --with-vst specified but VST-headers are missing + - LADSPA-support not experimental anymore and enabled per default when + header is found + - use -O2 per default + 2006-09-11 Javier Serrano Polo * plugins/vestige/lvsl_server.c: diff --git a/Makefile.am b/Makefile.am index bfbb58501..a4f23a480 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,7 +58,9 @@ lmms_MOC = \ ./combobox.moc \ ./config_mgr.moc \ ./cpuload_widget.moc \ + ./effect_control_dialog.moc \ ./effect_label.moc \ + ./effect_select_dialog.moc \ ./effect_tab_widget.moc \ ./envelope_and_lfo_widget.moc \ ./envelope_tab_widget.moc \ @@ -69,11 +71,9 @@ lmms_MOC = \ ./kmultitabbar.moc \ ./kmultitabbar-qt3.moc \ ./knob.moc \ - ./ladspa_browser.moc \ ./ladspa_control.moc \ - ./ladspa_control_dialog.moc \ - ./ladspa_description.moc \ ./ladspa_port_dialog.moc \ + ./ladspa_subplugin_features.moc \ ./lcd_spinbox.moc \ ./led_checkbox.moc \ ./main_window.moc \ @@ -98,7 +98,6 @@ lmms_MOC = \ ./sample_buffer.moc \ ./sample_play_handle.moc \ ./sample_track.moc \ - ./select_ladspa_dialog.moc \ ./setup_dialog.moc \ ./side_bar.moc \ ./side_bar_widget.moc \ @@ -143,6 +142,8 @@ lmms_SOURCES = \ $(srcdir)/src/core/bb_editor.cpp \ $(srcdir)/src/core/config_mgr.cpp \ $(srcdir)/src/core/effect_chain.cpp \ + $(srcdir)/src/core/effect_control_dialog.cpp \ + $(srcdir)/src/core/effect_select_dialog.cpp \ $(srcdir)/src/core/effect_tab_widget.cpp \ $(srcdir)/src/core/effect.cpp \ $(srcdir)/src/core/engine.cpp \ @@ -152,10 +153,8 @@ lmms_SOURCES = \ $(srcdir)/src/core/file_browser.cpp \ $(srcdir)/src/core/import_filter.cpp \ $(srcdir)/src/core/instrument.cpp \ - $(srcdir)/src/core/ladspa_browser.cpp \ - $(srcdir)/src/core/ladspa_control_dialog.cpp \ - $(srcdir)/src/core/ladspa_effect.cpp \ $(srcdir)/src/core/ladspa_port_dialog.cpp \ + $(srcdir)/src/core/ladspa_subplugin_features.cpp \ $(srcdir)/src/core/main_window.cpp \ $(srcdir)/src/core/main.cpp \ $(srcdir)/src/core/meter_dialog.cpp \ @@ -170,7 +169,6 @@ lmms_SOURCES = \ $(srcdir)/src/core/plugin_browser.cpp \ $(srcdir)/src/core/preset_preview_play_handle.cpp \ $(srcdir)/src/core/sample_play_handle.cpp \ - $(srcdir)/src/core/select_ladspa_dialog.cpp \ $(srcdir)/src/core/setup_dialog.cpp \ $(srcdir)/src/core/song_editor.cpp \ $(srcdir)/src/core/track.cpp \ @@ -211,7 +209,6 @@ lmms_SOURCES = \ $(srcdir)/src/widgets/kmultitabbar.cpp \ $(srcdir)/src/widgets/knob.cpp \ $(srcdir)/src/widgets/ladspa_control.cpp \ - $(srcdir)/src/widgets/ladspa_description.cpp \ $(srcdir)/src/widgets/lcd_spinbox.cpp \ $(srcdir)/src/widgets/led_checkbox.cpp \ $(srcdir)/src/widgets/nstate_button.cpp \ @@ -353,19 +350,19 @@ lmms_SOURCES = \ $(srcdir)/include/engine.h \ $(srcdir)/include/effect.h \ $(srcdir)/include/effect_chain.h \ + $(srcdir)/include/effect_control_dialog.h \ $(srcdir)/include/effect_label.h \ $(srcdir)/include/effect_tab_widget.h \ $(srcdir)/include/ladspa_2_lmms.h \ - $(srcdir)/include/ladspa_browser.h \ $(srcdir)/include/ladspa_control.h \ - $(srcdir)/include/ladspa_control_dialog.h \ - $(srcdir)/include/ladspa_description.h \ $(srcdir)/include/ladspa_port_dialog.h \ $(srcdir)/include/rack_plugin.h \ $(srcdir)/include/rack_view.h \ - $(srcdir)/include/select_ladspa_dialog.h \ - $(srcdir)/include/ladspa_effect.h \ + $(srcdir)/include/effect_select_dialog.h \ + $(srcdir)/include/dummy_effect.h \ $(srcdir)/include/meter_dialog.h \ + $(srcdir)/include/ladspa_subplugin_features.h \ + $(srcdir)/include/ladspa_base.h \ $(srcdir)/include/qxembed.h diff --git a/configure.in b/configure.in index d94226593..0328efebf 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.2.1-cvs20060903, lmms-devel/at/lists/dot/sf/dot/net) -AM_INIT_AUTOMAKE(lmms, 0.2.1-cvs20060903) +AC_INIT(lmms, 0.2.1-cvs20060917, lmms-devel/at/lists/dot/sf/dot/net) +AM_INIT_AUTOMAKE(lmms, 0.2.1-cvs20060917) AM_CONFIG_HEADER(config.h) @@ -26,8 +26,8 @@ if test "x`$CC --version|head -1|cut -d\ -f3|cut -d. -f1`" = "x4" ; then fi fi -CFLAGS="$CFLAGS $EXTRAFLAGS" -CXXFLAGS="$CXXFLAGS $EXTRAFLAGS" +CFLAGS="-O2 $CFLAGS $EXTRAFLAGS" +CXXFLAGS="-O2 $CXXFLAGS $EXTRAFLAGS" AC_PATH_XTRA gw_CHECK_QT @@ -195,6 +195,7 @@ if test "x$with_vst" = "xyes" ; then AC_DEFINE(HAVE_VST_AEFFECTX_H) else WINE_OK_BUT_VST_INCOMPLETE="true" + WINEGCC="" fi fi CC="$ORIG_CC" @@ -204,7 +205,7 @@ AM_CONDITIONAL(VST_SUPPORT, test ! -z "$WINEGCC") # check for LADSPA-SDK AC_ARG_WITH(ladspa, - AS_HELP_STRING([--with-ladspa], [enable support for LADSPA]), [ with_ladspa=yes ], [ with_ladspa=no ]) + AS_HELP_STRING([--without-ladspa], [enable support for LADSPA]), , [ with_ladspa=yes ] ) AH_TEMPLATE(HAVE_LADSPA_H, [Define to 1 if you have the header file.]) if test "x$with_ladspa" = "xyes" ; then AC_CHECK_HEADER(ladspa.h, HAVE_LADSPA_H="true") @@ -213,6 +214,7 @@ if test ! -z "$HAVE_LADSPA_H" ; then AC_DEFINE(HAVE_LADSPA_H) fi #AM_CONDITIONAL(HAVE_LADSPA_H, test ! -z "$HAVE_LADSPA_H") +AM_CONDITIONAL(LADSPA_SUPPORT, test ! -z "$HAVE_LADSPA_H") # check for STK @@ -502,6 +504,7 @@ AC_CONFIG_FILES([Makefile plugins/audio_file_processor/Makefile plugins/bit_invader/Makefile plugins/flp_import/Makefile + plugins/ladspa_effect/Makefile plugins/midi_import/Makefile plugins/organic/Makefile plugins/plucked_string_synth/Makefile @@ -648,40 +651,39 @@ fi -# not yet... -#if test -z "$HAVE_LADSPA_H" ; then -# echo " ========================" -# echo " === LMMS - WARNING =======================================================" -# echo " ========================" -# echo " =" -# echo " = You don't seem to have installed LADSPA-SDK which is neccessary for" -# echo " = building LMMS with LADSPA support. LADSPA-support is very useful" -# echo " = as you're able to use a lot of LADSPA-effects inside LMMS." -# echo " = Consider installing the missing packages for using the full power of LMMS." -# echo " =" -# with_warnings="true" -#else -# PLUGINS_TO_BUILD="$PLUGINS_TO_BUILD\n\t\* LADSPA-plugins" -#fi - - if test -z "$HAVE_LADSPA_H" ; then echo " ========================" echo " === LMMS - WARNING =======================================================" echo " ========================" echo " =" - echo " = If you want support for LADSPA based effects, please pass" - echo " = " - echo " = --with-ladspa" - echo " = " - echo " = to configure, LADSPA support is still experimental." + echo " = You don't seem to have installed LADSPA-SDK which is neccessary for" + echo " = building LMMS with LADSPA support. LADSPA-support is very useful" + echo " = as you're able to use a lot of LADSPA-effects inside LMMS." + echo " = Consider installing the missing packages for using the full power of LMMS." echo " =" with_warnings="true" else - PLUGINS_TO_BUILD="$PLUGINS_TO_BUILD\n\t\* LADSPA for effects processing" + PLUGINS_TO_BUILD="$PLUGINS_TO_BUILD\n\t\* LADSPA-effect-hoster" fi +#if test -z "$HAVE_LADSPA_H" ; then +# echo " ========================" +# echo " === LMMS - WARNING =======================================================" +# echo " ========================" +# echo " =" +# echo " = If you want support for LADSPA based effects, please pass" +# echo " = " +# echo " = --with-ladspa" +# echo " = " +# echo " = to configure, LADSPA support is still experimental." +# echo " =" +# with_warnings="true" +#else +# PLUGINS_TO_BUILD="$PLUGINS_TO_BUILD\n\t\* LADSPA for effects processing" +#fi + + if test -z "$HAVE_STK_H" ; then echo " ========================" echo " === LMMS - WARNING =======================================================" diff --git a/data/locale/de.qm b/data/locale/de.qm index bcf532fa1..dbc410dc4 100755 Binary files a/data/locale/de.qm and b/data/locale/de.qm differ diff --git a/data/locale/de.ts b/data/locale/de.ts index 3db0a9310..06df3bfa0 100755 --- a/data/locale/de.ts +++ b/data/locale/de.ts @@ -684,35 +684,35 @@ http://lmms.sourceforge.net Draw mode (D) - Zeichnen-Modus (D) + Zeichnen-Modus (D) Erase mode (E) - Löschen-Modus (E) + Löschen-Modus (E) Select mode (S) - Auswahl-Modus (S) + Auswahl-Modus (S) Move selection mode (M) - Verschieben-Modus (M) + Verschieben-Modus (M) If you click here, draw-mode will be activated. In this mode you can add and move single values. This is the default-mode which is used most of the time. You can also press 'D' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Zeichen-Modus aktiviert. In diesem Modus können Sie einzelne Werte hinzufügen und verschieben. Das ist der Standard-Modus, der meistens benutzt wird. Sie können auch 'D' auf Ihrer Tastatur drücken, um in diesen Modus zu gelangen. + Wenn Sie hier klicken, wird der Zeichen-Modus aktiviert. In diesem Modus können Sie einzelne Werte hinzufügen und verschieben. Das ist der Standard-Modus, der meistens benutzt wird. Sie können auch 'D' auf Ihrer Tastatur drücken, um in diesen Modus zu gelangen. If you click here, erase-mode will be activated. In this mode you can erase single values. You can also press 'E' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Radier-Modus aktiviert. In diesem Modus können Sie einzelne Werte löschen. Sie können auch 'E' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. + Wenn Sie hier klicken, wird der Radier-Modus aktiviert. In diesem Modus können Sie einzelne Werte löschen. Sie können auch 'E' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. If you click here, select-mode will be activated. In this mode you can select values. This is neccessary if you want to cut, copy, paste, delete or move values. You can also press 'S' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Auswahl-Modus aktiviert. In diesem Modus können Sie Werte markieren. Das ist nötig, wenn Sie (mehrere) Noten ausschneiden, kopieren, einfügen, löschen oder verschieben wollen. Sie können auch 'S' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. + Wenn Sie hier klicken, wird der Auswahl-Modus aktiviert. In diesem Modus können Sie Werte markieren. Das ist nötig, wenn Sie (mehrere) Noten ausschneiden, kopieren, einfügen, löschen oder verschieben wollen. Sie können auch 'S' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. If you click here, move-mode will be activated. In this mode you can move the values you selected in select-mode. You can also press 'M' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Verschiebe-Modus aktiviert. In diesem Modus können Sie die markierten Werte verschieben. Sie können auch 'M' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. + Wenn Sie hier klicken, wird der Verschiebe-Modus aktiviert. In diesem Modus können Sie die markierten Werte verschieben. Sie können auch 'M' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. Cut selected values (Ctrl+X) @@ -758,6 +758,38 @@ http://lmms.sourceforge.net All selected values were copied to the clipboard. Alle ausgewählten Werte wurden in die Zwischenablage kopiert. + + Draw mode (Shift+D) + + + + Erase mode (Shift+E) + + + + Select mode (Shift+S) + + + + Move selection mode (Shift+M) + + + + If you click here, draw-mode will be activated. In this mode you can add and move single values. This is the default-mode which is used most of the time. You can also press 'Shift+D' on your keyboard to activate this mode. + + + + If you click here, erase-mode will be activated. In this mode you can erase single values. You can also press 'Shift+E' on your keyboard to activate this mode. + + + + If you click here, select-mode will be activated. In this mode you can select values. This is neccessary if you want to cut, copy, paste, delete or move values. You can also press 'Shift+S' on your keyboard to activate this mode. + + + + If you click here, move-mode will be activated. In this mode you can move the values you selected in select-mode. You can also press 'Shift+M' on your keyboard to activate this mode. + + bbEditor @@ -1121,6 +1153,32 @@ installiert sind. Soll der Einrichtungsassistent jetzt gestartet werden?LMMS-Arbeitsverzeichnis wählen + + effectSelectDialog + + Effects Selector + Effektauswähler + + + Add + Hinzufügen + + + Cancel + Abbrechen + + + + effectTabWidget + + EFFECTS CHAIN + EFFEKT-KETTE + + + Add + Hinzufügen + + envelopeAndLFOWidget @@ -1730,6 +1788,10 @@ Stellen Sie sicher, dass Sie Schreibzugriff auf die gewählte Datei/Gerät haben FX channel FX-Kanal + + FX + FX + knob @@ -1762,6 +1824,146 @@ Stellen Sie sicher, dass Sie Schreibzugriff auf die gewählte Datei/Gerät haben Im Aut&omation-Editor öffnen + + ladspaControl + + Link channels + Kanäle verbinden + + + Value: + Wert: + + + Sorry, no help available. + Sorry, keine Hilfe verfügbar. + + + + ladspaControlDialog + + Channel + Kanal + + + Link Channels + Kanäle verbinden + + + + ladspaPortDialog + + Name + Name + + + Rate + Rate + + + Direction + Richtung + + + Type + Typ + + + Min < Default < Max + Min < Standard < Max + + + Logarithmic + Logarithmisch + + + SR Dependent + SR-abhängig + + + Audio + Audio + + + Control + Steuerung + + + Input + Eingang + + + Output + Ausgang + + + Toggled + + + + Integer + Gannzahl + + + Float + Kommazahl + + + Yes + Ja + + + + ladspaSubPluginDescriptionWidget + + Description + Beschreibung + + + Name: + Name: + + + Maker: + Hersteller: + + + Copyright: + Copyright: + + + Requires Real Time: Yes + Benötigt Echtzeit: ja + + + Requires Real Time: No + Benötigt Echtzeit: nein + + + Real Time Capable: Yes + Echtzeitfähig: ja + + + Real Time Capable: No + Echtzeitfähig: nein + + + In Place Broken: Yes + + + + In Place Broken: No + + + + Channels In: + Eingangs-Kanäle: + + + Channels Out: + Ausgangs-Kanäle: + + lcdSpinBox @@ -1984,6 +2186,216 @@ Bitte besuchen Sie http://wiki.mindrules.net für Dokumentationen über LMMS.By pressing this button, you can show or hide the Automation Editor. With the help of the Automation Editor you can edit dynamic values in an easy way. Durch das Drücken dieses Knopfes können Sie den Automation-Editor ein- oder ausblenden. Mit Hilfe des Automation-Editors können Sie dynamische Werte auf eine einfache Art und Weise bearbeiten. + + LADSPA Plugins... + LADSPA-Plugins... + + + + mallets + + Spread + + + + Spread: + + + + Hardness + + + + Hardness: + + + + Position + + + + Position: + + + + Vibrato Gain + + + + Vib Gain + + + + Vib Gain: + + + + Vibrato Freq + + + + Vib Freq + + + + Vib Freq: + + + + Stick Mix + + + + Stick Mix: + + + + Modulator + + + + Modulator: + + + + Crossfade + + + + Crossfade: + + + + LFO Speed + + + + LFO Speed: + + + + LFO Depth + + + + LFO Depth: + + + + ADSR + + + + ADSR: + + + + Bowed + + + + Pressure + + + + Pressure: + + + + Motion + + + + Motion: + + + + Speed + + + + Speed: + + + + Vibrato + + + + Vibrato: + + + + Instrument + + + + Marimba + + + + Vibraphone + + + + Agogo + + + + Wood1 + + + + Reso + + + + Wood2 + + + + Beats + + + + Two Fixed + + + + Clump + + + + Tubular Bells + + + + Uniform Bar + + + + Tuned Bar + + + + Glass + + + + Tibetan Bowl + + + + + meterDialog + + Meter Numerator + Takt/Zähler + + + Meter Denominator + Takt/Nenner + midiClient @@ -2226,15 +2638,15 @@ Lautstärke eines Steps kann mit Mausrad geändert werden pianoRoll If you click here, erase-mode will be activated. In this mode you can erase single notes. You can also press 'E' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Radier-Modus aktiviert. In diesem Modus können Sie einzelne Noten löschen. Sie können auch 'E' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. + Wenn Sie hier klicken, wird der Radier-Modus aktiviert. In diesem Modus können Sie einzelne Noten löschen. Sie können auch 'E' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. If you click here, select-mode will be activated. In this mode you can select notes. This is neccessary if you want to cut, copy, paste, delete or move notes. You can also press 'S' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Auswahl-Modus aktiviert. In diesem Modus können Sie Noten markieren. Das ist nötig, wenn Sie (mehrere) Noten ausschneiden, kopieren, einfügen, löschen oder verschieben wollen. Sie können auch 'S' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. + Wenn Sie hier klicken, wird der Auswahl-Modus aktiviert. In diesem Modus können Sie Noten markieren. Das ist nötig, wenn Sie (mehrere) Noten ausschneiden, kopieren, einfügen, löschen oder verschieben wollen. Sie können auch 'S' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. If you click here, move-mode will be activated. In this mode you can move the notes you selected in select-mode. You can also press 'M' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Verschiebe-Modus aktiviert. In diesem Modus können Sie die markierten Noten verschieben. Sie können auch 'M' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. + Wenn Sie hier klicken, wird der Verschiebe-Modus aktiviert. In diesem Modus können Sie die markierten Noten verschieben. Sie können auch 'M' auf Ihrer Tastatur drücken, um diesen Modus zu aktivieren. Cut selected notes (Ctrl+X) @@ -2278,7 +2690,7 @@ Lautstärke eines Steps kann mit Mausrad geändert werden If you click here, draw-mode will be activated. In this mode you can add, resize and move single notes. This is the default-mode which is used most of the time. You can also press 'D' on your keyboard to activate this mode. - Wenn Sie hier klicken, wird der Zeichen-Modus aktiviert. In diesem Modus können Sie einzelne Noten hinzufügen, deren Größe ändern oder sie verschieben. Das ist der Standard-Modus, der meistens benutzt wird. Sie können auch 'D' auf Ihrer Tastatur drücken, um in diesen Modus zu gelangen. + Wenn Sie hier klicken, wird der Zeichen-Modus aktiviert. In diesem Modus können Sie einzelne Noten hinzufügen, deren Größe ändern oder sie verschieben. Das ist der Standard-Modus, der meistens benutzt wird. Sie können auch 'D' auf Ihrer Tastatur drücken, um in diesen Modus zu gelangen. Piano-Roll - %1 @@ -2302,19 +2714,19 @@ Lautstärke eines Steps kann mit Mausrad geändert werden Draw mode (D) - Zeichnen-Modus (D) + Zeichnen-Modus (D) Erase mode (E) - Löschen-Modus (E) + Löschen-Modus (E) Select mode (S) - Auswahl-Modus (S) + Auswahl-Modus (S) Move selection mode (M) - Verschieben-Modus (M) + Verschieben-Modus (M) Notes copied @@ -2328,6 +2740,38 @@ Lautstärke eines Steps kann mit Mausrad geändert werden Last note Letzte Note + + Draw mode (Shift+D) + + + + Erase mode (Shift+E) + + + + Select mode (Shift+S) + + + + Move selection mode (Shift+M) + + + + If you click here, draw-mode will be activated. In this mode you can add, resize and move single notes. This is the default-mode which is used most of the time. You can also press 'Shift+D' on your keyboard to activate this mode. + + + + If you click here, erase-mode will be activated. In this mode you can erase single notes. You can also press 'Shift+E' on your keyboard to activate this mode. + + + + If you click here, select-mode will be activated. In this mode you can select notes. This is neccessary if you want to cut, copy, paste, delete or move notes. You can also press 'Shift+S' on your keyboard to activate this mode. + + + + If you click here, move-mode will be activated. In this mode you can move the notes you selected in select-mode. You can also press 'Shift+M' on your keyboard to activate this mode. + + pianoWidget @@ -2417,6 +2861,14 @@ Lautstärke eines Steps kann mit Mausrad geändert werden Filter for importing FL Studio projects into LMMS Filter für Import von FL Studio Projekten in LMMS + + Tuneful things to bang on + + + + plugin for using arbitrary LADSPA-effects inside LMMS. + Plugin, um beliebige LADSPA-Effekte in LMMS nutzen zu können. + projectNotes @@ -2537,6 +2989,97 @@ Lautstärke eines Steps kann mit Mausrad geändert werden &Farbe... + + rackPlugin + + Turn the effect off + Effekt ausschalten + + + On/Off + An/aus + + + Toggles the effect on or off. + Schalten den Effekt an oder aus. + + + Wet/Dry mix + Wet/Dry-Mix + + + W/D + W/D + + + Wet Level: + Wet-Level: + + + The Wet/Dry knob sets the ratio between the input signal and the effect that shows up in the output. + + + + Decay + Abfallzeit + + + Time: + Zeit: + + + The Decay knob controls how many buffers of silence must pass before the plugin stops processing. Smaller values will reduce the CPU overhead but run the risk of clipping the tail on delay effects. + + + + Gate + Gate + + + Gate: + Gate: + + + The Gate knob controls the signal level that is considered to be 'silence' while deciding when to stop processing signals. + + + + Controls + Eigensch. + + + Effect plugins function as a chained series of effects where the signal will be processed from top to bottom. + +The On/Off switch allows you to bypass a given plugin at any point in time. + +The Wet/Dry knob controls the balance between the input signal and the effected signal that is the resulting output from the effect. The input for one stage is the output from the previous stage, so the 'dry' signal for effects lower in the chain contains all of the previous effects. + +The Decay knob controls how long the signal will continue to be processed after the notes have been released. The effect will stop processing signals when the signal has dropped below a given threshold for a given length of time. This knob sets the 'given length of time'. Longer times will require more CPU, so this number should be set low for most effects. It needs to be bumped up for effects that produce lengthy periods of silence, e.g. delays. + +The Gate knob controls the 'given threshold' for the effect's auto shutdown. The clock for the 'given length of time' will begin as soon as the processed signal level drops below the level specified with this knob. + +The Controls button opens a dialog for editing the effect's parameters. + +Right clicking will bring up a context menu where you can change the order in which the effects are processed or delete an effect altogether. + + + + Move &up + Nach &oben verschieben + + + Move &down + Nach &unten verschieben + + + &Remove this plugin + Plugin entfe&rnen + + + &Help + &Hilfe + + renameDialog @@ -2761,6 +3304,22 @@ Latenz: %2 ms Choose FL Studio installation directory FL Studio Installationsverzeichnis wählen + + LADSPA plugin directories + LADSPA-Plugin-Verzeichnis + + + STK rawwave directory + STK RawWave-Verzeichnis + + + Choose LADSPA plugin directory + Wählen Sie Ihr LADSPA-Plugin-Verzeichnis + + + Choose STK rawwave directory + Wählen Sie Ihr STK-RawWave-Verzeichnis + setupWidget @@ -3090,6 +3649,14 @@ Bitte stellen Sie sicher, dass Sie Schreibrechte auf diese Datei besitzen und ve &Open in automation editor Im Aut&omation-Editor öffnen + + Custom... + Benutzerdefiniert... + + + Custom + Benutzerdefiniert + timeLine @@ -3270,6 +3837,14 @@ Klick rechts = alle anderen Spuren stummschalten (Solo) Mute Stumm + + Enable automation + Automation aktivieren + + + Disable automation + Automation deaktivieren + tripleOscillator diff --git a/include/audio_port.h b/include/audio_port.h index 1d9be76fb..dc23bfadb 100644 --- a/include/audio_port.h +++ b/include/audio_port.h @@ -38,13 +38,9 @@ #endif -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT -#include "effect_chain.h" -#endif - #include "mixer.h" #include "effect_board.h" +#include "effect_chain.h" class audioPort : public engineObject @@ -80,12 +76,10 @@ public: return( m_nextFxChannel ); } -#ifdef LADSPA_SUPPORT inline effectChain * getEffects( void ) { return( m_effects ); } -#endif void setNextFxChannel( const fx_ch_t _chnl ) { @@ -106,9 +100,7 @@ public: NONE, FIRST, BOTH } m_bufferUsage; -#ifdef LADSPA_SUPPORT inline bool processEffects( void ) { return( m_effects->processAudioBuffer( m_firstBuffer, m_frames ) ); }; -#endif private: surroundSampleFrame * m_firstBuffer; @@ -118,10 +110,8 @@ private: QString m_name; -#ifdef LADSPA_SUPPORT effectChain * m_effects; fpab_t m_frames; -#endif } ; diff --git a/include/dummy_effect.h b/include/dummy_effect.h new file mode 100644 index 000000000..274c179e3 --- /dev/null +++ b/include/dummy_effect.h @@ -0,0 +1,67 @@ +/* + * dummy_effect.h - effect used as fallback if an effect couldn't be loaded + * + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _DUMMY_EFFECT_H +#define _DUMMY_EFFECT_H + +#include "effect.h" + + +class dummyEffect : public effect +{ +public: + inline dummyEffect( void ) : + effect( NULL, NULL ) + { + } + + inline virtual ~dummyEffect() + { + } + + + inline virtual void saveSettings( QDomDocument &, QDomElement & ) + { + } + + inline virtual void loadSettings( const QDomElement & ) + { + } + + inline virtual QString nodeName( void ) const + { + return( "dummyeffect" ); + } + + inline virtual effectControlDialog * createControlDialog( track * ) + { + // TODO: setup a dummy control-dialog for not crashing LMMS + return( NULL ); + } + +} ; + + +#endif diff --git a/include/effect.h b/include/effect.h index bc3a15e71..2346ecc57 100644 --- a/include/effect.h +++ b/include/effect.h @@ -2,6 +2,7 @@ * effect.h - base class for effects * * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -22,12 +23,10 @@ * */ + #ifndef _EFFECT_H #define _EFFECT_H -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT - #ifdef HAVE_CONFIG_H #include #endif @@ -35,24 +34,37 @@ #ifdef QT4 #include +#include #else -#include +#include +#include #endif #include "qt3support.h" -#include "engine.h" +#include "plugin.h" #include "mixer.h" -class effect: public engineObject +class effectControlDialog; +class track; + + +class effect : public plugin { public: - effect( engine * _engine ); + struct constructionData + { + engine * eng; + descriptor::subPluginFeatures::key key; + } ; + + + effect( const plugin::descriptor * _desc, constructionData * _cdata ); virtual ~effect(); virtual bool FASTCALL processAudioBuffer( @@ -129,17 +141,6 @@ public: { m_wetDry = _wet; } - - inline const QString & getName( void ) - { - return( m_name ); - } - - inline void setName( QString _name ) - { - m_name = _name; - } - inline float getGate( void ) { return( m_gate ); @@ -186,9 +187,21 @@ public: { m_noRun = _state; } - + + inline const descriptor::subPluginFeatures::key & getKey( void ) + { + return( m_key ); + } + + virtual effectControlDialog * createControlDialog( track * _track ) = 0; + + static effect * FASTCALL instantiate( const QString & _plugin_name, + constructionData & _cdata ); + + private: - QString m_name; + descriptor::subPluginFeatures::key m_key; + ch_cnt_t m_processors; bool m_okay; @@ -202,8 +215,12 @@ private: float m_wetDry; float m_gate; QMutex m_processLock; -}; - -#endif + +} ; + + +typedef effect::descriptor::subPluginFeatures::key effectKey; +typedef effect::descriptor::subPluginFeatures::keyList effectKeyList; + #endif diff --git a/include/effect_chain.h b/include/effect_chain.h index 890893e0a..915647fcd 100644 --- a/include/effect_chain.h +++ b/include/effect_chain.h @@ -25,9 +25,6 @@ #ifndef _EFFECT_CHAIN_H #define _EFFECT_CHAIN_H -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT - #ifdef QT4 #include @@ -49,7 +46,7 @@ class effectChain: public engineObject { public: effectChain( engine * _engine ); - ~effectChain(); + virtual ~effectChain(); void FASTCALL appendEffect( effect * _effect ); void FASTCALL deleteEffect( effect * _effect ); @@ -79,9 +76,3 @@ private: #endif -#endif - - - - - diff --git a/include/effect_control_dialog.h b/include/effect_control_dialog.h new file mode 100644 index 000000000..43271c379 --- /dev/null +++ b/include/effect_control_dialog.h @@ -0,0 +1,76 @@ +/* + * effect_control_dialog.h - base-class for effect-dialogs for displaying and + * editing control port values + * + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _EFFECT_CONTROL_DIALOG_H +#define _EFFECT_CONTROL_DIALOG_H + +#ifdef QT4 + +#include + +#else + +#include + +#endif + +#include "qt3support.h" + +#include "journalling_object.h" +#include "effect.h" + + +class track; + + +class effectControlDialog : public QWidget, public journallingObject +{ + Q_OBJECT + +public: + effectControlDialog( QWidget * _parent, effect * _eff ); + virtual ~effectControlDialog(); + + virtual ch_cnt_t getControlCount( void ) = 0; + +signals: + void closed(); + + +protected: + virtual void closeEvent( QCloseEvent * _ce ); + template + T * getEffect( void ) + { + return( dynamic_cast( m_effect ) ); + } + + +private: + effect * m_effect; + +} ; + +#endif diff --git a/include/effect_label.h b/include/effect_label.h index 68e4fbbc4..d7b9ea6f1 100644 --- a/include/effect_label.h +++ b/include/effect_label.h @@ -26,8 +26,7 @@ #ifndef _EFFECT_LABEL_H #define _EFFECT_LABEL_H -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT +#include "qt3support.h" #ifdef QT4 @@ -101,5 +100,3 @@ private: }; #endif - -#endif diff --git a/include/effect_select_dialog.h b/include/effect_select_dialog.h new file mode 100644 index 000000000..e2c33ee3e --- /dev/null +++ b/include/effect_select_dialog.h @@ -0,0 +1,108 @@ +/* + * effect_select_dialog.h - dialog to choose effect plugin + * + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _EFFECT_SELECT_DIALOG_H +#define _EFFECT_SELECT_DIALOG_H + +#include "qt3support.h" + +#ifdef QT4 + +#include +#include +#define QListBoxItem Q3ListBoxItem + +#else + +#include +#include + +#define Q3ListBox QListBox + +#endif + +#include "engine.h" +#include "effect.h" + + +class effectSelectDialog : public QDialog, public engineObject +{ + Q_OBJECT +public: + effectSelectDialog( QWidget * _parent, engine * _engine ); + virtual ~effectSelectDialog(); + + effect * instantiateSelectedPlugin( void ); + +public slots: + void showPorts( void ); + void setSelection( const effectKey & _selection ); + void selectPlugin( void ); + +private: + effectKey m_currentSelection; + +} ; + + + +class effectList : public QWidget, public engineObject +{ + Q_OBJECT +public: + effectList( QWidget * _parent, engine * _engine ); + + virtual ~effectList(); + + inline effectKey getSelected( void ) + { + return( m_currentSelection ); + } + + +signals: + void highlighted( const effectKey & _key ); + void addPlugin( const effectKey & _key ); + void doubleClicked( const effectKey & _key ); + + +protected slots: + void onHighlighted( int _plugin ); + void onAddButtonReleased(); + void onDoubleClicked( QListBoxItem * _item ); + + +private: + vvector m_pluginDescriptors; + effectKeyList m_effectKeys; + effectKey m_currentSelection; + + Q3ListBox * m_pluginList; + QWidget * m_descriptionWidgetParent; + QWidget * m_descriptionWidget; + +} ; + +#endif diff --git a/include/effect_tab_widget.h b/include/effect_tab_widget.h index a62d7302a..45312fc9a 100644 --- a/include/effect_tab_widget.h +++ b/include/effect_tab_widget.h @@ -27,9 +27,6 @@ #ifndef _EFFECT_TAB_WIDGET_H #define _EFFECT_TAB_WIDGET_H -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT - #include "qt3support.h" #ifdef QT4 @@ -108,7 +105,4 @@ private: } ; - -#endif - #endif diff --git a/include/instrument.h b/include/instrument.h index 7e27041dc..5f4026511 100644 --- a/include/instrument.h +++ b/include/instrument.h @@ -96,7 +96,7 @@ public: // instantiate instrument-plugin with given name or return NULL // on failure static instrument * FASTCALL instantiate( const QString & _plugin_name, - instrumentTrack * _channel_track ); + instrumentTrack * _channel_track ); protected: inline instrumentTrack * getInstrumentTrack( void ) const diff --git a/include/instrument_track.h b/include/instrument_track.h index f24d1fe25..22447e0ff 100755 --- a/include/instrument_track.h +++ b/include/instrument_track.h @@ -69,12 +69,8 @@ class notePlayHandle; class pianoWidget; class presetPreviewPlayHandle; class surroundArea; - class flpImport; - -#ifdef LADSPA_SUPPORT class effectTabWidget; -#endif class instrumentTrack : public QWidget, public track, public midiEventProcessor @@ -248,9 +244,7 @@ private: envelopeTabWidget * m_envWidget; arpAndChordsTabWidget * m_arpWidget; midiTabWidget * m_midiWidget; -#ifdef LADSPA_SUPPORT effectTabWidget * m_effWidget; -#endif // test-piano at the bottom of every instrument-settings-window pianoWidget * m_pianoWidget; diff --git a/include/ladspa_base.h b/include/ladspa_base.h new file mode 100644 index 000000000..c84bbf28c --- /dev/null +++ b/include/ladspa_base.h @@ -0,0 +1,94 @@ +/* + * ladspa_base.h - basic declarations concerning LADSPA + * + * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _LADSPA_BASE_H +#define _LADSPA_BASE_H + +#include "ladspa_manager.h" + +#ifdef LADSPA_SUPPORT + +#include "plugin.h" + +class ladspaControl; + + +typedef enum bufferRates +{ + CHANNEL_IN, + CHANNEL_OUT, + AUDIO_RATE_INPUT, + AUDIO_RATE_OUTPUT, + CONTROL_RATE_INPUT, + CONTROL_RATE_OUTPUT +} buffer_rate_t; + +typedef enum bufferData +{ + TOGGLED, + INTEGER, + FLOAT, + TIME, + NONE +} buffer_data_t; + +typedef struct portDescription +{ + QString name; + ch_cnt_t proc; + Uint16 port_id; + Uint16 control_id; + buffer_rate_t rate; + buffer_data_t data_type; + float scale; + LADSPA_Data max; + LADSPA_Data min; + LADSPA_Data def; + LADSPA_Data value; + LADSPA_Data * buffer; + ladspaControl * control; +} port_desc_t; + + +inline ladspa_key_t subPluginKeyToLadspaKey( + const plugin::descriptor::subPluginFeatures::key & _key ) +{ + return( ladspa_key_t( _key.user.toStringList().first(), + _key.user.toStringList().last() ) ); +} + +inline plugin::descriptor::subPluginFeatures::key ladspaKeyToSubPluginKey( + plugin::descriptor * _desc, + const QString & _name, + const ladspa_key_t & _key ) +{ + return( plugin::descriptor::subPluginFeatures::key( _desc, _name, + QVariant( QStringList() << _key.first << _key.second ) ) ); +} + + +#endif + +#endif diff --git a/include/ladspa_browser.h b/include/ladspa_browser.h index 7040513d2..79b36cb9f 100644 --- a/include/ladspa_browser.h +++ b/include/ladspa_browser.h @@ -1,3 +1,4 @@ +#if 0 /* * ladspa_browser.h - dialog to display information about installed LADSPA * plugins @@ -73,3 +74,6 @@ private: #endif #endif + +#endif + diff --git a/include/ladspa_manager.h b/include/ladspa_manager.h index 58b28857e..a90f16fa3 100644 --- a/include/ladspa_manager.h +++ b/include/ladspa_manager.h @@ -58,7 +58,7 @@ #include "types.h" -#include "qt3support.h" +//#include "qt3support.h" class engine; @@ -82,7 +82,7 @@ calls using: as the plug-in key. */ -enum pluginType +enum ladspaPluginType { SOURCE, TRANSFER, @@ -96,7 +96,7 @@ typedef struct ladspaManagerStorage { LADSPA_Descriptor_Function descriptorFunction; Uint32 index; - pluginType type; + ladspaPluginType type; Uint16 inputChannels; Uint16 outputChannels; } ladspaManagerDescription; diff --git a/include/ladspa_subplugin_features.h b/include/ladspa_subplugin_features.h new file mode 100644 index 000000000..e52da63eb --- /dev/null +++ b/include/ladspa_subplugin_features.h @@ -0,0 +1,68 @@ +/* + * ladspa_subplugin_features.h - derivation from + * plugin::descriptor::subPluginFeatures for + * hosting LADSPA-plugins + * + * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _LADSPA_SUBPLUGIN_FEATURES_H +#define _LADSPA_SUBPLUGIN_FEATURES_H + +#include "plugin.h" +#include "ladspa_2_lmms.h" + +#ifdef LADSPA_SUPPORT + +class QLabel; +class ladspa2LMMS; + + +class ladspaSubPluginDescriptionWidget : public QWidget +{ +public: + ladspaSubPluginDescriptionWidget( QWidget * _parent, engine * _engine, + const ladspa_key_t & _key ); + + +} ; + + + +class ladspaSubPluginFeatures : public plugin::descriptor::subPluginFeatures +{ +public: + ladspaSubPluginFeatures( plugin::pluginTypes _type ); + + virtual QWidget * createDescriptionWidget( QWidget * _parent, + engine * _eng, + const key & _key ); + + virtual void listSubPluginKeys( engine * _eng, + plugin::descriptor * _desc, keyList & _kl ); + +} ; + +#endif + +#endif diff --git a/include/main_window.h b/include/main_window.h index ecac9f7b6..cda902e66 100644 --- a/include/main_window.h +++ b/include/main_window.h @@ -119,7 +119,7 @@ public slots: void showSettingsDialog( void ); void aboutLMMS( void ); void help( void ); - void ladspaPluginBrowser( void ); +// void ladspaPluginBrowser( void ); void toggleAutomationEditorWin( void ); void toggleBBEditorWin( void ); void toggleSongEditorWin( void ); diff --git a/include/plugin.h b/include/plugin.h index 07d8ad361..76ccb2d22 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -49,6 +49,7 @@ #include "types.h" #include "journalling_object.h" #include "embed.h" +#include "base64.h" #define STRINGIFY_PLUGIN_NAME(s) STR(s) @@ -56,6 +57,7 @@ class QPixmap; +class QWidget; class plugin : public journallingObject @@ -63,11 +65,13 @@ class plugin : public journallingObject public: enum pluginTypes { - INSTRUMENT, // instrument being used in channel-track - EFFECT, // effect-plugin for effect-board - IMPORT_FILTER, // filter for importing a file - EXPORT_FILTER, // filter for exporting a file - UNDEFINED = 255 + Instrument, // instrument being used in channel-track + Effect, // effect-plugin for effect-board + ImportFilter, // filter for importing a file + ExportFilter, // filter for exporting a file + AnalysisTools, // analysis-tools (level-meter etc) + Other, + Undefined = 255 } ; // descriptor holds information about a plugin - every external plugin @@ -82,6 +86,68 @@ public: int version; pluginTypes type; const QPixmap * logo; + class subPluginFeatures + { + public: + struct key + { + inline key( plugin::descriptor * _desc = NULL, + const QString & _name = QString::null, + const QVariant & _user = QVariant() ) + : + desc( _desc ), + name( _name ), + user( _user ) + { + } + + inline key( const QString & _dump_data ) + : + desc( NULL ) + { + const vlist l = + base64::decode( _dump_data ). + toList(); + name = l[0].toString(); + user = l[1]; + } + inline QString dumpBase64( void ) const + { + return( base64::encode( + vlist() + << name << user ) ); + } + plugin::descriptor * desc; + QString name; + QVariant user; + }; + typedef vlist keyList; + + subPluginFeatures( plugin::pluginTypes _type ) : + m_type( _type ) + { + } + + virtual ~subPluginFeatures() + { + } + + virtual QWidget * createDescriptionWidget( + QWidget *, engine *, const key & ) + { + return( NULL ); + } + virtual void listSubPluginKeys( engine *, + plugin::descriptor *, + keyList & ) + { + } + + protected: + const plugin::pluginTypes m_type; + } + * sub_plugin_features; + } ; // contructor of a plugin @@ -89,7 +155,7 @@ public: virtual ~plugin(); // returns public-name out of descriptor - inline QString publicName( void ) const + virtual inline QString publicName( void ) const { return( m_descriptor->public_name ); } diff --git a/include/rack_plugin.h b/include/rack_plugin.h index 12a10aa26..fa7f981c8 100644 --- a/include/rack_plugin.h +++ b/include/rack_plugin.h @@ -1,6 +1,6 @@ /* - * effect_tab_widget.h - tab-widget in channel-track-window for setting up - * effects + * rack_plugin.h - tab-widget in channel-track-window for setting up + * effects * * Copyright (c) 2006 Danny McRae * @@ -25,9 +25,6 @@ #ifndef _RACK_PLUGIN_H #define _RACK_PLUGIN_H -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT - #ifdef QT4 #include @@ -48,13 +45,12 @@ #include "journalling_object.h" #include "led_checkbox.h" #include "track.h" -#include "ladspa_effect.h" -#include "ladspa_control_dialog.h" #include "audio_port.h" class knob; class tempoSyncKnob; +class effectControlDialog; class rackPlugin: public QWidget, public journallingObject @@ -62,20 +58,15 @@ class rackPlugin: public QWidget, public journallingObject Q_OBJECT public: - rackPlugin( QWidget * _parent, ladspa_key_t _key, - track * _track, engine * _engine, audioPort * _port ); - ~rackPlugin(); + rackPlugin( QWidget * _parent, effect * _eff, track * _track, + audioPort * _port ); + virtual ~rackPlugin(); inline effect * getEffect() { return( m_effect ); } - - inline const ladspa_key_t & getKey( void ) - { - return( m_key ); - } - + virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); virtual void FASTCALL loadSettings( const QDomElement & _this ); @@ -113,16 +104,13 @@ private: QGroupBox * m_controls; QLabel * m_label; QPushButton * m_editButton; - ladspaEffect * m_effect; - ladspaControlDialog * m_controlView; + effect * m_effect; + effectControlDialog * m_controlView; track * m_track; audioPort * m_port; QMenu * m_contextMenu; - ladspa_key_t m_key; - QString m_name; bool m_show; -}; - -#endif + +} ; #endif diff --git a/include/rack_view.h b/include/rack_view.h index 29dfcc6d9..c92cc9d2d 100644 --- a/include/rack_view.h +++ b/include/rack_view.h @@ -21,11 +21,8 @@ * Boston, MA 02110-1301 USA. * */ -#ifndef _RIGHT_FRAME_H -#define _RIGHT_FRAME_H - -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT +#ifndef _RACK_VIEW_H +#define _RACK_VIEW_H #ifdef QT4 @@ -48,7 +45,6 @@ #include "journalling_object.h" #include "rack_plugin.h" #include "track.h" -#include "ladspa_2_lmms.h" #include "audio_port.h" @@ -61,7 +57,7 @@ public: track * _track, audioPort * _port ); ~rackView(); - void addPlugin( ladspa_key_t _key ); + void addEffect( effect * _e ); virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); @@ -88,10 +84,7 @@ private: audioPort * m_port; Uint32 m_lastY; - - ladspa2LMMS * m_ladspa; -}; - -#endif + +} ; #endif diff --git a/include/sample_track.h b/include/sample_track.h index c08c2664f..2cfdc0f1c 100644 --- a/include/sample_track.h +++ b/include/sample_track.h @@ -45,12 +45,7 @@ #include "volume_knob.h" #include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT class effectLabel; -#else -class nameLabel; -#endif - class audioPort; class QLabel; @@ -160,11 +155,7 @@ public: private: -#ifdef LADSPA_SUPPORT effectLabel * m_trackLabel; -#else - nameLabel * m_trackLabel; -#endif audioPort * m_audioPort; volumeKnob * m_volumeKnob; diff --git a/plugins/Makefile.am b/plugins/Makefile.am index d0ceedd34..1fa1ac6c6 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -2,9 +2,13 @@ if VST_SUPPORT VESTIGE_SUBDIR=vestige endif +if LADSPA_SUPPORT +LADSPA_DIR=ladspa_effect +endif + if STK_SUPPORT STK_DIR=stk endif -SUBDIRS = audio_file_processor bit_invader flp_import midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VESTIGE_SUBDIR) vibed +SUBDIRS = audio_file_processor bit_invader flp_import $(LADSPA_DIR) midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VESTIGE_SUBDIR) vibed diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 859ffa6b1..b2627bdcb 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -57,10 +57,11 @@ #include "tooltip.h" #include "string_pair_drag.h" #include "mmp.h" +#include "volume_knob.h" + #undef SINGLE_SOURCE_COMPILE #include "embed.cpp" -#include "volume_knob.h" extern "C" @@ -76,8 +77,9 @@ plugin::descriptor audiofileprocessor_plugin_descriptor = "instrument-track" ), "Tobias Doerffel ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL } ; } diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index 49f3bb927..d393ba609 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -79,8 +79,9 @@ plugin::descriptor bitinvader_plugin_descriptor = "Rough & Dirty Wavetable Synthesizer." ), "Andreas Brandmaier ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL } ; } diff --git a/plugins/flp_import/flp_import.cpp b/plugins/flp_import/flp_import.cpp index 26ea70a38..5c34f9596 100644 --- a/plugins/flp_import/flp_import.cpp +++ b/plugins/flp_import/flp_import.cpp @@ -80,8 +80,9 @@ plugin::descriptor flpimport_plugin_descriptor = "Filter for importing FL Studio projects into LMMS" ), "Tobias Doerffel ", 0x0100, - plugin::IMPORT_FILTER, - new QPixmap() + plugin::ImportFilter, + new QPixmap(), + NULL } ; @@ -109,7 +110,7 @@ extern QString outstring; } -void dump_mem( const void * buffer, uint n_bytes ) +static void dump_mem( const void * buffer, uint n_bytes ) { uchar * cp = (uchar *) buffer; for( uint k = 0; k < n_bytes; ++k ) diff --git a/plugins/ladspa_effect/Makefile.am b/plugins/ladspa_effect/Makefile.am new file mode 100644 index 000000000..00758e765 --- /dev/null +++ b/plugins/ladspa_effect/Makefile.am @@ -0,0 +1,34 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="ladspaeffect" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./ladspa_effect.moc ./ladspa_control_dialog.moc + + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(top_builddir)/buildtools/bin2res $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES= libladspaeffect.la + +libladspaeffect_la_SOURCES = ladspa_effect.cpp ladspa_control_dialog.cpp ladspa_effect.h ladspa_control_dialog.h + +$(libladspaeffect_la_SOURCES): ./embedded_resources.h diff --git a/plugins/ladspa_effect/ladspa_control_dialog.cpp b/plugins/ladspa_effect/ladspa_control_dialog.cpp new file mode 100644 index 000000000..49222adb6 --- /dev/null +++ b/plugins/ladspa_effect/ladspa_control_dialog.cpp @@ -0,0 +1,285 @@ +#ifndef SINGLE_SOURCE_COMPILE + +/* + * ladspa_control_dialog.cpp - dialog for displaying and editing control port + * values for LADSPA plugins + * + * Copyright (c) 2006 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifdef QT4 + +#include + +#else + +#include + +#endif + +#include "ladspa_effect.h" + + +ladspaControlDialog::ladspaControlDialog( QWidget * _parent, + ladspaEffect * _eff, + track * _track ) : + effectControlDialog( _parent, _eff ), + m_effect( _eff ), + m_processors( _eff->getProcessorCount() ), + m_track( _track ), + m_noLink( FALSE ) +{ + m_mainLay = new QVBoxLayout( this ); +#ifdef QT3 + m_effectLay = new QHBoxLayout( m_mainLay ); +#else + m_effectLay = new QHBoxLayout(); + m_mainLay->addLayout( m_effectLay ); +#endif + + multi_proc_t controls = m_effect->getControls(); + m_controlCount = controls.count(); + + int rows = static_cast( sqrt( + static_cast( m_controlCount ) ) ); + + for( ch_cnt_t proc = 0; proc < m_processors; proc++ ) + { + control_list_t p; + + bool linked_control = FALSE; + int row_cnt = 0; + buffer_data_t last_port = NONE; + + QGroupBox * grouper; + if( m_processors > 1 ) + { +#ifdef QT3 + grouper = new QGroupBox( rows, Qt::Vertical, + tr( "Channel " ) + QString::number( proc + 1 ), + this ); +#else + grouper = new QGroupBox( tr( "Channel " ) + + QString::number( proc + 1 ), + this ); + grouper->setAlignment( Qt::Vertical ); +#endif + if( proc == 0 ) + { + linked_control = TRUE; + } + } + else + { +#ifdef QT3 + grouper = new QGroupBox( rows, Qt::Vertical, + "", this ); +#else + grouper = new QGroupBox( this ); + grouper->setAlignment( Qt::Vertical ); +#endif + } + + for( multi_proc_t::iterator it = controls.begin(); + it != controls.end(); it++ ) + { + if( (*it)->proc == proc ) + { + if( last_port == NONE || + (*it)->data_type != TOGGLED || + ( (*it)->data_type == TOGGLED && + last_port == TOGGLED ) ) + { + (*it)->control = + new ladspaControl( + grouper, (*it), + eng(), m_track, + linked_control ); + } + else + { + while( row_cnt < rows ) + { + m_blanks.append( + new QWidget( grouper ) ); + row_cnt++; + } + (*it)->control = new ladspaControl( + grouper, (*it), + eng(), + m_track, + linked_control ); + row_cnt = 0; + } + + row_cnt++; + if( row_cnt == ( rows - 1 ) ) + { + row_cnt = 0; + } + last_port = (*it)->data_type; + + p.append( (*it)->control ); + + if( linked_control ) + { + connect( (*it)->control, + SIGNAL( linkChanged( Uint16, bool ) ), + this, + SLOT( linkPort( Uint16, bool ) ) ); + } + } + } + + m_controls.append( p ); + + m_effectLay->addWidget( grouper ); + } + if( m_processors > 1 ) + { + m_mainLay->addSpacing( 3 ); +#ifdef QT3 + QHBoxLayout * center = new QHBoxLayout( m_mainLay ); +#else + QHBoxLayout * center = new QHBoxLayout(); + m_mainLay->addLayout( center ); +#endif + m_stereoLink = new ledCheckBox( tr( "Link Channels" ), + this, "", eng(), m_track ); + connect( m_stereoLink, SIGNAL( toggled( bool ) ), + this, SLOT( link( bool ) ) ); + m_stereoLink->setChecked( TRUE ); + center->addWidget( m_stereoLink ); + } +} + + + + +ladspaControlDialog::~ladspaControlDialog() +{ + for( ch_cnt_t proc = 0; proc < m_processors; proc++ ) + { + m_controls[proc].clear(); + } + m_controls.clear(); +} + + + + +void FASTCALL ladspaControlDialog::saveSettings( QDomDocument & _doc, + QDomElement & _this ) +{ + if( m_processors > 1 ) + { + _this.setAttribute( "link", m_stereoLink->isChecked() ); + } + + multi_proc_t controls = m_effect->getControls(); + _this.setAttribute( "ports", controls.count() ); + for( multi_proc_t::iterator it = controls.begin(); + it != controls.end(); it++ ) + { + QString n = "port" + QString::number( (*it)->proc ) + + QString::number( (*it)->port_id ); + (*it)->control->saveSettings( _doc, _this, n ); + } +} + + + + +void FASTCALL ladspaControlDialog::loadSettings( const QDomElement & _this ) +{ + if( m_processors > 1 ) + { + m_stereoLink->setChecked( _this.attribute( "link" ).toInt() ); + } + + multi_proc_t controls = m_effect->getControls(); + for( multi_proc_t::iterator it = controls.begin(); + it != controls.end(); it++ ) + { + QString n = "port" + QString::number( (*it)->proc ) + + QString::number( (*it)->port_id ); + (*it)->control->loadSettings( _this, n ); + } +} + + + + +void ladspaControlDialog::linkPort( Uint16 _port, bool _state ) +{ + ladspaControl * first = m_controls[0][_port]; + if( _state ) + { + for( ch_cnt_t proc = 1; proc < m_processors; proc++ ) + { + first->linkControls( m_controls[proc][_port] ); + } + } + else + { + for( ch_cnt_t proc = 1; proc < m_processors; proc++ ) + { + first->unlinkControls( m_controls[proc][_port] ); + } + m_noLink = TRUE; + m_stereoLink->setChecked( FALSE ); + } +} + + + +void ladspaControlDialog::link( bool _state ) +{ + if( _state ) + { + for( Uint16 port = 0; + port < m_controlCount / m_processors; + port++ ) + { + m_controls[0][port]->setLink( TRUE ); + } + } + else if( !m_noLink ) + { + for( Uint16 port = 0; + port < m_controlCount / m_processors; + port++ ) + { + m_controls[0][port]->setLink( FALSE ); + } + } + else + { + m_noLink = FALSE; + } +} + + +#include "ladspa_control_dialog.moc" + +#endif + diff --git a/plugins/ladspa_effect/ladspa_control_dialog.h b/plugins/ladspa_effect/ladspa_control_dialog.h new file mode 100644 index 000000000..d15b21882 --- /dev/null +++ b/plugins/ladspa_effect/ladspa_control_dialog.h @@ -0,0 +1,103 @@ +/* + * ladspa_control_dialog.h - dialog for displaying and editing control port + * values for LADSPA plugins + * + * Copyright (c) 2006 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _LADSPA_CONTROL_DIALOG_H +#define _LADSPA_CONTROL_DIALOG_H + +#include "ladspa_manager.h" + +#ifdef LADSPA_SUPPORT + +#ifdef QT4 + +#include +#include + +#else + +#include +#include + +#endif + +#include "qt3support.h" + +#include "effect_control_dialog.h" +#include "ladspa_control.h" +#include "track.h" +#include "led_checkbox.h" + + +typedef vvector control_list_t; + +class ladspaEffect; + + +class ladspaControlDialog : public effectControlDialog +{ + Q_OBJECT +public: + ladspaControlDialog( QWidget * _parent, ladspaEffect * _eff, + track * _track ); + virtual ~ladspaControlDialog(); + + inline ch_cnt_t getControlCount( void ) + { + return( m_controlCount ); + } + + virtual void FASTCALL saveSettings( QDomDocument & _doc, + QDomElement & _parent ); + virtual void FASTCALL loadSettings( const QDomElement & _this ); + inline virtual QString nodeName( void ) const + { + return( "controls" ); + } + + +protected slots: + void link( bool _state ); + void linkPort( Uint16 _port, bool _state ); + + +private: + ladspaEffect * m_effect; + ch_cnt_t m_processors; + ch_cnt_t m_controlCount; + track * m_track; + bool m_noLink; + audioPort * m_port; + ledCheckBox * m_stereoLink; + vvector m_blanks; + vvector m_controls; + + QVBoxLayout * m_mainLay; + QHBoxLayout * m_effectLay; + +} ; + +#endif + +#endif diff --git a/plugins/ladspa_effect/ladspa_effect.cpp b/plugins/ladspa_effect/ladspa_effect.cpp new file mode 100644 index 000000000..ccf47ae31 --- /dev/null +++ b/plugins/ladspa_effect/ladspa_effect.cpp @@ -0,0 +1,490 @@ +/* + * ladspa_effect.cpp - class for processing LADSPA effects + * + * Copyright (c) 2006 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifdef QT4 + +#include + +#else + +#include "qmessagebox.h" +#define indexOf find + +#endif + + +#include "ladspa_effect.h" +#include "mixer.h" +#include "config_mgr.h" +#include "buffer_allocator.h" +#include "audio_device.h" +#include "ladspa_control.h" +#include "ladspa_subplugin_features.h" + + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +extern "C" +{ + +plugin::descriptor ladspaeffect_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "LADSPA Effect", + QT_TRANSLATE_NOOP( "pluginBrowser", + "plugin for using arbitrary LADSPA-effects " + "inside LMMS." ), + "Danny McRae ", + 0x0100, + plugin::Effect, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + new ladspaSubPluginFeatures( plugin::Effect ) +} ; + +} + + +ladspaEffect::ladspaEffect( effect::constructionData * _cdata ) : + effect( &ladspaeffect_plugin_descriptor, _cdata ), + m_effName( "none" ), + m_key( subPluginKeyToLadspaKey( _cdata->key ) + /* ladspa_key_t( _cdata->settings.attribute( "label" ), + _cdata->settings.attribute( "lib" ) )*/ ), + m_ladspa( eng()->getLADSPAManager() ) +{ + if( m_ladspa->getDescription( m_key ) == NULL ) + { + QMessageBox::warning( 0, "Effect", + "Unknown LADSPA plugin requested: " + m_key.first, + QMessageBox::Ok, QMessageBox::NoButton ); + setOkay( FALSE ); + return; + } + + setPublicName( m_ladspa->getShortName( m_key ) ); + + // Calculate how many processing units are needed. + const ch_cnt_t lmms_chnls = eng()->getMixer()->audioDev()->channels(); + m_effectChannels = m_ladspa->getDescription( m_key )->inputChannels; + setProcessorCount( lmms_chnls / m_effectChannels ); + + // Categorize the ports, and create the buffers. + m_portCount = m_ladspa->getPortCount( m_key ); + + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ ) + { + multi_proc_t ports; + for( Uint16 port = 0; port < m_portCount; port++ ) + { + port_desc_t * p = new portDescription; + + p->name = m_ladspa->getPortName( m_key, port ); + p->proc = proc; + p->port_id = port; + + // Determine the port's category. + if( m_ladspa->isPortAudio( m_key, port ) ) + { + // Nasty manual memory management--was having difficulty + // with some prepackaged plugins that were segfaulting + // during cleanup. It was easier to troubleshoot with the + // memory management all taking place in one file. + p->buffer = + new LADSPA_Data[eng()->getMixer()->framesPerAudioBuffer()]; + + if( p->name.toUpper().contains( "IN" ) && + m_ladspa->isPortInput( m_key, port ) ) + { + p->rate = CHANNEL_IN; + } + else if( p->name.toUpper().contains( "OUT" ) && + m_ladspa->isPortOutput( m_key, port ) ) + { + p->rate = CHANNEL_OUT; + } + else if( m_ladspa->isPortInput( m_key, port ) ) + { + p->rate = AUDIO_RATE_INPUT; + } + else + { + p->rate = AUDIO_RATE_OUTPUT; + } + } + else + { + p->buffer = new LADSPA_Data; + + if( m_ladspa->isPortInput( m_key, port ) ) + { + p->rate = CONTROL_RATE_INPUT; + } + else + { + p->rate = CONTROL_RATE_OUTPUT; + } + } + + p->scale = 1.0f; + if( m_ladspa->isPortToggled( m_key, port ) ) + { + p->data_type = TOGGLED; + } + else if( m_ladspa->isInteger( m_key, port ) ) + { + p->data_type = INTEGER; + } + else if( p->name.toUpper().contains( "(SECONDS)" ) ) + { + p->data_type = TIME; + p->scale = 1000.0f; + int loc = p->name.toUpper().indexOf( + "(SECONDS)" ); + p->name.replace( loc, 9, "(ms)" ); + } + else if( p->name.toUpper().contains( "(S)" ) ) + { + p->data_type = TIME; + p->scale = 1000.0f; + int loc = p->name.toUpper().indexOf( "(S)" ); + p->name.replace( loc, 3, "(ms)" ); + } + else if( p->name.toUpper().contains( "(MS)" ) ) + { + p->data_type = TIME; + int loc = p->name.toUpper().indexOf( "(MS)" ); + p->name.replace( loc, 4, "(ms)" ); + } + else + { + p->data_type = FLOAT; + } + + // Get the range and default values. + p->max = m_ladspa->getUpperBound( m_key, port ); + if( p->max == NOHINT ) + { + p->max = 1.0f; + } + + if( m_ladspa->areHintsSampleRateDependent( + m_key, port ) ) + { + p->max *= eng()->getMixer()->sampleRate(); + } + + p->min = m_ladspa->getLowerBound( m_key, port ); + if( p->min == NOHINT ) + { + p->min = 0.0f; + } + + if( m_ladspa->areHintsSampleRateDependent( + m_key, port ) ) + { + p->min *= eng()->getMixer()->sampleRate(); + } + + p->def = m_ladspa->getDefaultSetting( m_key, port ); + if( p->def == NOHINT ) + { + if( p->data_type != TOGGLED ) + { + p->def = ( p->min + p->max ) / 2.0f; + } + else + { + p->def = 1.0f; + } + } + + p->max *= p->scale; + p->min *= p->scale; + p->def *= p->scale; + + p->value = p->def; + + + ports.append( p ); + + // For convenience, keep a separate list of the ports that are used + // to control the processors. + if( p->rate == AUDIO_RATE_INPUT || + p->rate == CONTROL_RATE_INPUT ) + { + p->control_id = m_controls.count(); + m_controls.append( p ); + } + } + m_ports.append( ports ); + } + + // Instantiate the processing units. + m_descriptor = m_ladspa->getDescriptor( m_key ); + if( m_descriptor == NULL ) + { + QMessageBox::warning( 0, "Effect", + "Can't get LADSPA descriptor function: " + m_key.first, + QMessageBox::Ok, QMessageBox::NoButton ); + setOkay( FALSE ); + return; + } + if( m_descriptor->run == NULL ) + { + QMessageBox::warning( 0, "Effect", + "Plugin has no processor: " + m_key.first, + QMessageBox::Ok, QMessageBox::NoButton ); + setDontRun( TRUE ); + } + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ ) + { + LADSPA_Handle effect = m_ladspa->instantiate( m_key, + eng()->getMixer()->sampleRate() ); + if( effect == NULL ) + { + QMessageBox::warning( 0, "Effect", + "Can't get LADSPA instance: " + m_key.first, + QMessageBox::Ok, QMessageBox::NoButton ); + setOkay( FALSE ); + return; + } + m_handles.append( effect ); + + } + + // Connect the ports. + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ ) + { + for( Uint16 port = 0; port < m_portCount; port++ ) + { + if( !m_ladspa->connectPort( m_key, + m_handles[proc], + port, + m_ports[proc][port]->buffer ) ) + { + QMessageBox::warning( 0, "Effect", + "Failed to connect port: " + m_key.first, + QMessageBox::Ok, QMessageBox::NoButton ); + setDontRun( TRUE ); + return; + } + } + } + + // Activate the processing units. + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ ) + { + m_ladspa->activate( m_key, m_handles[proc] ); + } +} + + + + +ladspaEffect::~ladspaEffect() +{ + if( !isOkay() ) + { + return; + } + + lock(); + + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ ) + { + m_ladspa->deactivate( m_key, m_handles[proc] ); + m_ladspa->cleanup( m_key, m_handles[proc] ); + for( Uint16 port = 0; port < m_portCount; port++ ) + { + free( m_ports[proc][port]->buffer ); + free( m_ports[proc][port] ); + } + m_ports[proc].clear(); + } + m_ports.clear(); + m_handles.clear(); + + unlock(); +} + + + + +bool FASTCALL ladspaEffect::processAudioBuffer( surroundSampleFrame * _buf, + const fpab_t _frames ) +{ + if( !isOkay() || dontRun() || !isRunning() || + isBypassed() || !tryLock() ) + { + return( FALSE ); + } + + // Copy the LMMS audio buffer to the LADSPA input buffer and initialize + // the control ports. Need to change this to handle non-in-place-broken + // plugins--would speed things up to use the same buffer for both + // LMMS and LADSPA. + ch_cnt_t channel = 0; + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++) + { + for( Uint16 port = 0; port < m_portCount; port++ ) + { + switch( m_ports[proc][port]->rate ) + { + case CHANNEL_IN: + for( fpab_t frame = 0; + frame < _frames; frame++ ) + { + m_ports[proc][port]->buffer[frame] = + _buf[frame][channel]; + } + channel++; + break; + case AUDIO_RATE_INPUT: + m_ports[proc][port]->value = + static_cast( + m_ports[proc][port]->control->getValue() / + m_ports[proc][port]->scale ); + // This only supports control rate ports, so the audio rates are + // treated as though they were control rate by setting the + // port buffer to all the same value. + for( fpab_t frame = 0; + frame < _frames; frame++ ) + { + m_ports[proc][port]->buffer[frame] = + m_ports[proc][port]->value; + } + break; + case CONTROL_RATE_INPUT: + m_ports[proc][port]->value = + static_cast( + m_ports[proc][port]->control->getValue() / + m_ports[proc][port]->scale ); + m_ports[proc][port]->buffer[0] = + m_ports[proc][port]->value; + break; + case CHANNEL_OUT: + case AUDIO_RATE_OUTPUT: + case CONTROL_RATE_OUTPUT: + break; + default: + break; + } + } + } + + // Process the buffers. + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++ ) + { + (m_descriptor->run)(m_handles[proc], _frames); + } + + // Copy the LADSPA output buffers to the LMMS buffer. + double out_sum = 0.0; + channel = 0; + for( ch_cnt_t proc = 0; proc < getProcessorCount(); proc++) + { + for( Uint16 port = 0; port < m_portCount; port++ ) + { + switch( m_ports[proc][port]->rate ) + { + case CHANNEL_IN: + case AUDIO_RATE_INPUT: + case CONTROL_RATE_INPUT: + break; + case CHANNEL_OUT: + for( fpab_t frame = 0; + frame < _frames; frame++ ) + { + _buf[frame][channel] = + getDryLevel() * + _buf[frame][channel] + + getWetLevel() * + m_ports[proc][port]->buffer[frame]; + out_sum += + _buf[frame][channel] * + _buf[frame][channel]; + } + channel++; + break; + case AUDIO_RATE_OUTPUT: + case CONTROL_RATE_OUTPUT: + break; + default: + break; + } + } + } + + // Check whether we need to continue processing input. Restart the + // counter if the threshold has been exceeded. + if( out_sum <= getGate() ) + { + incrementBufferCount(); + if( getBufferCount() > getTimeout() ) + { + stopRunning(); + resetBufferCount(); + } + } + else + { + resetBufferCount(); + } + + unlock(); + return( isRunning() ); +} + + + + +void FASTCALL ladspaEffect::setControl( Uint16 _control, LADSPA_Data _value ) +{ + if( !isOkay() ) + { + return; + } + lock(); + m_controls[_control]->value = _value; + unlock(); +} + + +#undef indexOf + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( void * _data ) +{ + return( new ladspaEffect( + static_cast( _data ) ) ); +} + +} + diff --git a/plugins/ladspa_effect/ladspa_effect.h b/plugins/ladspa_effect/ladspa_effect.h new file mode 100644 index 000000000..c1f5d8740 --- /dev/null +++ b/plugins/ladspa_effect/ladspa_effect.h @@ -0,0 +1,100 @@ +/* + * ladspa_effect.h - class for handling LADSPA effect plugins + * + * Copyright (c) 2006 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _LADSPA_EFFECT_H +#define _LADSPA_EFFECT_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "qt3support.h" + +#include "effect.h" +#include "ladspa_2_lmms.h" +#include "mixer.h" +#include "ladspa_control.h" +#include "ladspa_control_dialog.h" +#include "ladspa_base.h" +#include "main_window.h" + + +typedef vvector multi_proc_t; + +class ladspaEffect : public effect +{ +public: + ladspaEffect( effect::constructionData * _cdata ); + virtual ~ladspaEffect(); + + virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, + const fpab_t _frames ); + + void FASTCALL setControl( Uint16 _control, LADSPA_Data _data ); + + inline const multi_proc_t & getControls( void ) + { + return( m_controls ); + } + + virtual inline QString publicName( void ) const + { + return( m_effName ); + } + + inline void setPublicName( const QString & _name ) + { + m_effName = _name; + } + + virtual inline effectControlDialog * createControlDialog( + track * _track ) + { + return( new ladspaControlDialog( + eng()->getMainWindow()->workspace(), + this, _track ) ); + } + + inline virtual QString nodeName( void ) const + { + return( "ladspaeffect" ); + } + + +private: + QString m_effName; + ladspa_key_t m_key; + ladspa2LMMS * m_ladspa; + Uint16 m_effectChannels; + Uint16 m_portCount; + fpab_t m_bufferSize; + + const LADSPA_Descriptor * m_descriptor; + vvector m_handles; + + vvector m_ports; + multi_proc_t m_controls; +} ; + +#endif diff --git a/plugins/ladspa_effect/logo.png b/plugins/ladspa_effect/logo.png new file mode 100644 index 000000000..1d2f606a8 Binary files /dev/null and b/plugins/ladspa_effect/logo.png differ diff --git a/plugins/midi_import/midi_import.cpp b/plugins/midi_import/midi_import.cpp index 1622724f9..5a0f71686 100644 --- a/plugins/midi_import/midi_import.cpp +++ b/plugins/midi_import/midi_import.cpp @@ -62,8 +62,9 @@ plugin::descriptor midiimport_plugin_descriptor = "Filter for importing MIDI-files into LMMS" ), "Tobias Doerffel ", 0x0100, - plugin::IMPORT_FILTER, - new QPixmap() + plugin::ImportFilter, + new QPixmap(), + NULL } ; } diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index 1d4f4fe46..8a4bce74c 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -76,8 +76,9 @@ plugin::descriptor organic_plugin_descriptor = "Additive Synthesizer for organ-like sounds" ), "Andreas Brandmaier ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL } ; } diff --git a/plugins/plucked_string_synth/plucked_string_synth.cpp b/plugins/plucked_string_synth/plucked_string_synth.cpp index 457bf51e2..853b8d69d 100644 --- a/plugins/plucked_string_synth/plucked_string_synth.cpp +++ b/plugins/plucked_string_synth/plucked_string_synth.cpp @@ -58,8 +58,9 @@ plugin::descriptor pluckedstringsynth_plugin_descriptor = "cheap synthesis of guitar/harp-like sounds" ), "Tobias Doerffel ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL } ; } diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index 1bd258f96..ca971e533 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -60,8 +60,9 @@ plugin::descriptor malletsstk_plugin_descriptor = "Tuneful things to bang on" ), "Danny McRae ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL } ; } diff --git a/plugins/triple_oscillator/triple_oscillator.cpp b/plugins/triple_oscillator/triple_oscillator.cpp index fcd1033a0..ccf0ed8d3 100644 --- a/plugins/triple_oscillator/triple_oscillator.cpp +++ b/plugins/triple_oscillator/triple_oscillator.cpp @@ -73,8 +73,9 @@ plugin::descriptor tripleoscillator_plugin_descriptor = "in several ways" ), "Tobias Doerffel ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL } ; } diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 0324b91b4..d9e3d29f8 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -77,8 +77,9 @@ plugin::descriptor vestige_plugin_descriptor = "VST-host for using VST(i)-plugins within LMMS" ), "Tobias Doerffel ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL } ; } diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 9b0a579b2..f742acca5 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -72,8 +72,9 @@ plugin::descriptor vibedstrings_plugin_descriptor = "Vibrating string modeler" ), "Danny McRae ", 0x0100, - plugin::INSTRUMENT, - new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ) + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL }; } diff --git a/src/audio/audio_port.cpp b/src/audio/audio_port.cpp index ae0927df0..00987b090 100644 --- a/src/audio/audio_port.cpp +++ b/src/audio/audio_port.cpp @@ -25,11 +25,9 @@ */ #include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT #include "mixer.h" #include "audio_device.h" #include "config_mgr.h" -#endif #include "audio_port.h" #include "audio_device.h" @@ -52,10 +50,8 @@ audioPort::audioPort( const QString & _name, engine * _engine ) : eng()->getMixer()->framesPerAudioBuffer() ); eng()->getMixer()->addAudioPort( this ); setExtOutputEnabled( TRUE ); -#ifdef LADSPA_SUPPORT m_frames = eng()->getMixer()->framesPerAudioBuffer(); m_effects = new effectChain( eng() ); -#endif } diff --git a/src/core/effect.cpp b/src/core/effect.cpp index 0c819700b..2032aa604 100644 --- a/src/core/effect.cpp +++ b/src/core/effect.cpp @@ -1,9 +1,10 @@ #ifndef SINGLE_SOURCE_COMPILE /* - * effect.cpp - class for processing LADSPA effects + * effect.cpp - base-class for effects * * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -24,9 +25,6 @@ * */ -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT - #ifdef QT4 #include @@ -39,10 +37,12 @@ #include "effect.h" +#include "dummy_effect.h" -effect::effect( engine * _engine ) : - engineObject( _engine ), +effect::effect( const plugin::descriptor * _desc, constructionData * _cdata ) : + plugin( _desc, _cdata->eng ), + m_key( _cdata->key ), m_okay( TRUE ), m_noRun( FALSE ), m_running( FALSE ), @@ -82,8 +82,22 @@ void FASTCALL effect::setGate( float _level ) } +effect * effect::instantiate( const QString & _plugin_name, + constructionData & _cdata ) +{ + plugin * p = plugin::instantiate( _plugin_name, &_cdata ); + // check whether instantiated plugin is an instrument + if( dynamic_cast( p ) != NULL ) + { + // everything ok, so return pointer + return( dynamic_cast( p ) ); + } + + // not quite... so delete plugin and return dummy instrument + delete p; + return( new dummyEffect() ); +} + -#endif - #endif diff --git a/src/core/effect_chain.cpp b/src/core/effect_chain.cpp index 4d0234fb9..6fb7a41fd 100644 --- a/src/core/effect_chain.cpp +++ b/src/core/effect_chain.cpp @@ -24,8 +24,6 @@ * */ -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT #include "effect_chain.h" @@ -195,6 +193,4 @@ bool effectChain::isRunning( void ) } -#endif - #endif diff --git a/src/core/effect_control_dialog.cpp b/src/core/effect_control_dialog.cpp new file mode 100644 index 000000000..a4746bf26 --- /dev/null +++ b/src/core/effect_control_dialog.cpp @@ -0,0 +1,78 @@ +#ifndef SINGLE_SOURCE_COMPILE + +/* + * effect_control_dialog.cpp - base-class for effect-dialogs for displaying + * and editing control port values + * + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifdef QT4 + +#include +#include + +#else + +#include + +#endif + +#include "effect_control_dialog.h" + + +effectControlDialog::effectControlDialog( QWidget * _parent, effect * _eff ) : + QWidget( _parent +#ifdef QT3 + , "effectControlDialog" +#endif + ), + journallingObject( _eff->eng() ), + m_effect( _eff ) +{ + setWindowTitle( m_effect->publicName() ); + +} + + + + +effectControlDialog::~effectControlDialog() +{ +} + + + + +void effectControlDialog::closeEvent( QCloseEvent * _ce ) +{ + _ce->ignore(); + emit( closed() ); +} + + + + +#include "effect_control_dialog.moc" + +#endif + diff --git a/src/core/effect_select_dialog.cpp b/src/core/effect_select_dialog.cpp new file mode 100644 index 000000000..828ccfae4 --- /dev/null +++ b/src/core/effect_select_dialog.cpp @@ -0,0 +1,276 @@ +#ifndef SINGLE_SOURCE_COMPILE + +/* + * effect_select_dialog.cpp - dialog to choose effect plugin + * + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "qt3support.h" + +#ifdef QT4 + +#include +#include + +#else + +#include +#include + +#endif + +#include "effect_select_dialog.h" + +#include "gui_templates.h" +#include "embed.h" + + +effectSelectDialog::effectSelectDialog( QWidget * _parent, engine * _engine ) : + QDialog( _parent ), + engineObject( _engine ) +{ + setWindowIcon( embed::getIconPixmap( "setup_audio" ) ); + setWindowTitle( tr( "Effects Selector" ) ); + setModal( TRUE ); + + QVBoxLayout * vlayout = new QVBoxLayout( this ); + vlayout->setSpacing( 10 ); + vlayout->setMargin( 10 ); + + effectList * elist = new effectList( this, eng() ); + elist->setMinimumSize( 500, 400 ); + connect( elist, SIGNAL( doubleClicked( const effectKey & ) ), + this, SLOT( selectPlugin() ) ); + connect( elist, SIGNAL( highlighted( const effectKey & ) ), + this, SLOT( setSelection( const effectKey & ) ) ); + m_currentSelection = elist->getSelected(); + + QWidget * buttons = new QWidget( this ); + QHBoxLayout * btn_layout = new QHBoxLayout( buttons ); + btn_layout->setSpacing( 0 ); + btn_layout->setMargin( 0 ); + + + QPushButton * select_btn = new QPushButton( + embed::getIconPixmap( "add" ), + tr( "Add" ), buttons ); + connect( select_btn, SIGNAL( clicked() ), + this, SLOT( selectPlugin() ) ); + +/* QPushButton * ports_btn = new QPushButton( + embed::getIconPixmap("ports" ), + tr( "Ports" ), buttons ); + connect( ports_btn, SIGNAL( clicked() ), + this, SLOT( showPorts() ) ); +*/ + QPushButton * cancel_btn = new QPushButton( + embed::getIconPixmap( "cancel" ), + tr( "Cancel" ), buttons ); + connect( cancel_btn, SIGNAL( clicked() ), + this, SLOT( reject() ) ); + + btn_layout->addStretch(); + btn_layout->addSpacing( 10 ); + btn_layout->addWidget( select_btn ); +/* btn_layout->addSpacing( 10 ); + btn_layout->addWidget( ports_btn );*/ + btn_layout->addSpacing( 10 ); + btn_layout->addWidget( cancel_btn ); + btn_layout->addSpacing( 10 ); + + vlayout->addWidget( elist ); + vlayout->addSpacing( 10 ); + vlayout->addWidget( buttons ); + vlayout->addSpacing( 10 ); + //vlayout->addStretch(); + + show(); +} + + + + +effectSelectDialog::~effectSelectDialog() +{ +} + + + + +effect * effectSelectDialog::instantiateSelectedPlugin( void ) +{ + if( !m_currentSelection.name.isEmpty() && m_currentSelection.desc ) + { + effect::constructionData cd = + { + eng(), + m_currentSelection + } ; + return( effect::instantiate( m_currentSelection.desc->name, + cd ) ); + } + return( NULL ); +} + + + + +void effectSelectDialog::showPorts( void ) +{ +/* ladspaPortDialog ports( m_currentSelection, eng() ); + ports.exec();*/ +} + + + + +void effectSelectDialog::setSelection( const effectKey & _selection ) +{ + m_currentSelection = _selection; +} + + + + +void effectSelectDialog::selectPlugin( void ) +{ + accept(); +} + + + + + + + +effectList::effectList( QWidget * _parent, engine * _engine ) : + QWidget( _parent ), + engineObject( _engine ), + m_descriptionWidgetParent( new QWidget( this ) ), + m_descriptionWidget( NULL ) +{ + plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors ); + + for( vvector::iterator it = + m_pluginDescriptors.begin(); + it != m_pluginDescriptors.end(); ++it ) + { + if( it->type != plugin::Effect ) + { + continue; + } + if( it->sub_plugin_features ) + { + it->sub_plugin_features->listSubPluginKeys( eng(), + // as iterators are always stated to be not + // equal with pointers, we dereference the + // iterator and take the address of the item, + // so we're on the safe side and the compiler + // likely will reduce that to just "it" + &( *it ), + m_effectKeys ); + } + else + { + // TODO + } + } + + QStringList plugin_names; + for( effectKeyList::const_iterator it = m_effectKeys.begin(); + it != m_effectKeys.end(); ++it ) + { + plugin_names += QString( ( *it ).desc->public_name ) + ": " + + ( *it ).name; + } + + m_pluginList = new Q3ListBox( this ); + m_pluginList->insertStringList( plugin_names ); + connect( m_pluginList, SIGNAL( highlighted( int ) ), + SLOT( onHighlighted( int ) ) ); + connect( m_pluginList, SIGNAL( doubleClicked( QListBoxItem * ) ), + SLOT( onDoubleClicked( QListBoxItem * ) ) ); + QVBoxLayout * vboxl = new QVBoxLayout( this ); + vboxl->setMargin( 0 ); + vboxl->setSpacing( 10 ); + vboxl->addWidget( m_pluginList ); + vboxl->addWidget( m_descriptionWidgetParent ); + + new QVBoxLayout( m_descriptionWidgetParent ); + + if( m_pluginList->numRows() > 0 ) + { + m_pluginList->setSelected( 0, true ); + onHighlighted( 0 ); + } +} + + + + +effectList::~effectList() +{ +} + + + + +void effectList::onHighlighted( int _pluginIndex ) +{ + m_currentSelection = m_effectKeys[_pluginIndex]; + delete m_descriptionWidget; + if( m_currentSelection.desc && + m_currentSelection.desc->sub_plugin_features ) + { + m_descriptionWidget = m_currentSelection.desc-> + sub_plugin_features-> + createDescriptionWidget( m_descriptionWidgetParent, + eng(), m_currentSelection ); + } + dynamic_cast( m_descriptionWidgetParent->layout() )-> + addWidget( m_descriptionWidget ); + m_descriptionWidget->show(); + emit( highlighted( m_currentSelection ) ); +} + + + + +void effectList::onDoubleClicked( QListBoxItem * _item ) +{ + emit( doubleClicked( m_currentSelection ) ); +} + + + + +void effectList::onAddButtonReleased() +{ + emit( addPlugin( m_currentSelection ) ); +} + + + +#include "effect_select_dialog.moc" + +#endif diff --git a/src/core/effect_tab_widget.cpp b/src/core/effect_tab_widget.cpp index 4df9eb323..09ff64d38 100644 --- a/src/core/effect_tab_widget.cpp +++ b/src/core/effect_tab_widget.cpp @@ -25,8 +25,6 @@ * */ -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT #include "qt3support.h" @@ -52,11 +50,12 @@ #include "group_box.h" #include "tooltip.h" #include "embed.h" -#include "select_ladspa_dialog.h" +#include "effect_select_dialog.h" #include "rack_plugin.h" #include "audio_port.h" + effectTabWidget::effectTabWidget( instrumentTrack * _track, audioPort * _port ) : QWidget( _track->tabWidgetParent() ), @@ -146,16 +145,16 @@ void effectTabWidget::loadSettings( const QDomElement & _this ) void effectTabWidget::addEffect( void ) { - selectLADSPADialog sl( this, eng() ); - sl.exec(); - - if( sl.result() == QDialog::Rejected ) + effectSelectDialog esd( this, eng() ); + esd.exec(); + + if( esd.result() == QDialog::Rejected ) { return; } - - ladspa_key_t key = sl.getSelection(); - m_rack->addPlugin( key ); + + effect * e = esd.instantiateSelectedPlugin(); + m_rack->addEffect( e ); } @@ -178,7 +177,4 @@ void effectTabWidget::closeEvent( QCloseEvent * _ce ) #include "effect_tab_widget.moc" - -#endif - #endif diff --git a/src/core/import_filter.cpp b/src/core/import_filter.cpp index 6ebb3fc80..af55eb9aa 100644 --- a/src/core/import_filter.cpp +++ b/src/core/import_filter.cpp @@ -83,7 +83,7 @@ void importFilter::import( const QString & _file_to_import, for( vvector::iterator it = d.begin(); it != d.end(); ++it ) { - if( it->type == plugin::IMPORT_FILTER ) + if( it->type == plugin::ImportFilter ) { plugin * p = plugin::instantiate( it->name, s ); if( dynamic_cast( p ) != NULL && diff --git a/src/core/ladspa_browser.cpp b/src/core/ladspa_browser.cpp index b2b973d5f..cbba0f477 100644 --- a/src/core/ladspa_browser.cpp +++ b/src/core/ladspa_browser.cpp @@ -1,3 +1,4 @@ +#if 0 #ifndef SINGLE_SOURCE_COMPILE /* @@ -305,3 +306,4 @@ void ladspaBrowser::displayHelp( void ) #endif #endif +#endif diff --git a/src/core/ladspa_subplugin_features.cpp b/src/core/ladspa_subplugin_features.cpp new file mode 100644 index 000000000..8b713f8f2 --- /dev/null +++ b/src/core/ladspa_subplugin_features.cpp @@ -0,0 +1,192 @@ +#ifndef SINGLE_SOURCE_COMPILE + +/* + * ladspa_subplugin_features.cpp - derivation from + * plugin::descriptor::subPluginFeatures for + * hosting LADSPA-plugins + * + * Copyright (c) 2006 Danny McRae + * Copyright (c) 2006 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "ladspa_manager.h" + +#ifdef LADSPA_SUPPORT + + +#ifdef QT4 + +#include +#include +#include + +#else + +#include +#include +#include +#include + +#endif + + +#include "ladspa_subplugin_features.h" +#include "ladspa_base.h" +#include "mixer.h" +#include "audio_device.h" + + +ladspaSubPluginDescriptionWidget::ladspaSubPluginDescriptionWidget( + QWidget * _parent, engine * _engine, + const ladspa_key_t & _key ) : + QWidget( _parent +#ifdef QT3 + , "ladspaSubPluginDescriptionWidget" +#endif + ) +{ + ladspa2LMMS * lm = _engine->getLADSPAManager(); + QVBoxLayout * l = new QVBoxLayout( this ); + +#ifndef QT3 + QGroupBox * groupbox = new QGroupBox( tr( "Description" ), this ); +#else + QGroupBox * groupbox = new QGroupBox( 9, Qt::Vertical, + tr( "Description" ), this ); +#endif + + QLabel * label = new QLabel( groupbox ); + label->setText( tr( "Name: " ) + lm->getName( _key ) ); + + QLabel * maker = new QLabel( groupbox ); + maker->setText( tr( "Maker: " ) + lm->getMaker( _key ) ); + + QLabel * copyright = new QLabel( groupbox ); + copyright->setText( tr( "Copyright: " ) + lm->getCopyright( _key ) ); + + QLabel * requiresRealTime = new QLabel( groupbox ); + if( lm->hasRealTimeDependency( _key ) ) + { + requiresRealTime->setText( tr( "Requires Real Time: Yes" ) ); + } + else + { + requiresRealTime->setText( tr( "Requires Real Time: No" ) ); + } + + QLabel * realTimeCapable = new QLabel( groupbox ); + if( lm->isRealTimeCapable( _key ) ) + { + realTimeCapable->setText( tr( "Real Time Capable: Yes" ) ); + } + else + { + realTimeCapable->setText( tr( "Real Time Capable: No" ) ); + } + + QLabel * inplaceBroken = new QLabel( groupbox ); + if( lm->isInplaceBroken( _key ) ) + { + inplaceBroken->setText( tr( "In Place Broken: Yes" ) ); + } + else + { + inplaceBroken->setText( tr( "In Place Broken: No" ) ); + } + + QLabel * channelsIn = new QLabel( groupbox ); + channelsIn->setText( tr( "Channels In: " ) + + QString::number( lm->getDescription( _key )->inputChannels ) ); + + QLabel * channelsOut = new QLabel( groupbox ); + channelsOut->setText( tr( "Channels Out: " ) + + QString::number( lm->getDescription( _key )->outputChannels ) ); + l->addWidget( groupbox ); +} + + + + +ladspaSubPluginFeatures::ladspaSubPluginFeatures( plugin::pluginTypes _type ) : + subPluginFeatures( _type ) +{ +} + + + + +QWidget * ladspaSubPluginFeatures::createDescriptionWidget( + QWidget * _parent, engine * _eng, const key & _key ) +{ + return( new ladspaSubPluginDescriptionWidget( _parent, _eng, + subPluginKeyToLadspaKey( _key ) ) ); +} + + + + +void ladspaSubPluginFeatures::listSubPluginKeys( engine * _eng, + plugin::descriptor * _desc, keyList & _kl ) +{ + ladspa2LMMS * lm = _eng->getLADSPAManager(); + + l_sortable_plugin_t plugins; + switch( m_type ) + { + case plugin::Instrument: + plugins = lm->getInstruments(); + break; + case plugin::Effect: + plugins = lm->getValidEffects(); + //plugins += lm->getInvalidEffects(); + break; + case plugin::AnalysisTools: + plugins = lm->getAnalysisTools(); + break; + case plugin::Other: + plugins = lm->getOthers(); + break; + default: + break; + } + + for( l_sortable_plugin_t::const_iterator it = plugins.begin(); + it != plugins.end(); ++it ) + { + if( lm->getDescription( ( *it ).second )->inputChannels <= + _eng->getMixer()->audioDev()->channels() ) + { + _kl.push_back( ladspaKeyToSubPluginKey( + _desc, + ( *it ).first, + ( *it ).second ) ); + } + } +} + + + +#include "ladspa_subplugin_features.moc" + +#endif + +#endif diff --git a/src/core/main_window.cpp b/src/core/main_window.cpp index 9051f2c2f..033e21f98 100644 --- a/src/core/main_window.cpp +++ b/src/core/main_window.cpp @@ -81,10 +81,6 @@ #include "project_journal.h" #include "automation_editor.h" -#ifdef LADSPA_SUPPORT -#include "ladspa_browser.h" -#endif - #if QT_VERSION >= 0x030100 QSplashScreen * mainWindow::s_splashScreen = NULL; @@ -532,7 +528,7 @@ void mainWindow::finalize( void ) tr( "What's this?" ), this, SLOT( enterWhatsThisMode() ) ); - +#if 0 #ifdef LADSPA_SUPPORT #ifdef QT4 help_menu->addSeparator(); @@ -542,6 +538,7 @@ void mainWindow::finalize( void ) help_menu->addAction( embed::getIconPixmap( "help" ), tr( "LADSPA Plugins..." ), this, SLOT( ladspaPluginBrowser() ) ); #endif +#endif #ifdef QT4 @@ -830,7 +827,7 @@ void mainWindow::help( void ) - +#if 0 void mainWindow::ladspaPluginBrowser( void ) { // moc for Qt 3.x doesn't recognize preprocessor directives, @@ -840,7 +837,7 @@ void mainWindow::ladspaPluginBrowser( void ) lb.exec(); #endif } - +#endif diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index c0df319f9..d927f0311 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -278,18 +278,12 @@ const surroundSampleFrame * mixer::renderNextBuffer( void ) eng()->getSongEditor()->processNextBuffer(); -#ifdef LADSPA_SUPPORT bool more_effects = FALSE; -#endif for( vvector::iterator it = m_audioPorts.begin(); it != m_audioPorts.end(); ++it ) { -#ifdef LADSPA_SUPPORT more_effects = ( *it )->processEffects(); if( ( *it )->m_bufferUsage != audioPort::NONE || more_effects ) -#else - if( ( *it )->m_bufferUsage != audioPort::NONE ) -#endif { processBuffer( ( *it )->firstBuffer(), ( *it )->nextFxChannel() ); diff --git a/src/core/plugin.cpp b/src/core/plugin.cpp index b36d5e371..642347a5a 100644 --- a/src/core/plugin.cpp +++ b/src/core/plugin.cpp @@ -57,7 +57,7 @@ static plugin::descriptor dummy_plugin_descriptor = QT_TRANSLATE_NOOP( "pluginBrowser", "no description" ), "Tobias Doerffel ", 0x0100, - plugin::UNDEFINED, + plugin::Undefined, NULL } ; @@ -105,17 +105,9 @@ QString plugin::getParameter( const QString & ) plugin * plugin::instantiate( const QString & _plugin_name, void * _data ) { -/*#ifdef HAVE_DLFCN_H - void * handle = dlopen( QString( "lib" + _plugin_name + ".so" ). -#ifdef QT4 - toAscii().constData() -#else - ascii() -#endif - , RTLD_NOW );*/ QLibrary plugin_lib( configManager::inst()->pluginDir() + _plugin_name ); - if( /*handle == NULL*/ plugin_lib.load() == FALSE ) + if( plugin_lib.load() == FALSE ) { QMessageBox::information( NULL, mixer::tr( "Plugin not found" ), @@ -127,13 +119,6 @@ plugin * plugin::instantiate( const QString & _plugin_name, void * _data ) } instantiationHook inst_hook = ( instantiationHook ) plugin_lib.resolve( "lmms_plugin_main" ); -/* dlerror(); - instantiationHook inst_hook = ( instantiationHook )( dlsym( handle, - "lmms_plugin_main" ) ); - char * error = dlerror(); - if( error != NULL ) - { - printf( "%s\n", error );*/ if( inst_hook == NULL ) { QMessageBox::information( NULL, @@ -148,10 +133,7 @@ plugin * plugin::instantiate( const QString & _plugin_name, void * _data ) plugin_lib.setAutoUnload( FALSE ); #endif plugin * inst = inst_hook( _data ); - //dlclose( handle ); return( inst ); -/*#endif - return( new dummyPlugin() );*/ } @@ -190,27 +172,6 @@ void plugin::getDescriptorsOfAvailPlugins( vvector & _plugin_descs ) #ifndef QT4 plugin_lib.setAutoUnload( FALSE ); #endif -/* - void * handle = dlopen( f.absoluteFilePath(). -#ifdef QT4 - toAscii().constData(), -#else - ascii(), -#endif - RTLD_NOW ); - char * msg = dlerror(); - if( msg != NULL || handle == NULL ) - { - printf( "plugin-loader: %s\n", msg ); - continue; - } - void * foo = dlsym( handle, "lmms_plugin_main" ); - msg = dlerror(); - if( msg != NULL || foo == NULL ) - { - printf( "plugin-loader: %s\n", msg ); - continue; - }*/ QString desc_name = f.fileName().section( '.', 0, 0 ) + "_plugin_descriptor"; if( desc_name.left( 3 ) == "lib" ) @@ -229,21 +190,7 @@ void plugin::getDescriptorsOfAvailPlugins( vvector & _plugin_descs ) { continue; } -/* (descriptor *) dlsym( handle, desc_name. -#ifdef QT4 - toAscii().constData() -#else - ascii() -#endif - ); - msg = dlerror(); - if( msg != NULL || plugin_desc == NULL ) - { - printf( "plugin-loader: %s\n", msg ); - continue; - }*/ _plugin_descs.push_back( *plugin_desc ); - //dlclose( handle ); } } diff --git a/src/core/plugin_browser.cpp b/src/core/plugin_browser.cpp index dc37c4209..89ab392b7 100644 --- a/src/core/plugin_browser.cpp +++ b/src/core/plugin_browser.cpp @@ -88,7 +88,7 @@ pluginBrowser::pluginBrowser( QWidget * _parent, engine * _engine ) : m_pluginDescriptors.begin(); it != m_pluginDescriptors.end(); ++it ) { - if( it->type == plugin::INSTRUMENT ) + if( it->type == plugin::Instrument ) { pluginDescWidget * p = new pluginDescWidget( *it, m_view, eng() ); diff --git a/src/lmms_single_source.cpp b/src/lmms_single_source.cpp index 7166a3941..49054c817 100644 --- a/src/lmms_single_source.cpp +++ b/src/lmms_single_source.cpp @@ -2,8 +2,6 @@ #undef SINGLE_SOURCE_COMPILE #include "src/tracks/instrument_track.cpp" #include "src/core/effect_tab_widget.cpp" -#include "src/core/ladspa_control_dialog.cpp" -#include "src/core/select_ladspa_dialog.cpp" #include "src/core/midi_tab_widget.cpp" #include "src/lib/string_pair_drag.cpp" #include "src/lib/buffer_allocator.cpp" @@ -18,11 +16,13 @@ #include "src/lib/clipboard.cpp" #include "src/lib/sample_buffer.cpp" #include "src/core/meter_dialog.cpp" -#include "src/core/ladspa_effect.cpp" #include "src/core/effect_chain.cpp" #include "src/core/effect.cpp" -#include "src/core/ladspa_browser.cpp" +#include "src/core/effect_select_dialog.cpp" +#include "src/core/effect_control_dialog.cpp" +//#include "src/core/ladspa_browser.cpp" #include "src/core/ladspa_port_dialog.cpp" +#include "src/core/ladspa_subplugin_features.cpp" #include "src/core/import_filter.cpp" #include "src/core/config_mgr.cpp" #include "src/core/envelope_and_lfo_widget.cpp" diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 33c7d6c2f..eb5c70ccc 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -26,12 +26,6 @@ */ -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT -#include "effect_chain.h" -#include "effect_tab_widget.h" -#endif - #include "qt3support.h" #ifdef QT4 @@ -93,6 +87,9 @@ #include "mmp.h" #include "string_pair_drag.h" #include "volume_knob.h" +#include "effect_chain.h" +#include "effect_tab_widget.h" + const char * volume_help = QT_TRANSLATE_NOOP( "instrumentTrack", @@ -309,17 +306,11 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : m_envWidget = new envelopeTabWidget( this ); m_arpWidget = new arpAndChordsTabWidget( this ); m_midiWidget = new midiTabWidget( this, m_midiPort ); -#ifdef LADSPA_SUPPORT m_effWidget = new effectTabWidget( this, m_audioPort ); -#endif m_tabWidget->addTab( m_envWidget, tr( "ENV/LFO/FILTER" ), 1 ); m_tabWidget->addTab( m_arpWidget, tr( "ARP/CHORD" ), 2 ); -#ifdef LADSPA_SUPPORT m_tabWidget->addTab( m_effWidget, tr( "FX" ), 3 ); m_tabWidget->addTab( m_midiWidget, tr( "MIDI" ), 4 ); -#else - m_tabWidget->addTab( m_midiWidget, tr( "MIDI" ), 3 ); -#endif // setup piano-widget m_pianoWidget = new pianoWidget( this ); @@ -575,9 +566,7 @@ void instrumentTrack::processAudioBuffer( sampleFrame * _buf, } float v_scale = (float) getVolume() / DEFAULT_VOLUME; -#ifdef LADSPA_SUPPORT m_audioPort->getEffects()->startRunning(); -#endif // instruments using instrument-play-handles will call this method // without any knowledge about notes, so they pass NULL for _n, which @@ -1097,9 +1086,7 @@ void instrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc, m_envWidget->saveState( _doc, _this ); m_arpWidget->saveState( _doc, _this ); m_midiWidget->saveState( _doc, _this ); -#ifdef LADSPA_SUPPORT m_effWidget->saveState( _doc, _this ); -#endif } @@ -1135,27 +1122,10 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this ) { m_midiWidget->restoreState( node.toElement() ); } -#ifdef LADSPA_SUPPORT else if( m_effWidget->nodeName() == node.nodeName() ) { m_effWidget->restoreState( node.toElement() ); } -#else - else if( node.nodeName() == "fx" ) - { - // A song saved using ladspa will segfault when - // a version of lmms compiled without ladspa tries - // to instantiate a plugin from "libfx.so", so - // we catch it here. - QMessageBox::information( 0, - tr( "No LADSPA Support" ), - tr( "This instrument uses " - "features that aren't " - "available in this " - "version of LMMS." ), - QMessageBox::Ok ); - } -#endif else if( automationPattern::classNodeName() != node.nodeName() ) { diff --git a/src/tracks/sample_track.cpp b/src/tracks/sample_track.cpp index 0417f287a..ad94311b9 100644 --- a/src/tracks/sample_track.cpp +++ b/src/tracks/sample_track.cpp @@ -44,12 +44,7 @@ #endif -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT #include "effect_label.h" -#else -#include "name_label.h" -#endif #include "sample_track.h" #include "song_editor.h" @@ -370,10 +365,9 @@ sampleTrack::sampleTrack( trackContainer * _tc ) : { getTrackWidget()->setFixedHeight( 32 ); -#ifdef LADSPA_SUPPORT m_trackLabel = new effectLabel( tr( "Sample track" ), getTrackSettingsWidget(), eng(), this ); -#else +#if 0 m_trackLabel = new nameLabel( tr( "Sample track" ), getTrackSettingsWidget(), eng() ); m_trackLabel->setPixmap( embed::getIconPixmap( "sample_track" ) ); @@ -427,9 +421,7 @@ bool FASTCALL sampleTrack::play( const midiTime & _start, { sendMidiTime( _start ); -#ifdef LADSPA_SUPPORT m_audioPort->getEffects()->startRunning(); -#endif bool played_a_note = FALSE; // will be return variable for( csize i = 0; i < numOfTCOs(); ++i ) @@ -484,9 +476,8 @@ void sampleTrack::saveTrackSpecificSettings( QDomDocument & _doc, QDomElement & _this ) { _this.setAttribute( "name", m_trackLabel->text() ); -#ifdef LADSPA_SUPPORT m_trackLabel->saveState( _doc, _this ); -#else +#if 0 _this.setAttribute( "icon", m_trackLabel->pixmapFile() ); #endif m_volumeKnob->saveSettings( _doc, _this, "vol" ); @@ -498,7 +489,6 @@ void sampleTrack::saveTrackSpecificSettings( QDomDocument & _doc, void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this ) { m_trackLabel->setText( _this.attribute( "name" ) ); -#ifdef LADSPA_SUPPORT QDomNode node = _this.firstChild(); while( !node.isNull() ) { @@ -511,7 +501,7 @@ void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this ) } node = node.nextSibling(); } -#else +#if 0 if( _this.attribute( "icon" ) != "" ) { m_trackLabel->setPixmapFile( _this.attribute( "icon" ) ); diff --git a/src/widgets/effect_label.cpp b/src/widgets/effect_label.cpp index 75f555fcf..8b76a69ab 100644 --- a/src/widgets/effect_label.cpp +++ b/src/widgets/effect_label.cpp @@ -25,8 +25,6 @@ * */ -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT #include "effect_label.h" #include "sample_track.h" @@ -192,7 +190,4 @@ void effectLabel::mouseDoubleClickEvent( QMouseEvent * _me ) #include "effect_label.moc" - -#endif - #endif diff --git a/src/widgets/ladspa_control.cpp b/src/widgets/ladspa_control.cpp index df213902e..2020d5d03 100644 --- a/src/widgets/ladspa_control.cpp +++ b/src/widgets/ladspa_control.cpp @@ -39,7 +39,7 @@ #include "ladspa_control.h" -#include "ladspa_effect.h" +#include "ladspa_base.h" #include "tooltip.h" #include "tempo_sync_knob.h" diff --git a/src/widgets/ladspa_description.cpp b/src/widgets/ladspa_description.cpp index a5788c98c..48048f013 100644 --- a/src/widgets/ladspa_description.cpp +++ b/src/widgets/ladspa_description.cpp @@ -1,3 +1,4 @@ +#if 0 #ifndef SINGLE_SOURCE_COMPILE /* @@ -42,10 +43,10 @@ #include "audio_device.h" -pluginDescription::pluginDescription( QWidget * _parent, engine * _engine ): +ladspaSubPluginDescriptionWidget::ladspaSubPluginDescriptionWidget( QWidget * _parent, engine * _engine ): QWidget( _parent #ifdef QT3 - , "pluginDescription" + , "ladspaSubPluginDescriptionWidget" #endif ), m_ladspaManager( _engine->getLADSPAManager() ) @@ -88,14 +89,14 @@ pluginDescription::pluginDescription( QWidget * _parent, engine * _engine ): -pluginDescription::~pluginDescription() +ladspaSubPluginDescriptionWidget::~ladspaSubPluginDescriptionWidget() { } -void pluginDescription::onHighlighted( const ladspa_key_t & _key ) +void ladspaSubPluginDescriptionWidget::update( const ladspa_key_t & _key ) { m_label->setText( tr( "Name: " ) + m_ladspaManager->getName( _key ) ); @@ -142,7 +143,7 @@ void pluginDescription::onHighlighted( const ladspa_key_t & _key ) ladspaDescription::ladspaDescription( QWidget * _parent, engine * _engine, - pluginType _type ): + ladspaPluginType _type ): QWidget( _parent #ifdef QT3 , "ladspaDescription" @@ -205,11 +206,11 @@ ladspaDescription::ladspaDescription( QWidget * _parent, SLOT( onDoubleClicked( QListBoxItem * ) ) ); m_boxer->addWidget( m_grouper ); - m_pluginDescription = new pluginDescription( this, _engine ); + m_ladspaSubPluginDescriptionWidget = new ladspaSubPluginDescriptionWidget( this, _engine ); connect( this, SIGNAL( highlighted( const ladspa_key_t & ) ), - m_pluginDescription, - SLOT( onHighlighted( const ladspa_key_t & ) ) ); - m_boxer->addWidget( m_pluginDescription ); + m_ladspaSubPluginDescriptionWidget, + SLOT( update( const ladspa_key_t & ) ) ); + m_boxer->addWidget( m_ladspaSubPluginDescriptionWidget ); if( m_pluginList->numRows() > 0 ) { @@ -224,7 +225,7 @@ ladspaDescription::ladspaDescription( QWidget * _parent, ladspaDescription::~ladspaDescription() { - delete m_pluginDescription; + delete m_ladspaSubPluginDescriptionWidget; delete m_pluginList; delete m_grouper; delete m_boxer; @@ -261,3 +262,5 @@ void ladspaDescription::onAddButtonReleased() #endif #endif + +#endif diff --git a/src/widgets/rack_plugin.cpp b/src/widgets/rack_plugin.cpp index 51c37c652..78dc70b65 100644 --- a/src/widgets/rack_plugin.cpp +++ b/src/widgets/rack_plugin.cpp @@ -25,8 +25,8 @@ * */ -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT + +#include "qt3support.h" #ifdef QT4 @@ -57,31 +57,26 @@ #include "knob.h" #include "tempo_sync_knob.h" #include "tooltip.h" -#include "ladspa_2_lmms.h" -#include "ladspa_control_dialog.h" +#include "effect_control_dialog.h" #include "embed.h" #include "gui_templates.h" #include "main_window.h" rackPlugin::rackPlugin( QWidget * _parent, - ladspa_key_t _key, + effect * _eff, track * _track, - engine * _engine, audioPort * _port ) : QWidget( _parent ), - journallingObject( _engine ), + journallingObject( _track->eng() ), + m_effect( _eff ), m_track( _track ), m_port( _port ), m_contextMenu( NULL ), - m_key( _key ), m_show( TRUE ) { - m_effect = new ladspaEffect( _key, eng() ); m_port->getEffects()->appendEffect( m_effect ); - - m_name = m_effect->getName(); - + setFixedSize( 210, 60 ); QPixmap bg = embed::getIconPixmap( "effect_plugin" ); @@ -170,9 +165,8 @@ rackPlugin::rackPlugin( QWidget * _parent, connect( m_editButton, SIGNAL( clicked() ), this, SLOT( editControls() ) ); - QString name = eng()->getLADSPAManager()->getShortName( _key ); m_label = new QLabel( this ); - m_label->setText( name ); + m_label->setText( m_effect->publicName() ); f = m_label->font(); f.setBold( TRUE ); m_label->setFont( pointSize<7>( f ) ); @@ -188,9 +182,11 @@ rackPlugin::rackPlugin( QWidget * _parent, 195, 10 ) ) ); #endif - m_controlView = new ladspaControlDialog( + m_controlView = m_effect->createControlDialog( m_track ); +/* eng()->getMainWindow()->workspace(), + new ControlDialog( eng()->getMainWindow()->workspace(), - m_effect, eng(), m_track ); + m_effect, eng(), m_track );*/ connect( m_controlView, SIGNAL( closed() ), this, SLOT( closeEffects() ) ); m_controlView->hide(); @@ -300,10 +296,11 @@ void rackPlugin::contextMenuEvent( QContextMenuEvent * ) { m_contextMenu = new QMenu( this ); #ifdef QT4 - m_contextMenu->setTitle( m_effect->getName() ); + m_contextMenu->setTitle( m_effect->publicName() ); #else QLabel * caption = new QLabel( "" + - QString( m_effect->getName() ) + "", + QString( m_effect->publicName() ) + + "", this ); caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) ); caption->setAlignment( Qt::AlignCenter ); @@ -435,5 +432,3 @@ void rackPlugin::closeEffects( void ) #include "rack_plugin.moc" #endif - -#endif diff --git a/src/widgets/rack_view.cpp b/src/widgets/rack_view.cpp index 0b278a777..48d8cca33 100644 --- a/src/widgets/rack_view.cpp +++ b/src/widgets/rack_view.cpp @@ -1,7 +1,7 @@ #ifndef SINGLE_SOURCE_COMPILE /* - * right_frame.cpp - provides the display for the rackInsert instances + * rack_view.cpp - provides the display for the rackInsert instances * * Copyright (c) 2006 Danny McRae * @@ -24,8 +24,6 @@ * */ -#include "ladspa_manager.h" -#ifdef LADSPA_SUPPORT #ifdef QT4 @@ -48,8 +46,7 @@ rackView::rackView( QWidget * _parent, QWidget( _parent ), journallingObject( _engine ), m_track( _track ), - m_port( _port ), - m_ladspa( eng()->getLADSPAManager() ) + m_port( _port ) { setFixedSize( 230, 184 ); @@ -76,7 +73,7 @@ rackView::~rackView() -void rackView::addPlugin( ladspa_key_t _key ) +void rackView::addEffect( effect * _e ) { #ifdef QT4 if( !m_scrollArea->widget() ) @@ -90,8 +87,7 @@ void rackView::addPlugin( ladspa_key_t _key ) #else QWidget * w = m_scrollArea->viewport(); #endif - rackPlugin * plugin = new rackPlugin( w, - _key, m_track, eng(), m_port ); + rackPlugin * plugin = new rackPlugin( w, _e, m_track, m_port ); connect( plugin, SIGNAL( moveUp( rackPlugin * ) ), this, SLOT( moveUp( rackPlugin * ) ) ); connect( plugin, SIGNAL( moveDown( rackPlugin * ) ), @@ -228,21 +224,15 @@ void rackView::redraw() void FASTCALL rackView::saveSettings( QDomDocument & _doc, QDomElement & _this ) { - int num = 0; - _this.setAttribute( "plugins", m_rackInserts.count() ); + _this.setAttribute( "numofeffects", m_rackInserts.count() ); for( vvector::iterator it = m_rackInserts.begin(); it != m_rackInserts.end(); it++ ) { - ladspa_key_t key = ( *it )->getKey(); - _this.setAttribute( "label" + QString::number(num), - key.first ); - _this.setAttribute( "lib" + QString::number(num), key.second ); - _this.setAttribute( "name" + QString::number(num), - m_ladspa->getName( key ) ); - _this.setAttribute( "maker" + QString::number(num), - m_ladspa->getMaker( key ) ); - ( *it )->saveState( _doc, _this ); - num++; + QDomElement ef = ( *it )->saveState( _doc, _this ); + ef.setAttribute( "name", + ( *it )->getEffect()->getDescriptor()->name ); + ef.setAttribute( "key", + ( *it )->getEffect()->getKey().dumpBase64() ); } } @@ -251,19 +241,26 @@ void FASTCALL rackView::saveSettings( QDomDocument & _doc, void FASTCALL rackView::loadSettings( const QDomElement & _this ) { - int plugin_cnt = _this.attribute( "plugins" ).toInt(); - + const int plugin_cnt = _this.attribute( "numofeffects" ).toInt(); + QDomNode node = _this.firstChild(); for( int i = 0; i < plugin_cnt; i++ ) { - QString lib = _this.attribute( "lib" + QString::number( i ) ); - QString label = _this.attribute( "label" + - QString::number( i ) ); - ladspa_key_t key( label, lib ); - if( m_ladspa->getDescriptor( key ) != NULL ) + if( node.isElement() && node.nodeName() == "effect" ) { - addPlugin( key ); - + QDomElement cn = node.toElement(); + const QString name = cn.attribute( "name" ); + effect::constructionData cd = + { + eng(), + // we have this really convenient key-ctor + // which takes a QString and decodes the + // base64-data inside :-) + effectKey( cn.attribute( "key" ) ) + } ; + addEffect(effect::instantiate( name, cd ) ); + // TODO: somehow detect if effect is sub-plugin-capable + // but couldn't load sub-plugin with requsted key if( node.isElement() ) { if( m_rackInserts.last()->nodeName() == @@ -274,21 +271,6 @@ void FASTCALL rackView::loadSettings( const QDomElement & _this ) } } } - else - { - QString name = _this.attribute( "name" + - QString::number( i ) ); - QString maker = _this.attribute( "maker" + - QString::number( i ) ); - QString message = "Couldn't find " + name + - " from:\n\n"; - message += "Library: " + lib + "\n"; - message += "Label: " + label + "\n"; - message += "Maker: " + maker; - - QMessageBox::information( 0, tr( "Uknown plugin" ), - message, QMessageBox::Ok ); - } node = node.nextSibling(); } @@ -299,5 +281,3 @@ void FASTCALL rackView::loadSettings( const QDomElement & _this ) #include "rack_view.moc" #endif - -#endif