Skip to content

Commit

Permalink
nyquist support in a module; application need not link libnyquist
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Licameli committed Apr 11, 2024
1 parent a74de13 commit 0ae04be
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 47 deletions.
1 change: 1 addition & 0 deletions libraries/lib-module-manager/ModuleSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static const std::unordered_set<wxString> &autoEnabledModules()
"mod-vst",
"mod-vst3",
"mod-effect-classes",
"mod-nyquist",
};
return modules;
}
Expand Down
1 change: 1 addition & 0 deletions modules/nyquist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# The list of modules is ordered so that each module occurs after any others
# that it depends on
set( MODULES
mod-nyquist
)

if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
Expand Down
2 changes: 1 addition & 1 deletion modules/nyquist/mod-nyq-bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set( DEFINES
)
set( LIBRARIES
PRIVATE
Audacity
mod-nyquist-interface
)
audacity_module( ${TARGET} "${SOURCES}" "${LIBRARIES}"
"${DEFINES}" "" )
Expand Down
2 changes: 1 addition & 1 deletion modules/nyquist/mod-nyq-bench/NyqBench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "ShuttleGui.h"
#include "effects/EffectManager.h"
#include "effects/EffectUI.h"
#include "effects/nyquist/Nyquist.h"
#include "Nyquist.h"
#include "../images/AudacityLogo.xpm"
#include "CommandContext.h"
#include "AudacityMessageBox.h"
Expand Down
2 changes: 1 addition & 1 deletion modules/nyquist/mod-nyq-bench/NyqBench.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <sstream>

#include "CommandManager.h"
#include "effects/nyquist/Nyquist.h"
#include "Nyquist.h"

class wxFileName;

Expand Down
21 changes: 21 additions & 0 deletions modules/nyquist/mod-nyquist/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#[[
Interface to the Nyquist library, which can implement effects, generators,
analyzers, and tools invoking macro commands
]]

set( SOURCES
LoadNyquist.cpp
LoadNyquist.h
Nyquist.cpp
Nyquist.h
)
set( LIBRARIES
Audacity
libnyquist
)

# Third party libraries used only by this module
set(EXTRA_CLUSTER_NODES "${LIBRARIES}" PARENT_SCOPE)

audacity_module( mod-nyquist "${SOURCES}" "${LIBRARIES}"
"" "" )
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
**********************************************************************/



#include "LoadNyquist.h"

#include <wx/log.h>
Expand Down Expand Up @@ -271,3 +269,6 @@ bool NyquistEffectsModule::CheckPluginExist(const PluginPath& path) const
// ============================================================================
// NyquistEffectsModule implementation
// ============================================================================

#include "ModuleConstants.h"
DEFINE_MODULE_ENTRIES
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ effects from this one class.
*//*******************************************************************/


#include "Nyquist.h"
#include "EffectOutputTracks.h"

Expand All @@ -51,17 +50,17 @@ effects from this one class.
#include <wx/numformatter.h>
#include <wx/stdpaths.h>

#include "../../LabelTrack.h"
#include "LabelTrack.h"
#include "NoteTrack.h"
#include "../../ShuttleGetDefinition.h"
#include "../../prefs/GUIPrefs.h"
#include "../../prefs/SpectrogramSettings.h"
#include "../../tracks/playabletrack/wavetrack/ui/WaveChannelView.h"
#include "../../tracks/playabletrack/wavetrack/ui/WaveChannelViewConstants.h"
#include "../../widgets/NumericTextCtrl.h"
#include "../../widgets/valnum.h"
#include "../EffectEditor.h"
#include "../EffectManager.h"
#include "ShuttleGetDefinition.h"
#include "prefs/GUIPrefs.h"
#include "prefs/SpectrogramSettings.h"
#include "tracks/playabletrack/wavetrack/ui/WaveChannelView.h"
#include "tracks/playabletrack/wavetrack/ui/WaveChannelViewConstants.h"
#include "widgets/NumericTextCtrl.h"
#include "widgets/valnum.h"
#include "effects/EffectEditor.h"
#include "effects/EffectManager.h"
#include "AudacityMessageBox.h"
#include "BasicUI.h"
#include "FileNames.h"
Expand Down Expand Up @@ -3500,7 +3499,7 @@ void NyquistOutputDialog::OnOk(wxCommandEvent & /* event */)
}

