src-tree cleanup: separate surfaces from libraries

libardourcp and now libardour_midisurface are not control
surfaces, but helper libraries for those.
They need to be deployed to the library folder (shared between
ctrl surfaces) and not scanned as ctrl surfaces at runtime.
This commit is contained in:
Robin Gareus 2022-11-19 00:07:22 +01:00
parent 22007bf882
commit d521c2ede6
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
20 changed files with 8 additions and 11 deletions

View file

@ -0,0 +1,310 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="ardour_cp"
ProjectGUID="{546C4F76-AEF4-4686-BA67-402071117061}"
RootNamespace="ardour_cp"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug 32|Win32"
OutputDirectory="$(ProjectDir)\$(ConfigurationName)\bin"
IntermediateDirectory="$(ProjectDir)\$(ConfigurationName)\obj\$(ProjectName)"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\MSVCMixbus3\MSVCMixbus5.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/FI$(TargetSxsFolder)\targetsxs.h"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\ardour;..\..\..\pbd;..\..\..\fst;&quot;$(GenericIncludeFolder)\ardourext&quot;;..\..\..\surfaces\control_protocol;..\..\..\evoral;..\..\..\libltc;..\..\..\temporal;..\..\..\rubberband;&quot;..\..\..\vamp-sdk&quot;;&quot;..\..\..\midi++2&quot;;..\..\..\taglib;..\..\..\taglib\taglib;..\..\..\taglib\taglib\toolkit;..\..\..\audiographer;..\..\..\lua;&quot;$(GenericLibraryFolder)\glib-2.0\include&quot;;&quot;$(GenericIncludeFolder)\libsndfile&quot;;&quot;$(GenericIncludeFolder)\gtk-2.0&quot;;&quot;$(GenericIncludeFolder)\cairo&quot;;&quot;$(GenericIncludeFolder)\freetype2&quot;;&quot;$(GenericIncludeFolder)\pango-1.0&quot;;&quot;$(GenericIncludeFolder)\gtk-2.0\gdk&quot;;&quot;$(GenericIncludeFolder)\atk-2.0&quot;;&quot;$(GenericIncludeFolder)\lrdf&quot;;&quot;$(GenericIncludeFolder)\raptor&quot;"
PreprocessorDefinitions="PLATFORM_WINDOWS;COMPILER_MSVC;UINTSDEFINED=1;BUILDING_ARDOUR_CP;LIBCONTROLCP_DLL_EXPORTS;RUBBERBAND_IS_IN_WIN_STATIC_LIB;LUA_BUILD_AS_DLL;USE_CAIRO_IMAGE_SURFACE;NOMINMAX;NO_POSIX_MEMALIGN;INCLUDE_ARDOUR_MISCELLANEOUS=1;BOOST_REGEX_DYN_LINK;BOOST_REGEX_NO_LIB;BOOST_CHRONO_NO_LIB;BOOST_SYSTEM_NO_LIB;BOOST_THREAD_NO_LIB;BOOST_DATE_TIME_NO_LIB;BOOST_ATOMIC_NO_LIB;GNU_WIN32;WIN32;_WIN32;_DEBUG;DEBUG=&quot;Debug&quot;;ARCH_X86;USE_XMMINTRIN;BUILD_SSE_OPTIMIZATIONS;ENABLE_NLS;PACKAGE=&quot;\&quot;ardour_cp\&quot;&quot;;_REENTRANT;_USE_MATH_DEFINES;_LARGEFILE_SOURCE;_LARGEFILE64_SOURCE;LIBC_DISABLE_DEPRECATED;BOOST_SYSTEM_NO_DEPRECATED;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;INTERNAL_SHARED_LIBS=1;JACK_SESSION=1;HAVE_GLIB=1;HAVE_GTHREAD=1;HAVE_SNDFILE=1;HAVE_GIOMM=1;HAVE_CURL=1;HAVE_LO=1;HAVE_MODE_T=1;PHONE_HOME=1;FREESOUND=1;WINDOWS_KEY=\&quot;Mod4&gt;&lt;Super\&quot;;IS_OSX=0;HAVE_XML=1;HAVE_UUID=1;HAVE_LIBS_PBD=1;HAVE_JACK=1;HAVE_LIBS_MIDIPP2=1;HAVE_LIBS_EVORAL=1;HAVE_FFTW3=1;HAVE_FFTW3F=1;HAVE_AUBIO=1;HAVE_LIBS_VAMP_SDK=1;HAVE_LIBS_VAMP_PLUGINS=1;HAVE_LIBS_TAGLIB=1;HAVE_LIBS_LIBLTC=1;HAVE_LIBS_RUBBERBAND=1;HAVE_CONTROL_PROTOCOL=1;HAVE_FRONTIER=1;HAVE_GENERIC_MIDI=1;HAVE_MACKIE=1;HAVE_OSC=1;HAVE_TRANZPORT=1;HAVE_WIIMOTE=1;HAVE_LIBS_SURFACES=1;HAVE_2IN2OUT=1;HAVE_1IN2OUT=1;HAVE_VBAP=1;HAVE_LIBS_PANNERS=1;HAVE_LIBS_TEMPORAL=1;HAVE_LRDF=1;HAVE_SAMPLERATE=1;HAVE_SERD=1;HAVE_SORD=1;HAVE_SRATOM=1;HAVE_LILV=1;HAVE_LILV_0_16_0=1;HAVE_OGG=1;HAVE_FLAC=1;HAVE_RUBBERBAND=1;USE_RUBBERBAND=1;HAVE_JACK_SESSION=1;HAVE_UNISTD=1;HAVE_JACK_ON_INFO_SHUTDOWN=1;HAVE_JACK_VIDEO_SUPPORT=1;HAVE_BOOST_SCOPED_PTR_HPP=1;HAVE_BOOST_PTR_CONTAINER_PTR_LIST_HPP=1;HAVE_LIBS_ARDOUR=1;HAVE_GTKMM=1;HAVE_GTK=1;HAVE_LIBS_GTKMM2EXT=1;HAVE_LIBS_CLEARLOOKS_NEWER=1;HAVE_BOOST_FORMAT_HPP=1;HAVE_LIBS_AUDIOGRAPHER=1;HAVE_GNOMECANVAS=0;HAVE_GNOMECANVASMM=0;HAVE_X11=0;HAVE_FONTCONFIG=1;HAVE_BOOST_SHARED_PTR_HPP=1;HAVE_BOOST_WEAK_PTR_HPP=1;HAVE_GTK2_ARDOUR=1;HAVE_EXPORT=1;HAVE_MIDI_MAPS=1;HAVE_MCP=1;HAVE_PATCHFILES=1;HAVE_TOOLS_SANITY_CHECK=1;SMF_VERSION=\&quot;1.2\&quot;"
MinimalRebuild="true"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="3"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(DllPrefix)glibmm32$(GlibmmDllSuffix)D.lib $(DllPrefix)giomm32$(GlibmmDllSuffix)D.lib pthreadVCE2.lib $(DllPrefix)gthread32$(GlibDllSuffix)D.lib $(DllPrefix)gobject32$(GlibDllSuffix)D.lib $(DllPrefix)gmodule32$(GlibDllSuffix)D.lib $(DllPrefix)glib32$(GlibDllSuffix)D.lib $(DllPrefix)gio32$(GlibDllSuffix)D.lib $(DllPrefix)sigc++32-2.0D.lib $(DllPrefix)temporal32D.lib $(DllPrefix)pbd32D.lib intlD.lib"
OutputFile="$(OutDir)\$(DllPrefix)$(ProjectName)32D.dll"
AdditionalLibraryDirectories="F:\pthread-win32\Pre-built.2\lib"
IgnoreDefaultLibraryNames="libboost_regex-vc80-mt-gd-1_40.lib;msvcrt.lib;dsound.lib"
GenerateDebugInformation="true"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
UseFAT32Workaround="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y &quot;$(OutDir)\$(TargetName).dll&quot; &quot;$(Debug32TargetFolder)\$(TargetName).dll&quot;&#x0D;&#x0A;copy /Y &quot;$(OutDir)\$(TargetName).dll&quot; &quot;$(Debug32TestSuiteFolder)\$(TargetName).dll&quot;&#x0D;&#x0A;copy /Y &quot;$(OutDir)\$(TargetName).lib&quot; &quot;$(GenericWin32LibraryFolder)\$(TargetName).lib&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release 32|Win32"
OutputDirectory="$(ProjectDir)\$(ConfigurationName)\bin"
IntermediateDirectory="$(ProjectDir)\$(ConfigurationName)\obj\$(ProjectName)"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\MSVCMixbus3\MSVCMixbus5.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/FI$(TargetSxsFolder)\targetsxs.h"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..;..\..\..\ardour;..\..\..\pbd;..\..\..\fst;&quot;$(GenericIncludeFolder)\ardourext&quot;;..\..\..\surfaces\control_protocol;..\..\..\evoral;..\..\..\libltc;..\..\..\temporal;..\..\..\rubberband;&quot;..\..\..\vamp-sdk&quot;;&quot;..\..\..\midi++2&quot;;..\..\..\taglib;..\..\..\taglib\taglib;..\..\..\taglib\taglib\toolkit;..\..\..\audiographer;..\..\..\lua;&quot;$(GenericLibraryFolder)\glib-2.0\include&quot;;&quot;$(GenericIncludeFolder)\libsndfile&quot;;&quot;$(GenericIncludeFolder)\gtk-2.0&quot;;&quot;$(GenericIncludeFolder)\cairo&quot;;&quot;$(GenericIncludeFolder)\freetype2&quot;;&quot;$(GenericIncludeFolder)\pango-1.0&quot;;&quot;$(GenericIncludeFolder)\gtk-2.0\gdk&quot;;&quot;$(GenericIncludeFolder)\atk-2.0&quot;;&quot;$(GenericIncludeFolder)\lrdf&quot;;&quot;$(GenericIncludeFolder)\raptor&quot;"
PreprocessorDefinitions="PLATFORM_WINDOWS;COMPILER_MSVC;UINTSDEFINED=1;_SECURE_SCL=0;BUILDING_ARDOUR_CP;LIBCONTROLCP_DLL_EXPORTS;RUBBERBAND_IS_IN_WIN_STATIC_LIB;LUA_BUILD_AS_DLL;USE_CAIRO_IMAGE_SURFACE;NOMINMAX;NO_POSIX_MEMALIGN;INCLUDE_ARDOUR_MISCELLANEOUS=1;BOOST_REGEX_DYN_LINK;BOOST_REGEX_NO_LIB;BOOST_CHRONO_NO_LIB;BOOST_SYSTEM_NO_LIB;BOOST_THREAD_NO_LIB;BOOST_DATE_TIME_NO_LIB;BOOST_ATOMIC_NO_LIB;GNU_WIN32;WIN32;_WIN32;NDEBUG;ARCH_X86;USE_XMMINTRIN;BUILD_SSE_OPTIMIZATIONS;ENABLE_NLS;PACKAGE=&quot;\&quot;ardour_cp\&quot;&quot;;_REENTRANT;_USE_MATH_DEFINES;_LARGEFILE_SOURCE;_LARGEFILE64_SOURCE;LIBC_DISABLE_DEPRECATED;BOOST_SYSTEM_NO_DEPRECATED;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;INTERNAL_SHARED_LIBS=1;JACK_SESSION=1;HAVE_GLIB=1;HAVE_GTHREAD=1;HAVE_SNDFILE=1;HAVE_GIOMM=1;HAVE_CURL=1;HAVE_LO=1;HAVE_MODE_T=1;PHONE_HOME=1;FREESOUND=1;WINDOWS_KEY=\&quot;Mod4&gt;&lt;Super\&quot;;IS_OSX=0;HAVE_XML=1;HAVE_UUID=1;HAVE_LIBS_PBD=1;HAVE_JACK=1;HAVE_LIBS_MIDIPP2=1;HAVE_LIBS_EVORAL=1;HAVE_FFTW3=1;HAVE_FFTW3F=1;HAVE_AUBIO=1;HAVE_LIBS_VAMP_SDK=1;HAVE_LIBS_VAMP_PLUGINS=1;HAVE_LIBS_TAGLIB=1;HAVE_LIBS_LIBLTC=1;HAVE_LIBS_RUBBERBAND=1;HAVE_CONTROL_PROTOCOL=1;HAVE_FRONTIER=1;HAVE_GENERIC_MIDI=1;HAVE_MACKIE=1;HAVE_OSC=1;HAVE_TRANZPORT=1;HAVE_WIIMOTE=1;HAVE_LIBS_SURFACES=1;HAVE_2IN2OUT=1;HAVE_1IN2OUT=1;HAVE_VBAP=1;HAVE_LIBS_PANNERS=1;HAVE_LIBS_TEMPORAL=1;HAVE_LRDF=1;HAVE_SAMPLERATE=1;HAVE_SERD=1;HAVE_SORD=1;HAVE_SRATOM=1;HAVE_LILV=1;HAVE_LILV_0_16_0=1;HAVE_OGG=1;HAVE_FLAC=1;HAVE_RUBBERBAND=1;USE_RUBBERBAND=1;HAVE_JACK_SESSION=1;HAVE_UNISTD=1;HAVE_JACK_ON_INFO_SHUTDOWN=1;HAVE_JACK_VIDEO_SUPPORT=1;HAVE_BOOST_SCOPED_PTR_HPP=1;HAVE_BOOST_PTR_CONTAINER_PTR_LIST_HPP=1;HAVE_LIBS_ARDOUR=1;HAVE_GTKMM=1;HAVE_GTK=1;HAVE_LIBS_GTKMM2EXT=1;HAVE_LIBS_CLEARLOOKS_NEWER=1;HAVE_BOOST_FORMAT_HPP=1;HAVE_LIBS_AUDIOGRAPHER=1;HAVE_GNOMECANVAS=0;HAVE_GNOMECANVASMM=0;HAVE_X11=0;HAVE_FONTCONFIG=1;HAVE_BOOST_SHARED_PTR_HPP=1;HAVE_BOOST_WEAK_PTR_HPP=1;HAVE_GTK2_ARDOUR=1;HAVE_EXPORT=1;HAVE_MIDI_MAPS=1;HAVE_MCP=1;HAVE_PATCHFILES=1;HAVE_TOOLS_SANITY_CHECK=1;SMF_VERSION=\&quot;1.2\&quot;"
StringPooling="false"
RuntimeLibrary="2"
EnableEnhancedInstructionSet="1"
WarningLevel="3"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(DllPrefix)glibmm32$(GlibmmDllSuffix).lib $(DllPrefix)giomm32$(GlibmmDllSuffix).lib pthreadVCE2.lib $(DllPrefix)gthread32$(GlibDllSuffix).lib $(DllPrefix)gobject32$(GlibDllSuffix).lib $(DllPrefix)gmodule32$(GlibDllSuffix).lib $(DllPrefix)glib32$(GlibDllSuffix).lib $(DllPrefix)gio32$(GlibDllSuffix).lib $(DllPrefix)sigc++32-2.0.lib $(DllPrefix)temporal32.lib $(DllPrefix)pbd32.lib intl.lib"
OutputFile="$(OutDir)\$(DllPrefix)$(ProjectName)32.dll"
AdditionalLibraryDirectories="F:\pthread-win32\Pre-built.2\lib"
IgnoreDefaultLibraryNames="libboost_regex-vc80-mt-gd-1_40.lib;dsound.lib"
SubSystem="2"
OptimizeReferences="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
UseFAT32Workaround="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y &quot;$(OutDir)\$(TargetName).dll&quot; &quot;$(Release32TargetFolder)\$(TargetName).dll&quot;&#x0D;&#x0A;copy /Y &quot;$(OutDir)\$(TargetName).dll&quot; &quot;$(Release32TestSuiteFolder)\$(TargetName).dll&quot;&#x0D;&#x0A;copy /Y &quot;$(OutDir)\$(TargetName).lib&quot; &quot;$(GenericWin32LibraryFolder)\$(TargetName).lib&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release 32 with Debugging Capability|Win32"
OutputDirectory="$(ProjectDir)\$(ConfigurationName)\bin"
IntermediateDirectory="$(ProjectDir)\$(ConfigurationName)\obj\$(ProjectName)"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\MSVCMixbus3\MSVCMixbus5.vsprops"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/FI$(TargetSxsFolder)\targetsxs.h"
Optimization="0"
AdditionalIncludeDirectories="..;..\..\..\ardour;..\..\..\pbd;..\..\..\fst;&quot;$(GenericIncludeFolder)\ardourext&quot;;..\..\..\surfaces\control_protocol;..\..\..\evoral;..\..\..\libltc;..\..\..\temporal;..\..\..\rubberband;&quot;..\..\..\vamp-sdk&quot;;&quot;..\..\..\midi++2&quot;;..\..\..\taglib;..\..\..\taglib\taglib;..\..\..\taglib\taglib\toolkit;..\..\..\audiographer;..\..\..\lua;&quot;$(GenericLibraryFolder)\glib-2.0\include&quot;;&quot;$(GenericIncludeFolder)\libsndfile&quot;;&quot;$(GenericIncludeFolder)\gtk-2.0&quot;;&quot;$(GenericIncludeFolder)\cairo&quot;;&quot;$(GenericIncludeFolder)\freetype2&quot;;&quot;$(GenericIncludeFolder)\pango-1.0&quot;;&quot;$(GenericIncludeFolder)\gtk-2.0\gdk&quot;;&quot;$(GenericIncludeFolder)\atk-2.0&quot;;&quot;$(GenericIncludeFolder)\lrdf&quot;;&quot;$(GenericIncludeFolder)\raptor&quot;"
PreprocessorDefinitions="PLATFORM_WINDOWS;COMPILER_MSVC;UINTSDEFINED=1;_SECURE_SCL=0;BUILDING_ARDOUR_CP;LIBCONTROLCP_DLL_EXPORTS;RUBBERBAND_IS_IN_WIN_STATIC_LIB;LUA_BUILD_AS_DLL;USE_CAIRO_IMAGE_SURFACE;NOMINMAX;NO_POSIX_MEMALIGN;INCLUDE_ARDOUR_MISCELLANEOUS=1;BOOST_REGEX_DYN_LINK;BOOST_REGEX_NO_LIB;BOOST_CHRONO_NO_LIB;BOOST_SYSTEM_NO_LIB;BOOST_THREAD_NO_LIB;BOOST_DATE_TIME_NO_LIB;BOOST_ATOMIC_NO_LIB;GNU_WIN32;WIN32;_WIN32;ARCH_X86;USE_XMMINTRIN;BUILD_SSE_OPTIMIZATIONS;ENABLE_NLS;PACKAGE=&quot;\&quot;ardour_cp\&quot;&quot;;_REENTRANT;_USE_MATH_DEFINES;_LARGEFILE_SOURCE;_LARGEFILE64_SOURCE;LIBC_DISABLE_DEPRECATED;BOOST_SYSTEM_NO_DEPRECATED;__STDC_LIMIT_MACROS;__STDC_FORMAT_MACROS;INTERNAL_SHARED_LIBS=1;JACK_SESSION=1;HAVE_GLIB=1;HAVE_GTHREAD=1;HAVE_SNDFILE=1;HAVE_GIOMM=1;HAVE_CURL=1;HAVE_LO=1;HAVE_MODE_T=1;PHONE_HOME=1;FREESOUND=1;WINDOWS_KEY=\&quot;Mod4&gt;&lt;Super\&quot;;IS_OSX=0;HAVE_XML=1;HAVE_UUID=1;HAVE_LIBS_PBD=1;HAVE_JACK=1;HAVE_LIBS_MIDIPP2=1;HAVE_LIBS_EVORAL=1;HAVE_FFTW3=1;HAVE_FFTW3F=1;HAVE_AUBIO=1;HAVE_LIBS_VAMP_SDK=1;HAVE_LIBS_VAMP_PLUGINS=1;HAVE_LIBS_TAGLIB=1;HAVE_LIBS_LIBLTC=1;HAVE_LIBS_RUBBERBAND=1;HAVE_CONTROL_PROTOCOL=1;HAVE_FRONTIER=1;HAVE_GENERIC_MIDI=1;HAVE_MACKIE=1;HAVE_OSC=1;HAVE_TRANZPORT=1;HAVE_WIIMOTE=1;HAVE_LIBS_SURFACES=1;HAVE_2IN2OUT=1;HAVE_1IN2OUT=1;HAVE_VBAP=1;HAVE_LIBS_PANNERS=1;HAVE_LIBS_TEMPORAL=1;HAVE_LRDF=1;HAVE_SAMPLERATE=1;HAVE_SERD=1;HAVE_SORD=1;HAVE_SRATOM=1;HAVE_LILV=1;HAVE_LILV_0_16_0=1;HAVE_OGG=1;HAVE_FLAC=1;HAVE_RUBBERBAND=1;USE_RUBBERBAND=1;HAVE_JACK_SESSION=1;HAVE_UNISTD=1;HAVE_JACK_ON_INFO_SHUTDOWN=1;HAVE_JACK_VIDEO_SUPPORT=1;HAVE_BOOST_SCOPED_PTR_HPP=1;HAVE_BOOST_PTR_CONTAINER_PTR_LIST_HPP=1;HAVE_LIBS_ARDOUR=1;HAVE_GTKMM=1;HAVE_GTK=1;HAVE_LIBS_GTKMM2EXT=1;HAVE_LIBS_CLEARLOOKS_NEWER=1;HAVE_BOOST_FORMAT_HPP=1;HAVE_LIBS_AUDIOGRAPHER=1;HAVE_GNOMECANVAS=0;HAVE_GNOMECANVASMM=0;HAVE_X11=0;HAVE_FONTCONFIG=1;HAVE_BOOST_SHARED_PTR_HPP=1;HAVE_BOOST_WEAK_PTR_HPP=1;HAVE_GTK2_ARDOUR=1;HAVE_EXPORT=1;HAVE_MIDI_MAPS=1;HAVE_MCP=1;HAVE_PATCHFILES=1;HAVE_TOOLS_SANITY_CHECK=1;SMF_VERSION=\&quot;1.2\&quot;"
StringPooling="false"
RuntimeLibrary="2"
EnableEnhancedInstructionSet="1"
WarningLevel="3"
DebugInformationFormat="3"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="$(DllPrefix)glibmm32$(GlibmmDllSuffix)RDC.lib $(DllPrefix)giomm32$(GlibmmDllSuffix)RDC.lib pthreadVCE2.lib $(DllPrefix)gthread32$(GlibDllSuffix)RDC.lib $(DllPrefix)gobject32$(GlibDllSuffix)RDC.lib $(DllPrefix)gmodule32$(GlibDllSuffix)RDC.lib $(DllPrefix)glib32$(GlibDllSuffix)RDC.lib $(DllPrefix)gio32$(GlibDllSuffix)RDC.lib $(DllPrefix)sigc++32-2.0RDC.lib $(DllPrefix)temporal32RDC.lib $(DllPrefix)pbd32RDC.lib intlRDC.lib"
OutputFile="$(OutDir)\$(DllPrefix)$(ProjectName)32RDC.dll"
AdditionalLibraryDirectories="F:\pthread-win32\Pre-built.2\lib"
IgnoreDefaultLibraryNames="libboost_regex-vc80-mt-gd-1_40.lib;dsound.lib"
GenerateDebugInformation="true"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
UseFAT32Workaround="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y &quot;$(OutDir)\$(TargetName).dll&quot; &quot;$(Release32TestSuiteFolder)\$(TargetName).dll&quot;&#x0D;&#x0A;copy /Y &quot;$(OutDir)\$(TargetName).lib&quot; &quot;$(GenericWin32LibraryFolder)\$(TargetName).lib&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\basic_ui.cc"
>
</File>
<File
RelativePath="..\control_protocol.cc"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\control_protocol\basic_ui.h"
>
</File>
<File
RelativePath="..\control_protocol\control_protocol.h"
>
</File>
<File
RelativePath="..\control_protocol\types.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\..\..\..\gtk2_ardour\win32\msvc_resources.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,996 @@
/*
* Copyright (C) 2006-2009 David Robillard <d@drobilla.net>
* Copyright (C) 2006-2018 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2015 Robin Gareus <robin@gareus.org>
* Copyright (C) 2016-2017 Ben Loftis <ben@harrisonconsoles.com>
* Copyright (C) 2017-2019 Johannes Mueller <github@johannes-mueller.org>
* Copyright (C) 2017 Len Ovens <len@ovenwerks.net>
* Copyright (C) 2017 Tim Mayberry <mojofunk@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "pbd/pthread_utils.h"
#include "pbd/memento_command.h"
#include "temporal/tempo.h"
#include "ardour/session.h"
#include "ardour/location.h"
#include "ardour/tempo.h"
#include "ardour/transport_master_manager.h"
#include "ardour/utils.h"
#include "control_protocol/basic_ui.h"
#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace Temporal;
PBD::Signal2<void,std::string,std::string> BasicUI::AccessAction;
BasicUI::BasicUI (Session& s)
: session (&s),
_tbank_route_width (8),
_tbank_row_height (8),
_tbank_start_route (0),
_tbank_start_row (0)
{
}
BasicUI::BasicUI ()
: session (0)
{
}
BasicUI::~BasicUI ()
{
}
void
BasicUI::register_thread (std::string name)
{
std::string pool_name = name;
pool_name += " events";
SessionEvent::create_per_thread_pool (pool_name, 64);
}
void
BasicUI::access_action ( std::string action_path )
{
int split_at = action_path.find( "/" );
std::string group = action_path.substr( 0, split_at );
std::string item = action_path.substr( split_at + 1 );
AccessAction( group, item );
}
void
BasicUI::loop_toggle ()
{
if (!session) {
return;
}
Location * looploc = session->locations()->auto_loop_location();
if (!looploc) {
return;
}
if (session->get_play_loop()) {
/* looping enabled, our job is to disable it */
session->request_play_loop (false);
} else {
/* looping not enabled, our job is to enable it.
loop-is-NOT-mode: this action always starts the transport rolling.
loop-IS-mode: this action simply sets the loop play mechanism, but
does not start transport.
*/
if (Config->get_loop_is_mode()) {
session->request_play_loop (true, false);
} else {
session->request_play_loop (true, true);
}
}
//show the loop markers
looploc->set_hidden (false, this);
}
void
BasicUI::loop_location (timepos_t const & start, timepos_t const & end)
{
Location* tll;
if ((tll = session->locations()->auto_loop_location()) == 0) {
Location* loc = new Location (*session, start, end, _("Loop"), Location::IsAutoLoop);
session->locations()->add (loc, true);
session->set_auto_loop_location (loc);
} else {
tll->set_hidden (false, this);
tll->set (start, end);
}
}
void
BasicUI::goto_start (bool and_roll)
{
session->goto_start (and_roll);
}
void
BasicUI::goto_zero ()
{
session->request_locate (0);
}
void
BasicUI::goto_end ()
{
session->goto_end ();
}
void
BasicUI::add_marker (const std::string& markername)
{
timepos_t where (session->audible_sample());
Location *location = new Location (*session, where, where, markername, Location::IsMark);
session->begin_reversible_command (_("add marker"));
XMLNode &before = session->locations()->get_state();
session->locations()->add (location, true);
XMLNode &after = session->locations()->get_state();
session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
session->commit_reversible_command ();
}
void
BasicUI::remove_marker_at_playhead ()
{
access_action("Common/remove-location-from-playhead");
}
void
BasicUI::button_varispeed (bool fwd)
{
// incrementally increase speed by semitones
// (keypress auto-repeat is 100ms)
const float maxspeed = Config->get_shuttle_max_speed();
float semitone_ratio = exp2f (1.0f/12.0f);
const float octave_down = pow (1.0/semitone_ratio, 12.0);
float transport_speed = get_transport_speed ();
float speed;
if (Config->get_rewind_ffwd_like_tape_decks()) {
if (fwd) {
if (transport_speed <= 0) {
session->request_transport_speed (1.0);
session->request_roll (TRS_UI);
return;
}
} else {
if (transport_speed >= 0) {
session->request_transport_speed (-1.0);
session->request_roll (TRS_UI);
return;
}
}
} else {
if (fabs (transport_speed) <= 0.1) {
/* close to zero, maybe flip direction */
if (fwd) {
if (transport_speed <= 0) {
session->request_transport_speed (1.0);
session->request_roll (TRS_UI);
}
} else {
if (transport_speed >= 0) {
session->request_transport_speed (-1.0);
session->request_roll (TRS_UI);
}
}
/* either we've just started, or we're moving as slowly as we
* ever should
*/
return;
}
if (fwd) {
if (transport_speed < 0.f) {
if (fabs (transport_speed) < octave_down) {
/* we need to move the speed back towards zero */
semitone_ratio = powf (1.f / semitone_ratio, 4.f);
} else {
semitone_ratio = 1.f / semitone_ratio;
}
} else {
if (fabs (transport_speed) < octave_down) {
/* moving very slowly, use 4 semitone steps */
semitone_ratio = powf (semitone_ratio, 4.f);
}
}
} else {
if (transport_speed > 0.f) {
/* we need to move the speed back towards zero */
if (transport_speed < octave_down) {
semitone_ratio = powf (1.f / semitone_ratio, 4.f);
} else {
semitone_ratio = 1.f / semitone_ratio;
}
} else {
if (fabs (transport_speed) < octave_down) {
/* moving very slowly, use 4 semitone steps */
semitone_ratio = powf (semitone_ratio, 4.f);
}
}
}
}
speed = semitone_ratio * transport_speed;
speed = std::max (-maxspeed, std::min (maxspeed, speed));
session->request_transport_speed (speed);
session->request_roll (TRS_UI);
}
void
BasicUI::rewind ()
{
button_varispeed (false);
}
void
BasicUI::ffwd ()
{
button_varispeed (true);
}
void
BasicUI::transport_stop ()
{
session->request_stop ();
}
bool
BasicUI::stop_button_onoff () const
{
return session->transport_stopped_or_stopping ();
}
bool
BasicUI::play_button_onoff () const
{
return get_transport_speed() == 1.0;
}
bool
BasicUI::ffwd_button_onoff () const
{
return get_transport_speed() > 1.0;
}
bool
BasicUI::rewind_button_onoff () const
{
return get_transport_speed() < 0.0;
}
bool
BasicUI::loop_button_onoff () const
{
return session->get_play_loop();
}
void
BasicUI::transport_play (bool from_last_start)
{
/* ::toggle_roll() is smarter and preferred */
if (!session) {
return;
}
if (session->is_auditioning()) {
return;
}
#if 0
if (session->config.get_external_sync()) {
switch (TransportMasterManager::instance().current().type()) {
case Engine:
break;
default:
/* transport controlled by the master */
return;
}
}
#endif
bool rolling = transport_rolling();
if (session->get_play_loop()) {
/* If loop playback is not a mode, then we should cancel
it when this action is requested. If it is a mode
we just leave it in place.
*/
if (!Config->get_loop_is_mode()) {
/* XXX it is not possible to just leave seamless loop and keep
playing at present (nov 4th 2009)
*/
if (rolling) {
/* stop loop playback but keep rolling */
session->request_play_loop (false, false);
}
}
} else if (session->get_play_range () ) {
/* stop playing a range if we currently are */
session->request_play_range (0, true);
}
if (rolling) {
session->request_transport_speed (1.0, TRS_UI);
} else {
session->request_roll ();
}
}
void
BasicUI::rec_enable_toggle ()
{
switch (session->record_status()) {
case Session::Disabled:
if (session->ntracks() == 0) {
// string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu.");
// MessageDialog msg (*editor, txt);
// msg.run ();
return;
}
session->maybe_enable_record ();
break;
case Session::Recording:
case Session::Enabled:
session->disable_record (false, true);
}
}
void
BasicUI::all_tracks_rec_in ()
{
session->set_all_tracks_record_enabled (true);
}
void
BasicUI::all_tracks_rec_out ()
{
session->set_all_tracks_record_enabled (false);
}
void
BasicUI::save_state ()
{
session->save_state ("");
}
void
BasicUI::prev_marker ()
{
access_action("Common/jump-backward-to-mark");
}
void
BasicUI::next_marker ()
{
access_action("Common/jump-forward-to-mark");
}
void
BasicUI::set_transport_speed (double speed)
{
session->request_roll (TRS_UI);
session->request_transport_speed (speed);
}
double
BasicUI::get_transport_speed () const
{
return session->actual_speed ();
}
double
BasicUI::transport_rolling () const
{
return !session->transport_stopped_or_stopping ();
}
void
BasicUI::trigger_stop_all (bool stop_all)
{
session->trigger_stop_all (stop_all);
}
void
BasicUI::trigger_cue_row (int cue_idx)
{
session->trigger_cue_row (cue_idx);
}
void
BasicUI::tbank_set_size (int width, int height)
{
_tbank_route_width = width;
_tbank_row_height = height;
}
void
BasicUI::tbank_step_routes (int step_size)
{
_tbank_start_route += step_size;
if (_tbank_start_route + _tbank_route_width > session->num_triggerboxes() ) {
_tbank_start_route=session->num_triggerboxes() - _tbank_route_width;
}
if (_tbank_start_route < 0) {
_tbank_start_route=0;
}
}
void
BasicUI::tbank_step_rows (int step_size)
{
_tbank_start_row += step_size;
if (_tbank_start_row + _tbank_row_height > TriggerBox::default_triggers_per_box ) {
_tbank_start_row=TriggerBox::default_triggers_per_box - _tbank_row_height;
}
if (_tbank_start_row < 0) {
_tbank_start_row=0;
}
}
void
BasicUI::store_mixer_scene (int idx)
{
session->store_nth_mixer_scene (idx);
}
void
BasicUI::apply_mixer_scene (int idx)
{
session->apply_nth_mixer_scene (idx);
}
void
BasicUI::undo ()
{
access_action ("Editor/undo");
}
void
BasicUI::redo ()
{
access_action ("Editor/redo");
}
void
BasicUI::toggle_all_rec_enables ()
{
if (session->get_record_enabled()) {
// session->record_disenable_all ();
} else {
// session->record_enable_all ();
}
}
void
BasicUI::toggle_punch_in ()
{
session->config.set_punch_in (!session->config.get_punch_in());
}
void
BasicUI::toggle_punch_out ()
{
session->config.set_punch_out (!session->config.get_punch_out());
}
bool
BasicUI::get_record_enabled ()
{
return session->get_record_enabled();
}
void
BasicUI::set_record_enable (bool yn)
{
if (yn) {
session->maybe_enable_record ();
} else {
session->disable_record (false, true);
}
}
samplepos_t
BasicUI::transport_sample ()
{
return session->transport_sample();
}
void
BasicUI::locate (samplepos_t where, LocateTransportDisposition ltd)
{
session->request_locate (where, false, ltd);
}
void
BasicUI::locate (samplepos_t where, bool roll)
{
session->request_locate (where, false, roll ? MustRoll : RollIfAppropriate);
}
void
BasicUI::jump_by_seconds (double secs, LocateTransportDisposition ltd)
{
samplepos_t current = session->transport_sample();
double s = (double) current / (double) session->nominal_sample_rate();
s+= secs;
if (s < 0) {
s = 0;
}
s = s * session->nominal_sample_rate();
session->request_locate (floor(s), false, ltd);
}
void
BasicUI::jump_by_bars (int bars, LocateTransportDisposition ltd)
{
TempoMap::SharedPtr tmap (TempoMap::fetch());
Temporal::BBT_Time bbt (tmap->bbt_at (timepos_t (session->transport_sample())));
bbt.bars += bars;
if (bbt.bars < 0) {
bbt.bars = 1;
}
bbt.beats = 1;
bbt.ticks = 0;
session->request_locate (tmap->sample_at (bbt), false, ltd);
}
void
BasicUI::jump_by_beats (int beats, LocateTransportDisposition ltd)
{
Beats qn_goal = timepos_t (session->transport_sample ()).beats() + Beats (beats, 0);
if (qn_goal < Beats()) {
qn_goal = Beats();
}
session->request_locate (timepos_t (qn_goal).samples());
}
void
BasicUI::toggle_monitor_mute ()
{
if (session->monitor_out()) {
boost::shared_ptr<MonitorProcessor> mon = session->monitor_out()->monitor_control();
if (mon->cut_all ()) {
mon->set_cut_all (false);
} else {
mon->set_cut_all (true);
}
}
}
void
BasicUI::toggle_monitor_dim ()
{
if (session->monitor_out()) {
boost::shared_ptr<MonitorProcessor> mon = session->monitor_out()->monitor_control();
if (mon->dim_all ()) {
mon->set_dim_all (false);
} else {
mon->set_dim_all (true);
}
}
}
void
BasicUI::toggle_monitor_mono ()
{
if (session->monitor_out()) {
boost::shared_ptr<MonitorProcessor> mon = session->monitor_out()->monitor_control();
if (mon->mono()) {
mon->set_mono (false);
} else {
mon->set_mono (true);
}
}
}
void
BasicUI::midi_panic ()
{
session->midi_panic ();
}
void
BasicUI::toggle_click ()
{
bool state = !Config->get_clicking();
Config->set_clicking (state);
}
void
BasicUI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
{
/* TO BE KEPT IN SYNC WITH ARDOUR_UI::toggle_roll() */
if (!session) {
return;
}
if (session->is_auditioning()) {
session->cancel_audition ();
return;
}
if (session->config.get_external_sync()) {
switch (TransportMasterManager::instance().current()->type()) {
case Engine:
break;
default:
/* transport controlled by the master */
return;
}
}
bool rolling = transport_rolling();
if (rolling) {
if (roll_out_of_bounded_mode) {
/* drop out of loop/range playback but leave transport rolling */
if (session->get_play_loop()) {
if (session->actively_recording()) {
/* actually stop transport because
otherwise the captured data will make
no sense.
*/
session->request_play_loop (false, true);
} else {
session->request_play_loop (false, false);
}
} else if (session->get_play_range ()) {
session->request_cancel_play_range ();
}
} else {
session->request_stop (with_abort, true);
}
} else { /* not rolling */
if (session->get_play_loop() && Config->get_loop_is_mode()) {
session->request_locate (session->locations()->auto_loop_location()->start().samples(), false, MustRoll);
} else {
session->request_roll (TRS_UI);
}
}
}
void
BasicUI::stop_forget ()
{
session->request_stop (true, true);
}
void BasicUI::mark_in () { access_action("Common/start-range-from-playhead"); }
void BasicUI::mark_out () { access_action("Common/finish-range-from-playhead"); }
void BasicUI::set_punch_range () { access_action("Editor/set-punch-from-edit-range"); }
void BasicUI::set_loop_range () { access_action("Editor/set-loop-from-edit-range"); }
void BasicUI::set_session_range () { access_action("Editor/set-session-from-edit-range"); }
void BasicUI::quick_snapshot_stay () { access_action("Main/QuickSnapshotStay"); }
void BasicUI::quick_snapshot_switch () { access_action("Main/QuickSnapshotSwitch"); }
void BasicUI::fit_1_track() { access_action("Editor/fit_1_track"); }
void BasicUI::fit_2_tracks() { access_action("Editor/fit_2_tracks"); }
void BasicUI::fit_4_tracks() { access_action("Editor/fit_4_tracks"); }
void BasicUI::fit_8_tracks() { access_action("Editor/fit_8_tracks"); }
void BasicUI::fit_16_tracks() { access_action("Editor/fit_16_tracks"); }
void BasicUI::fit_32_tracks() { access_action("Editor/fit_32_tracks"); }
void BasicUI::fit_all_tracks() { access_action("Editor/fit_all_tracks"); }
void BasicUI::zoom_10_ms() { access_action("Editor/zoom_10_ms"); }
void BasicUI::zoom_100_ms() { access_action("Editor/zoom_100_ms"); }
void BasicUI::zoom_1_sec() { access_action("Editor/zoom_1_sec"); }
void BasicUI::zoom_10_sec() { access_action("Editor/zoom_10_sec"); }
void BasicUI::zoom_1_min() { access_action("Editor/zoom_1_min"); }
void BasicUI::zoom_5_min() { access_action("Editor/zoom_5_min"); }
void BasicUI::zoom_10_min() { access_action("Editor/zoom_10_min"); }
void BasicUI::zoom_to_session() { access_action("Editor/zoom-to-session"); }
void BasicUI::temporal_zoom_in() { access_action("Editor/temporal-zoom-in"); }
void BasicUI::temporal_zoom_out() { access_action("Editor/temporal-zoom-out"); }
void BasicUI::scroll_up_1_track() { access_action("Editor/step-tracks-up"); }
void BasicUI::scroll_dn_1_track() { access_action("Editor/step-tracks-down"); }
void BasicUI::scroll_up_1_page() { access_action("Editor/scroll-tracks-up"); }
void BasicUI::scroll_dn_1_page() { access_action("Editor/scroll-tracks-down"); }
bool
BasicUI::locating ()
{
return session->locate_pending();
}
bool
BasicUI::locked ()
{
return session->transport_locked ();
}
ARDOUR::samplecnt_t
BasicUI::timecode_frames_per_hour ()
{
return session->timecode_frames_per_hour ();
}
void
BasicUI::timecode_time (samplepos_t where, Timecode::Time& timecode)
{
session->timecode_time (where, *((Timecode::Time *) &timecode));
}
void
BasicUI::timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const
{
session->timecode_to_sample (*((Timecode::Time*)&timecode), sample, use_offset, use_subframes);
}
void
BasicUI::sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const
{
session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes);
}
void
BasicUI::cancel_all_solo ()
{
if (session) {
session->cancel_all_solo ();
}
}
struct SortLocationsByPosition {
bool operator() (Location* a, Location* b) {
return a->start() < b->start();
}
};
void
BasicUI::goto_nth_marker (int n)
{
if (!session) {
return;
}
const Locations::LocationList& l (session->locations()->list());
Locations::LocationList ordered;
ordered = l;
SortLocationsByPosition cmp;
ordered.sort (cmp);
for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) {
if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_session_range()) {
if (n == 0) {
session->request_locate ((*i)->start().samples());
break;
}
--n;
}
}
}
ARDOUR::TriggerPtr
BasicUI::find_trigger (int x, int y)
{
boost::shared_ptr<Route> r = session->get_remote_nth_route (x);
if (!r) {
return TriggerPtr();
}
boost::shared_ptr<TriggerBox> tb = r->triggerbox();
if (!tb || !tb->active()) {
return TriggerPtr();
}
TriggerPtr tp (tb->trigger (y));
if (!tp) {
return TriggerPtr();
}
return tp;
}
float
BasicUI::trigger_progress_at (int x)
{
boost::shared_ptr<TriggerBox> tb = session->triggerbox_at (_tbank_start_route + x);
if (tb) {
ARDOUR::TriggerPtr trigger = tb->currently_playing ();
if (trigger) {
return trigger->position_as_fraction ();
}
}
return -1;
}
BasicUI::TriggerDisplay
BasicUI::trigger_display_at (int x, int y)
{
TriggerDisplay disp;
boost::shared_ptr<TriggerBox> tb = session->triggerbox_at (_tbank_start_route + x);
if (tb) {
ARDOUR::TriggerPtr current = tb->currently_playing ();
TriggerPtr tp = tb->trigger (_tbank_start_row + y);
if (tp) {
if (!tp->region()) {
disp.state = -1;
} else if (tp == current) {
disp.state = 1;
} else {
disp.state = 0;
}
}
}
return disp;
}
void
BasicUI::bang_trigger_at (int x, int y)
{
session->bang_trigger_at (_tbank_start_route + x, _tbank_start_row + y);
}
void
BasicUI::unbang_trigger_at (int x, int y)
{
session->unbang_trigger_at (_tbank_start_route + x, _tbank_start_row + y);
}
#if 0
this stuff is waiting to go in so that all UIs can offer complex solo/mute functionality
void
BasicUI::solo_release (boost::shared_ptr<Route> r)
{
}
void
BasicUI::solo_press (boost::shared_ptr<Route> r, bool momentary, bool global, bool exclusive, bool isolate, bool solo_group)
{
if (momentary) {
_solo_release = new SoloMuteRelease (_route->soloed());
}
if (global) {
if (_solo_release) {
_solo_release->routes = _session->get_routes ();
}
if (Config->get_solo_control_is_listen_control()) {
_session->set_listen (_session->get_routes(), !_route->listening(), Session::rt_cleanup, true);
} else {
_session->set_solo (_session->get_routes(), !_route->soloed(), Session::rt_cleanup, true);
}
} else if (exclusive) {
if (_solo_release) {
_solo_release->exclusive = true;
boost::shared_ptr<RouteList> routes = _session->get_routes();
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
if ((*i)->soloed ()) {
_solo_release->routes_on->push_back (*i);
} else {
_solo_release->routes_off->push_back (*i);
}
}
}
if (Config->get_solo_control_is_listen_control()) {
/* ??? we need a just_one_listen() method */
} else {
_session->set_just_one_solo (_route, true);
}
} else if (isolate) {
// shift-click: toggle solo isolated status
_route->set_solo_isolated (!_route->solo_isolated(), this);
delete _solo_release;
_solo_release = 0;
} else if (solo_group) {
/* Primary-button1: solo mix group.
NOTE: Primary-button2 is MIDI learn.
*/
if (_route->route_group()) {
if (_solo_release) {
_solo_release->routes = _route->route_group()->route_list();
}
if (Config->get_solo_control_is_listen_control()) {
_session->set_listen (_route->route_group()->route_list(), !_route->listening(), Session::rt_cleanup, true);
} else {
_session->set_solo (_route->route_group()->route_list(), !_route->soloed(), Session::rt_cleanup, true);
}
}
} else {
/* click: solo this route */
boost::shared_ptr<RouteList> rl (new RouteList);
rl->push_back (route());
if (_solo_release) {
_solo_release->routes = rl;
}
if (Config->get_solo_control_is_listen_control()) {
_session->set_listen (rl, !_route->listening());
} else {
_session->set_solo (rl, !_route->soloed());
}
}
}
#endif

