1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 07:40:23 +02:00

Get module sources ready for building on linux

This commit is contained in:
James Crook 2018-04-06 10:00:59 +01:00
parent 0885fda459
commit 30d438958c
2 changed files with 45 additions and 14 deletions

View File

@ -84,29 +84,44 @@ and replace the main project window with our own wxFrame.
*/
class ModNullCallback
#ifdef _MSC_VER
#define DLL_API _declspec(dllexport)
#define DLL_IMPORT _declspec(dllimport)
#else
#define DLL_API __attribute__ ((visibility("default")))
#define DLL_IMPORT
#endif
// derived from wxFrame as it needs to be some kind of event handler.
class ModNullCallback : public wxFrame
{
public:
// Name these OnFuncXXX functions by whatever they will do.
void OnFuncFirst();
void OnFuncSecond();
void OnFuncFirst(const CommandContext &);
void OnFuncSecond(const CommandContext &);
};
void ModNullCallback::OnFuncFirst()
void ModNullCallback::OnFuncFirst(const CommandContext &)
{
int k=32;
}
void ModNullCallback::OnFuncSecond()
void ModNullCallback::OnFuncSecond(const CommandContext &)
{
int k=42;
}
ModNullCallback * pModNullCallback=NULL;
#define ModNullFN(X) FNT(ModNullCallback, pModNullCallback, &ModNullCallback:: X)
#define ModNullFN(X) ident, static_cast<CommandFunctorPointer>(&ModNullCallback:: X)
extern "C" {
static CommandHandlerObject &ident(AudacityProject&project)
{
// no specific command handler object ... use the project.
return project;
}
// GetVersionString
// REQUIRED for the module to be accepted by Audacity.
// Without it Audacity will see a version number mismatch.
@ -138,15 +153,22 @@ int ModuleDispatch(ModuleDispatchTypes type)
return 0;
wxMenuBar * pBar = p->GetMenuBar();
wxMenu * pMenu = pBar->GetMenu( 7 ); // Menu 7 is the Analyze Menu.
wxMenu * pMenu = pBar->GetMenu( 8 ); // Menu 8 is the Analyze Menu.
CommandManager * c = p->GetCommandManager();
c->SetCurrentMenu( pMenu );
c->AddSeparator();
c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag);
// We add two new commands into the Analyze menu.
c->AddItem( _T("A New Command..."), _T("1st Experimental Command"),
c->AddItem(
_T("A New Command"), // internal name
_T("1st Experimental Command"), //displayed name
true, // has dialog
ModNullFN( OnFuncFirst ) );
c->AddItem( _T("Another New Command..."), _T("2nd Experimental Command"),
c->AddItem(
_T("Another New Command"),
_T("2nd Experimental Command"),
false, // no dialog
ModNullFN( OnFuncSecond ) );
c->ClearCurrentMenu();
}
@ -161,7 +183,7 @@ int ModuleDispatch(ModuleDispatchTypes type)
//Example code commented out.
#if 0
// This is an example function to hijack the main panel
int MOD_NULL_DLL_API MainPanelFunc(int ix)
int DLL_API MainPanelFunc(int ix)
{
ix=ix;//compiler food
// If we wanted to hide Audacity's Project,

View File

@ -40,6 +40,15 @@ and replace the main project window with our own wxFrame.
*/
#ifdef _MSC_VER
#define DLL_API _declspec(dllexport)
#define DLL_IMPORT _declspec(dllimport)
#else
#define DLL_API __attribute__ ((visibility("default")))
#define DLL_IMPORT
#endif
// HACK!
// This must match the enum in LoadModules.h
// We do NOT include LoadModules.h, because we want
@ -59,14 +68,14 @@ typedef enum
extern void PipeServer();
typedef SCRIPT_PIPE_DLL_IMPORT int (*tpExecScriptServerFunc)( wxString * pIn, wxString * pOut);
typedef DLL_IMPORT int (*tpExecScriptServerFunc)( wxString * pIn, wxString * pOut);
static tpExecScriptServerFunc pScriptServerFn=NULL;
extern "C" {
SCRIPT_PIPE_DLL_API wxChar * GetVersionString()
DLL_API wxChar * GetVersionString()
{
// Make sure that this version of the module requires the version
// of Audacity it is built with.
@ -75,7 +84,7 @@ SCRIPT_PIPE_DLL_API wxChar * GetVersionString()
return AUDACITY_VERSION_STRING;
}
extern int SCRIPT_PIPE_DLL_API ModuleDispatch(ModuleDispatchTypes type);
extern int DLL_API ModuleDispatch(ModuleDispatchTypes type);
// ModuleDispatch
// is called by Audacity to initialize/terminmate the module,
// and ask if it has anything for the menus.
@ -100,7 +109,7 @@ int ModuleDispatch(ModuleDispatchTypes type){
}
// And here is our special registration function.
int SCRIPT_PIPE_DLL_API RegScriptServerFunc( tpExecScriptServerFunc pFn )
int DLL_API RegScriptServerFunc( tpExecScriptServerFunc pFn )
{
if( pFn )
{