Skip to content

Commit

Permalink
Initial Idea
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Jun 19, 2022
0 parents commit e9eb3ee
Show file tree
Hide file tree
Showing 13 changed files with 431 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Visual Studio
obj/
*.sln
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
.vs/
packages/
target/
*.pdb
packages.config
CMakeSettings.json
.vscode
.cache


# IntelliJ IDEA
.idea

# CMake common patterns
build/
cmake-build-*/


# A place to store stuff and get it git ignored
ignore/*
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "libs/clap"]
path = libs/clap
url = https://github.com/free-audio/clap
[submodule "libs/clap-helpers"]
path = libs/clap-helpers
url = https://github.com/free-audio/clap-helpers
[submodule "libs/airwindows"]
path = libs/airwindows
url = https://github.com/airwindows/airwindows
160 changes: 160 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
cmake_minimum_required(VERSION 3.15)

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "Build for 10.1")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE Type Unspecified; picking Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()

project(claudio-effect-x VERSION 0.9.0 LANGUAGES C CXX)


set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)


# use asan as an option (currently mac only)
option(USE_SANITIZER "Build and link with ASAN" FALSE)

# Copy on mac (could expand to other platforms)
option(COPY_AFTER_BUILD "Copy the clap to ~/Library on MACOS, ~/.clap on linux" FALSE)

add_subdirectory(libs/clap EXCLUDE_FROM_ALL)
add_subdirectory(libs/clap-helpers EXCLUDE_FROM_ALL)

if(NOT EXISTS "${CMAKE_BINARY_DIR}/individuals")
message(STATUS "Creating individuals directory")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/individuals")
endif()

add_library(${PROJECT_NAME} MODULE
src/claudio.cpp
src/claudio_configured.cpp
)
target_include_directories(${PROJECT_NAME} PRIVATE include ${CMAKE_BINARY_DIR}/individuals)
target_link_libraries(${PROJECT_NAME} clap-core clap-helpers)
set_property(TARGET ${PROJECT_NAME} PROPERTY AIRWIN_INCLUDES "")
set_property(TARGET ${PROJECT_NAME} PROPERTY AIRWIN_COUNT 0)

function (addAirwin airwin)
set(awt claudio_${airwin})
set(aw_src libs/airwindows/plugins/MacVST/${airwin}/source)
add_library(${awt} STATIC ${aw_src}/${airwin}.cpp ${aw_src}/${airwin}Proc.cpp)
target_include_directories(${awt} PRIVATE include)
if (APPLE)
target_compile_options(${PROJECT_NAME} PRIVATE
-Werror -Wno-unused-value
)
endif()

set(CREATE_FN "${awt}CreateEffectInstance")
set(AIRWIN_NAME "${airwin}")
configure_file(src/individual_claudio.in.h individuals/${awt}.h)
configure_file(src/individual_claudio.in.cpp individuals/${awt}.cpp)

target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/individuals/${awt}.cpp)

target_compile_definitions(${awt} PRIVATE -DcreateEffectInstance=${CREATE_FN})
target_link_libraries(${PROJECT_NAME} ${awt})

get_target_property(AW ${PROJECT_NAME} AIRWIN_INCLUDES)
list(APPEND AW ${airwin})
set_property(TARGET ${PROJECT_NAME} PROPERTY AIRWIN_INCLUDES ${AW})

get_target_property(AWC ${PROJECT_NAME} AIRWIN_COUNT)
math(EXPR AWC "${AWC} + 1")
set_property(TARGET ${PROJECT_NAME} PROPERTY AIRWIN_COUNT ${AWC})
endfunction()

addAirwin(Chamber)
addAirwin(Galactic)
addAirwin(ZLowpass)
addAirwin(DeBess)


get_target_property(AWC ${PROJECT_NAME} AIRWIN_COUNT)
message(STATUS "Generating ${AWC} plugins" )

set(sumfn "${CMAKE_BINARY_DIR}/individuals/claudio_configured.hxx")
file(WRITE ${sumfn} "// machine generated. Include once\n")

get_target_property(AW ${PROJECT_NAME} AIRWIN_INCLUDES)
foreach(awt ${AW})
message(STATUS "Airwindow: ${awt}")
file(APPEND ${sumfn} "#include \"claudio_${awt}.h\"\n")
endforeach()

file(APPEND ${sumfn} "uint32_t claudio_get_plugin_count(const clap_plugin_factory *f) { return ${AWC}; }\n")
file(APPEND ${sumfn} "const clap_plugin_descriptor *claudio_get_plugin_descriptor(const clap_plugin_factory *f, uint32_t w)\n")
file(APPEND ${sumfn} "{ switch(w) {\n")
set(CASEW 0)
foreach(awt ${AW})

file(APPEND ${sumfn} "case ${CASEW}:\n")
file(APPEND ${sumfn} " return &claudio_${awt}_desc;\n")
file(APPEND ${sumfn} " break;\n")
math(EXPR CASEW "${CASEW} + 1")
endforeach()
file(APPEND ${sumfn} "} return nullptr; } \n")

file(APPEND ${sumfn} "AudioEffect *claudio_get_aeffInstance(audioMasterCallback c, const char* plugin_id)\n")
file(APPEND ${sumfn} "{")
set(CASEW 0)
foreach(awt ${AW})

file(APPEND ${sumfn} "if (strcmp(plugin_id, \"unofficial.com.airwindows.${awt}\") == 0) return claudio_${awt}CreateEffectInstance(c);\n")
endforeach()
file(APPEND ${sumfn} "return nullptr; } \n")


if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
BUNDLE True
BUNDLE_EXTENSION clap
MACOSX_BUNDLE_GUI_IDENTIFIER org.surge-synth-team.${PROJECT_NAME}
MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
MACOSX_BUNDLE_BUNDLE_VERSION "0.1"
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}.plist.in
)

target_compile_definitions(${PROJECT_NAME} PRIVATE IS_MAC=1)
target_compile_options(${PROJECT_NAME} PRIVATE
-Werror -Wno-unused-value
$<$<BOOL:${USE_SANITIZER}>:-fsanitize=address>
$<$<BOOL:${USE_SANITIZER}>:-fsanitize=undefined>
)
target_link_options(${PROJECT_NAME} PRIVATE
$<$<BOOL:${USE_SANITIZER}>:-fsanitize=address>
$<$<BOOL:${USE_SANITIZER}>:-fsanitize=undefined>
)

if (${COPY_AFTER_BUILD})
message(STATUS "Will copy plugin after every build" )
set(products_folder ${CMAKE_BINARY_DIR})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Installing ${products_folder}/${PROJECT_NAME}.clap to ~/Library/Audio/Plug-Ins/CLAP/"
COMMAND ${CMAKE_COMMAND} -E make_directory "~/Library/Audio/Plug-Ins/CLAP"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${products_folder}/${PROJECT_NAME}.clap" "~/Library/Audio/Plug-Ins/CLAP/${PROJECT_NAME}.clap"
)
endif()
elseif(UNIX)
target_compile_definitions(${PROJECT_NAME} PRIVATE IS_LINUX=1)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".clap" PREFIX "")
if (${COPY_AFTER_BUILD})
message(STATUS "Will copy plugin after every build" )
set(products_folder ${CMAKE_BINARY_DIR})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Installing ${products_folder}/${PROJECT_NAME}.clap to ~/.clap"
COMMAND ${CMAKE_COMMAND} -E make_directory "~/.clap"
COMMAND ${CMAKE_COMMAND} -E copy "${products_folder}/${PROJECT_NAME}.clap" "~/.clap"
)
endif()

else()
target_compile_definitions(${PROJECT_NAME} PRIVATE IS_WIN=1)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".clap" PREFIX "")
endif()
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright 2022, Paul Walker and others as listed in the git history

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


34 changes: 34 additions & 0 deletions cmake/claudio-effect-x.plist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
</dict>
</plist>
64 changes: 64 additions & 0 deletions include/audioeffectx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// Created by Paul Walker on 6/18/22.
//

#ifndef CLAUDIO_EFFECT_X_AUDIOEFFECTX_H
#define CLAUDIO_EFFECT_X_AUDIOEFFECTX_H

#include <cstdint>
#include <cstring>

struct clap_host;
typedef const clap_host * audioMasterCallback;
typedef int VstPlugCategory;
typedef int32_t VstInt32;
#define vst_strncpy strncpy

static constexpr uint32_t kVstMaxProgNameLen = 32;
static constexpr uint32_t kVstMaxParamStrLen = 64;
static constexpr uint32_t kVstMaxProductStrLen = 64;
static constexpr uint32_t kVstMaxVendorStrLen = 64;

static constexpr uint32_t kPlugCategEffect = 1;

inline void float2string(float, const char*, uint32_t) {}

struct AudioEffect
{
virtual ~AudioEffect() = default;


double getSampleRate() { return 48000.0; }

void setNumInputs(uint32_t kNumInputs) {}
void setNumOutputs(uint32_t kNumOutputs) {}
void setUniqueID(uint32_t kUniqueId) {}

bool canProcessReplacing() { return false; }
bool canDoubleReplacing() { return false; }

void programsAreChunks(bool b) {}

virtual bool getEffectName(char* name) = 0; // The plug-in name
virtual VstPlugCategory getPlugCategory() = 0; // The general category for the plug-in
virtual bool getProductString(char* text) = 0; // This is a unique plug-in string provided by Steinberg
virtual bool getVendorString(char* text) = 0 ; // Vendor info
virtual VstInt32 getVendorVersion() = 0; // Version number
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames) = 0;
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames) = 0;
virtual VstInt32 getChunk (void** data, bool isPreset) = 0;
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset) = 0;
virtual float getParameter(VstInt32 index) = 0; // get the parameter value at the specified index
virtual void setParameter(VstInt32 index, float value) = 0; // set the parameter at index to value
virtual void getParameterLabel(VstInt32 index, char *text) = 0; // label for the parameter (eg dB)
virtual void getParameterName(VstInt32 index, char *text) = 0; // name of the parameter
virtual void getParameterDisplay(VstInt32 index, char *text) = 0; // text description of the current value
virtual VstInt32 canDo(char *text) = 0;
};

struct AudioEffectX : public AudioEffect
{
AudioEffectX(audioMasterCallback audioMaster, uint32_t kNumPrograms, uint32_t kNumParameters) {}
};

#endif //CLAUDIO_EFFECT_X_AUDIOEFFECTX_H
1 change: 1 addition & 0 deletions libs/airwindows
Submodule airwindows added at adb0bd
1 change: 1 addition & 0 deletions libs/clap
Submodule clap added at 55ee06
1 change: 1 addition & 0 deletions libs/clap-helpers
Submodule clap-helpers added at 716cdf
17 changes: 17 additions & 0 deletions src/claudio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Created by Paul Walker on 6/18/22.
//

#include "audioeffectx.h"

#include "claudio_Galactic.h"

#include "clap/clap.h"



int foo()
{
claudio_GalacticCreateEffectInstance(nullptr);
return 0;
}
Loading

0 comments on commit e9eb3ee

Please sign in to comment.