View file

@ -0,0 +1,433 @@
/*
* Copyright (C) 2006-2009 David Robillard <d@drobilla.net>
* Copyright (C) 2006-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
* Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "pbd/convert.h"
#include "pbd/error.h"
#include "pbd/pthread_utils.h"
#include "temporal/superclock.h"
#include "temporal/tempo.h"
#include "ardour/control_protocol_manager.h"
#include "ardour/gain_control.h"
#include "ardour/session.h"
#include "ardour/record_enable_control.h"
#include "ardour/route.h"
#include "ardour/audio_track.h"
#include "ardour/meter.h"
#include "ardour/amp.h"
#include "ardour/selection.h"
#include "control_protocol/control_protocol.h"
using namespace ARDOUR;
using namespace std;
using namespace PBD;
Signal0<void> ControlProtocol::ZoomToSession;
Signal0<void> ControlProtocol::ZoomOut;
Signal0<void> ControlProtocol::ZoomIn;
Signal0<void> ControlProtocol::Enter;
Signal0<void> ControlProtocol::Undo;
Signal0<void> ControlProtocol::Redo;
Signal1<void,float> ControlProtocol::ScrollTimeline;
Signal1<void,uint32_t> ControlProtocol::GotoView;
Signal0<void> ControlProtocol::CloseDialog;
PBD::Signal0<void> ControlProtocol::VerticalZoomInAll;
PBD::Signal0<void> ControlProtocol::VerticalZoomOutAll;
PBD::Signal0<void> ControlProtocol::VerticalZoomInSelected;
PBD::Signal0<void> ControlProtocol::VerticalZoomOutSelected;
PBD::Signal0<void> ControlProtocol::StepTracksDown;
PBD::Signal0<void> ControlProtocol::StepTracksUp;
StripableNotificationList ControlProtocol::_last_selected;
PBD::ScopedConnection ControlProtocol::selection_connection;
bool ControlProtocol::selection_connected = false;
const std::string ControlProtocol::state_node_name ("Protocol");
ControlProtocol::ControlProtocol (Session& s, string str)
: BasicUI (s)
, _name (str)
, glib_event_callback (boost::bind (&ControlProtocol::event_loop_precall, this))
, _active (false)
{
if (!selection_connected) {
/* this is all static, connect it only once (and early), for all ControlProtocols */
ControlProtocolManager::StripableSelectionChanged.connect_same_thread (selection_connection, boost::bind (&ControlProtocol::notify_stripable_selection_changed, _1));
selection_connected = true;
}
}
ControlProtocol::~ControlProtocol ()
{
}
void
ControlProtocol::event_loop_precall ()
{
/* reload the thread-local ptr to the tempo map */
Temporal::TempoMap::fetch ();
}
void
ControlProtocol::install_precall_handler (Glib::RefPtr<Glib::MainContext> context)
{
glib_event_callback.attach (context);
}
int
ControlProtocol::set_active (bool yn)
{
_active = yn;
return 0;
}
void
ControlProtocol::next_track (uint32_t initial_id)
{
// STRIPABLE route_table[0] = _session->get_nth_stripable (++initial_id, RemoteControlID::Route);
}
void
ControlProtocol::prev_track (uint32_t initial_id)
{
if (!initial_id) {
return;
}
// STRIPABLE route_table[0] = _session->get_nth_stripable (--initial_id, RemoteControlID::Route);
}
void
ControlProtocol::set_route_table_size (uint32_t size)
{
while (route_table.size() < size) {
route_table.push_back (boost::shared_ptr<Route> ((Route*) 0));
}
}
void
ControlProtocol::set_route_table (uint32_t table_index, boost::shared_ptr<ARDOUR::Route> r)
{
if (table_index >= route_table.size()) {
return;
}
route_table[table_index] = r;
// XXX SHAREDPTR need to handle r->GoingAway
}
bool
ControlProtocol::set_route_table (uint32_t table_index, uint32_t remote_control_id)
{
#if 0 // STRIPABLE
boost::shared_ptr<Route> r = session->route_by_remote_id (remote_control_id);
if (!r) {
return false;
}
set_route_table (table_index, r);
#endif
return true;
}
void
ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn)
{
if (table_index >= route_table.size()) {
return;
}
boost::shared_ptr<Route> r = route_table[table_index];
boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack>(r);
if (at) {
at->rec_enable_control()->set_value (1.0, Controllable::UseGroup);
}
}
bool
ControlProtocol::route_get_rec_enable (uint32_t table_index)
{
if (table_index >= route_table.size()) {
return false;
}
boost::shared_ptr<Route> r = route_table[table_index];
boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack>(r);
if (at) {
return at->rec_enable_control()->get_value();
}
return false;
}
float
ControlProtocol::route_get_gain (uint32_t table_index)
{
if (table_index >= route_table.size()) {
return 0.0f;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return 0.0f;
}
return r->gain_control()->get_value();
}
void
ControlProtocol::route_set_gain (uint32_t table_index, float gain)
{
if (table_index >= route_table.size()) {
return;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r != 0) {
r->gain_control()->set_value (gain, Controllable::UseGroup);
}
}
float
ControlProtocol::route_get_effective_gain (uint32_t table_index)
{
if (table_index >= route_table.size()) {
return 0.0f;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return 0.0f;
}
return r->amp()->gain_control()->get_value();
}
float
ControlProtocol::route_get_peak_input_power (uint32_t table_index, uint32_t which_input)
{
if (table_index >= route_table.size()) {
return 0.0f;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return 0.0f;
}
return r->peak_meter()->meter_level (which_input, MeterPeak);
}
bool
ControlProtocol::route_get_muted (uint32_t table_index)
{
if (table_index >= route_table.size()) {
return false;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return false;
}
return r->mute_control()->muted ();
}
void
ControlProtocol::route_set_muted (uint32_t table_index, bool yn)
{
if (table_index >= route_table.size()) {
return;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r != 0) {
r->mute_control()->set_value (yn ? 1.0 : 0.0, Controllable::UseGroup);
}
}
bool
ControlProtocol::route_get_soloed (uint32_t table_index)
{
if (table_index >= route_table.size()) {
return false;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return false;
}
return r->soloed ();
}
void
ControlProtocol::route_set_soloed (uint32_t table_index, bool yn)
{
if (table_index >= route_table.size()) {
return;
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r != 0) {
session->set_control (r->solo_control(), yn ? 1.0 : 0.0, Controllable::UseGroup);
}
}
string
ControlProtocol:: route_get_name (uint32_t table_index)
{
if (table_index >= route_table.size()) {
return "";
}
boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return "";
}
return r->name();
}
list<boost::shared_ptr<Bundle> >
ControlProtocol::bundles ()
{
return list<boost::shared_ptr<Bundle> > ();
}
XMLNode&
ControlProtocol::get_state () const
{
XMLNode* node = new XMLNode (state_node_name);
node->set_property ("name", _name);
node->set_property ("feedback", get_feedback());
return *node;
}
int
ControlProtocol::set_state (XMLNode const & node, int /* version */)
{
bool feedback;
if (node.get_property ("feedback", feedback)) {
set_feedback (feedback);
}
return 0;
}
boost::shared_ptr<Stripable>
ControlProtocol::first_selected_stripable () const
{
return session->selection().first_selected_stripable ();
}
void
ControlProtocol::add_stripable_to_selection (boost::shared_ptr<ARDOUR::Stripable> s)
{
session->selection().add (s, boost::shared_ptr<AutomationControl>());
}
void
ControlProtocol::set_stripable_selection (boost::shared_ptr<ARDOUR::Stripable> s)
{
session->selection().select_stripable_and_maybe_group (s, true, true, 0);
}
void
ControlProtocol::toggle_stripable_selection (boost::shared_ptr<ARDOUR::Stripable> s)
{
session->selection().toggle (s, boost::shared_ptr<AutomationControl>());
}
void
ControlProtocol::remove_stripable_from_selection (boost::shared_ptr<ARDOUR::Stripable> s)
{
session->selection().remove (s, boost::shared_ptr<AutomationControl>());
}
void
ControlProtocol::add_rid_to_selection (int rid)
{
boost::shared_ptr<Stripable> s = session->get_remote_nth_stripable (rid, PresentationInfo::MixerStripables);
if (s) {
session->selection().add (s, boost::shared_ptr<AutomationControl>());
}
}
void
ControlProtocol::set_rid_selection (int rid)
{
boost::shared_ptr<Stripable> s = session->get_remote_nth_stripable (rid, PresentationInfo::MixerStripables);
if (s) {
session->selection().select_stripable_and_maybe_group (s, true, true, 0);
}
}
void
ControlProtocol::toggle_rid_selection (int rid)
{
boost::shared_ptr<Stripable> s = session->get_remote_nth_stripable (rid, PresentationInfo::MixerStripables);
if (s) {
session->selection().toggle (s, boost::shared_ptr<AutomationControl>());
}
}
void
ControlProtocol::remove_rid_from_selection (int rid)
{
boost::shared_ptr<Stripable> s = session->get_remote_nth_stripable (rid, PresentationInfo::MixerStripables);
if (s) {
session->selection().remove (s, boost::shared_ptr<AutomationControl>());
}
}
void
ControlProtocol::clear_stripable_selection ()
{
session->selection().clear_stripables ();
}
void
ControlProtocol::notify_stripable_selection_changed (StripableNotificationListPtr sp)
{
_last_selected = *sp;
}