// Registration of extra functions in XLisp.
#include "../../../lib-src/libnyquist/nyquist/xlisp/xlisp.h"
#include "nyquist/xlisp/xlisp.h"

static LVAL gettext()
{
Expand Down Expand Up @@ -3583,8 +3582,18 @@ void * nyq_reformat_aud_do_response(const wxString & Str) {
return (void *)dst;
}

#include "../../commands/ScriptCommandRelay.h"
#include "commands/ScriptCommandRelay.h"


static void * ExecForLisp( char * pIn )
{
wxString Str1(pIn);
wxString Str2;

ExecFromMain(&Str1, &Str2);

return nyq_reformat_aud_do_response(Str2);
}

/* xlc_aud_do -- interface to C routine aud_do */
/**/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef __AUDACITY_EFFECT_NYQUIST__
#define __AUDACITY_EFFECT_NYQUIST__

#include "../StatefulEffect.h"
#include "effects/StatefulEffect.h"
#include "FileNames.h"
#include "SampleCount.h"
#include "wxPanelWrapper.h"
Expand Down Expand Up @@ -73,7 +73,7 @@ struct NyquistSettings {
// Other fields, to do
};

class AUDACITY_DLL_API NyquistEffect final
class NyquistEffect final
: public EffectWithSettings<NyquistSettings, StatefulEffect>
{
public:
Expand Down
10 changes: 0 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,6 @@ list( APPEND SOURCES
effects/TwoPassSimpleMono.cpp
effects/TwoPassSimpleMono.h

# Nyquist Effects

$<$<BOOL:${USE_NYQUIST}>:
effects/nyquist/LoadNyquist.cpp
effects/nyquist/LoadNyquist.h
effects/nyquist/Nyquist.cpp
effects/nyquist/Nyquist.h
>

# Export

export/ExportAudioDialog.cpp
Expand Down Expand Up @@ -820,7 +811,6 @@ set( LIBRARIES
PUBLIC
${CMAKE_REQUIRED_LIBRARIES}
ZLIB::ZLIB
$<$<BOOL:${USE_NYQUIST}>:libnyquist>
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD,NetBSD,CYGWIN>:PkgConfig::GLIB>
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD,NetBSD,CYGWIN>:PkgConfig::GTK>
$<$<TARGET_EXISTS:Threads::Threads>:Threads::Threads>
Expand Down
14 changes: 1 addition & 13 deletions src/commands/ScriptCommandRelay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static int ExecFromWorker(wxString *pIn, wxString *pOut)
}

/// Executes a command on the main (GUI) thread.
static int ExecFromMain(wxString *pIn, wxString *pOut)
int ExecFromMain(wxString *pIn, wxString *pOut)
{
return ExecCommand(pIn, pOut, true);
}
Expand All @@ -90,15 +90,3 @@ void ScriptCommandRelay::StartScriptServer(tpRegScriptServerFunc scriptFn)

std::thread(server, scriptFn).detach();
}

#if USE_NYQUIST
void * ExecForLisp( char * pIn )
{
wxString Str1(pIn);
wxString Str2;

ExecFromMain(&Str1, &Str2);

return nyq_reformat_aud_do_response(Str2);
}
#endif
5 changes: 1 addition & 4 deletions src/commands/ScriptCommandRelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ class AUDACITY_DLL_API ScriptCommandRelay
static void StartScriptServer(tpRegScriptServerFunc scriptFn);
};

// The void * return is actually a Lisp LVAL and will be cast to such as needed.
extern void * ExecForLisp( char * pIn );
extern void * nyq_make_opaque_string( int size, unsigned char *src );
extern void * nyq_reformat_aud_do_response(const wxString & Str);
AUDACITY_DLL_API int ExecFromMain(wxString *pIn, wxString *pOut);

#endif /* End of include guard: __SCRIPT_COMMAND_RELAY__ */

0 comments on commit 0ae04be

Please sign in to comment.