-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compiling into LV2 plugin, testing required.
Restructure the project.
- Loading branch information
Showing
42 changed files
with
1,375 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(rnnoise_vst) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
include_directories(src/) | ||
|
||
set(PLUGIN_INTERFACE_SRC | ||
src/pluginterfaces/vst2.x/aeffect.h | ||
src/pluginterfaces/vst2.x/aeffectx.h | ||
src/pluginterfaces/vst2.x/vstfxstore.h) | ||
|
||
set(VST2_SRC | ||
src/vst2.x/aeffeditor.h | ||
src/vst2.x/audioeffect.h | ||
src/vst2.x/audioeffectx.h | ||
src/vst2.x/vstplugmain.cpp | ||
src/vst2.x/audioeffect.cpp | ||
src/vst2.x/audioeffectx.cpp) | ||
|
||
set(RNNOISE_SRC | ||
src/rnnoise/rnnoise.h | ||
src/rnnoise/_kiss_fft_guts.h | ||
src/rnnoise/arch.h | ||
src/rnnoise/celt_lpc.c | ||
src/rnnoise/celt_lpc.h | ||
src/rnnoise/common.h | ||
src/rnnoise/denoise.c | ||
src/rnnoise/kiss_fft.c | ||
src/rnnoise/kiss_fft.h | ||
src/rnnoise/opus_types.h | ||
src/rnnoise/pitch.c | ||
src/rnnoise/pitch.h | ||
src/rnnoise/rnn.c | ||
src/rnnoise/rnn.h | ||
src/rnnoise/rnn_data.c | ||
src/rnnoise/rnn_data.h | ||
src/rnnoise/tansig_table.h) | ||
|
||
set(ALL_SOURCES | ||
${PLUGIN_INTERFACE_SRC} | ||
${VST2_SRC} | ||
${RNNOISE_SRC} | ||
src/RnNoiseAudioEffect.h | ||
src/RnNoiseAudioEffect.cpp) | ||
include(GNUInstallDirs) | ||
|
||
add_subdirectory(src/rnnoise) | ||
|
||
set(TARGET_X64 rnnoise_vst_x64) | ||
set(TARGET_X32 rnnoise_vst_x32) | ||
|
||
add_library(${TARGET_X64} SHARED ${ALL_SOURCES}) | ||
add_library(${TARGET_X32} SHARED ${ALL_SOURCES}) | ||
|
||
target_link_libraries(${TARGET_X64} "-static -static-libgcc -static-libstdc++ -m64") | ||
target_link_libraries(${TARGET_X32} "-static -static-libgcc -static-libstdc++ -m32") | ||
|
||
target_compile_options(${TARGET_X64} | ||
PRIVATE | ||
"-m64;" | ||
"$<$<CONFIG:RELEASE>:-O3;>" | ||
) | ||
|
||
target_compile_options(${TARGET_X32} | ||
PRIVATE | ||
"-m32;" | ||
"$<$<CONFIG:RELEASE>:-O3;>" | ||
) | ||
add_subdirectory(src/common) | ||
add_subdirectory(src/vst_plugin) | ||
add_subdirectory(src/lv2_plugin) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(RnNoisePluginCommon LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
set(COMMON_SRC | ||
include/common/RnNoiseCommonPlugin.h | ||
src/RnNoiseCommonPlugin.cpp) | ||
|
||
add_library(RnNoisePluginCommon STATIC ${COMMON_SRC}) | ||
|
||
target_link_libraries(RnNoisePluginCommon RnNoise) | ||
|
||
target_include_directories(RnNoisePluginCommon PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
PRIVATE src) | ||
|
||
install(TARGETS RnNoisePluginCommon | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <memory> | ||
#include <vector> | ||
|
||
struct DenoiseState; | ||
|
||
class RnNoiseCommonPlugin { | ||
public: | ||
|
||
void init(); | ||
|
||
void deinit(); | ||
|
||
void process(const float *in, float *out, int32_t sampleFrames); | ||
|
||
private: | ||
|
||
void createDenoiseState(); | ||
|
||
private: | ||
static const int k_denoiseFrameSize = 480; | ||
static const int k_denoiseSampleRate = 48000; | ||
|
||
std::shared_ptr<DenoiseState> m_denoiseState; | ||
|
||
std::vector<float> m_inputBuffer; | ||
std::vector<float> m_outputBuffer; | ||
}; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(rnnoise_lv2_plugin LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
include_directories(/) | ||
|
||
set(PROJECT_ROOT ../../../) | ||
|
||
set(LV2_INTERFACE_SRC | ||
lv2/lv2plug.in/ns/lv2core/lv2.h | ||
lv2/lv2plug.in/ns/lv2core/lv2_util.h | ||
lv2/lv2plug.in/ns/lv2core/Plugin.hpp | ||
lv2/lv2plug.in/ns/lv2core/Lib.hpp) | ||
|
||
set(LV2_IMPL_SRC | ||
RnNoiseLv2Plugin.h | ||
RnNoiseLv2Plugin.cpp | ||
RnNoiseLv2Lib.h | ||
RnNoiseLv2Lib.cpp) | ||
|
||
set(LV2_PLUGIN_SOURCES | ||
${LV2_INTERFACE_SRC} | ||
${LV2_IMPL_SRC}) | ||
|
||
function(build bit) | ||
set(LV2_TARGET_X${bit} rnnoise_lv2_x${bit}) | ||
|
||
add_library(${LV2_TARGET_X${bit}} SHARED ${LV2_PLUGIN_SOURCES}) | ||
|
||
target_link_libraries(${LV2_TARGET_X${bit}} RnNoisePluginCommon "-static -static-libgcc -static-libstdc++ -m${bit}") | ||
|
||
set(X${bit}_COMPILE_OPTIONS | ||
"-m${bit};" | ||
"$<$<CONFIG:RELEASE>:-O3;>") | ||
|
||
target_compile_options(${LV2_TARGET_X${bit}} PRIVATE ${X${bit}_COMPILE_OPTIONS}) | ||
|
||
set_target_properties(${LV2_TARGET_X${bit}} PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin/x${bit}/rnnoise.lv2") | ||
|
||
configure_file(resources/manifest_x${bit}.ttl ${PROJECT_ROOT}/bin/x${bit}/rnnoise.lv2/manifest.ttl) | ||
configure_file(resources/rnnoise.ttl ${PROJECT_ROOT}/bin/x${bit}/rnnoise.lv2/rnnoise.ttl) | ||
endfunction() | ||
|
||
build(32) | ||
build(64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "RnNoiseLv2Lib.h" | ||
|
||
LV2_SYMBOL_EXTERN const LV2_Lib_Descriptor * | ||
lv2_lib_descriptor(const char *bundle_path, | ||
const LV2_Feature *const *features) { | ||
return new RnNoiseLib(bundle_path, features); | ||
} | ||
|
||
RnNoiseLib::RnNoiseLib(const char *bundle_path, const LV2_Feature *const *features) | ||
: Lib(bundle_path, features), | ||
m_rnNoisePluginDescriptor("https://github.com/werman/noise-suppression-for-voice") { | ||
} | ||
|
||
const LV2_Descriptor *RnNoiseLib::get_plugin(uint32_t index) { | ||
if (index == 0) { | ||
return &m_rnNoisePluginDescriptor; | ||
} | ||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include "lv2/lv2plug.in/ns/lv2core/Lib.hpp" | ||
|
||
#include "RnNoiseLv2Plugin.h" | ||
|
||
class RnNoiseLib : public lv2::Lib { | ||
public: | ||
RnNoiseLib(const char *bundle_path, const LV2_Feature *const *features); | ||
|
||
const LV2_Descriptor *get_plugin(uint32_t index) override; | ||
|
||
private: | ||
|
||
const lv2::Descriptor<RnNoiseLv2Plugin> m_rnNoisePluginDescriptor; | ||
}; | ||
|
||
|
||
|
Oops, something went wrong.