View file

@ -0,0 +1,206 @@
/*
* Copyright (C) 2006-2010 David Robillard <d@drobilla.net>
* Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2015 Robin Gareus <robin@gareus.org>
* Copyright (C) 2016 Ben Loftis <ben@harrisonconsoles.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __ardour_basic_ui_h__
#define __ardour_basic_ui_h__
#include <string>
#include <stdint.h>
#include "pbd/signals.h"
#include "temporal/timeline.h"
#include "ardour/types.h"
#include "ardour/presentation_info.h"
#include "temporal/time.h"
#include "control_protocol/visibility.h"
namespace ARDOUR {
class Session;
class SessionEvent;
class Stripable;
class Trigger;
}
class LIBCONTROLCP_API BasicUI {
public:
BasicUI (ARDOUR::Session&);
virtual ~BasicUI ();
void add_marker (const std::string& = std::string());
void remove_marker_at_playhead ();
// void mark_in();
// void mark_out();
void register_thread (std::string name);
/* transport control */
void loop_toggle ();
void loop_location (Temporal::timepos_t const & start, Temporal::timepos_t const & end);
void access_action ( std::string action_path );
static PBD::Signal2<void,std::string,std::string> AccessAction;
void goto_zero ();
void goto_start (bool and_roll = false);
void goto_end ();
void button_varispeed (bool fwd);
void rewind ();
void ffwd ();
void transport_stop ();
void transport_play (bool jump_back = false);
void set_transport_speed (double speed);
double get_transport_speed () const;
double transport_rolling () const;
void jump_by_seconds (double sec, ARDOUR::LocateTransportDisposition ltd = ARDOUR::RollIfAppropriate);
void jump_by_bars (int bars, ARDOUR::LocateTransportDisposition ltd = ARDOUR::RollIfAppropriate);
void jump_by_beats (int beats, ARDOUR::LocateTransportDisposition ltd = ARDOUR::RollIfAppropriate);
ARDOUR::samplepos_t transport_sample ();
void locate (ARDOUR::samplepos_t sample, ARDOUR::LocateTransportDisposition ltd);
void locate (ARDOUR::samplepos_t sample, bool);
bool locating ();
bool locked ();
void save_state ();
void prev_marker ();
void next_marker ();
void undo ();
void redo ();
void toggle_punch_in ();
void toggle_punch_out ();
void mark_in();
void mark_out();
void toggle_click();
void midi_panic();
void trigger_cue_row (int cue);
void trigger_stop_all (bool stop_now = false);
void store_mixer_scene (int scn);
void apply_mixer_scene (int scn);
void toggle_monitor_mute();
void toggle_monitor_dim();
void toggle_monitor_mono();
void cancel_all_solo ();
void quick_snapshot_stay ();
void quick_snapshot_switch ();
void toggle_roll(bool with_abort, bool roll_out_of_bounded_mode); //this provides the same operation as the "spacebar", it's a lot smarter than "play".
void stop_forget();
void set_punch_range();
void set_loop_range();
void set_session_range();
void set_record_enable (bool yn);
bool get_record_enabled ();
//editor visibility stuff (why do we have to make explicit numbers here? because "gui actions" don't accept args
void fit_1_track();
void fit_2_tracks();
void fit_4_tracks();
void fit_8_tracks();
void fit_16_tracks();
void fit_32_tracks();
void fit_all_tracks();
void zoom_10_ms();
void zoom_100_ms();
void zoom_1_sec();
void zoom_10_sec();
void zoom_1_min();
void zoom_5_min();
void zoom_10_min();
void zoom_to_session();
void temporal_zoom_in();
void temporal_zoom_out();
void scroll_up_1_track();
void scroll_dn_1_track();
void scroll_up_1_page();
void scroll_dn_1_page();
void rec_enable_toggle ();
void toggle_all_rec_enables ();
void all_tracks_rec_in ();
void all_tracks_rec_out ();
void goto_nth_marker (int n);
ARDOUR::samplecnt_t timecode_frames_per_hour ();
void timecode_time (samplepos_t where, Timecode::Time&);
void timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const;
void sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
bool stop_button_onoff() const;
bool play_button_onoff() const;
bool ffwd_button_onoff() const;
bool rewind_button_onoff() const;
bool loop_button_onoff() const;
/* These functions access Triggers in the order they are displayed on the Cue page, WITH an optional bank offset
Use this for a launchpad-style NxM (route x row) matrix that maps directly to the Cue page layout.
Trigger banking is separate from 'route' banking implemented by a fader surface.
To match a fader/mute/solo to the Trigger banking, the tentative plan is:
request trigger-tracks-only to be displayed on the surface
bank the faders using the offset reported here
*/
void tbank_set_size (int route_width, int row_height);
void tbank_step_routes (int step_size);
void tbank_step_rows (int step_size);
float trigger_progress_at (int x); /* 0..1 or -1 for not playing; */
struct TriggerDisplay {
int state;
TriggerDisplay () {
state = -1; /* -1=empty; 0=stopped; 1=playing */ /*potentially extend to include */
//potentially name, color, launch style, follow action(s) etc
}
};
TriggerDisplay trigger_display_at (int x, int y);
void bang_trigger_at (int x, int y);
void unbang_trigger_at (int x, int y);
/* it would be nice to use TriggerPtr here but that implies including ardour/triggerbox.h */
boost::shared_ptr<ARDOUR::Trigger> find_trigger (int x, int y);
protected:
BasicUI ();
ARDOUR::Session* session;
int _tbank_route_width, _tbank_row_height;
int _tbank_start_route, _tbank_start_row;
};
#endif /* __ardour_basic_ui_h__ */

