mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Added mod-null, mod-nyq-bench, mod-track-panel. Updated mod-script-pipe to use wchar_t* for version number.
This commit is contained in:
170
lib-src/mod-track-panel/ModTrackPanelCallback.cpp
Normal file
170
lib-src/mod-track-panel/ModTrackPanelCallback.cpp
Normal file
@@ -0,0 +1,170 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
ModTrackPanelCallback.cpp
|
||||
|
||||
James Crook
|
||||
|
||||
Audacity is free software.
|
||||
This file is licensed under the wxWidgets license, see License.txt
|
||||
|
||||
********************************************************************//**
|
||||
|
||||
\class ModTrackPanelCallback
|
||||
\brief ModTrackPanelCallback is a class containing all the callback
|
||||
functions for the second generation ModTrackPanel. These functions are
|
||||
added into the standard Audacity Project Menus.
|
||||
|
||||
*//*****************************************************************//**
|
||||
|
||||
\class ModTrackPanelCommandFunctor
|
||||
\brief We create one of these functors for each menu item or
|
||||
command which we register with the Command Manager. These take the
|
||||
click from the menu into the actaul function to be called.
|
||||
|
||||
*//********************************************************************/
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "ModTrackPanelCallback.h"
|
||||
#include "../../src/Audacity.h"
|
||||
#include "../../src/ShuttleGui.h"
|
||||
#include "../../src/Project.h"
|
||||
#include "../../src/LoadModules.h"
|
||||
|
||||
/*
|
||||
There are several functions that can be used in a GUI module.
|
||||
|
||||
//#define versionFnName "GetVersionString"
|
||||
If the version is wrong, the module will be rejected.
|
||||
That is it will be loaded and then unloaded.
|
||||
|
||||
//#define ModuleDispatchName "ModuleDispatch"
|
||||
The most useful function. See the example in this
|
||||
file. It has several cases/options in it.
|
||||
|
||||
//#define scriptFnName "RegScriptServerFunc"
|
||||
This function is run from a non gui thread. It was originally
|
||||
created for the benefit of mod-script-pipe.
|
||||
|
||||
//#define mainPanelFnName "MainPanelFunc"
|
||||
This function is the hijacking function, to take over Audacity
|
||||
and replace the main project window with our own wxFrame.
|
||||
|
||||
*/
|
||||
|
||||
class ModTrackPanelCallback
|
||||
{
|
||||
public:
|
||||
void OnFuncShow();
|
||||
void OnFuncHide();
|
||||
};
|
||||
|
||||
typedef void (ModTrackPanelCallback::*ModTrackPanelCommandFunction)();
|
||||
|
||||
class ModTrackPanelCommandFunctor:public CommandFunctor
|
||||
{
|
||||
public:
|
||||
ModTrackPanelCommandFunctor(ModTrackPanelCallback *pData,
|
||||
ModTrackPanelCommandFunction pFunction);
|
||||
virtual void operator()(int index = 0);
|
||||
public:
|
||||
ModTrackPanelCallback * mpData;
|
||||
ModTrackPanelCommandFunction mpFunction;
|
||||
};
|
||||
|
||||
ModTrackPanelCommandFunctor::ModTrackPanelCommandFunctor(ModTrackPanelCallback *pData,
|
||||
ModTrackPanelCommandFunction pFunction)
|
||||
{
|
||||
mpData = pData;
|
||||
mpFunction = pFunction;
|
||||
}
|
||||
|
||||
// The dispatching function.
|
||||
void ModTrackPanelCommandFunctor::operator()(int index )
|
||||
{
|
||||
(mpData->*(mpFunction))();
|
||||
}
|
||||
|
||||
#define ModTrackPanelFN(X) new ModTrackPanelCommandFunctor(pModTrackPanelCallback, \
|
||||
(ModTrackPanelCommandFunction)(&ModTrackPanelCallback::X))
|
||||
|
||||
|
||||
void ModTrackPanelCallback::OnFuncShow()
|
||||
{
|
||||
int k=3;
|
||||
}
|
||||
|
||||
void ModTrackPanelCallback::OnFuncHide()
|
||||
{
|
||||
int k=4;
|
||||
}
|
||||
|
||||
ModTrackPanelCallback * pModTrackPanelCallback=NULL;
|
||||
|
||||
extern "C" {
|
||||
// GetVersionString
|
||||
// REQUIRED for the module to be accepted by Audacity.
|
||||
// Without it Audacity will see a version number mismatch.
|
||||
MOD_TRACK_PANEL_DLL_API wchar_t * GetVersionString()
|
||||
{
|
||||
// Make sure that this version of the module requires the version
|
||||
// of Audacity it is built with.
|
||||
// For now, the versions must match exactly for Audacity to
|
||||
// agree to load the module.
|
||||
return AUDACITY_VERSION_STRING;
|
||||
}
|
||||
|
||||
// This is the function that connects us to Audacity.
|
||||
int MOD_TRACK_PANEL_DLL_API ModuleDispatch(ModuleDispatchTypes type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AppInitialized:
|
||||
break;
|
||||
case AppQuiting:
|
||||
break;
|
||||
case ProjectInitialized:
|
||||
case MenusRebuilt:
|
||||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
if( p== NULL )
|
||||
return 0;
|
||||
|
||||
wxMenuBar * pBar = p->GetMenuBar();
|
||||
wxMenu * pMenu = pBar->GetMenu( 7 ); // Menu 7 is the Analyze Menu.
|
||||
CommandManager * c = p->GetCommandManager();
|
||||
|
||||
c->SetToMenu( pMenu );
|
||||
c->AddSeparator();
|
||||
// We add two new commands into the Analyze menu.
|
||||
c->AddItem( _T("Audio Explorer..."), _T("Experimental GUI for audio analysis"),
|
||||
ModTrackPanelFN( OnFuncShow ) );
|
||||
c->AddItem( _T("Another Extension..."), _T("Experimental GUI for other things"),
|
||||
ModTrackPanelFN( OnFuncHide ) );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Example code commented out.
|
||||
#if 0
|
||||
// This is an example function to hijack the main panel
|
||||
int MOD_TRACK_PANEL_DLL_API MainPanelFunc(int ix)
|
||||
{
|
||||
ix=ix;//compiler food
|
||||
// If we wanted to hide Audacity's Project,
|
||||
// we'd create a new wxFrame right here and return a pointer to it
|
||||
// as our return result.
|
||||
|
||||
// Don't hijack the main panel, just return a NULL;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
} // End extern "C"
|
38
lib-src/mod-track-panel/ModTrackPanelCallback.h
Normal file
38
lib-src/mod-track-panel/ModTrackPanelCallback.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// The following ifdef block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the LIBSCRIPT_EXPORTS
|
||||
// symbol defined on the command line. this symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// MOD_TRACK_PANEL_DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
|
||||
|
||||
/* Magic for dynamic library import and export. This is unfortunately
|
||||
* compiler-specific because there isn't a standard way to do it. Currently it
|
||||
* works with the Visual Studio compiler for windows, and for GCC 4+. Anything
|
||||
* else gets all symbols made public, which gets messy */
|
||||
/* The Visual Studio implementation */
|
||||
#ifdef _MSC_VER
|
||||
#define MOD_TRACK_PANEL_DLL_IMPORT _declspec(dllimport)
|
||||
#ifdef BUILDING_MOD_TRACK_PANEL
|
||||
#define MOD_TRACK_PANEL_DLL_API _declspec(dllexport)
|
||||
#elif _DLL
|
||||
#define MOD_TRACK_PANEL_DLL_API _declspec(dllimport)
|
||||
#else
|
||||
#define AUDACITY_DLL_API
|
||||
#endif
|
||||
#endif //_MSC_VER
|
||||
|
||||
/* The GCC implementation */
|
||||
#ifdef CC_HASVISIBILITY // this is provided by the configure script, is only
|
||||
// enabled for suitable GCC versions
|
||||
/* The incantation is a bit weird here because it uses ELF symbol stuff. If we
|
||||
* make a symbol "default" it makes it visible (for import or export). Making it
|
||||
* "hidden" means it is invisible outside the shared object. */
|
||||
#define MOD_TRACK_PANEL_DLL_IMPORT __attribute__((visibility("default")))
|
||||
#ifdef BUILDING_MOD_TRACK_PANEL
|
||||
#define MOD_TRACK_PANEL_DLL_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define MOD_TRACK_PANEL_DLL_API __attribute__((visibility("default")))
|
||||
#endif
|
||||
#endif
|
||||
|
23
lib-src/mod-track-panel/Registrar.cpp
Normal file
23
lib-src/mod-track-panel/Registrar.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
Registrar.cpp
|
||||
|
||||
James Crook
|
||||
|
||||
Audacity is free software.
|
||||
This file is licensed under the wxWidgets license, see License.txt
|
||||
|
||||
********************************************************************//**
|
||||
|
||||
\class Registrar
|
||||
\brief Registrar is a class that other classes register resources of
|
||||
various kinds with. It makes a system that is much more amenable to
|
||||
plugging in of new resources.
|
||||
|
||||
*//********************************************************************/
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "Registrar.h"
|
||||
|
20
lib-src/mod-track-panel/Registrar.h
Normal file
20
lib-src/mod-track-panel/Registrar.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
Registrar.h
|
||||
|
||||
James Crook
|
||||
|
||||
Manages centralised registration of resources.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_REGISTRAR__
|
||||
#define __AUDACITY_REGISTRAR__
|
||||
|
||||
class Registrar {
|
||||
public:
|
||||
|
||||
};
|
||||
#endif
|
202
lib-src/mod-track-panel/mod-track-panel.vcproj
Normal file
202
lib-src/mod-track-panel/mod-track-panel.vcproj
Normal file
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mod-track-panel"
|
||||
ProjectGUID="{1D40165D-E385-4EAB-A755-CF5EA645F4FA}"
|
||||
RootNamespace="modtrackpanel2"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Unicode Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(WXWIN)\lib\vc_dll\mswud";"$(WXWIN)\include";"$(SolutionDir)";..\..\..;..\..\..\..\src\include\win32;..\..\..\..\src\include;..\FileDialog;..\expat;"..\lib-widget-extra";..\libflac\include;..\libid3tag;..\liblrdf;..\libmad;..\libnyquist;..\libogg\include;..\libresample\include;..\libsamplerate\src;..\libscorealign;..\libsndfile;..\libvamp;..\libvorbis\include;"..\portaudio-v19\include";..\portmixer\include;..\portsmf;..\redland\raptor\src;..\slv2;..\sbsms\include;..\soundtouch\include;..\twolame\libtwolame;..\portmidi\pm_common;..\portmidi\pm_win;..\portmidi\porttime;..\ffmpeg\win32;..\ffmpeg"
|
||||
PreprocessorDefinitions="BUILDING_MOD_TRACK_PANEL;WXUSINGDLL;__WXMSW__;__WXDEBUG__;WIN32;_DEBUG;_USRDLL"
|
||||
StringPooling="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wxmsw28ud_core.lib wxbase28ud.lib odbc32.lib odbccp32.lib oldnames.lib comctl32.lib rpcrt4.lib wsock32.lib netapi32.lib Audacity.lib"
|
||||
OutputFile="$(OutDir)\modules\$(ProjectName).dll"
|
||||
AdditionalLibraryDirectories=""$(WXWIN)\lib\vc_dll";"$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Unicode Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories=""$(WXWIN)\lib\vc_dll\mswu";"$(WXWIN)\include";"$(SolutionDir)";..\..\..;..\..\..\..\src\include\win32;..\..\..\..\src\include;..\FileDialog;..\expat;"..\lib-widget-extra";..\libflac\include;..\libid3tag;..\liblrdf;..\libmad;..\libnyquist;..\libogg\include;..\libresample\include;..\libsamplerate\src;..\libscorealign;..\libsndfile;..\libvamp;..\libvorbis\include;"..\portaudio-v19\include";..\portmixer\include;..\portsmf;..\redland\raptor\src;..\slv2;..\sbsms\include;..\soundtouch\include;..\twolame\libtwolame;..\portmidi\pm_common;..\portmidi\pm_win;..\portmidi\porttime;..\ffmpeg\win32;..\ffmpeg"
|
||||
PreprocessorDefinitions="BUILDING_MOD_TRACK_PANEL;WXUSINGDLL;__WXMSW__;NDEBUG;_WINDOWS;WIN32;_USRDLL"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wxmsw28u_core.lib wxbase28u.lib odbc32.lib odbccp32.lib oldnames.lib comctl32.lib rpcrt4.lib wsock32.lib netapi32.lib Audacity.lib"
|
||||
OutputFile="$(OutDir)\modules\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(WXWIN)\lib\vc_dll";"$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</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=".\ModTrackPanelCallback.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ModTrackPanelCallback.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Registrar.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Registrar.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
Reference in New Issue
Block a user