part 2 of 3 of the 2.8 -> 3.0 merge
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 16 Apr 2009 16:02:25 +0000 (16:02 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 16 Apr 2009 16:02:25 +0000 (16:02 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4987 d708f5d6-7413-0410-9779-e7cbd77b26cf

48 files changed:
gtk2_ardour/SAE-de-keypad.bindings.in
gtk2_ardour/SAE-de-nokeypad.bindings.in
gtk2_ardour/SAE-us-keypad.bindings.in
gtk2_ardour/SAE-us-nokeypad.bindings.in
gtk2_ardour/SConscript
gtk2_ardour/ardour.menus.in
gtk2_ardour/editor_ops.cc
gtk2_ardour/ergonomic-us.bindings.in
gtk2_ardour/mnemonic-us.bindings.in
gtk2_ardour/plugin_ui.cc
gtk2_ardour/plugin_ui.h
gtk2_ardour/vst_pluginui.cc
libs/ardour/ardour/audio_unit.h
libs/ardour/ardour/audioanalyser.h
libs/ardour/ardour/chan_count.h
libs/ardour/ardour/session.h
libs/ardour/audio_unit.cc
libs/ardour/audioanalyser.cc
libs/ardour/chan_count.cc
libs/ardour/globals.cc
libs/ardour/region.cc
libs/ardour/session.cc
libs/ardour/session_process.cc
libs/ardour/session_vst.cc
libs/ardour/vst_plugin.cc
libs/pbd/SConscript
libs/pbd/pathscanner.cc
libs/pbd/pthread_utils.cc
libs/rubberband/src/vamp/RubberBandVampPlugin.h
libs/surfaces/osc/osc.cc
libs/vamp-plugins/Onset.h
libs/vamp-sdk/src/vamp-hostsdk/PluginBufferingAdapter.cpp
libs/vamp-sdk/src/vamp-hostsdk/PluginChannelAdapter.cpp
libs/vamp-sdk/src/vamp-hostsdk/PluginHostAdapter.cpp
libs/vamp-sdk/src/vamp-hostsdk/PluginInputDomainAdapter.cpp
libs/vamp-sdk/src/vamp-hostsdk/PluginLoader.cpp
libs/vamp-sdk/src/vamp-hostsdk/PluginSummarisingAdapter.cpp
libs/vamp-sdk/src/vamp-hostsdk/PluginWrapper.cpp
libs/vamp-sdk/src/vamp-hostsdk/RealTime.cpp
libs/vamp-sdk/src/vamp-sdk/PluginAdapter.cpp
libs/vamp-sdk/src/vamp-sdk/RealTime.cpp
libs/vamp-sdk/vamp-hostsdk/Plugin.h
libs/vamp-sdk/vamp-hostsdk/PluginBase.h
libs/vamp-sdk/vamp-hostsdk/PluginHostAdapter.h
libs/vamp-sdk/vamp-hostsdk/PluginWrapper.h
libs/vamp-sdk/vamp-hostsdk/RealTime.h
libs/vamp-sdk/vamp-sdk/PluginAdapter.h
vst/ardevst

index e8e3e1b338ac5557cb043f7534d3237a986f087b..dad2ead2244bb5921acea8d259109f5c7d22a1cb 100644 (file)
@@ -8,8 +8,9 @@
 (gtk_accel_path "<Actions>/Transport/ToggleRoll" "space")
 (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<%PRIMARY%>period")
 (gtk_accel_path "<Actions>/Transport/record-roll" "<%PRIMARY%>space")
+(gtk_accel_path "<Actions>/Editor/play-from-edit-point-and-return" "<%LEVEL4%>space")
 
-(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%PRIMARY%>,")
+(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%PRIMARY%>comma")
 
 (gtk_accel_path "<Actions>/Editor/align-regions-end" "<%PRIMARY%><%SECONDARY%>less")
 (gtk_accel_path "<Actions>/Editor/align-regions-end-relative" "<%PRIMARY%>less")
@@ -82,7 +83,7 @@
 (gtk_accel_path "<Actions>/Editor/duplicate-region" "<%PRIMARY%>d")
 (gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<%PRIMARY%><%TERTIARY%>d")
 (gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
-(gtk_accel_path "<Actions>/Common/toggle-rhythm-ferret" "<%WINDOW%>f")
+(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<%WINDOW%>f")
 ; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
 ; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
 (gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
 (gtk_accel_path "<Actions>/Editor/editor-delete" "BackSpace")
 (gtk_accel_path "<Actions>/Editor/remove-last-capture" "<%PRIMARY%>Delete")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary-noselection" "<%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary" "leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-backward-to-grid" "<%TERTIARY%><%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
 
 (gtk_accel_path "<Actions>/Editor/selected-marker-to-previous-region-boundary" "<%PRIMARY%><%TERTIARY%>leftarrow")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary-noselection" "<%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary" "rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-forward-to-grid" "<%TERTIARY%><%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-next-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
index 27c824e5dd6c065136bf185a26f97baa24abd195..bcd7f6d3dea40911c2395031b56b2a3d8c8a7678 100644 (file)
@@ -8,8 +8,9 @@
 (gtk_accel_path "<Actions>/Transport/ToggleRoll" "space")
 (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<%PRIMARY%>period")
 (gtk_accel_path "<Actions>/Transport/record-roll" "<%PRIMARY%>space")
+(gtk_accel_path "<Actions>/Editor/play-from-edit-point-and-return" "<%LEVEL4%>space")
 
-(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%PRIMARY%>,")
+(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%PRIMARY%>comma")
 
 (gtk_accel_path "<Actions>/Editor/align-regions-end" "<%PRIMARY%><%SECONDARY%>less")
 (gtk_accel_path "<Actions>/Editor/align-regions-end-relative" "<%PRIMARY%>less")
@@ -82,7 +83,7 @@
 (gtk_accel_path "<Actions>/Editor/duplicate-region" "<%PRIMARY%>d")
 (gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<%PRIMARY%><%TERTIARY%>d")
 (gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
-(gtk_accel_path "<Actions>/Common/toggle-rhythm-ferret" "<%SECONDARY%>f")
+(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<%SECONDARY%>f")
 ; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
 ; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
 (gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
 (gtk_accel_path "<Actions>/Editor/editor-delete" "BackSpace")
 (gtk_accel_path "<Actions>/Editor/remove-last-capture" "<%PRIMARY%>BackSpace")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary-noselection" "<%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary" "leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-backward-to-grid" "<%TERTIARY%><%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
 
 (gtk_accel_path "<Actions>/Editor/selected-marker-to-previous-region-boundary" "<%PRIMARY%><%TERTIARY%>leftarrow")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary-noselection" "<%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary" "rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-forward-to-grid" "<%TERTIARY%><%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-next-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
index e4d98140fdbf61fff9db7ef99e80995b8fc365a0..88085b096891e141c705f75ab0d067ff2f39acde 100644 (file)
@@ -8,7 +8,8 @@
 (gtk_accel_path "<Actions>/Transport/ToggleRoll" "space")
 (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<%PRIMARY%>period")
 (gtk_accel_path "<Actions>/Transport/record-roll" "<%PRIMARY%>space")
-
+(gtk_accel_path "<Actions>/Editor/play-from-edit-point-and-return" "<%LEVEL4%>space")
+(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%PRIMARY%>comma")
 (gtk_accel_path "<Actions>/Editor/align-regions-end" "<%PRIMARY%><%SECONDARY%>less")
 (gtk_accel_path "<Actions>/Editor/align-regions-end-relative" "<%PRIMARY%>less")
 (gtk_accel_path "<Actions>/Editor/align-regions-start" "<%LEVEL4%><%SECONDARY%>less")
@@ -61,7 +62,6 @@
 (gtk_accel_path "<Actions>/Editor/insert-region" "i")
 (gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "<%PRIMARY%>i")
 (gtk_accel_path "<Actions>/Editor/invert-selection" "<%TERTIARY%>i")
-(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%SECONDARY%>o")
 (gtk_accel_path "<Actions>/Main/Open" "<%PRIMARY%>o")
 (gtk_accel_path "<Actions>/Main/Recent" "<%PRIMARY%><%TERTIARY%>o")
 (gtk_accel_path "<Actions>/Editor/naturalize-region" "<%LEVEL4%>o")
@@ -81,7 +81,7 @@
 (gtk_accel_path "<Actions>/Editor/duplicate-region" "<%PRIMARY%>d")
 (gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<%PRIMARY%><%TERTIARY%>d")
 (gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
-(gtk_accel_path "<Actions>/Common/toggle-rhythm-ferret" "<%WINDOW%>f")
+(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<%WINDOW%>f")
 ; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
 ; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
 (gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
 (gtk_accel_path "<Actions>/Editor/editor-delete" "BackSpace")
 (gtk_accel_path "<Actions>/Editor/remove-last-capture" "<%PRIMARY%>Delete")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary-noselection" "<%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary" "leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-backward-to-grid" "<%TERTIARY%><%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
 
 (gtk_accel_path "<Actions>/Editor/selected-marker-to-previous-region-boundary" "<%PRIMARY%><%TERTIARY%>leftarrow")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary-noselection" "<%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary" "rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-forward-to-grid" "<%TERTIARY%><%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-next-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
index a84ee2bf2010fa9b3c46c0495fc22cf5eabc7296..33fe2f0e768da3b062345972f61198bd11edbbbb 100644 (file)
@@ -8,7 +8,8 @@
 (gtk_accel_path "<Actions>/Transport/ToggleRoll" "space")
 (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<%PRIMARY%>period")
 (gtk_accel_path "<Actions>/Transport/record-roll" "<%PRIMARY%>space")
-
+(gtk_accel_path "<Actions>/Editor/play-from-edit-point-and-return" "<%LEVEL4%>space")
+(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%PRIMARY%>comma")
 (gtk_accel_path "<Actions>/Editor/align-regions-end" "<%PRIMARY%><%SECONDARY%>less")
 (gtk_accel_path "<Actions>/Editor/align-regions-end-relative" "<%PRIMARY%>less")
 (gtk_accel_path "<Actions>/Editor/align-regions-start" "<%LEVEL4%><%SECONDARY%>less")
@@ -61,7 +62,6 @@
 (gtk_accel_path "<Actions>/Editor/insert-region" "i")
 (gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "<%PRIMARY%>i")
 (gtk_accel_path "<Actions>/Editor/invert-selection" "<%TERTIARY%>i")
-(gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%SECONDARY%>o")
 (gtk_accel_path "<Actions>/Main/Open" "<%PRIMARY%>o")
 (gtk_accel_path "<Actions>/Main/Recent" "<%PRIMARY%><%TERTIARY%>o")
 (gtk_accel_path "<Actions>/Editor/naturalize-region" "<%LEVEL4%>o")
@@ -81,7 +81,7 @@
 (gtk_accel_path "<Actions>/Editor/duplicate-region" "<%PRIMARY%>d")
 (gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<%PRIMARY%><%TERTIARY%>d")
 (gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f")
-(gtk_accel_path "<Actions>/Common/toggle-rhythm-ferret" "<%SECONDARY%>f")
+(gtk_accel_path "<Actions>/Editor/toggle-rhythm-ferret" "<%SECONDARY%>f")
 ; (gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
 ; (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g")
 (gtk_accel_path "<Actions>/Editor/nudge-backward" "g")
 (gtk_accel_path "<Actions>/Editor/editor-delete" "BackSpace")
 (gtk_accel_path "<Actions>/Editor/remove-last-capture" "<%PRIMARY%>BackSpace")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary-noselection" "<%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary" "leftarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-backward-to-grid" "<%TERTIARY%><%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
 
 (gtk_accel_path "<Actions>/Editor/selected-marker-to-previous-region-boundary" "<%PRIMARY%><%TERTIARY%>leftarrow")
 
+(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary-noselection" "<%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary" "rightarrow")
 (gtk_accel_path "<Actions>/Editor/playhead-forward-to-grid" "<%TERTIARY%><%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-next-region-sync" "<%TERTIARY%><%SECONDARY%>leftarrow")
index b625d5863e474415bba7046d31b72524951ac2df..e413be6eed7b505d1ab8f2512b8ce2f83d986d37 100644 (file)
@@ -56,8 +56,8 @@ gtkardour.Merge ([
     libraries['sndfile'],
     libraries['taglib'],
     libraries['sysmidi'],
-    libraries['vamp'],
     libraries['vamphost'],
+    libraries['vamp'],
     libraries['xml'],
     libraries['xslt']
 ])
index 7b260138ddca8e784992e5b1386541b0815f6423..eb0968da4ade5ed97eebd86dace71ce36bad08a4 100644 (file)
@@ -80,6 +80,8 @@
                   <separator/>
                   <menuitem action='playhead-to-next-region-boundary'/>
                   <menuitem action='playhead-to-previous-region-boundary'/>
+                  <menuitem action='playhead-to-next-region-boundary-noselection'/>
+                  <menuitem action='playhead-to-previous-region-boundary-noselection'/>
                   <menuitem action='playhead-to-next-region-sync'/>
                   <menuitem action='playhead-to-previous-region-sync'/>
                   <separator/>
index 2706a44669caf5f548e01c7b178fb757226a9e06..1b5067e2ac1d1ccdd684a745f414f9940140b1ec 100644 (file)
@@ -3688,7 +3688,7 @@ Editor::freeze_route ()
        pthread_attr_init(&attr);
        pthread_attr_setstacksize(&attr, 500000);
 
-       pthread_create (&itt.thread, &attr, _freeze_thread, this);
+       pthread_create_and_store (X_("freezer"), &itt.thread, &attr, _freeze_thread, this);
 
        pthread_attr_destroy(&attr);
 
index a8c3f1fe0ea07a83bb73313a273c0e6f14e7ccb1..523878bd3fe203a64ef83908df5c9267f5ce96bb 100644 (file)
@@ -14,7 +14,7 @@
 (gtk_accel_path "<Actions>/Editor/toggle-edit-mode" "1")
 (gtk_accel_path "<Actions>/Editor/cycle-snap-mode" "2")
 (gtk_accel_path "<Actions>/Editor/cycle-snap-choice" "3")
-; (gtk_accel_path "<Actions>/processormenu/copy" "")
+; (gtk_accel_path "<Actions>/redirectmenu/copy" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffFaster" "")
 (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<%PRIMARY%>space")
 (gtk_accel_path "<Actions>/Transport/record-roll" "<%TERTIARY%>space")
@@ -22,7 +22,7 @@
 ; (gtk_accel_path "<Actions>/RegionList/SortByRegionLength" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffSlowest" "")
 ; (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-sync" "")
-; (gtk_accel_path "<Actions>/processormenu/deactivate_all" "")
+; (gtk_accel_path "<Actions>/redirectmenu/deactivate_all" "")
 ; (gtk_accel_path "<Actions>/RegionList/SortByRegionPosition" "")
 ; (gtk_accel_path "<Actions>/Editor/ZoomFocus" "")
 (gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "<%SECONDARY%>i")
@@ -34,7 +34,7 @@
 ; (gtk_accel_path "<Actions>/Zoom/zoom-focus-playhead" "")
 ; (gtk_accel_path "<Actions>/Editor/center-edit-cursor" "")
 ; (gtk_accel_path "<Actions>/Editor/Monitoring" "")
-; (gtk_accel_path "<Actions>/processormenu/deactivate" "")
+; (gtk_accel_path "<Actions>/redirectmenu/deactivate" "")
 ; (gtk_accel_path "<Actions>/options/LatchedRecordEnable" "")
 ; (gtk_accel_path "<Actions>/Transport/TogglePunchIn" "")
 ; (gtk_accel_path "<Actions>/ShuttleActions/SetShuttleUnitsPercentage" "")
 (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary" "leftarrow")
 (gtk_accel_path "<Actions>/Editor/selected-marker-to-previous-region-boundary" "<%PRIMARY%><%TERTIARY%>leftarrow")
 ; (gtk_accel_path "<Actions>/Editor/EditCursorMovementOptions" "")
-; (gtk_accel_path "<Actions>/processormenu/activate_all" "")
-; (gtk_accel_path "<Actions>/processormenu/paste" "")
+; (gtk_accel_path "<Actions>/redirectmenu/activate_all" "")
+; (gtk_accel_path "<Actions>/redirectmenu/paste" "")
 ; (gtk_accel_path "<Actions>/Editor/Smpte25" "")
 ; (gtk_accel_path "<Actions>/options/RegionEquivalentsOverlap" "")
 ; (gtk_accel_path "<Actions>/Main/MeteringFallOffRate" "")
 (gtk_accel_path "<Actions>/Editor/align-regions-sync" "less")
 ; (gtk_accel_path "<Actions>/Editor/EditSelectRegionOptions" "")
 (gtk_accel_path "<Actions>/Editor/crop" "c")
-; (gtk_accel_path "<Actions>/processormenu/newsend" "")
+; (gtk_accel_path "<Actions>/redirectmenu/newsend" "")
 ; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceSubMenu" "")
 ; (gtk_accel_path "<Actions>/Editor/MeterFalloff" "")
 ; (gtk_accel_path "<Actions>/RegionList/rlRemove" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-minutes" "")
 ; (gtk_accel_path "<Actions>/Main/Windows" "")
 ; (gtk_accel_path "<Actions>/Main/CleanupUnused" "")
-; (gtk_accel_path "<Actions>/processormenu/deselectall" "")
+; (gtk_accel_path "<Actions>/redirectmenu/deselectall" "")
 ; (gtk_accel_path "<Actions>/options/SoloViaBus" "")
 ; (gtk_accel_path "<Actions>/RegionList/rlAudition" "")
 (gtk_accel_path "<Actions>/Editor/set-region-sync-position" "u")
 (gtk_accel_path "<Actions>/Editor/temporal-zoom-in" "t")
 ; (gtk_accel_path "<Actions>/JACK/Latency" "")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-range-end" "<%TERTIARY%>F2")
-; (gtk_accel_path "<Actions>/processormenu/rename" "")
+; (gtk_accel_path "<Actions>/redirectmenu/rename" "")
 ; (gtk_accel_path "<Actions>/RegionList/rlShowAuto" "")
 (gtk_accel_path "<Actions>/Editor/select-all-before-playhead" "<%PRIMARY%>p")
 ; (gtk_accel_path "<Actions>/Main/Session" "")
 ; (gtk_accel_path "<Actions>/Editor/PullupMinus4" "")
 (gtk_accel_path "<Actions>/Common/goto-mixer" "<%WINDOW%>m")
 ; (gtk_accel_path "<Actions>/RegionList/SortBySourceFileCreationDate" "")
-; (gtk_accel_path "<Actions>/processormenu/activate" "")
+; (gtk_accel_path "<Actions>/redirectmenu/activate" "")
 (gtk_accel_path "<Actions>/Editor/extend-range-to-start-of-region" "leftanglebracket")
 ; (gtk_accel_path "<Actions>/Editor/PullupMinus1" "")
 ; (gtk_accel_path "<Actions>/Editor/snap-normal" "")
 (gtk_accel_path "<Actions>/Common/ToggleKeyEditor" "<%WINDOW%>k")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-asixteenthbeat" "")
 (gtk_accel_path "<Actions>/Editor/select-all-in-punch-range" "<%PRIMARY%>d")
-; (gtk_accel_path "<Actions>/processormenu/edit" "")
+; (gtk_accel_path "<Actions>/redirectmenu/edit" "")
 (gtk_accel_path "<Actions>/Editor/duplicate-region" "d")
 (gtk_accel_path "<Actions>/Editor/multi-duplicate-region" "<%SECONDARY%>d")
 ; (gtk_accel_path "<Actions>/JACK/JACKLatency2048" "")
 ; (gtk_accel_path "<Actions>/options/FileHeaderFormatWAVE" "")
 (gtk_accel_path "<Actions>/Transport/GotoZero" "KP_0")
 (gtk_accel_path "<Actions>/Editor/select-all-after-edit-cursor" "<%TERTIARY%>End")
-; (gtk_accel_path "<Actions>/processormenu/cut" "")
-; (gtk_accel_path "<Actions>/processormenu/newinsert" "")
+; (gtk_accel_path "<Actions>/redirectmenu/cut" "")
+; (gtk_accel_path "<Actions>/redirectmenu/newinsert" "")
 ; (gtk_accel_path "<Actions>/options/UseMMC" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffOff" "")
 ;(gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-object" "o")
 ; (gtk_accel_path "<Actions>/Editor/toggle-xfades-active" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-bar" "")
 ; (gtk_accel_path "<Actions>/Editor/LayerLaterHigher" "")
-; (gtk_accel_path "<Actions>/processormenu/selectall" "")
+; (gtk_accel_path "<Actions>/redirectmenu/selectall" "")
 (gtk_accel_path "<Actions>/Editor/editor-copy" "<%PRIMARY%>c")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-quarters" "")
 (gtk_accel_path "<Actions>/Editor/temporal-zoom-out" "r")
 ; (gtk_accel_path "<Actions>/options/OutputAutoConnectManual" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-region-sync" "")
 (gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "apostrophe")
-; (gtk_accel_path "<Actions>/processormenu/clear" "")
+; (gtk_accel_path "<Actions>/redirectmenu/clear" "")
 ; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceFeedback" "")
 ; (gtk_accel_path "<Actions>/Editor/PullupPlus4Minus1" "")
 ; (gtk_accel_path "<Actions>/JACK/JACKLatency512" "")
 ; (gtk_accel_path "<Actions>/Main/Recent" "")
-; (gtk_accel_path "<Actions>/processormenu/newplugin" "")
+; (gtk_accel_path "<Actions>/redirectmenu/newplugin" "")
 ; (gtk_accel_path "<Actions>/options/InputAutoConnectManual" "")
 ; (gtk_accel_path "<Actions>/options/MeterHoldLong" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-seconds" "")
index 27e6e9f2594f4684e2c36434db3609c50bf9a247..d6df9078ccad229961a0368fe4631851b6a959ee 100644 (file)
@@ -98,7 +98,6 @@
 (gtk_accel_path "<Actions>/Editor/undo" "<%PRIMARY%>z")
 (gtk_accel_path "<Actions>/Editor/toggle-zoom" "<%TERTIARY%>z")
 (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-zoom" "z")
-(gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-note" "n")
 (gtk_accel_path "<Actions>/Editor/editor-cut" "<%PRIMARY%>x")
 (gtk_accel_path "<Actions>/Editor/editor-copy" "<%PRIMARY%>c")
 (gtk_accel_path "<Actions>/Common/ToggleColorManager" "<%WINDOW%>c")
 (gtk_accel_path "<Actions>/Editor/editor-paste" "<%PRIMARY%>v")
 (gtk_accel_path "<Actions>/Editor/brush-at-mouse" "<%PRIMARY%>b")
 (gtk_accel_path "<Actions>/Common/ToggleBigClock" "<%WINDOW%>b")
-(gtk_accel_path "<Actions>/Editor/normalize-region" "<%SECONDARY%>n")
-(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "<%SECONDARY%>m")
+(gtk_accel_path "<Actions>/Editor/normalize-region" "n")
+(gtk_accel_path "<Actions>/Editor/mute-unmute-region" "m")
 (gtk_accel_path "<Actions>/Common/toggle-editor-mixer-on-top" "<%WINDOW%>m")
 
 ;; arrow keys, navigation etc.
 (gtk_accel_path "<Actions>/Editor/move-selected-tracks-down" "<%PRIMARY%>downarrow")
 
 (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary" "leftarrow")
+(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary-noselection" "<%LEVEL4%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/tab-to-transient-backwards" "<%PRIMARY%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/nudge-playhead-backward" "<%SECONDARY%>leftarrow")
 (gtk_accel_path "<Actions>/Transport/Rewind" "<%TERTIARY%>leftarrow")
 (gtk_accel_path "<Actions>/Editor/selected-marker-to-previous-region-boundary" "<%PRIMARY%><%TERTIARY%>leftarrow")
 
 (gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary" "rightarrow")
+(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary-noselection" "<%LEVEL4%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/tab-to-transient-forwards" "<%PRIMARY%>rightarrow")
 (gtk_accel_path "<Actions>/Editor/nudge-playhead-forward" "<%SECONDARY%>rightarrow")
 (gtk_accel_path "<Actions>/Transport/Forward" "<%TERTIARY%>rightarrow")
 ; (gtk_accel_path "<Actions>/RegionList/RegionListSort" "")
 ; (gtk_accel_path "<Actions>/Main/Windows" "")
 ; (gtk_accel_path "<Actions>/Main/CleanupUnused" "")
-; (gtk_accel_path "<Actions>/processormenu/deselectall" "")
+; (gtk_accel_path "<Actions>/redirectmenu/deselectall" "")
 ; (gtk_accel_path "<Actions>/options/SoloViaBus" "")
 ; (gtk_accel_path "<Actions>/RegionList/rlAudition" "")
 ; (gtk_accel_path "<Actions>/Editor/PullupPlus4Plus1" "")
 ; (gtk_accel_path "<Actions>/options/InputAutoConnectPhysical" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-edit-cursor" "")
 ; (gtk_accel_path "<Actions>/JACK/Latency" "")
-; (gtk_accel_path "<Actions>/processormenu/rename" "")
+; (gtk_accel_path "<Actions>/redirectmenu/rename" "")
 ; (gtk_accel_path "<Actions>/RegionList/rlShowAuto" "")
 ; (gtk_accel_path "<Actions>/Main/Session" "")
 ; (gtk_accel_path "<Actions>/Main/AudioFileFormat" "")
 ; (gtk_accel_path "<Actions>/Editor/SnapMode" "")
 ; (gtk_accel_path "<Actions>/Editor/PullupMinus4" "")
 ; (gtk_accel_path "<Actions>/RegionList/SortBySourceFileCreationDate" "")
-; (gtk_accel_path "<Actions>/processormenu/activate" "")
+; (gtk_accel_path "<Actions>/redirectmenu/activate" "")
 ; (gtk_accel_path "<Actions>/Editor/PullupMinus1" "")
 ; (gtk_accel_path "<Actions>/Editor/snap-normal" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-asixteenthbeat" "")
-; (gtk_accel_path "<Actions>/processormenu/edit" "")
+; (gtk_accel_path "<Actions>/redirectmenu/edit" "")
 ; (gtk_accel_path "<Actions>/JACK/JACKLatency2048" "")
 ; (gtk_accel_path "<Actions>/Editor/ToggleWaveformsWhileRecording" "")
 ; (gtk_accel_path "<Actions>/Zoom/zoom-focus-right" "")
 ; (gtk_accel_path "<Actions>/options/FileHeaderFormatWAVE" "")
-; (gtk_accel_path "<Actions>/processormenu/cut" "")
-; (gtk_accel_path "<Actions>/processormenu/newinsert" "")
+; (gtk_accel_path "<Actions>/redirectmenu/cut" "")
+; (gtk_accel_path "<Actions>/redirectmenu/newinsert" "")
 ; (gtk_accel_path "<Actions>/options/UseMMC" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffOff" "")
 ; (gtk_accel_path "<Actions>/Editor/PullupMinus4Plus1" "")
 ; (gtk_accel_path "<Actions>/Editor/toggle-xfades-active" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-bar" "")
 ; (gtk_accel_path "<Actions>/Editor/LayerLaterHigher" "")
-; (gtk_accel_path "<Actions>/processormenu/selectall" "")
+; (gtk_accel_path "<Actions>/redirectmenu/selectall" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-quarters" "")
 ; (gtk_accel_path "<Actions>/options/UseSoftwareMonitoring" "")
 ; (gtk_accel_path "<Actions>/Editor/Subframes100" "")
 
 
-; (gtk_accel_path "<Actions>/processormenu/clear" "")
+; (gtk_accel_path "<Actions>/redirectmenu/clear" "")
 ; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceFeedback" "")
 ; (gtk_accel_path "<Actions>/Editor/PullupPlus4Minus1" "")
 ; (gtk_accel_path "<Actions>/JACK/JACKLatency512" "")
 ; (gtk_accel_path "<Actions>/Main/Recent" "")
-; (gtk_accel_path "<Actions>/processormenu/newplugin" "")
+; (gtk_accel_path "<Actions>/redirectmenu/newplugin" "")
 ; (gtk_accel_path "<Actions>/options/InputAutoConnectManual" "")
 ; (gtk_accel_path "<Actions>/options/MeterHoldLong" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-seconds" "")
 ; (gtk_accel_path "<Actions>/JACK/JACKReconnect" "")
 ; (gtk_accel_path "<Actions>/Editor/Autoconnect" "")
 ; (gtk_accel_path "<Actions>/Editor/Edit" "")
-; (gtk_accel_path "<Actions>/processormenu/copy" "")
+; (gtk_accel_path "<Actions>/redirectmenu/copy" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffFaster" "")
 ; (gtk_accel_path "<Actions>/RegionList/SortByRegionLength" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffSlowest" "")
 ; (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-sync" "")
-; (gtk_accel_path "<Actions>/processormenu/deactivate_all" "")
+; (gtk_accel_path "<Actions>/redirectmenu/deactivate_all" "")
 ; (gtk_accel_path "<Actions>/RegionList/SortByRegionPosition" "")
 ; (gtk_accel_path "<Actions>/Editor/ZoomFocus" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffSlow" "")
 ; (gtk_accel_path "<Actions>/Zoom/zoom-focus-playhead" "")
 ; (gtk_accel_path "<Actions>/Editor/center-edit-cursor" "")
 ; (gtk_accel_path "<Actions>/Editor/Monitoring" "")
-; (gtk_accel_path "<Actions>/processormenu/deactivate" "")
+; (gtk_accel_path "<Actions>/redirectmenu/deactivate" "")
 ; (gtk_accel_path "<Actions>/options/LatchedRecordEnable" "")
 ; (gtk_accel_path "<Actions>/Transport/TogglePunchIn" "")
 ; (gtk_accel_path "<Actions>/ShuttleActions/SetShuttleUnitsPercentage" "")
 ; (gtk_accel_path "<Actions>/Editor/Smpte30drop" "")
 ; (gtk_accel_path "<Actions>/Zoom/zoom-focus-edit" "")
 ; (gtk_accel_path "<Actions>/Editor/EditCursorMovementOptions" "")
-; (gtk_accel_path "<Actions>/processormenu/activate_all" "")
-; (gtk_accel_path "<Actions>/processormenu/paste" "")
+; (gtk_accel_path "<Actions>/redirectmenu/activate_all" "")
+; (gtk_accel_path "<Actions>/redirectmenu/paste" "")
 ; (gtk_accel_path "<Actions>/Editor/Smpte25" "")
 ; (gtk_accel_path "<Actions>/options/RegionEquivalentsOverlap" "")
 ; (gtk_accel_path "<Actions>/Main/MeteringFallOffRate" "")
 ; (gtk_accel_path "<Actions>/Editor/snap-magnetic" "")
 ; (gtk_accel_path "<Actions>/Editor/playhead-to-range-end" "")
 ; (gtk_accel_path "<Actions>/Editor/EditSelectRegionOptions" "")
-; (gtk_accel_path "<Actions>/processormenu/newsend" "")
+; (gtk_accel_path "<Actions>/redirectmenu/newsend" "")
 ; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceSubMenu" "")
 ; (gtk_accel_path "<Actions>/Editor/MeterFalloff" "")
 ; (gtk_accel_path "<Actions>/RegionList/rlRemove" "")
index 36c5001816b8d5d2a614fd559fd716be27d14b33..e92da7f49a10980d202720e0cef004d7ad4ca509 100644 (file)
@@ -136,8 +136,8 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert
        add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
 
        signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this)), false);
-       insert->GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away));
-
+       death_connection = insert->GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away));
+       
        gint h = _pluginui->get_preferred_height ();
        gint w = _pluginui->get_preferred_width ();
 
@@ -155,6 +155,7 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert
 
 PluginUIWindow::~PluginUIWindow ()
 {
+       delete _pluginui;
 }
 
 void
@@ -333,6 +334,9 @@ PluginUIWindow::plugin_going_away ()
        if (_pluginui) {
                _pluginui->stop_updating(0);
        }
+
+       death_connection.disconnect ();
+
        delete_when_idle (this);
 }
 
@@ -383,6 +387,10 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
        plugin_eq_bin.set_expanded(true);
 }
 
+PlugUIBase::~PlugUIBase()
+{
+}
+
 void
 PlugUIBase::processor_active_changed (boost::weak_ptr<Processor> weak_p)
 {
index a920bfb07e385670f277630a7713f34f0427b2ce..e074a9f7b08102c3d4c7423a1f2bd5a362fdc1df 100644 (file)
@@ -71,7 +71,7 @@ class PlugUIBase : public virtual sigc::trackable
 {
   public:
        PlugUIBase (boost::shared_ptr<ARDOUR::PluginInsert>);
-       virtual ~PlugUIBase() {}
+       virtual ~PlugUIBase();
 
        virtual gint get_preferred_height () = 0;
        virtual gint get_preferred_width () = 0;
@@ -241,6 +241,7 @@ class PluginUIWindow : public Gtk::Window
 
   private:
        PlugUIBase* _pluginui;
+       sigc::connection death_connection;
        Gtk::Window* parent;
        Gtk::VBox vbox;
        bool non_gtk_gui;
index 99c7a1b82b094532a0ff89f3d6c34bd60bdd13f3..a31187264eb085624300c5a4a8f21f8089264aab 100644 (file)
@@ -20,7 +20,7 @@
 #include <fst.h>
 #include <gtk/gtk.h>
 #include <gtk/gtksocket.h>
-#include "ardour/processor.h"
+#include "ardour/insert.h"
 #include "ardour/vst_plugin.h"
 
 #include "plugin_ui.h"
@@ -35,24 +35,36 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
        : PlugUIBase (pi),
          vst (vp)
 {
+       create_preset_store ();
+
        fst_run_editor (vst->fst());
 
+       preset_box.set_spacing (6);
+       preset_box.set_border_width (6);
        preset_box.pack_end (bypass_button, false, false, 10);
        preset_box.pack_end (save_button, false, false);
-       preset_box.pack_end (preset_combo, false, false);
-       preset_box.pack_end (eqgui_toggle, false, false);
+       preset_box.pack_end (vst_preset_combo, false, false);
 
+       vst_preset_combo.signal_changed().connect (mem_fun (*this, &VSTPluginUI::preset_chosen));
 
        bypass_button.set_active (!insert->active());
        
        pack_start (preset_box, false, false);
        pack_start (socket, true, true);
-       pack_start (plugin_eq_bin, true, true);
 }
 
 VSTPluginUI::~VSTPluginUI ()
 {
-       // nothing to do here - plugin destructor destroys the GUI
+       // plugin destructor destroys the custom GUI, via Windows fun-and-games,
+       // and then our PluginUIWindow does the rest
+}
+
+void
+VSTPluginUI::preset_chosen ()
+{
+       // we can't dispatch directly here, too many plugins only expects one GUI thread.
+       vst->fst()->want_program = vst_preset_combo.get_active_row_number ();
+       socket.grab_focus ();
 }
 
 int
@@ -124,28 +136,68 @@ VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket)
        return false;
 }
 
+void
+VSTPluginUI::create_preset_store ()
+{
+       FST *fst = vst->fst();
+       int vst_version = fst->plugin->dispatcher (fst->plugin, effGetVstVersion, 0, 0, NULL, 0.0f);
+
+       preset_model = ListStore::create (preset_columns);
+
+       for (int i = 0; i < fst->plugin->numPrograms; ++i) {
+               char buf[100];
+               TreeModel::Row row = *(preset_model->append());
+
+               snprintf (buf, 90, "preset %d", i);
+
+               if (vst_version >= 2) {
+                       fst->plugin->dispatcher (fst->plugin, 29, i, 0, buf, 0.0);
+               }
+               
+               row[preset_columns.name] = buf;
+               row[preset_columns.number] = i;
+       }
+       
+       if (fst->plugin->numPrograms > 0) {
+               fst->plugin->dispatcher( fst->plugin, effSetProgram, 0, 0, NULL, 0.0 );
+       }
+       
+       vst_preset_combo.set_model (preset_model);
+
+       CellRenderer* renderer = manage (new CellRendererText());
+       vst_preset_combo.pack_start (*renderer, true);
+       vst_preset_combo.add_attribute (*renderer, "text", 0);
+
+       if (vst->fst()->current_program != -1) {
+               vst_preset_combo.set_active (vst->fst()->current_program);
+       } else {
+               vst_preset_combo.set_active (0);
+       }
+}
+
 typedef int (*error_handler_t)( Display *, XErrorEvent *);
 static Display *the_gtk_display;
 static error_handler_t wine_error_handler;
 static error_handler_t gtk_error_handler;
 
-static int
+static int 
 fst_xerror_handler( Display *disp, XErrorEvent *ev )
 {
-       if (disp == the_gtk_display) {
-               printf ("relaying error to gtk\n");
-               return gtk_error_handler (disp, ev);
-       } else {
-               printf( "relaying error to wine\n" );
-               return wine_error_handler (disp, ev);
-       }
+       if (disp == the_gtk_display) {
+               printf ("relaying error to gtk\n");
+               return gtk_error_handler (disp, ev);
+       } else {
+               printf( "relaying error to wine\n" );
+               return wine_error_handler (disp, ev);
+       }
 }
 
 void
 gui_init (int *argc, char **argv[])
 {
-       wine_error_handler = XSetErrorHandler (NULL);
-       gtk_init (argc, argv);
-       the_gtk_display = gdk_x11_display_get_xdisplay (gdk_display_get_default());
-       gtk_error_handler = XSetErrorHandler( fst_xerror_handler );
+       wine_error_handler = XSetErrorHandler (NULL);
+       gtk_init (argc, argv);
+       the_gtk_display = gdk_x11_display_get_xdisplay (gdk_display_get_default());
+       gtk_error_handler = XSetErrorHandler( fst_xerror_handler );
 }
+
index a356da81ca4cfe30b31a33a2e94308b61ce9cfec..e023979ed8bdf8410c326491c39de399a7ed1722 100644 (file)
@@ -28,6 +28,7 @@
 #include <set>
 #include <string>
 #include <vector>
+#include <map>
 
 #include "ardour/plugin.h"
 
@@ -63,13 +64,13 @@ class AUPlugin : public ARDOUR::Plugin
        AUPlugin (const AUPlugin& other);
        virtual ~AUPlugin ();
        
-       std::string unique_id () const;
+        std::string unique_id () const;
        const char * label () const;
        const char * name () const { return _info->name.c_str(); }
        const char * maker () const { return _info->creator.c_str(); }
        uint32_t parameter_count () const;
        float default_value (uint32_t port);
-       nframes_t signal_latency () const;
+       nframes_t latency () const;
        void set_parameter (uint32_t which, float val);
        float get_parameter (uint32_t which) const;
     
@@ -79,8 +80,7 @@ class AUPlugin : public ARDOUR::Plugin
        void deactivate ();
        void set_block_size (nframes_t nframes);
     
-       int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset);
-       
+       int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset);
        std::set<uint32_t> automatable() const;
        string describe_parameter (uint32_t);
        string state_node_name () const { return "audiounit"; }
@@ -97,15 +97,14 @@ class AUPlugin : public ARDOUR::Plugin
        bool save_preset (string name);
        bool load_preset (const string preset_label);
        std::vector<std::string> get_presets ();
-    
+       std::string current_preset() const;
+
        bool has_editor () const;
        
-       bool reconfigurable_io() const { return true; }
-       bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
-       int32_t count_for_configuration (const ChanCount& in, ChanCount out) const;
-       bool configure_io (ChanCount in, ChanCount& out);
-       ChanCount output_streams() const;
-       ChanCount input_streams() const;
+       int32_t can_do (int32_t in, int32_t& out);
+       uint32_t output_streams() const;
+       uint32_t input_streams() const;
+       int32_t configure_io (int32_t in, int32_t out);
 
        boost::shared_ptr<CAAudioUnit> get_au () { return unit; }
        boost::shared_ptr<CAComponent> get_comp () const { return comp; }
@@ -118,13 +117,18 @@ class AUPlugin : public ARDOUR::Plugin
   private:
         boost::shared_ptr<CAComponent> comp;
         boost::shared_ptr<CAAudioUnit> unit;
-
+       
         bool initialized;
        int32_t input_channels;
        int32_t output_channels;
        std::vector<std::pair<int,int> > io_configs;
        AudioBufferList* buffers;
-       
+
+       /* XXX this should really be shared across all AUPlugin instances */
+
+       typedef std::map<std::string,std::string> PresetMap;
+       PresetMap preset_map;
+
        UInt32 global_elements;
        UInt32 output_elements;
        UInt32 input_elements;
@@ -144,7 +148,6 @@ class AUPlugin : public ARDOUR::Plugin
        
        std::vector<AUParameterDescriptor> descriptors;
        void init ();
-
 };
        
 typedef boost::shared_ptr<AUPlugin> AUPluginPtr;
@@ -171,9 +174,10 @@ class AUPluginInfo : public PluginInfo {
   private:
        boost::shared_ptr<CAComponentDescription> descriptor;
        UInt32 version;
-
+       
        static void discover_music (PluginInfoList&);
        static void discover_fx (PluginInfoList&);
+       static void discover_generators (PluginInfoList&);
        static void discover_by_description (PluginInfoList&, CAComponentDescription&);
        static Glib::ustring au_cache_path ();
 
index fefcd23a0e227d9765aa91a0c9ad5f1ceefaa229..824e63d3125b8646c58e81800183280029c05857 100644 (file)
@@ -24,7 +24,7 @@
 #include <string>
 #include <ostream>
 #include <fstream>
-#include <vamp-sdk/Plugin.h>
+#include "vamp-sdk/Plugin.h"
 #include <boost/utility.hpp>
 #include "ardour/audioregion.h"
 
index 38cc04b977089b20964096bc55b4b557e569bf52..ff70be6bb6638a8e5360aa5989eeb1813a9b09e2 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __ardour_chan_count_h__
 #define __ardour_chan_count_h__
 
+#include <ostream>
+
 #include "ardour/data_type.h"
 #include <cassert>
 
@@ -109,8 +111,9 @@ private:
        uint32_t _counts[DataType::num_types];
 };
 
-
 } // namespace ARDOUR
 
+std::ostream& operator<<(std::ostream& o, const ARDOUR::ChanCount& c);
+
 #endif // __ardour_chan_count_h__
 
index 6114cf8062cfe5ee89eccab88bbdf2573f7cf197..dc43e08a2d2140009cfa315d8cddfc36a8e664db 100644 (file)
@@ -1054,6 +1054,10 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        void process_export         (nframes_t);
        int  process_export_fw      (nframes_t);
 
+       void block_processing() { g_atomic_int_set (&processing_prohibited, 1); }
+       void unblock_processing() { g_atomic_int_set (&processing_prohibited, 0); }
+       bool processing_blocked() const { return g_atomic_int_get (&processing_prohibited); }
+
        /* slave tracking */
 
        static const int delta_accumulator_size = 25;
index f837ff8832b175d446f9c40271d8b08f3793a89e..0d069c0c23ecc53905ea9ba303141a5a67c55459 100644 (file)
 */
 
 #include <sstream>
+#include <errno.h>
+#include <string.h>
 
 #include "pbd/transmitter.h"
 #include "pbd/xml++.h"
 #include "pbd/whitespace.h"
+#include "pbd/pathscanner.h"
 
 #include <glibmm/thread.h>
 #include <glibmm/fileutils.h>
@@ -37,8 +40,8 @@
 #include <appleutility/CAAudioUnit.h>
 #include <appleutility/CAAUParameter.h>
 
+#include <CoreFoundation/CoreFoundation.h>
 #include <CoreServices/CoreServices.h>
-#include <AudioUnit/AudioUnit.h>
 
 #include "i18n.h"
 
@@ -46,8 +49,19 @@ using namespace std;
 using namespace PBD;
 using namespace ARDOUR;
 
+#ifndef AU_STATE_SUPPORT
+static bool seen_get_state_message = false;
+static bool seen_set_state_message = false;
+static bool seen_loading_message = false;
+static bool seen_saving_message = false;
+#endif
+
 AUPluginInfo::CachedInfoMap AUPluginInfo::cached_info;
 
+static string preset_search_path = "/Library/Audio/Presets:/Network/Library/Audio/Presets";
+static string preset_suffix = ".aupreset";
+static bool preset_search_path_initialized = false;
+
 static OSStatus 
 _render_callback(void *userData,
                 AudioUnitRenderActionFlags *ioActionFlags,
@@ -59,6 +73,212 @@ _render_callback(void *userData,
        return ((AUPlugin*)userData)->render_callback (ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData);
 }
 
+static int 
+save_property_list (CFPropertyListRef propertyList, Glib::ustring path)
+
+{
+       CFDataRef xmlData;
+       int fd;
+
+       // Convert the property list into XML data.
+       
+       xmlData = CFPropertyListCreateXMLData( kCFAllocatorDefault, propertyList);
+
+       if (!xmlData) {
+               error << _("Could not create XML version of property list") << endmsg;
+               return -1;
+       }
+
+       // Write the XML data to the file.
+
+       fd = open (path.c_str(), O_WRONLY|O_CREAT|O_EXCL, 0664);
+       while (fd < 0) {
+               if (errno == EEXIST) {
+                       /* tell any UI's that this file already exists and ask them what to do */
+                       bool overwrite = Plugin::PresetFileExists(); // EMIT SIGNAL
+                       if (overwrite) {
+                               fd = open (path.c_str(), O_WRONLY, 0664);
+                               continue;
+                       } else {
+                               return 0;
+                       }
+               }
+               error << string_compose (_("Cannot open preset file %1 (%2)"), path, strerror (errno)) << endmsg;
+               CFRelease (xmlData);
+               return -1;
+       }
+
+       size_t cnt = CFDataGetLength (xmlData);
+
+       if (write (fd, CFDataGetBytePtr (xmlData), cnt) != cnt) {
+               CFRelease (xmlData);
+               close (fd);
+               return -1;
+       }
+
+       close (fd);
+       return 0;
+}
+
+static CFPropertyListRef 
+load_property_list (Glib::ustring path) 
+{
+       int fd;
+       CFPropertyListRef propertyList;
+       CFDataRef         xmlData;
+       CFStringRef       errorString;
+
+       // Read the XML file.
+       
+       if ((fd = open (path.c_str(), O_RDONLY)) < 0) {
+               return propertyList;
+
+       }
+       
+       off_t len = lseek (fd, 0, SEEK_END);
+       char* buf = new char[len];
+       lseek (fd, 0, SEEK_SET);
+
+       if (read (fd, buf, len) != len) {
+               delete [] buf;
+               close (fd);
+               return propertyList;
+       }
+       
+       close (fd);
+
+       xmlData = CFDataCreateWithBytesNoCopy (kCFAllocatorDefault, (UInt8*) buf, len, kCFAllocatorNull);
+       
+       // Reconstitute the dictionary using the XML data.
+       
+       propertyList = CFPropertyListCreateFromXMLData( kCFAllocatorDefault,
+                                                       xmlData,
+                                                       kCFPropertyListImmutable,
+                                                       &errorString);
+
+       CFRelease (xmlData);
+       delete [] buf;
+
+       return propertyList;
+}
+
+//-----------------------------------------------------------------------------
+static void 
+set_preset_name_in_plist (CFPropertyListRef plist, string preset_name)
+{
+       if (!plist) {
+               return;
+       }
+       CFStringRef pn = CFStringCreateWithCString (kCFAllocatorDefault, preset_name.c_str(), kCFStringEncodingUTF8);
+
+       if (CFGetTypeID (plist) == CFDictionaryGetTypeID()) {
+               CFDictionarySetValue ((CFMutableDictionaryRef)plist, CFSTR(kAUPresetNameKey), pn);
+       }
+       
+       CFRelease (pn);
+}
+
+//-----------------------------------------------------------------------------
+static std::string
+get_preset_name_in_plist (CFPropertyListRef plist)
+{
+       std::string ret;
+
+       if (!plist) {
+               return ret;
+       }
+
+       if (CFGetTypeID (plist) == CFDictionaryGetTypeID()) {
+               const void *p = CFDictionaryGetValue ((CFMutableDictionaryRef)plist, CFSTR(kAUPresetNameKey));
+               if (p) {
+                       CFStringRef str = (CFStringRef) p;
+                       int len = CFStringGetLength(str);
+                       len =  (len * 2) + 1;
+                       char local_buffer[len];
+                       if (CFStringGetCString (str, local_buffer, len, kCFStringEncodingUTF8)) {
+                               ret = local_buffer;
+                       }
+               } 
+       }
+       return ret;
+}
+
+//--------------------------------------------------------------------------
+// general implementation for ComponentDescriptionsMatch() and ComponentDescriptionsMatch_Loosely()
+// if inIgnoreType is true, then the type code is ignored in the ComponentDescriptions
+Boolean ComponentDescriptionsMatch_General(const ComponentDescription * inComponentDescription1, const ComponentDescription * inComponentDescription2, Boolean inIgnoreType);
+Boolean ComponentDescriptionsMatch_General(const ComponentDescription * inComponentDescription1, const ComponentDescription * inComponentDescription2, Boolean inIgnoreType)
+{
+       if ( (inComponentDescription1 == NULL) || (inComponentDescription2 == NULL) )
+               return FALSE;
+
+       if ( (inComponentDescription1->componentSubType == inComponentDescription2->componentSubType) 
+                       && (inComponentDescription1->componentManufacturer == inComponentDescription2->componentManufacturer) )
+       {
+               // only sub-type and manufacturer IDs need to be equal
+               if (inIgnoreType)
+                       return TRUE;
+               // type, sub-type, and manufacturer IDs all need to be equal in order to call this a match
+               else if (inComponentDescription1->componentType == inComponentDescription2->componentType)
+                       return TRUE;
+       }
+
+       return FALSE;
+}
+
+//--------------------------------------------------------------------------
+// general implementation for ComponentAndDescriptionMatch() and ComponentAndDescriptionMatch_Loosely()
+// if inIgnoreType is true, then the type code is ignored in the ComponentDescriptions
+Boolean ComponentAndDescriptionMatch_General(Component inComponent, const ComponentDescription * inComponentDescription, Boolean inIgnoreType);
+Boolean ComponentAndDescriptionMatch_General(Component inComponent, const ComponentDescription * inComponentDescription, Boolean inIgnoreType)
+{
+       OSErr status;
+       ComponentDescription desc;
+
+       if ( (inComponent == NULL) || (inComponentDescription == NULL) )
+               return FALSE;
+
+       // get the ComponentDescription of the input Component
+       status = GetComponentInfo(inComponent, &desc, NULL, NULL, NULL);
+       if (status != noErr)
+               return FALSE;
+
+       // check if the Component's ComponentDescription matches the input ComponentDescription
+       return ComponentDescriptionsMatch_General(&desc, inComponentDescription, inIgnoreType);
+}
+
+//--------------------------------------------------------------------------
+// determine if 2 ComponentDescriptions are basically equal
+// (by that, I mean that the important identifying values are compared, 
+// but not the ComponentDescription flags)
+Boolean ComponentDescriptionsMatch(const ComponentDescription * inComponentDescription1, const ComponentDescription * inComponentDescription2)
+{
+       return ComponentDescriptionsMatch_General(inComponentDescription1, inComponentDescription2, FALSE);
+}
+
+//--------------------------------------------------------------------------
+// determine if 2 ComponentDescriptions have matching sub-type and manufacturer codes
+Boolean ComponentDescriptionsMatch_Loose(const ComponentDescription * inComponentDescription1, const ComponentDescription * inComponentDescription2)
+{
+       return ComponentDescriptionsMatch_General(inComponentDescription1, inComponentDescription2, TRUE);
+}
+
+//--------------------------------------------------------------------------
+// determine if a ComponentDescription basically matches that of a particular Component
+Boolean ComponentAndDescriptionMatch(Component inComponent, const ComponentDescription * inComponentDescription)
+{
+       return ComponentAndDescriptionMatch_General(inComponent, inComponentDescription, FALSE);
+}
+
+//--------------------------------------------------------------------------
+// determine if a ComponentDescription matches only the sub-type and manufacturer codes of a particular Component
+Boolean ComponentAndDescriptionMatch_Loosely(Component inComponent, const ComponentDescription * inComponentDescription)
+{
+       return ComponentAndDescriptionMatch_General(inComponent, inComponentDescription, TRUE);
+}
+
+
 AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> _comp)
        : Plugin (engine, session),
          comp (_comp),
@@ -70,6 +290,14 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
          current_buffers (0),
        frames_processed (0)
 {                      
+       if (!preset_search_path_initialized) {
+               Glib::ustring p = Glib::get_home_dir();
+               p += "/Library/Audio/Presets:";
+               p += preset_search_path;
+               preset_search_path = p;
+               preset_search_path_initialized = true;
+       }
+
        init ();
 }
 
@@ -109,7 +337,6 @@ AUPlugin::init ()
                err = CAAudioUnit::Open (*(comp.get()), *unit);
        } catch (...) {
                error << _("Exception thrown during AudioUnit plugin loading - plugin ignored") << endmsg;
-               cerr << _("Exception thrown during AudioUnit plugin loading - plugin ignored") << endl;
                throw failed_constructor();
        }
 
@@ -293,12 +520,8 @@ AUPlugin::default_value (uint32_t port)
 }
 
 nframes_t
-AUPlugin::signal_latency () const
+AUPlugin::latency () const
 {
-       if (_user_latency) {
-               return _user_latency;
-       }
-
        return unit->Latency() * _session.frame_rate();
 }
 
@@ -378,6 +601,7 @@ AUPlugin::_set_block_size (nframes_t nframes)
 
        if (initialized) {
                unit->Uninitialize ();
+               initialized = false;
        }
 
        if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 
@@ -394,7 +618,7 @@ AUPlugin::_set_block_size (nframes_t nframes)
 }
 
 int32_t
-AUPlugin::configure_io (ChanCount in, ChanCount out)
+AUPlugin::configure_io (int32_t in, int32_t out)
 {
        AudioStreamBasicDescription streamFormat;
 
@@ -417,13 +641,13 @@ AUPlugin::configure_io (ChanCount in, ChanCount out)
        streamFormat.mBytesPerPacket = 4;
        streamFormat.mBytesPerFrame = 4;
 
-       streamFormat.mChannelsPerFrame = in.n_audio();
+       streamFormat.mChannelsPerFrame = in;
 
        if (set_input_format (streamFormat) != 0) {
                return -1;
        }
 
-       streamFormat.mChannelsPerFrame = out.n_audio();
+       streamFormat.mChannelsPerFrame = out;
 
        if (set_output_format (streamFormat) != 0) {
                return -1;
@@ -432,22 +656,16 @@ AUPlugin::configure_io (ChanCount in, ChanCount out)
        return Plugin::configure_io (in, out);
 }
 
-bool
-AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out)
-{
-       int32_t ret = count_for_configuration (in, out);
-       return ret >= 0;
-}
-
 int32_t
-AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
+AUPlugin::can_do (int32_t in, int32_t& out)
 {
        // XXX as of May 13th 2008, AU plugin support returns a count of either 1 or -1. We never
        // attempt to multiply-instantiate plugins to meet io configurations.
 
        int32_t plugcnt = -1;
        AUPluginInfoPtr pinfo = boost::dynamic_pointer_cast<AUPluginInfo>(get_info());
-       int32_t in = cin.n_audio(); /* XXX handle MIDI one day ??? */
+
+       out = -1;
 
        vector<pair<int,int> >& io_configs = pinfo->cache.io_configs;
 
@@ -468,19 +686,19 @@ AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
 
                        if (possible_out == -1) {
                                /* out much match in (UNLIKELY!!) */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = 1;
                        } else if (possible_out == -2) {
                                /* any configuration possible, pick matching */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = 1;
                        } else if (possible_out < -2) {
                                /* explicit variable number of outputs, pick maximum */
-                               out.set (DataType::AUDIO, -possible_out);
+                               out = -possible_out;
                                plugcnt = 1;
                        } else {
                                /* exact number of outputs */
-                               out.set (DataType::AUDIO, possible_out);
+                               out = possible_out;
                                plugcnt = 1;
                        }
                }
@@ -491,19 +709,19 @@ AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
 
                        if (possible_out == -1) {
                                /* out much match in */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = 1;
                        } else if (possible_out == -2) {
                                /* any configuration possible, pick matching */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = 1;
                        } else if (possible_out < -2) {
                                /* explicit variable number of outputs, pick maximum */
-                               out.set (DataType::AUDIO, -possible_out);
+                               out = -possible_out;
                                plugcnt = 1;
                        } else {
                                /* exact number of outputs */
-                               out.set (DataType::AUDIO, possible_out);
+                               out = possible_out;
                                plugcnt = 1;
                        }
                }       
@@ -512,7 +730,7 @@ AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
 
                        if (possible_out == -1) {
                                /* any configuration possible, pick matching */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = 1;
                        } else if (possible_out == -2) {
                                error << string_compose (_("AU plugin %1 has illegal IO configuration (-2,-2)"), name())
@@ -520,11 +738,11 @@ AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
                                plugcnt = -1;
                        } else if (possible_out < -2) {
                                /* explicit variable number of outputs, pick maximum */
-                               out.set (DataType::AUDIO, -possible_out);
+                               out = -possible_out;
                                plugcnt = 1;
                        } else {
                                /* exact number of outputs */
-                               out.set (DataType::AUDIO, possible_out);
+                               out = possible_out;
                                plugcnt = 1;
                        }
                }
@@ -540,7 +758,7 @@ AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
 
                        if (possible_out == -1) {
                                /* out must match in */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = 1;
                        } else if (possible_out == -2) {
                                error << string_compose (_("AU plugin %1 has illegal IO configuration (-2,-2)"), name())
@@ -548,11 +766,11 @@ AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
                                plugcnt = -1;
                        } else if (possible_out < -2) {
                                /* explicit variable number of outputs, pick maximum */
-                               out.set (DataType::AUDIO, -possible_out);
+                               out = -possible_out;
                                plugcnt = 1;
                        } else {
                                /* exact number of outputs */
-                               out.set (DataType::AUDIO, possible_out);
+                               out = possible_out;
                                plugcnt = 1;
                        }
                }
@@ -563,19 +781,19 @@ AUPlugin::count_for_configuration(ChanCount cin, ChanCount& out) const
                        
                        if (possible_out == -1) {
                                /* out must match in */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = 1;
                        } else if (possible_out == -2) {
                                /* any output configuration, pick matching */
-                               out.set (DataType::AUDIO, in);
+                               out = in;
                                plugcnt = -1;
                        } else if (possible_out < -2) {
                                /* explicit variable number of outputs, pick maximum */
-                               out.set (DataType::AUDIO, -possible_out);
+                               out = -possible_out;
                                plugcnt = 1;
                        } else {
                                /* exact number of outputs */
-                               out.set (DataType::AUDIO, possible_out);
+                               out = possible_out;
                                plugcnt = 1;
                        }
                }
@@ -608,7 +826,7 @@ AUPlugin::set_output_format (AudioStreamBasicDescription& fmt)
                                              fmt.mChannelsPerFrame * sizeof(AudioBuffer));
 
        Glib::Mutex::Lock em (_session.engine().process_lock());
-       IO::PortCountChanged (ChanCount (DataType::AUDIO, fmt.mChannelsPerFrame));
+       IO::MoreOutputs (fmt.mChannelsPerFrame);
 
        return 0;
 }
@@ -635,36 +853,25 @@ AUPlugin::set_stream_format (int scope, uint32_t cnt, AudioStreamBasicDescriptio
        return 0;
 }
 
-
-ChanCount
+uint32_t
 AUPlugin::input_streams() const
 {
-       ChanCount in;
-
        if (input_channels < 0) {
                warning << string_compose (_("AUPlugin: %1 input_streams() called without any format set!"), name()) << endmsg;
-               in.set_audio (1);
-       } else {
-               in.set_audio (input_channels);
+               return 1;
        }
-
-       return in;
+       return input_channels;
 }
 
 
-ChanCount
+uint32_t
 AUPlugin::output_streams() const
 {
-       ChanCount out;
-
        if (output_channels < 0) {
                warning << string_compose (_("AUPlugin: %1 output_streams() called without any format set!"), name()) << endmsg;
-               out.set_audio (1);
-       } else {
-               out.set_audio (output_channels);
+               return 1;
        }
-
-       return out;
+       return output_channels;
 }
 
 OSStatus 
@@ -783,33 +990,406 @@ AUPlugin::parameter_is_output (uint32_t) const
 XMLNode&
 AUPlugin::get_state()
 {
-       XMLNode *root = new XMLNode (state_node_name());
        LocaleGuard lg (X_("POSIX"));
+       XMLNode *root = new XMLNode (state_node_name());
+
+#ifdef AU_STATE_SUPPORT
+       CFDataRef xmlData;
+       CFPropertyListRef propertyList;
+
+       if (unit->GetAUPreset (propertyList) != noErr) {
+               return *root;
+       }
+
+       // Convert the property list into XML data.
+       
+       xmlData = CFPropertyListCreateXMLData( kCFAllocatorDefault, propertyList);
+
+       if (!xmlData) {
+               error << _("Could not create XML version of property list") << endmsg;
+               return *root;
+       }
+
+       /* re-parse XML bytes to create a libxml++ XMLTree that we can merge into
+          our state node. GACK!
+       */
+
+       XMLTree t;
+
+       if (t.read_buffer (string ((const char*) CFDataGetBytePtr (xmlData), CFDataGetLength (xmlData)))) {
+               if (t.root()) {
+                       root->add_child_copy (*t.root());
+               }
+       }
+
+       CFRelease (xmlData);
+       CFRelease (propertyList);
+#else
+       if (!seen_get_state_message) {
+               info << _("Saving AudioUnit settings is not supported in this build of Ardour. Consider paying for a newer version")
+                    << endmsg;
+               seen_get_state_message = true;
+       }
+#endif
+       
        return *root;
 }
 
 int
 AUPlugin::set_state(const XMLNode& node)
 {
-       return -1;
+#ifdef AU_STATE_SUPPORT
+       int ret = -1;
+       CFPropertyListRef propertyList;
+       LocaleGuard lg (X_("POSIX"));
+
+       if (node.name() != state_node_name()) {
+               error << _("Bad node sent to AUPlugin::set_state") << endmsg;
+               return -1;
+       }
+       
+       if (node.children().empty()) {
+               return -1;
+       }
+
+       XMLNode* top = node.children().front();
+       XMLNode* copy = new XMLNode (*top);
+
+       XMLTree t;
+       t.set_root (copy);
+
+       const string& xml = t.write_buffer ();
+       CFDataRef xmlData = CFDataCreateWithBytesNoCopy (kCFAllocatorDefault, (UInt8*) xml.data(), xml.length(), kCFAllocatorNull);
+       CFStringRef errorString;
+
+       propertyList = CFPropertyListCreateFromXMLData( kCFAllocatorDefault,
+                                                       xmlData,
+                                                       kCFPropertyListImmutable,
+                                                       &errorString);
+
+       CFRelease (xmlData);
+       
+       if (propertyList) {
+               if (unit->SetAUPreset (propertyList) == noErr) {
+                       ret = 0;
+               } 
+               CFRelease (propertyList);
+       }
+       
+       return ret;
+#else
+       if (!seen_set_state_message) {
+               info << _("Restoring AudioUnit settings is not supported in this build of Ardour. Consider paying for a newer version")
+                    << endmsg;
+       }
+       return 0;
+#endif
 }
 
 bool
-AUPlugin::save_preset (string name)
+AUPlugin::load_preset (const string preset_label)
 {
-       return false;
+#ifdef AU_STATE_SUPPORT
+       bool ret = false;
+       CFPropertyListRef propertyList;
+       Glib::ustring path;
+       PresetMap::iterator x = preset_map.find (preset_label);
+
+       if (x == preset_map.end()) {
+               return false;
+       }
+       
+       if ((propertyList = load_property_list (x->second)) != 0) {
+               if (unit->SetAUPreset (propertyList) == noErr) {
+                       ret = true;
+               }
+               CFRelease(propertyList);
+       }
+       
+       return ret;
+#else
+       if (!seen_loading_message) {
+               info << _("Loading AudioUnit presets is not supported in this build of Ardour. Consider paying for a newer version")
+                    << endmsg;
+               seen_loading_message = true;
+       }
+       return true;
+#endif
 }
 
 bool
-AUPlugin::load_preset (const string preset_label)
+AUPlugin::save_preset (string preset_name)
 {
+#ifdef AU_STATE_SUPPORT
+       CFPropertyListRef propertyList;
+       vector<Glib::ustring> v;
+       Glib::ustring user_preset_path;
+       bool ret = true;
+
+       std::string m = maker();
+       std::string n = name();
+       
+       strip_whitespace_edges (m);
+       strip_whitespace_edges (n);
+
+       v.push_back (Glib::get_home_dir());
+       v.push_back ("Library");
+       v.push_back ("Audio");
+       v.push_back ("Presets");
+       v.push_back (m);
+       v.push_back (n);
+       
+       user_preset_path = Glib::build_filename (v);
+
+       if (g_mkdir_with_parents (user_preset_path.c_str(), 0775) < 0) {
+               error << string_compose (_("Cannot create user plugin presets folder (%1)"), user_preset_path) << endmsg;
+               return false;
+       }
+
+       if (unit->GetAUPreset (propertyList) != noErr) {
+               return false;
+       }
+
+       // add the actual preset name */
+
+       v.push_back (preset_name + preset_suffix);
+               
+       // rebuild
+
+       user_preset_path = Glib::build_filename (v);
+       
+       set_preset_name_in_plist (propertyList, preset_name);
+
+       if (save_property_list (propertyList, user_preset_path)) {
+               error << string_compose (_("Saving plugin state to %1 failed"), user_preset_path) << endmsg;
+               ret = false;
+       }
+
+       CFRelease(propertyList);
+
+       return ret;
+#else
+       if (!seen_saving_message) {
+               info << _("Saving AudioUnit presets is not supported in this build of Ardour. Consider paying for a newer version")
+                    << endmsg;
+               seen_saving_message = true;
+       }
        return false;
+#endif
 }
 
-vector<Plugin::PresetRecord>
+//-----------------------------------------------------------------------------
+// this is just a little helper function used by GetAUComponentDescriptionFromPresetFile()
+static SInt32 
+GetDictionarySInt32Value(CFDictionaryRef inAUStateDictionary, CFStringRef inDictionaryKey, Boolean * outSuccess)
+{
+       CFNumberRef cfNumber;
+       SInt32 numberValue = 0;
+       Boolean dummySuccess;
+
+       if (outSuccess == NULL)
+               outSuccess = &dummySuccess;
+       if ( (inAUStateDictionary == NULL) || (inDictionaryKey == NULL) )
+       {
+               *outSuccess = FALSE;
+               return 0;
+       }
+
+       cfNumber = (CFNumberRef) CFDictionaryGetValue(inAUStateDictionary, inDictionaryKey);
+       if (cfNumber == NULL)
+       {
+               *outSuccess = FALSE;
+               return 0;
+       }
+       *outSuccess = CFNumberGetValue(cfNumber, kCFNumberSInt32Type, &numberValue);
+       if (*outSuccess)
+               return numberValue;
+       else
+               return 0;
+}
+
+static OSStatus 
+GetAUComponentDescriptionFromStateData(CFPropertyListRef inAUStateData, ComponentDescription * outComponentDescription)
+{
+        CFDictionaryRef auStateDictionary;
+        ComponentDescription tempDesc = {0};
+        SInt32 versionValue;
+        Boolean gotValue;
+
+        if ( (inAUStateData == NULL) || (outComponentDescription == NULL) )
+                return paramErr;
+       
+        // the property list for AU state data must be of the dictionary type
+        if (CFGetTypeID(inAUStateData) != CFDictionaryGetTypeID()) {
+                return kAudioUnitErr_InvalidPropertyValue;
+       }
+
+        auStateDictionary = (CFDictionaryRef)inAUStateData;
+
+        // first check to make sure that the version of the AU state data is one that we know understand
+        // XXX should I really do this?  later versions would probably still hold these ID keys, right?
+        versionValue = GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetVersionKey), &gotValue);
+
+        if (!gotValue) {
+                return kAudioUnitErr_InvalidPropertyValue;
+       }
+#define kCurrentSavedStateVersion 0
+        if (versionValue != kCurrentSavedStateVersion) {
+                return kAudioUnitErr_InvalidPropertyValue;
+       }
+
+        // grab the ComponentDescription values from the AU state data
+        tempDesc.componentType = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetTypeKey), NULL);
+        tempDesc.componentSubType = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetSubtypeKey), NULL);
+        tempDesc.componentManufacturer = (OSType) GetDictionarySInt32Value(auStateDictionary, CFSTR(kAUPresetManufacturerKey), NULL);
+        // zero values are illegit for specific ComponentDescriptions, so zero for any value means that there was an error
+        if ( (tempDesc.componentType == 0) || (tempDesc.componentSubType == 0) || (tempDesc.componentManufacturer == 0) )
+                return kAudioUnitErr_InvalidPropertyValue;
+
+        *outComponentDescription = tempDesc;
+        return noErr;
+}
+
+
+static bool au_preset_filter (const string& str, void* arg)
+{
+       /* Not a dotfile, has a prefix before a period, suffix is aupreset */
+
+       bool ret;
+       
+       ret = (str[0] != '.' && str.length() > 9 && str.find (preset_suffix) == (str.length() - preset_suffix.length()));
+
+       if (ret && arg) {
+
+               /* check the preset file path name against this plugin
+                  ID. The idea is that all preset files for this plugin
+                  include "<manufacturer>/<plugin-name>" in their path.
+               */
+
+               Plugin* p = (Plugin *) arg;
+               string match = p->maker();
+               match += '/';
+               match += p->name();
+
+               ret = str.find (match) != string::npos;
+
+               if (ret == false) {
+                       string m = p->maker ();
+                       string n = p->name ();
+                       strip_whitespace_edges (m);
+                       strip_whitespace_edges (n);
+                       match = m;
+                       match += '/';
+                       match += n;
+                       
+                       ret = str.find (match) != string::npos;
+               }
+       }
+       
+       return ret;
+}
+
+bool 
+check_and_get_preset_name (Component component, const string& pathstr, string& preset_name)
+{
+        OSStatus status;
+        CFPropertyListRef plist;
+       ComponentDescription presetDesc;
+       bool ret = false;
+               
+       plist = load_property_list (pathstr);
+
+       if (!plist) {
+               return ret;
+       }
+       
+       // get the ComponentDescription from the AU preset file
+       
+       status = GetAUComponentDescriptionFromStateData(plist, &presetDesc);
+       
+       if (status == noErr) {
+               if (ComponentAndDescriptionMatch_Loosely(component, &presetDesc)) {
+
+                       /* try to get the preset name from the property list */
+
+                       if (CFGetTypeID(plist) == CFDictionaryGetTypeID()) {
+
+                               const void* psk = CFDictionaryGetValue ((CFMutableDictionaryRef)plist, CFSTR(kAUPresetNameKey));
+
+                               if (psk) {
+
+                                       const char* p = CFStringGetCStringPtr ((CFStringRef) psk, kCFStringEncodingUTF8);
+
+                                       if (!p) {
+                                               char buf[PATH_MAX+1];
+
+                                               if (CFStringGetCString ((CFStringRef)psk, buf, sizeof (buf), kCFStringEncodingUTF8)) {
+                                                       preset_name = buf;
+                                               }
+                                       }
+                               }
+                       }
+               } 
+       }
+
+       CFRelease (plist);
+
+       return true;
+}
+
+std::string
+AUPlugin::current_preset() const
+{
+       string preset_name;
+       
+#ifdef AU_STATE_SUPPORT
+       CFPropertyListRef propertyList;
+
+       if (unit->GetAUPreset (propertyList) == noErr) {
+               preset_name = get_preset_name_in_plist (propertyList);
+               CFRelease(propertyList);
+       }
+#endif
+       return preset_name;
+}
+
+vector<string>
 AUPlugin::get_presets ()
 {
-       vector<PresetRecord> presets;
+       vector<string*>* preset_files;
+       vector<string> presets;
+       PathScanner scanner;
+
+       preset_files = scanner (preset_search_path, au_preset_filter, this, true, true, -1, true);
+       
+       if (!preset_files) {
+               return presets;
+       }
+
+       for (vector<string*>::iterator x = preset_files->begin(); x != preset_files->end(); ++x) {
+
+               string path = *(*x);
+               string preset_name;
+
+               /* make an initial guess at the preset name using the path */
+
+               preset_name = Glib::path_get_basename (path);
+               preset_name = preset_name.substr (0, preset_name.find_last_of ('.'));
+
+               /* check that this preset file really matches this plugin
+                  and potentially get the "real" preset name from
+                  within the file.
+               */
+
+               if (check_and_get_preset_name (get_comp()->Comp(), path, preset_name)) {
+                       presets.push_back (preset_name);
+                       preset_map[preset_name] = path;
+               } 
+
+               delete *x;
+       }
+
+       delete preset_files;
        
        return presets;
 }
@@ -874,6 +1454,7 @@ AUPluginInfo::discover ()
        
        discover_fx (plugs);
        discover_music (plugs);
+       discover_generators (plugs);
 
        return plugs;
 }
@@ -904,6 +1485,19 @@ AUPluginInfo::discover_fx (PluginInfoList& plugs)
        discover_by_description (plugs, desc);
 }
 
+void
+AUPluginInfo::discover_generators (PluginInfoList& plugs)
+{
+       CAComponentDescription desc;
+       desc.componentFlags = 0;
+       desc.componentFlagsMask = 0;
+       desc.componentSubType = 0;
+       desc.componentManufacturer = 0;
+       desc.componentType = kAudioUnitType_Generator;
+
+       discover_by_description (plugs, desc);
+}
+
 void
 AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescription& desc)
 {
@@ -926,6 +1520,13 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
                case kAudioUnitType_OfflineEffect:
                case kAudioUnitType_FormatConverter:
                        continue;
+               case kAudioUnitType_Output:
+               case kAudioUnitType_MusicDevice:
+               case kAudioUnitType_MusicEffect:
+               case kAudioUnitType_Effect:
+               case kAudioUnitType_Mixer:
+               case kAudioUnitType_Generator:
+                       break;
                default:
                        break;
                }
@@ -935,15 +1536,12 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
                case kAudioUnitSubType_SystemOutput:
                case kAudioUnitSubType_GenericOutput:
                case kAudioUnitSubType_AUConverter:
+                       /* we don't want output units here */
                        continue;
                        break;
 
                case kAudioUnitSubType_DLSSynth:
-                       info->category = "DLSSynth";
-                       break;
-
-               case kAudioUnitType_MusicEffect:
-                       info->category = "MusicEffect";
+                       info->category = "DLS Synth";
                        break;
 
                case kAudioUnitSubType_Varispeed:
@@ -955,55 +1553,59 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
                        break;
 
                case kAudioUnitSubType_LowPassFilter:
-                       info->category = "LowPassFilter";
+                       info->category = "Low-pass Filter";
                        break;
 
                case kAudioUnitSubType_HighPassFilter:
-                       info->category = "HighPassFilter";
+                       info->category = "High-pass Filter";
                        break;
 
                case kAudioUnitSubType_BandPassFilter:
-                       info->category = "BandPassFilter";
+                       info->category = "Band-pass Filter";
                        break;
 
                case kAudioUnitSubType_HighShelfFilter:
-                       info->category = "HighShelfFilter";
+                       info->category = "High-shelf Filter";
                        break;
 
                case kAudioUnitSubType_LowShelfFilter:
-                       info->category = "LowShelfFilter";
+                       info->category = "Low-shelf Filter";
                        break;
 
                case kAudioUnitSubType_ParametricEQ:
-                       info->category = "ParametricEQ";
+                       info->category = "Parametric EQ";
                        break;
 
                case kAudioUnitSubType_GraphicEQ:
-                       info->category = "GraphicEQ";
+                       info->category = "Graphic EQ";
                        break;
 
                case kAudioUnitSubType_PeakLimiter:
-                       info->category = "PeakLimiter";
+                       info->category = "Peak Limiter";
                        break;
 
                case kAudioUnitSubType_DynamicsProcessor:
-                       info->category = "DynamicsProcessor";
+                       info->category = "Dynamics Processor";
                        break;
 
                case kAudioUnitSubType_MultiBandCompressor:
-                       info->category = "MultiBandCompressor";
+                       info->category = "Multiband Compressor";
                        break;
 
                case kAudioUnitSubType_MatrixReverb:
-                       info->category = "MatrixReverb";
+                       info->category = "Matrix Reverb";
                        break;
 
-               case kAudioUnitType_Mixer:
-                       info->category = "Mixer";
+               case kAudioUnitSubType_SampleDelay:
+                       info->category = "Sample Delay";
                        break;
 
-               case kAudioUnitSubType_StereoMixer:
-                       info->category = "StereoMixer";
+               case kAudioUnitSubType_Pitch:
+                       info->category = "Pitch";
+                       break;
+
+               case kAudioUnitSubType_NetSend:
+                       info->category = "Net Sender";
                        break;
 
                case kAudioUnitSubType_3DMixer:
@@ -1014,6 +1616,19 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
                        info->category = "MatrixMixer";
                        break;
 
+               case kAudioUnitSubType_ScheduledSoundPlayer:
+                       info->category = "Scheduled Sound Player";
+                       break;
+
+
+               case kAudioUnitSubType_AudioFilePlayer:
+                       info->category = "Audio File Player";
+                       break;
+
+               case kAudioUnitSubType_NetReceive:
+                       info->category = "Net Receiver";
+                       break;
+
                default:
                        info->category = "";
                }
@@ -1038,8 +1653,8 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
                           of values.
                        */
 
-                       info->n_inputs = ChanCount (DataType::AUDIO, info->cache.io_configs.front().first);
-                       info->n_outputs = ChanCount (DataType::AUDIO, info->cache.io_configs.front().second);
+                       info->n_inputs = info->cache.io_configs.front().first;
+                       info->n_outputs = info->cache.io_configs.front().second;
 
                        if (info->cache.io_configs.size() > 1) {
                                cerr << "ODD: variable IO config for " << info->unique_id << endl;
index 53684c835ee391c4960cf7e37ffd4c62419b19c2..53b60f9eaa0626accbdc23fc1ee7dcfee94eb639 100644 (file)
@@ -1,5 +1,7 @@
 #include <cstring>
+
 #include "vamp-hostsdk/PluginLoader.h"
+
 #include <glibmm/miscutils.h>
 #include <glibmm/fileutils.h>
 #include <glib/gstdio.h> // for g_remove()
index eb5033bcfc446878206715d9c78af9c5cf6b363e..1c892c1a87feeaf909dd6c8b68282f55fb9a6dee 100644 (file)
@@ -44,5 +44,8 @@ infinity_factory()
 const ChanCount ChanCount::INFINITE = infinity_factory();
 const ChanCount ChanCount::ZERO     = ChanCount();
 
-
 } // namespace ARDOUR
+
+std::ostream& operator<<(std::ostream& o, const ARDOUR::ChanCount& c) {
+       return o << "AUDIO=" << c.n_audio() << ":MIDI=" << c.n_midi();
+}
index 594b4fcd48d5696d4318cb601d12871f68efd173..1c354a5db01e3fa6f5c8f5f00872de0a85374678 100644 (file)
@@ -363,6 +363,9 @@ ARDOUR::cleanup ()
        delete Library;
        lrdf_cleanup ();
        delete &ControlProtocolManager::instance();
+#ifdef VST_SUPPORT
+       fst_exit ();
+#endif
        return 0;
 }
 
index 0fb2f64fc7682cf15d90b50311c22639f5792dee..dcca313c7921fcbb406f7e69520b99509d2fcae1 100644 (file)
@@ -39,6 +39,7 @@
 #include "ardour/region_factory.h"
 #include "ardour/filter.h"
 #include "ardour/profile.h"
+#include "ardour/utils.h"
 
 #include "i18n.h"
 
index e62d672984e3559236db4649f3345b4d98c4cddf..f2e1b2a730e72c6930eccd4577132cae63440e60 100644 (file)
@@ -4085,7 +4085,9 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
        // any bigger than this seems to cause stack overflows in called functions
        const nframes_t chunk_size = (128 * 1024)/4;
 
-       g_atomic_int_set (&processing_prohibited, 1);
+       // block all process callback handling
+
+       block_processing ();
 
        /* call tree *MUST* hold route_lock */
 
@@ -4211,7 +4213,7 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
                }
        }
 
-       g_atomic_int_set (&processing_prohibited, 0);
+       unblock_processing ();
 
        return result;
 }
index 0f697806eb6fe1b18d7dcd5246209228e12a9ee4..72fe634bb2249813b52b7e18e85ac5ac172fdd43 100644 (file)
@@ -58,12 +58,17 @@ Session::process (nframes_t nframes)
 
        _silent = false;
 
+       if (processing_blocked()) {
+               _silent = true;
+               return;
+       }
+
        if (non_realtime_work_pending()) {
                if (!transport_work_requested ()) {
                        post_transport ();
                } 
        } 
-       
+
        (this->*process_function) (nframes);
        
        // the ticker is for sending time information like MidiClock
@@ -100,13 +105,6 @@ Session::no_roll (nframes_t nframes, nframes_t offset)
                _click_io->silence (nframes, offset);
        }
 
-       if (g_atomic_int_get (&processing_prohibited)) {
-               for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
-                       (*i)->silence (nframes, offset);
-               }
-               return 0;
-       }
-
        for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
                
                if ((*i)->is_hidden()) {
@@ -432,7 +430,7 @@ Session::process_with_events (nframes_t nframes)
 
                        /* if an event left our state changing, do the right thing */
 
-                       if (non_realtime_work_pending()) {
+                       if (nframes && non_realtime_work_pending()) {
                                no_roll (nframes, offset);
                                break;
                        }
@@ -947,9 +945,7 @@ Session::maybe_sync_start (nframes_t& nframes, nframes_t& offset)
                   with any fancy stuff here, just the minimal silence.
                */
 
-               g_atomic_int_inc (&processing_prohibited);
-               no_roll (nframes, 0);
-               g_atomic_int_dec_and_test (&processing_prohibited);
+               _silent = true;
 
                if (Config->get_locate_while_waiting_for_sync()) {
                        if (micro_locate (nframes)) {
index 99809e41b90cd62e4de743340edb19a97f606a2d..3a158a3e73a2dd1a7ed6376386ac4ae7483bedf2 100644 (file)
 #include <cstdio>
 
 #include <fst.h>
+#include <fst/vestige/aeffectx.h>
 
 #include "ardour/session.h"
+#include "ardour/tempo.h"
 #include "ardour/vst_plugin.h"
 
 #include "i18n.h"
 
-// #define DEBUG_CALLBACKS
+#define DEBUG_CALLBACKS
+static int debug_callbacks = -1;
 
 #ifdef DEBUG_CALLBACKS
-#define SHOW_CALLBACK printf
+#define SHOW_CALLBACK if (debug_callbacks) printf
 #else
 #define SHOW_CALLBACK(...)
 #endif
@@ -48,14 +51,18 @@ long Session::vst_callback (AEffect* effect,
        VSTPlugin* plug;
        Session* session;
 
-       SHOW_CALLBACK ("am callback, opcode = %d", opcode);
+       if (debug_callbacks < 0) {
+               debug_callbacks = (getenv ("ARDOUR_DEBUG_VST_CALLBACKS") != 0);
+       }
        
        if (effect && effect->user) {
-               plug = (VSTPlugin*) (effect->user);
+               plug = (VSTPlugin*) (effect->user);
                session = &plug->session();
+               SHOW_CALLBACK ("am callback 0x%x, opcode = %ld, plugin = \"%s\" ", pthread_self(), opcode, plug->name());
        } else {
                plug = 0;
                session = 0;
+               SHOW_CALLBACK ("am callback 0x%x, opcode = %ld", pthread_self(), opcode);
        }
 
        switch(opcode){
@@ -112,7 +119,25 @@ long Session::vst_callback (AEffect* effect,
                if (session) {
                        _timeInfo.samplePos = session->transport_frame();
                        _timeInfo.sampleRate = session->frame_rate();
+                       _timeInfo.flags = 0;
+                       
+                       if (value & (kVstTempoValid)) {
+                               const Tempo& t (session->tempo_map().tempo_at (session->transport_frame()));
+                               _timeInfo.tempo = t.beats_per_minute ();
+                               _timeInfo.flags |= (kVstTempoValid);
+                       }
+                       if (value & (kVstBarsValid)) {
+                               const Meter& m (session->tempo_map().meter_at (session->transport_frame()));
+                               _timeInfo.timeSigNumerator = m.beats_per_bar ();
+                               _timeInfo.timeSigDenominator = m.note_divisor ();
+                               _timeInfo.flags |= (kVstBarsValid);
+                       }
+                       
+                       if (session->transport_speed() != 0.0f) {
+                               _timeInfo.flags |= kVstTransportPlaying;
+                       } 
                }
+
                return (long)&_timeInfo;
 
        case audioMasterProcessEvents:
@@ -127,7 +152,13 @@ long Session::vst_callback (AEffect* effect,
        case audioMasterTempoAt:
                SHOW_CALLBACK ("amc: audioMasterTempoAt\n");
                // returns tempo (in bpm * 10000) at sample frame location passed in <value>
-               return 0;
+               if (session) {
+                       const Tempo& t (session->tempo_map().tempo_at (value));
+                       return t.beats_per_minute() * 1000;
+               } else {
+                       return 0;
+               }
+               break;
 
        case audioMasterGetNumAutomatableParameters:
                SHOW_CALLBACK ("amc: audioMasterGetNumAutomatableParameters\n");
@@ -147,7 +178,10 @@ long Session::vst_callback (AEffect* effect,
 
        case audioMasterNeedIdle:
                SHOW_CALLBACK ("amc: audioMasterNeedIdle\n");
-              // plug needs idle calls (outside its editor window)
+               // plug needs idle calls (outside its editor window)
+               if (plug) {
+                       plug->fst()->wantIdle = 1;
+               }
                return 0;
 
        case audioMasterSizeWindow:
@@ -157,10 +191,16 @@ long Session::vst_callback (AEffect* effect,
 
        case audioMasterGetSampleRate:
                SHOW_CALLBACK ("amc: audioMasterGetSampleRate\n");
+               if (session) {
+                       return session->frame_rate();
+               }
                return 0;
 
        case audioMasterGetBlockSize:
                SHOW_CALLBACK ("amc: audioMasterGetBlockSize\n");
+               if (session) {
+                       return session->get_block_size();
+               }
                return 0;
 
        case audioMasterGetInputLatency:
@@ -305,7 +345,7 @@ long Session::vst_callback (AEffect* effect,
                return 0;
                
        default:
-               SHOW_CALLBACK ("VST master dispatcher: undefed: %d, %d\n", opcode, effKeysRequired);
+               SHOW_CALLBACK ("VST master dispatcher: undefed: %d\n", opcode);
                break;
        }       
        
index d69ef2a50ae9d55c6dfa7c5bbe652f05238f451f..2566357f873d841ddc6dee662a2087d2097aa709 100644 (file)
@@ -147,40 +147,31 @@ VSTPlugin::get_state()
        XMLNode *root = new XMLNode (state_node_name());
        LocaleGuard lg (X_("POSIX"));
 
+       if (_fst->current_program != -1) {
+               char buf[32];
+               snprintf (buf, sizeof (buf), "%d", _fst->current_program);
+               root->add_property ("current-program", buf);
+       }
+
        if (_plugin->flags & 32 /* effFlagsProgramsChunks */) {
 
                /* fetch the current chunk */
                
-               void* data;
+               guchar* data;
                long  data_size;
                
                if ((data_size = _plugin->dispatcher (_plugin, 23 /* effGetChunk */, 0, 0, &data, false)) == 0) {
                        return *root;
                }
 
-               /* save it to a file */
-               
-               sys::path user_vst_directory(user_config_directory());
-               user_vst_directory /= "vst";
-
-               try {
-                       sys::create_directories (user_vst_directory);   
-               }
-               catch (const sys::filesystem_error& ex)
-               {
-                       error << "Could not create user configuration directory" << endmsg;
-                       return *root;
-               }
-               
-               sys::path file (user_vst_directory);
-               
-               file /= "something";
-               
                /* store information */
 
                XMLNode* chunk_node = new XMLNode (X_("chunk"));
-               chunk_node->add_property ("path", file.to_string());
-               
+
+               gchar * encoded_data = g_base64_encode (data, data_size);
+               chunk_node->add_content (encoded_data);
+               g_free (encoded_data);
+
                root->add_child_nocopy (*chunk_node);
                
        } else {
@@ -211,11 +202,30 @@ VSTPlugin::set_state(const XMLNode& node)
                return 0;
        }
 
-       XMLNode* child;
+       const XMLProperty* prop;
 
-       if ((child = find_named_node (node, X_("chunks"))) != 0) {
+       if ((prop = node.property ("current-program")) != 0) {
+               _fst->current_program = atoi (prop->value());
+       }
 
-               return 0;
+       XMLNode* child;
+       int ret = -1;
+       
+       if ((child = find_named_node (node, X_("chunk"))) != 0) {
+
+               XMLPropertyList::const_iterator i;
+               XMLNodeList::const_iterator n;
+               int ret = -1;
+
+               for (n = child->children ().begin (); n != child->children ().end (); ++n) {
+                       if ((*n)->is_content ()) {
+                               gsize chunk_size = 0;
+                               guchar * data = g_base64_decode ((*n)->content ().c_str (), &chunk_size);
+                               //cerr << "Dispatch setChunk for " << name() << endl;
+                               ret = _plugin->dispatcher (_plugin, 24 /* effSetChunk */, 0, chunk_size, data, 0);
+                               g_free (data);
+                       }
+               }
 
        } else if ((child = find_named_node (node, X_("parameters"))) != 0) {
                
@@ -231,10 +241,15 @@ VSTPlugin::set_state(const XMLNode& node)
                        _plugin->setParameter (_plugin, param, val);
                }
 
-               return 0;
+               /* program number is not knowable */
+
+               _fst->current_program = -1;
+
+               ret = 0;
+
        }
 
-       return -1;
+       return ret;
 }
 
 int
@@ -244,6 +259,7 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
 
        desc.min_unbound = false;
        desc.max_unbound = false;
+       prop.flags = 0;
 
        if (_plugin->dispatcher (_plugin, effGetParameterProperties, which, 0, &prop, 0)) {
 
index 5a395641caeb8f34b6bf4159954b63fe99232071..51a852fd443e925d912386d9285c148697061d3d 100644 (file)
@@ -65,6 +65,9 @@ pbd.Merge ([ libraries['sigc2'],
              libraries['glib2'],
              libraries['boost'] ])
 
+if pbd['VST']:
+    pbd.Append(CCFLAGS="-DWINE_THREAD_SUPPORT", CPPPATH="#libs/fst")
+
 pbd.VersionBuild(['version.cc','pbd/version.h'], [])
 
 libpbd = pbd.SharedLibrary('pbd', pbd_files)
index 8f374771478931fd05c0bac8a3ff4ae77b653072..9b41de9544c0a3f085fc911d416340c2268f4c9a 100644 (file)
@@ -26,9 +26,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include <pbd/error.h>
-#include <pbd/pathscanner.h>
-#include <pbd/stl_delete.h>
+#include "pbd/error.h"
+#include "pbd/pathscanner.h"
+#include "pbd/stl_delete.h"
 
 using namespace PBD;
 
index 82742234870f27c5d072a31f8e2b05f27ff1e048..69270a767b1c50ad4953be1205b0784e5588ada4 100644 (file)
@@ -24,6 +24,9 @@
 #include <stdint.h>
 
 #include "pbd/pthread_utils.h"
+#ifdef WINE_THREAD_SUPPORT
+#include <fst.h>
+#endif
 
 using namespace std;
 
@@ -39,6 +42,15 @@ namespace PBD {
 
 using namespace PBD;
 
+static int thread_creator (pthread_t* thread_id, const pthread_attr_t* attr, void *(*function)(void*), void* arg)
+{
+#ifdef WINE_THREAD_SUPPORT
+       return wine_pthread_create (thread_id, attr, function, arg);
+#else
+       return pthread_create (thread_id, attr, function, arg);
+#endif
+}
+
 void
 PBD::notify_gui_about_thread_creation (pthread_t thread, std::string str, int request_count)
 {
@@ -70,7 +82,7 @@ pthread_create_and_store (string name, pthread_t  *thread, pthread_attr_t *attr,
                attr = &default_attr;
        }
 
-       if ((ret = pthread_create (thread, attr, start_routine, arg)) == 0) {
+       if ((ret = thread_creator (thread, attr, start_routine, arg)) == 0) {
                std::pair<string,pthread_t> newpair;
                newpair.first = name;
                newpair.second = *thread;
index f062e35eea49a28034f66b3ba09d353155ac44c5..67cf1dfba42c327c957a0f8027cb49934f27f9c9 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef _RUBBERBAND_VAMP_PLUGIN_H_
 #define _RUBBERBAND_VAMP_PLUGIN_H_
 
-#include <vamp-sdk/Plugin.h>
+#include "vamp-sdk/Plugin.h"
 
 #include "RubberBandStretcher.h"
 
index d8ff311486e8fbda02e653efae5defebcdfeaa60..264ce74f4950514eb7d8ee5ee510dc582c52f5a8 100644 (file)
@@ -301,7 +301,7 @@ OSC::init_osc_thread ()
        pthread_attr_init(&attr);
        pthread_attr_setstacksize(&attr, 500000);
 
-       pthread_create (&_osc_thread, &attr, &OSC::_osc_receiver, this);
+       pthread_create_and_store (X_("OSC"), &_osc_thread, &attr, &OSC::_osc_receiver, this);
        if (!_osc_thread) {
                return false;
        }
index 314e107308ccdc4723e3ccebfbfe1014c2e4be84..c858151b213753d0258d263cabc28933132d6095 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef _ONSET_PLUGIN_H_
 #define _ONSET_PLUGIN_H_
 
-#include <vamp-sdk/Plugin.h>
+#include "vamp-sdk/Plugin.h"
 #include <aubio/aubio.h>
 
 class Onset : public Vamp::Plugin
index 0aa92d9efc5640b66d755bca432712b1623ad100..797173d7f893690f5622c1bf245e8b0fe29cef6f 100644 (file)
@@ -38,7 +38,7 @@
 #include <vector>
 #include <map>
 
-#include <vamp-hostsdk/PluginBufferingAdapter.h>
+#include "vamp-hostsdk/PluginBufferingAdapter.h"
 
 using std::vector;
 using std::map;
index 92a35bba85ccd003a7c8955154b2550a9da30873..9a5abf546339262aaf254888702628909c5f8f51 100644 (file)
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include <vamp-hostsdk/PluginChannelAdapter.h>
+#include "vamp-hostsdk/PluginChannelAdapter.h"
 
 _VAMP_SDK_HOSTSPACE_BEGIN(PluginChannelAdapter.cpp)
 
index 5bf323b1a70e78eb635f207a0facc3c06ee23afa..051a9bb905d4f55f043dd279ae5cabce5edc2cb7 100644 (file)
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include <vamp-hostsdk/PluginHostAdapter.h>
+#include "vamp-hostsdk/PluginHostAdapter.h"
 #include <cstdlib>
 
 #if ( VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION != 0 )
index 967d5cfcd953be6142b932cbe1137c3fbd1d98a8..e5b37b56abdb2257bbc228ea594a3aef9b464a59 100644 (file)
@@ -37,7 +37,7 @@
     authorization.
 */
 
-#include <vamp-hostsdk/PluginInputDomainAdapter.h>
+#include "vamp-hostsdk/PluginInputDomainAdapter.h"
 
 #include <cmath>
 
index 3bf23bb16567157c2f8a5a1a70aad74db8a0aa92..686a77c36c08a8ce2ee6fdceeeb3076a081b92d5 100644 (file)
     authorization.
 */
 
-#include <vamp-hostsdk/PluginHostAdapter.h>
-#include <vamp-hostsdk/PluginLoader.h>
-#include <vamp-hostsdk/PluginInputDomainAdapter.h>
-#include <vamp-hostsdk/PluginChannelAdapter.h>
-#include <vamp-hostsdk/PluginBufferingAdapter.h>
+#include "vamp-hostsdk/PluginHostAdapter.h"
+#include "vamp-hostsdk/PluginLoader.h"
+#include "vamp-hostsdk/PluginInputDomainAdapter.h"
+#include "vamp-hostsdk/PluginChannelAdapter.h"
+#include "vamp-hostsdk/PluginBufferingAdapter.h"
 
 #include <fstream>
 #include <cctype> // tolower
index 592190fdf4a0ac862cbf64b4e0e7978efd72f1e6..4a1a63da7356e9c3322ea874d3792fbd48d3e5f6 100644 (file)
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include <vamp-hostsdk/PluginSummarisingAdapter.h>
+#include "vamp-hostsdk/PluginSummarisingAdapter.h"
 
 #include <map>
 #include <algorithm>
index 02bdc280f1767d94c3f02986dee793dff94d26d8..dc076f8b5318277880c9744fd06785209cb8d2ae 100644 (file)
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include <vamp-hostsdk/PluginWrapper.h>
+#include "vamp-hostsdk/PluginWrapper.h"
 
 _VAMP_SDK_HOSTSPACE_BEGIN(PluginWrapper.cpp)
 
index 537ccbde5d84f48356388831979d7eaf3230a03a..c7424f041e49acc52ccefa38c69b36d5cd1ceca1 100644 (file)
@@ -34,6 +34,6 @@
     authorization.
 */
 
-#include <vamp-hostsdk/RealTime.h>
+#include "vamp-hostsdk/RealTime.h"
 #include "../vamp-sdk/RealTime.cpp"
 
index fc195d775b83ea5478750ac83206a8c046159cce..2c91e40d94e55683ad2fa1b620e2f0668653711c 100644 (file)
@@ -34,7 +34,7 @@
     authorization.
 */
 
-#include <vamp-sdk/PluginAdapter.h>
+#include "vamp-sdk/PluginAdapter.h"
 
 #include <cstring>
 #include <cstdlib>
index d3c436478518360ed5dd2e88b71ce3f23eaf79ec..16741dfa232cebb4cde0c6c0d078f750f7c00117 100644 (file)
@@ -57,7 +57,7 @@ using std::endl;
 #include <sys/time.h>
 #endif
 
-#include <vamp-sdk/RealTime.h>
+#include "vamp-sdk/RealTime.h"
 
 _VAMP_SDK_PLUGSPACE_BEGIN(RealTime.cpp)
 
index 72a3b640d543bea67b2b6879b3892ee1ee9d6c97..1e849cb437b0e47ef011387f0b285930c620d7c1 100644 (file)
@@ -42,6 +42,6 @@
 
 #include "hostguard.h"
 
-#include <vamp-sdk/Plugin.h>
+#include "vamp-sdk/Plugin.h"
 
 #endif
index f12c25a7150a31d58f7457d2f70d4c925a5c906b..ed45dc7bb3e4ca151f4875b70b75785407c2f70e 100644 (file)
@@ -42,6 +42,6 @@
 
 #include "hostguard.h"
 
-#include <vamp-sdk/PluginBase.h>
+#include "vamp-sdk/PluginBase.h"
 
 #endif
index 2ca1d6994943e75febcbbce5cdc6fe22a3aa9342..588b9cf8a17fb51f4c0df2b7d60c38569f3b0aa3 100644 (file)
@@ -40,7 +40,7 @@
 #include "hostguard.h"
 #include "Plugin.h"
 
-#include <vamp/vamp.h>
+#include "vamp/vamp.h"
 
 #include <vector>
 
index 357050d2be9f42a394e7a19a1a59971dfaa41d0b..6b246e9f69b23ed62770f43c6567abfc616a14ff 100644 (file)
@@ -38,7 +38,7 @@
 #define _VAMP_PLUGIN_WRAPPER_H_
 
 #include "hostguard.h"
-#include <vamp-hostsdk/Plugin.h>
+#include "vamp-hostsdk/Plugin.h"
 
 _VAMP_SDK_HOSTSPACE_BEGIN(PluginWrapper.h)
 
index d789b6a1ac9a90accebfa965d8babcf1eeac92ba..8992cb57723bf1d5ed07ad1b1be47e0c229865ee 100644 (file)
@@ -41,6 +41,6 @@
 // use this header instead.
 
 #include "hostguard.h"
-#include <vamp-sdk/RealTime.h>
+#include "vamp-sdk/RealTime.h"
 
 #endif
index dafd532a3b9a8524f6ccd8d5a7d792f4a090493f..e27f1638c025195f2dc72324c50bf3dc80e8432b 100644 (file)
@@ -38,7 +38,7 @@
 #define _VAMP_PLUGIN_ADAPTER_H_
 
 #include <map>
-#include <vamp/vamp.h>
+#include "vamp/vamp.h"
 
 #include "Plugin.h"
 
index ceed75b920a34ecc8194707f80bb08fbdb49281a..c5f42420234100295265ed95807c249cd82c1f30 100755 (executable)
@@ -2,5 +2,5 @@
 
 . ../gtk2_ardour/ardev_common.sh
 
-export LD_LIBRARY_PATH=../gtk2_ardour:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH=$TOP/gtk2_ardour:$LD_LIBRARY_PATH
 exec wine $TOP/vst/ardour_vst.exe.so "$@"