View file

@ -0,0 +1,209 @@
/*
* Copyright (C) 2006-2012 David Robillard <d@drobilla.net>
* Copyright (C) 2006-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2013-2017 John Emmas <john@creativepost.co.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef ardour_control_protocols_h
#define ardour_control_protocols_h
#include <list>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "pbd/signals.h"
#include "pbd/stateful.h"
#include "pbd/glib_event_source.h"
#include "control_protocol/basic_ui.h"
#include "control_protocol/types.h"
#include "control_protocol/visibility.h"
namespace ARDOUR {
class Route;
class Session;
class Bundle;
class Stripable;
class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI
{
public:
ControlProtocol (Session&, std::string name);
virtual ~ControlProtocol ();
virtual std::string name () const { return _name; }
virtual int set_active (bool yn);
virtual bool active () const { return _active; }
virtual int set_feedback (bool /*yn*/) { return 0; }
virtual bool get_feedback () const { return false; }
virtual void midi_connectivity_established () {}
virtual void stripable_selection_changed () = 0;
PBD::Signal0<void> ActiveChanged;
/* signals that a control protocol can emit and other (presumably graphical)
* user interfaces can respond to
*/
static PBD::Signal0<void> ZoomToSession;
static PBD::Signal0<void> ZoomIn;
static PBD::Signal0<void> ZoomOut;
static PBD::Signal0<void> Enter;
static PBD::Signal0<void> Undo;
static PBD::Signal0<void> Redo;
static PBD::Signal1<void, float> ScrollTimeline;
static PBD::Signal1<void, uint32_t> GotoView;
static PBD::Signal0<void> CloseDialog;
static PBD::Signal0<void> VerticalZoomInAll;
static PBD::Signal0<void> VerticalZoomOutAll;
static PBD::Signal0<void> VerticalZoomInSelected;
static PBD::Signal0<void> VerticalZoomOutSelected;
static PBD::Signal0<void> StepTracksDown;
static PBD::Signal0<void> StepTracksUp;
void add_stripable_to_selection (boost::shared_ptr<ARDOUR::Stripable>);
void set_stripable_selection (boost::shared_ptr<ARDOUR::Stripable>);
void toggle_stripable_selection (boost::shared_ptr<ARDOUR::Stripable>);
void remove_stripable_from_selection (boost::shared_ptr<ARDOUR::Stripable>);
void clear_stripable_selection ();
virtual void add_rid_to_selection (int rid);
virtual void set_rid_selection (int rid);
virtual void toggle_rid_selection (int rid);
virtual void remove_rid_from_selection (int rid);
boost::shared_ptr<ARDOUR::Stripable> first_selected_stripable () const;
/* the model here is as follows:
we imagine most control surfaces being able to control
from 1 to N tracks at a time, with a session that may
contain 1 to M tracks, where M may be smaller, larger or
equal to N.
the control surface has a fixed set of physical controllers
which can potentially be mapped onto different tracks/busses
via some mechanism.
therefore, the control protocol object maintains
a table that reflects the current mapping between
the controls and route object.
*/
void set_route_table_size (uint32_t size);
void set_route_table (uint32_t table_index, boost::shared_ptr<ARDOUR::Route>);
bool set_route_table (uint32_t table_index, uint32_t remote_control_id);
void route_set_rec_enable (uint32_t table_index, bool yn);
bool route_get_rec_enable (uint32_t table_index);
float route_get_gain (uint32_t table_index);
void route_set_gain (uint32_t table_index, float);
float route_get_effective_gain (uint32_t table_index);
float route_get_peak_input_power (uint32_t table_index, uint32_t which_input);
bool route_get_muted (uint32_t table_index);
void route_set_muted (uint32_t table_index, bool);
bool route_get_soloed (uint32_t table_index);
void route_set_soloed (uint32_t table_index, bool);
std::string route_get_name (uint32_t table_index);
virtual std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
virtual bool has_editor () const { return false; }
virtual void* get_gui () const { return 0; }
virtual void tear_down_gui () {}
XMLNode& get_state () const;
int set_state (XMLNode const&, int version);
static const std::string state_node_name;
static StripableNotificationList const& last_selected () { return _last_selected; }
static void notify_stripable_selection_changed (StripableNotificationListPtr);
protected:
void next_track (uint32_t initial_id);
void prev_track (uint32_t initial_id);
std::vector<boost::shared_ptr<ARDOUR::Route> > route_table;
std::string _name;
GlibEventLoopCallback glib_event_callback;
virtual void event_loop_precall ();
void install_precall_handler (Glib::RefPtr<Glib::MainContext>);
private:
LIBCONTROLCP_LOCAL ControlProtocol (const ControlProtocol&); /* noncopyable */
bool _active;
static StripableNotificationList _last_selected;
static PBD::ScopedConnection selection_connection;
static bool selection_connected;
};
extern "C" {
class ControlProtocolDescriptor
{
public:
const char* name; /* descriptive */
const char* id; /* unique and version-specific */
void* ptr; /* protocol can store a value here */
void* module; /* not for public access */
int mandatory; /* if non-zero, always load and do not make optional */
bool supports_feedback; /* if true, protocol has toggleable feedback mechanism */
bool (*probe) (ControlProtocolDescriptor*);
ControlProtocol* (*initialize) (ControlProtocolDescriptor*, Session*);
void (*destroy) (ControlProtocolDescriptor*, ControlProtocol*);
/* this is required if the control protocol connects to signals
* from libardour. they all do. It should allocate a
* type-specific request buffer for the calling thread, and
* store it in a thread-local location that will be used to
* find it when sending the event loop a message
* (e.g. call_slot()). It should also return the allocated
* buffer as a void*.
*/
void* (*request_buffer_factory) (uint32_t);
};
}
}
/* this is where the strange inheritance pattern hits the wall. A control
protocol thread/event loop is inherited from AbstractUI, but the precall
handler is inherited from ControlProtocol. When the AbstractUI sets up the
event loop, it will call attach_request_source() which will in turn pass a
Glib::MainContext to maybe_install_precall_handler(). We override the
definition of that method here to make it actuall install the
ControlProtocol's handler.
*/
#define CONTROL_PROTOCOL_THREADS_NEED_TEMPO_MAP_DECL() \
void maybe_install_precall_handler (Glib::RefPtr<Glib::MainContext> ctxt) { install_precall_handler (ctxt); }
#endif // ardour_control_protocols_h

View file

@ -0,0 +1,38 @@
/*
* Copyright (C) 2012-2016 Paul Davis <paul@linuxaudiosystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __ardour_control_protocol_types_h__
#define __ardour_control_protocol_types_h__
#include <vector>
#include <boost/smart_ptr.hpp>
namespace ARDOUR {
class Route;
class Stripable;
typedef std::vector<boost::weak_ptr<ARDOUR::Route> > RouteNotificationList;
typedef boost::shared_ptr<RouteNotificationList> RouteNotificationListPtr;
typedef std::vector<boost::shared_ptr<ARDOUR::Route> > StrongRouteNotificationList;
typedef std::vector<boost::weak_ptr<ARDOUR::Stripable> > StripableNotificationList;
typedef boost::shared_ptr<StripableNotificationList> StripableNotificationListPtr;
typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > StrongStripableNotificationList;
}
#endif /* __ardour_control_protocol_types_h__ */

View file

@ -0,0 +1,54 @@
/*
* Copyright (C) 2013-2015 Paul Davis <paul@linuxaudiosystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __libcontrolcp_visibility_h__
#define __libcontrolcp_visibility_h__
#if defined(COMPILER_MSVC)
#define LIBCONTROLCP_DLL_IMPORT __declspec(dllimport)
#define LIBCONTROLCP_DLL_EXPORT __declspec(dllexport)
#define LIBCONTROLCP_DLL_LOCAL
#else
#define LIBCONTROLCP_DLL_IMPORT __attribute__ ((visibility ("default")))
#define LIBCONTROLCP_DLL_EXPORT __attribute__ ((visibility ("default")))
#define LIBCONTROLCP_DLL_LOCAL __attribute__ ((visibility ("hidden")))
#endif
#ifdef LIBCONTROLCP_DLL_EXPORTS // defined if we are building the libcontrolcp DLL (instead of using it)
#define LIBCONTROLCP_API LIBCONTROLCP_DLL_EXPORT
#else
#define LIBCONTROLCP_API LIBCONTROLCP_DLL_IMPORT
#endif
#define LIBCONTROLCP_LOCAL LIBCONTROLCP_DLL_LOCAL
/* These should be used by surfaces/control interfaces. They use (probably)
* libcontrolcp but they are not part of it. The idea here is to avoid
* having to define per-surface macros for each and every surface. Instead,
* every surface defines ARDOURSURFACE_DLL_EXPORTS during building and
* uses ARDOURSURFACE_API in its declarations.
*/
#ifdef ARDOURSURFACE_DLL_EXPORTS // defined if we are building the libcontrolcp DLL (instead of using it)
#define ARDOURSURFACE_API LIBCONTROLCP_DLL_EXPORT
#else
#define ARDOURSURFACE_API LIBCONTROLCP_DLL_IMPORT
#endif
#define ARDOURSURFACE_LOCAL LIBCONTROLCP_DLL_LOCAL
#endif /* __libcontrolcp_visibility_h__ */

View file

@ -0,0 +1,40 @@
#!/usr/bin/env python
from waflib.extras import autowaf as autowaf
import os
# Mandatory variables
top = '.'
out = 'build'
controlcp_sources = [
'basic_ui.cc',
'control_protocol.cc',
]
def options(opt):
autowaf.set_options(opt)
def configure(conf):
pass
def build(bld):
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=controlcp_sources)
# defines for this library
obj.defines = [ 'LIBCONTROLCP_DLL_EXPORTS' ]
else:
obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=controlcp_sources)
obj.cxxflags = [ bld.env['compiler_flags_dict']['pic'] ]
obj.defines = [ ]
obj.export_includes = ['.', './control_protocol' ]
obj.defines += [ 'PACKAGE="ardour_cp"' ]
obj.includes = ['.', './control_protocol']
obj.name = 'libardour_cp'
obj.target = 'ardourcp'
obj.use = 'libardour libpbd'
obj.uselib = 'GLIBMM SIGCPP XML OSX'
obj.install_path = bld.env['LIBDIR']
def shutdown():
autowaf.shutdown()

View file

@ -0,0 +1,113 @@
/*
* Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "midi_byte_array.h"
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstdarg>
#include <iomanip>
#include <stdexcept>
MidiByteArray::MidiByteArray (size_t size, MIDI::byte array[])
: std::vector<MIDI::byte>()
{
for (size_t i = 0; i < size; ++i)
{
push_back (array[i]);
}
}
MidiByteArray::MidiByteArray (size_t count, MIDI::byte first, ...)
: vector<MIDI::byte>()
{
push_back (first);
va_list var_args;
va_start (var_args, first);
for (size_t i = 1; i < count; ++i)
{
MIDI::byte b = va_arg (var_args, int);
push_back (b);
}
va_end (var_args);
}
void MidiByteArray::copy (size_t count, MIDI::byte * arr)
{
for (size_t i = 0; i < count; ++i) {
push_back (arr[i]);
}
}
MidiByteArray & operator << (MidiByteArray & mba, const MIDI::byte & b)
{
mba.push_back (b);
return mba;
}
MidiByteArray & operator << (MidiByteArray & mba, const MidiByteArray & barr)
{
std::back_insert_iterator<MidiByteArray> bit (mba);
copy (barr.begin(), barr.end(), bit);
return mba;
}
std::ostream & operator << (std::ostream & os, const MidiByteArray & mba)
{
os << "[";
char fill = os.fill('0');
for (MidiByteArray::const_iterator it = mba.begin(); it != mba.end(); ++it) {
if (it != mba.begin()) os << " ";
os << std::hex << std::setw(2) << (int)*it;
}
os.fill (fill);
os << std::dec;
os << "]";
return os;
}
MidiByteArray & operator << (MidiByteArray & mba, const std::string & st)
{
/* note that this assumes that "st" is ASCII encoded
*/
mba.insert (mba.end(), st.begin(), st.end());
return mba;
}
bool
MidiByteArray::compare_n (const MidiByteArray& other, MidiByteArray::size_type n) const
{
MidiByteArray::const_iterator us = begin();
MidiByteArray::const_iterator them = other.begin();
while (n && us != end() && them != other.end()) {
if ((*us) != (*them)) {
return false;
}
--n;
++us;
++them;
}
return true;
}

View file

@ -0,0 +1,449 @@
/*
* Copyright (C) 2022 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "pbd/debug.h"
#include "pbd/i18n.h"
#include "ardour/async_midi_port.h"
#include "ardour/audioengine.h"
#include "ardour/bundle.h"
#include "ardour/debug.h"
#include "ardour/midiport_manager.h"
#include "ardour/midi_port.h"
#include "ardour/session.h"
#include "midi_surface.h"
using namespace ARDOUR;
using namespace Glib;
using namespace PBD;
#include "pbd/abstract_ui.cc" // instantiate template
MIDISurface::MIDISurface (ARDOUR::Session& s, std::string const & namestr, std::string const & port_prefix, bool use_pad_filter)
: ControlProtocol (s, namestr)
, AbstractUI<MidiSurfaceRequest> (namestr)
, with_pad_filter (use_pad_filter)
, _in_use (false)
, port_name_prefix (port_prefix)
, _connection_state (ConnectionState (0))
{
}
MIDISurface::~MIDISurface ()
{
/* leave it all up to derived classes, because ordering it hard. */
}
void
MIDISurface::port_setup ()
{
ports_acquire ();
if (!input_port_name().empty() || !output_port_name().empty()) {
ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::port_registration_handler, this), this);
}
ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::connection_handler, this, _1, _2, _3, _4, _5), this);
port_registration_handler ();
}
void
MIDISurface::drop ()
{
/* do this before stopping the event loop, so that we don't get any notifications */
port_connections.drop_connections ();
stop_using_device ();
device_release ();
ports_release ();
}
int
MIDISurface::ports_acquire ()
{
DEBUG_TRACE (DEBUG::MIDISurface, "acquiring ports\n");
/* setup ports */
_async_in = AudioEngine::instance()->register_input_port (DataType::MIDI, string_compose (X_("%1 in"), port_name_prefix), true);
_async_out = AudioEngine::instance()->register_output_port (DataType::MIDI, string_compose (X_("%1 out"), port_name_prefix), true);
if (_async_in == 0 || _async_out == 0) {
DEBUG_TRACE (DEBUG::MIDISurface, "cannot register ports\n");
return -1;
}
/* We do not add our ports to the input/output bundles because we don't
* want users wiring them by hand. They could use JACK tools if they
* really insist on that (and use JACK)
*/
_input_port = boost::dynamic_pointer_cast<AsyncMIDIPort>(_async_in).get();
_output_port = boost::dynamic_pointer_cast<AsyncMIDIPort>(_async_out).get();
/* Create a shadow port where, depending on the state of the surface,
* we will make pad note on/off events appear. The surface code will
* automatically this port to the first selected MIDI track.
*/
if (with_pad_filter) {
boost::dynamic_pointer_cast<AsyncMIDIPort>(_async_in)->add_shadow_port (string_compose (_("%1 Pads"), port_name_prefix), boost::bind (&MIDISurface::pad_filter, this, _1, _2));
boost::shared_ptr<MidiPort> shadow_port = boost::dynamic_pointer_cast<AsyncMIDIPort>(_async_in)->shadow_port();
if (shadow_port) {
_output_bundle.reset (new ARDOUR::Bundle (_("Push 2 Pads"), false));
_output_bundle->add_channel (
shadow_port->name(),
ARDOUR::DataType::MIDI,
session->engine().make_port_name_non_relative (shadow_port->name())
);
}
}
session->BundleAddedOrRemoved ();
connect_to_parser ();
/* Connect input port to event loop */
AsyncMIDIPort* asp;
asp = dynamic_cast<AsyncMIDIPort*> (_input_port);
asp->xthread().set_receive_handler (sigc::bind (sigc::mem_fun (this, &MIDISurface::midi_input_handler), _input_port));
asp->xthread().attach (main_loop()->get_context());
return 0;
}
void
MIDISurface::ports_release ()
{
DEBUG_TRACE (DEBUG::MIDISurface, "releasing ports\n");
/* wait for button data to be flushed */
AsyncMIDIPort* asp;
asp = dynamic_cast<AsyncMIDIPort*> (_output_port);
asp->drain (10000, 500000);
{
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_async_in);
AudioEngine::instance()->unregister_port (_async_out);
}
_async_in.reset ((ARDOUR::Port*) 0);
_async_out.reset ((ARDOUR::Port*) 0);
_input_port = 0;
_output_port = 0;
}
void
MIDISurface::port_registration_handler ()
{
if (!_async_in || !_async_out) {
/* ports not registered yet */
return;
}
if (_async_in->connected() && _async_out->connected()) {
/* don't waste cycles here */
return;
}
std::vector<std::string> in;
std::vector<std::string> out;
AudioEngine::instance()->get_ports (string_compose (".*%1", input_port_name()), DataType::MIDI, PortFlags (IsPhysical|IsOutput), in);
AudioEngine::instance()->get_ports (string_compose (".*%1", output_port_name()), DataType::MIDI, PortFlags (IsPhysical|IsInput), out);
if (!in.empty() && !out.empty()) {
if (!_async_in->connected()) {
AudioEngine::instance()->connect (_async_in->name(), in.front());
}
if (!_async_out->connected()) {
AudioEngine::instance()->connect (_async_out->name(), out.front());
}
}
}
bool
MIDISurface::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn)
{
DEBUG_TRACE (DEBUG::MIDISurface, "FaderPort::connection_handler start\n");
if (!_input_port || !_output_port) {
return false;
}
std::string ni = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (boost::shared_ptr<ARDOUR::Port>(_async_in)->name());
std::string no = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (boost::shared_ptr<ARDOUR::Port>(_async_out)->name());
if (ni == name1 || ni == name2) {
if (yn) {
_connection_state |= InputConnected;
} else {
_connection_state &= ~InputConnected;
}
} else if (no == name1 || no == name2) {
if (yn) {
_connection_state |= OutputConnected;
} else {
_connection_state &= ~OutputConnected;
}
} else {
DEBUG_TRACE (DEBUG::MIDISurface, string_compose ("Connections between %1 and %2 changed, but I ignored it\n", name1, name2));
/* not our ports */
return false;
}
DEBUG_TRACE (DEBUG::MIDISurface, string_compose ("our ports changed connection state: %1 -> %2 connected ? %3\n",
name1, name2, yn));
if ((_connection_state & (InputConnected|OutputConnected)) == (InputConnected|OutputConnected)) {
/* XXX this is a horrible hack. Without a short sleep here,
something prevents the device wakeup messages from being
sent and/or the responses from being received.
*/
g_usleep (100000);
DEBUG_TRACE (DEBUG::MIDISurface, "device now connected for both input and output\n");
/* may not have the device open if it was just plugged
in. Really need USB device detection rather than MIDI port
detection for this to work well.
*/
device_acquire ();
begin_using_device ();
} else {
DEBUG_TRACE (DEBUG::MIDISurface, "Device disconnected (input or output or both) or not yet fully connected\n");
stop_using_device ();
}
ConnectionChange (); /* emit signal for our GUI */
DEBUG_TRACE (DEBUG::MIDISurface, "connection_handler end\n");
return true; /* connection status changed */
}
boost::shared_ptr<Port>
MIDISurface::output_port()
{
return _async_out;
}
boost::shared_ptr<Port>
MIDISurface::input_port()
{
return _async_in;
}
void
MIDISurface::write (const MidiByteArray& data)
{
/* immediate delivery */
_output_port->write (&data[0], data.size(), 0);
}
void
MIDISurface::write (MIDI::byte const * data, size_t size)
{
_output_port->write (data, size, 0);
}
bool
MIDISurface::midi_input_handler (IOCondition ioc, MIDI::Port* port)
{
if (ioc & ~IO_IN) {
DEBUG_TRACE (DEBUG::MIDISurface, "MIDI port closed\n");
return false;
}
if (ioc & IO_IN) {
DEBUG_TRACE (DEBUG::MIDISurface, string_compose ("something happened on %1\n", port->name()));
AsyncMIDIPort* asp = dynamic_cast<AsyncMIDIPort*>(port);
if (asp) {
asp->clear ();
}
DEBUG_TRACE (DEBUG::MIDISurface, string_compose ("data available on %1\n", port->name()));
if (_in_use) {
samplepos_t now = AudioEngine::instance()->sample_time();
port->parse (now);
}
}
return true;
}
void
MIDISurface::connect_to_parser ()
{
DEBUG_TRACE (DEBUG::MIDISurface, string_compose ("Connecting to signals on port %2\n", _input_port->name()));
MIDI::Parser* p = _input_port->parser();
/* Incoming sysex */
p->sysex.connect_same_thread (*this, boost::bind (&MIDISurface::handle_midi_sysex, this, _1, _2, _3));
/* V-Pot messages are Controller */
p->controller.connect_same_thread (*this, boost::bind (&MIDISurface::handle_midi_controller_message, this, _1, _2));
/* Button messages are NoteOn */
p->note_on.connect_same_thread (*this, boost::bind (&MIDISurface::handle_midi_note_on_message, this, _1, _2));
/* Button messages are NoteOn but libmidi++ sends note-on w/velocity = 0 as note-off so catch them too */
p->note_off.connect_same_thread (*this, boost::bind (&MIDISurface::handle_midi_note_on_message, this, _1, _2));
/* Fader messages are Pitchbend */
p->channel_pitchbend[0].connect_same_thread (*this, boost::bind (&MIDISurface::handle_midi_pitchbend_message, this, _1, _2));
p->poly_pressure.connect_same_thread (*this, boost::bind (&MIDISurface::handle_midi_polypressure_message, this, _1, _2));
}
void
MIDISurface::thread_init ()
{
pthread_set_name (event_loop_name().c_str());
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
set_thread_priority ();
}
void
MIDISurface::connect_session_signals()
{
// receive routes added
//session->RouteAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_routes_added, this, _1), this);
// receive VCAs added
//session->vca_manager().VCAAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::notify_vca_added, this, _1), this);
// receive record state toggled
session->RecordStateChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::notify_record_state_changed, this), this);
// receive transport state changed
session->TransportStateChange.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::notify_transport_state_changed, this), this);
session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::notify_loop_state_changed, this), this);
// receive punch-in and punch-out
Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::notify_parameter_changed, this, _1), this);
session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::notify_parameter_changed, this, _1), this);
// receive rude solo changed
session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MIDISurface::notify_solo_active_changed, this, _1), this);
}
XMLNode&
MIDISurface::get_state() const
{
XMLNode& node (ControlProtocol::get_state());
XMLNode* child;
child = new XMLNode (X_("Input"));
child->add_child_nocopy (_async_in->get_state());
node.add_child_nocopy (*child);
child = new XMLNode (X_("Output"));
child->add_child_nocopy (_async_out->get_state());
node.add_child_nocopy (*child);
return node;
}
int
MIDISurface::set_state (const XMLNode & node, int version)
{
DEBUG_TRACE (DEBUG::MIDISurface, string_compose ("MIDISurface::set_state: active %1\n", active()));
if (ControlProtocol::set_state (node, version)) {
return -1;
}
XMLNode* child;
if ((child = node.child (X_("Input"))) != 0) {
XMLNode* portnode = child->child (Port::state_node_name.c_str());
if (portnode) {
portnode->remove_property ("name");
_async_in->set_state (*portnode, version);
}
}
if ((child = node.child (X_("Output"))) != 0) {
XMLNode* portnode = child->child (Port::state_node_name.c_str());
if (portnode) {
portnode->remove_property ("name");
_async_out->set_state (*portnode, version);
}
}
return 0;
}
void
MIDISurface::do_request (MidiSurfaceRequest * req)
{
if (req->type == CallSlot) {
call_slot (MISSING_INVALIDATOR, req->the_slot);
} else if (req->type == Quit) {
stop_using_device ();
}
}
int
MIDISurface::begin_using_device ()
{
_in_use = true;
connect_session_signals ();
return 0;
}
int
MIDISurface::stop_using_device ()
{
session_connections.drop_connections ();
_in_use = false;
return 0;
}
std::list<boost::shared_ptr<ARDOUR::Bundle> >
MIDISurface::bundles ()
{
std::list<boost::shared_ptr<ARDOUR::Bundle> > b;
if (_output_bundle) {
b.push_back (_output_bundle);
}
return b;
}
void*
MIDISurface::request_factory (uint32_t num_requests)
{
/* AbstractUI<T>::request_buffer_factory() is a template method only
instantiated in this source module. To provide something visible for
use in the interface/descriptor, we have this static method that is
template-free.
*/
return request_buffer_factory (num_requests);
}

View file

@ -0,0 +1,78 @@
/*
* Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef midi_byte_array_h
#define midi_byte_array_h
#include <iostream>
#include <vector>
#include <boost/shared_array.hpp>
//#include <midi++/types.h>
namespace MIDI {
typedef unsigned char byte;
}
/**
To make building arrays of bytes easier. Thusly:
MidiByteArray mba;
mba << 0xf0 << 0x00 << 0xf7;
MidiByteArray buf;
buf << mba;
MidiByteArray direct( 3, 0xf0, 0x00, 0xf7 );
cout << mba << endl;
cout << buf << endl;
cout << direct << endl;
will all result in "f0 00 f7" being output to stdout
*/
class MidiByteArray : public std::vector<MIDI::byte>
{
public:
MidiByteArray() : std::vector<MIDI::byte>() {}
MidiByteArray( size_t count, MIDI::byte array[] );
bool compare_n (const MidiByteArray& other, MidiByteArray::size_type len) const;
/**
Accepts a preceding count, and then a list of bytes
*/
MidiByteArray( size_t count, MIDI::byte first, ... );
/// copy the given number of bytes from the given array
void copy( size_t count, MIDI::byte arr[] );
};
/// append the given byte to the end of the array
MidiByteArray & operator << ( MidiByteArray & mba, const MIDI::byte & b );
/// append the given string to the end of the array
MidiByteArray & operator << ( MidiByteArray & mba, const std::string & );
/// append the given array to the end of this array
MidiByteArray & operator << ( MidiByteArray & mba, const MidiByteArray & barr );
/// output the bytes as hex to the given stream
std::ostream & operator << ( std::ostream & os, const MidiByteArray & mba );
#endif

View file

@ -0,0 +1,134 @@
/*
* Copyright (C) 2022 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define ABSTRACT_UI_EXPORTS
#include "pbd/abstract_ui.h"
#include "control_protocol/control_protocol.h"
#include "midi++/types.h"
#include "midi_byte_array.h"
namespace MIDI {
class Parser;
class Port;
}
namespace ARDOUR {
class Bundle;
class Port;
class MidiBuffer;
}
struct MidiSurfaceRequest : public BaseUI::BaseRequestObject {
public:
MidiSurfaceRequest () {}
~MidiSurfaceRequest () {}
};
class MIDISurface : public ARDOUR::ControlProtocol
, public AbstractUI<MidiSurfaceRequest>
{
public:
MIDISurface (ARDOUR::Session&, std::string const & name, std::string const & port_name_prefix, bool use_pad_filter);
~MIDISurface ();
static void* request_factory (uint32_t num_requests);
boost::shared_ptr<ARDOUR::Port> input_port();
boost::shared_ptr<ARDOUR::Port> output_port();
// Bundle to represent our input ports
boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
// Bundle to represent our output ports
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
ARDOUR::Session & get_session() { return *session; }
virtual std::string input_port_name () const = 0;
virtual std::string output_port_name () const = 0;
void write (const MidiByteArray&);
void write (MIDI::byte const *, size_t);
XMLNode& get_state() const;
int set_state (const XMLNode & node, int version);
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
PBD::Signal0<void> ConnectionChange;
CONTROL_PROTOCOL_THREADS_NEED_TEMPO_MAP_DECL();
protected:
bool with_pad_filter;
bool _in_use;
std::string port_name_prefix;
MIDI::Port* _input_port;
MIDI::Port* _output_port;
boost::shared_ptr<ARDOUR::Port> _async_in;
boost::shared_ptr<ARDOUR::Port> _async_out;
void do_request (MidiSurfaceRequest*);
virtual void connect_to_parser ();
virtual void handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t) {}
virtual void handle_midi_polypressure_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_note_on_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_note_off_message (MIDI::Parser&, MIDI::EventTwoBytes*) {}
virtual void handle_midi_sysex (MIDI::Parser&, MIDI::byte *, size_t) {}
virtual bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
virtual void thread_init ();
PBD::ScopedConnectionList session_connections;
virtual void connect_session_signals ();
virtual void notify_record_state_changed () {}
virtual void notify_transport_state_changed () {}
virtual void notify_loop_state_changed () {}
virtual void notify_parameter_changed (std::string) {}
virtual void notify_solo_active_changed (bool) {}
virtual void port_registration_handler ();
virtual bool pad_filter (ARDOUR::MidiBuffer& in, ARDOUR::MidiBuffer& out) const { return false; }
enum ConnectionState {
InputConnected = 0x1,
OutputConnected = 0x2
};
int _connection_state;
virtual bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
PBD::ScopedConnectionList port_connections;
virtual int ports_acquire ();
virtual void ports_release ();
virtual int begin_using_device ();
virtual int stop_using_device ();
virtual int device_acquire () = 0;
virtual void device_release () = 0;
void drop ();
void port_setup ();
};

View file

@ -0,0 +1,33 @@
#!/usr/bin/env python
from waflib.extras import autowaf as autowaf
import os
# Mandatory variables
top = '.'
out = 'build'
def options(opt):
autowaf.set_options(opt)
def configure(conf):
pass
def build(bld):
obj = bld(features = 'cxx cxxshlib')
obj.source = '''
midi_surface.cc
midi_byte_array.cc
'''
obj.export_includes = ['.', './midi_surface']
obj.defines = [ 'PACKAGE="ardour_midisurface"' ]
obj.defines += [ 'ARDOURSURFACE_DLL_EXPORTS' ]
obj.defines += [ 'VERSIONSTRING="' + bld.env['VERSION'] + '"' ]
obj.includes = ['.', './midi_surface']
obj.name = 'libardour_midisurface'
obj.target = 'ardour_midisurface'
obj.uselib = 'GLIB GLIBMM SIGCPP XML OSX'
obj.use = 'libardour libardour_cp libpbd libevoral libmidipp libtemporal'
obj.install_path = bld.env['LIBDIR']
def shutdown():
autowaf.shutdown()