├── ImpulseLoader ├── zita-resampler-1.1.0 │ ├── AUTHORS │ ├── README │ ├── zita-resampler │ │ ├── resampler-table.h │ │ └── resampler.h │ ├── resampler-table.cc │ └── resampler.cc ├── lv2 │ ├── DSP │ │ ├── zita-resampler-1.1.0 │ │ │ ├── AUTHORS │ │ │ ├── README │ │ │ ├── zita-resampler │ │ │ │ ├── resampler-table.h │ │ │ │ └── resampler.h │ │ │ ├── resampler-table.cc │ │ │ └── resampler.cc │ │ ├── dry_wet.cc │ │ ├── gain.cc │ │ └── gx_resampler.h │ ├── manifest.ttl │ ├── lv2_plugin.h │ ├── uris.h │ └── ImpulseLoader.ttl ├── resources │ ├── menu.png │ ├── norm.png │ ├── eject.png │ ├── exit_.png │ └── ImpulseLoader.png ├── clap │ ├── clap │ │ ├── id.h │ │ ├── private │ │ │ ├── std.h │ │ │ └── macros.h │ │ ├── color.h │ │ ├── timestamp.h │ │ ├── all.h │ │ ├── fixedpoint.h │ │ ├── string-sizes.h │ │ ├── ext │ │ │ ├── event-registry.h │ │ │ ├── tail.h │ │ │ ├── latency.h │ │ │ ├── log.h │ │ │ ├── timer-support.h │ │ │ ├── note-name.h │ │ │ ├── render.h │ │ │ ├── draft │ │ │ │ ├── extensible-audio-ports.h │ │ │ │ ├── transport-control.h │ │ │ │ ├── tuning.h │ │ │ │ ├── resource-directory.h │ │ │ │ └── triggers.h │ │ │ ├── state.h │ │ │ ├── posix-fd-support.h │ │ │ ├── voice-info.h │ │ │ ├── preset-load.h │ │ │ ├── ambisonic.h │ │ │ ├── thread-pool.h │ │ │ ├── track-info.h │ │ │ ├── configurable-audio-ports.h │ │ │ ├── thread-check.h │ │ │ ├── audio-ports-activation.h │ │ │ ├── state-context.h │ │ │ ├── note-ports.h │ │ │ ├── remote-controls.h │ │ │ ├── param-indication.h │ │ │ ├── surround.h │ │ │ ├── audio-ports-config.h │ │ │ ├── audio-ports.h │ │ │ └── context-menu.h │ │ ├── universal-plugin-id.h │ │ ├── audio-buffer.h │ │ ├── stream.h │ │ ├── host.h │ │ ├── version.h │ │ ├── factory │ │ │ ├── plugin-factory.h │ │ │ └── draft │ │ │ │ ├── plugin-invalidation.h │ │ │ │ └── plugin-state-converter.h │ │ ├── process.h │ │ ├── clap.h │ │ ├── plugin-features.h │ │ ├── plugin.h │ │ └── entry.h │ ├── clapplug.h │ └── Parameter.h ├── standalone │ ├── ImpulseLoader.desktop │ ├── standalone.h │ ├── main.cpp │ └── jack.cc ├── engine │ ├── dry_wet.cc │ ├── gain.cc │ ├── gx_resampler.h │ └── engine.h ├── gui │ └── widgets.h └── vst2 │ └── VstPlug.cpp ├── ImpulseLoader.png ├── .gitmodules ├── README.md ├── makefile └── .github └── workflows └── build.yml /ImpulseLoader/zita-resampler-1.1.0/AUTHORS: -------------------------------------------------------------------------------- 1 | Fons Adriaensen 2 | -------------------------------------------------------------------------------- /ImpulseLoader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brummer10/ImpulseLoader/HEAD/ImpulseLoader.png -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/zita-resampler-1.1.0/AUTHORS: -------------------------------------------------------------------------------- 1 | Fons Adriaensen 2 | -------------------------------------------------------------------------------- /ImpulseLoader/resources/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brummer10/ImpulseLoader/HEAD/ImpulseLoader/resources/menu.png -------------------------------------------------------------------------------- /ImpulseLoader/resources/norm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brummer10/ImpulseLoader/HEAD/ImpulseLoader/resources/norm.png -------------------------------------------------------------------------------- /ImpulseLoader/resources/eject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brummer10/ImpulseLoader/HEAD/ImpulseLoader/resources/eject.png -------------------------------------------------------------------------------- /ImpulseLoader/resources/exit_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brummer10/ImpulseLoader/HEAD/ImpulseLoader/resources/exit_.png -------------------------------------------------------------------------------- /ImpulseLoader/resources/ImpulseLoader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brummer10/ImpulseLoader/HEAD/ImpulseLoader/resources/ImpulseLoader.png -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/std.h" 4 | #include "private/macros.h" 5 | 6 | typedef uint32_t clap_id; 7 | 8 | static const CLAP_CONSTEXPR clap_id CLAP_INVALID_ID = UINT32_MAX; 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libxputty"] 2 | path = libxputty 3 | url = https://github.com/brummer10/libxputty.git 4 | [submodule "FFTConvolver"] 5 | path = FFTConvolver 6 | url = https://github.com/HiFi-LoFi/FFTConvolver.git 7 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/manifest.ttl: -------------------------------------------------------------------------------- 1 | 2 | @prefix lv2: . 3 | @prefix rdfs: . 4 | 5 | a lv2:Plugin ; 6 | lv2:binary ; 7 | rdfs:seeAlso . 8 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/private/std.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "macros.h" 4 | 5 | #ifdef CLAP_HAS_CXX11 6 | # include 7 | #else 8 | # include 9 | #endif 10 | 11 | #ifdef __cplusplus 12 | # include 13 | #else 14 | # include 15 | # include 16 | #endif 17 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/color.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/std.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct clap_color { 10 | uint8_t alpha; 11 | uint8_t red; 12 | uint8_t green; 13 | uint8_t blue; 14 | } clap_color_t; 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /ImpulseLoader/zita-resampler-1.1.0/README: -------------------------------------------------------------------------------- 1 | Files in this directory are from zita-resampler by 2 | Fons Adriaensen 3 | 4 | Please refer to the version official archive 5 | http://kokkinizita.linuxaudio.org/linuxaudio/ 6 | 7 | These files are only included to ease compilation 8 | and installion of Guitarix. Don't modify. 9 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/zita-resampler-1.1.0/README: -------------------------------------------------------------------------------- 1 | Files in this directory are from zita-resampler by 2 | Fons Adriaensen 3 | 4 | Please refer to the version official archive 5 | http://kokkinizita.linuxaudio.org/linuxaudio/ 6 | 7 | These files are only included to ease compilation 8 | and installion of Guitarix. Don't modify. 9 | -------------------------------------------------------------------------------- /ImpulseLoader/standalone/ImpulseLoader.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=0.2 3 | Type=Application 4 | Name=ImpulseLoader 5 | Comment=Impulse loader for Jack Audio Connection Kit 6 | Exec=ImpulseLoader 7 | Icon=ImpulseLoader 8 | Categories=AudioVideo;Audio; 9 | Terminal=false 10 | X-NSM-Capable=false 11 | X-NSM-Exec=ImpulseLoader 12 | Name[de_DE]=ImpulseLoader.desktop 13 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/timestamp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/std.h" 4 | #include "private/macros.h" 5 | 6 | // This type defines a timestamp: the number of seconds since UNIX EPOCH. 7 | // See C's time_t time(time_t *). 8 | typedef uint64_t clap_timestamp; 9 | 10 | // Value for unknown timestamp. 11 | static const CLAP_CONSTEXPR clap_timestamp CLAP_TIMESTAMP_UNKNOWN = 0; 12 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/all.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "clap.h" 4 | 5 | #include "factory/draft/plugin-invalidation.h" 6 | #include "factory/draft/plugin-state-converter.h" 7 | 8 | #include "ext/draft/extensible-audio-ports.h" 9 | #include "ext/draft/resource-directory.h" 10 | #include "ext/draft/transport-control.h" 11 | #include "ext/draft/triggers.h" 12 | #include "ext/draft/tuning.h" 13 | #include "ext/draft/undo.h" 14 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/fixedpoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/std.h" 4 | #include "private/macros.h" 5 | 6 | /// We use fixed point representation of beat time and seconds time 7 | /// Usage: 8 | /// double x = ...; // in beats 9 | /// clap_beattime y = round(CLAP_BEATTIME_FACTOR * x); 10 | 11 | // This will never change 12 | static const CLAP_CONSTEXPR int64_t CLAP_BEATTIME_FACTOR = 1LL << 31; 13 | static const CLAP_CONSTEXPR int64_t CLAP_SECTIME_FACTOR = 1LL << 31; 14 | 15 | typedef int64_t clap_beattime; 16 | typedef int64_t clap_sectime; 17 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/string-sizes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | enum { 8 | // String capacity for names that can be displayed to the user. 9 | CLAP_NAME_SIZE = 256, 10 | 11 | // String capacity for describing a path, like a parameter in a module hierarchy or path within a 12 | // set of nested track groups. 13 | // 14 | // This is not suited for describing a file path on the disk, as NTFS allows up to 32K long 15 | // paths. 16 | CLAP_PATH_SIZE = 1024, 17 | }; 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/event-registry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_EVENT_REGISTRY[] = "clap.event-registry"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct clap_host_event_registry { 12 | // Queries an event space id. 13 | // The space id 0 is reserved for CLAP's core events. See CLAP_CORE_EVENT_SPACE. 14 | // 15 | // Return false and sets *space_id to UINT16_MAX if the space name is unknown to the host. 16 | // [main-thread] 17 | bool(CLAP_ABI *query)(const clap_host_t *host, const char *space_name, uint16_t *space_id); 18 | } clap_host_event_registry_t; 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/tail.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_TAIL[] = "clap.tail"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct clap_plugin_tail { 12 | // Returns tail length in samples. 13 | // Any value greater or equal to INT32_MAX implies infinite tail. 14 | // [main-thread,audio-thread] 15 | uint32_t(CLAP_ABI *get)(const clap_plugin_t *plugin); 16 | } clap_plugin_tail_t; 17 | 18 | typedef struct clap_host_tail { 19 | // Tell the host that the tail has changed. 20 | // [audio-thread] 21 | void(CLAP_ABI *changed)(const clap_host_t *host); 22 | } clap_host_tail_t; 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clapplug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * clapplug.h 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | 10 | #pragma once 11 | 12 | #ifndef CLAPPLUG_H_ 13 | #define CLAPPLUG_H_ 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | 20 | struct Interface { 21 | uint32_t clapplug; 22 | }; 23 | 24 | #include "widgets.h" 25 | 26 | int 27 | ends_with(const char* name, const char* extension) { 28 | const char* ldot = strrchr(name, '.'); 29 | if (ldot != NULL) { 30 | size_t length = strlen(extension); 31 | return strncmp(ldot + 1, extension, length) == 0; 32 | } 33 | return 0; 34 | } 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif //CLAPPLUG_H_ 41 | -------------------------------------------------------------------------------- /ImpulseLoader/standalone/standalone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * standalone.h 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | 10 | #pragma once 11 | 12 | #ifndef STANDALONE_H_ 13 | #define STANDALONE_H_ 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | 20 | struct Interface { 21 | uint32_t standalone; 22 | }; 23 | 24 | #include "widgets.h" 25 | 26 | int 27 | ends_with(const char* name, const char* extension) { 28 | const char* ldot = strrchr(name, '.'); 29 | if (ldot != NULL) { 30 | size_t length = strlen(extension); 31 | return strncmp(ldot + 1, extension, length) == 0; 32 | } 33 | return 0; 34 | } 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif //STANDALONE_H_ 41 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/latency.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_LATENCY[] = "clap.latency"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct clap_plugin_latency { 12 | // Returns the plugin latency in samples. 13 | // [main-thread & active] 14 | uint32_t(CLAP_ABI *get)(const clap_plugin_t *plugin); 15 | } clap_plugin_latency_t; 16 | 17 | typedef struct clap_host_latency { 18 | // Tell the host that the latency changed. 19 | // The latency is only allowed to change if the plugin is deactivated. 20 | // If the plugin is activated, call host->request_restart() 21 | // [main-thread] 22 | void(CLAP_ABI *changed)(const clap_host_t *host); 23 | } clap_host_latency_t; 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_LOG[] = "clap.log"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | enum { 12 | CLAP_LOG_DEBUG = 0, 13 | CLAP_LOG_INFO = 1, 14 | CLAP_LOG_WARNING = 2, 15 | CLAP_LOG_ERROR = 3, 16 | CLAP_LOG_FATAL = 4, 17 | 18 | // These severities should be used to report misbehaviour. 19 | // The plugin one can be used by a layer between the plugin and the host. 20 | CLAP_LOG_HOST_MISBEHAVING = 5, 21 | CLAP_LOG_PLUGIN_MISBEHAVING = 6, 22 | }; 23 | typedef int32_t clap_log_severity; 24 | 25 | typedef struct clap_host_log { 26 | // Log a message through the host. 27 | // [thread-safe] 28 | void(CLAP_ABI *log)(const clap_host_t *host, clap_log_severity severity, const char *msg); 29 | } clap_host_log_t; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/universal-plugin-id.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Pair of plugin ABI and plugin identifier. 4 | // 5 | // If you want to represent other formats please send us an update to the comment with the 6 | // name of the abi and the representation of the id. 7 | typedef struct clap_universal_plugin_id { 8 | // The plugin ABI name, in lowercase and null-terminated. 9 | // eg: "clap", "vst3", "vst2", "au", ... 10 | const char *abi; 11 | 12 | // The plugin ID, null-terminated and formatted as follows: 13 | // 14 | // CLAP: use the plugin id 15 | // eg: "com.u-he.diva" 16 | // 17 | // AU: format the string like "type:subt:manu" 18 | // eg: "aumu:SgXT:VmbA" 19 | // 20 | // VST2: print the id as a signed 32-bits integer 21 | // eg: "-4382976" 22 | // 23 | // VST3: print the id as a standard UUID 24 | // eg: "123e4567-e89b-12d3-a456-426614174000" 25 | const char *id; 26 | } clap_universal_plugin_id_t; 27 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/timer-support.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_TIMER_SUPPORT[] = "clap.timer-support"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct clap_plugin_timer_support { 12 | // [main-thread] 13 | void(CLAP_ABI *on_timer)(const clap_plugin_t *plugin, clap_id timer_id); 14 | } clap_plugin_timer_support_t; 15 | 16 | typedef struct clap_host_timer_support { 17 | // Registers a periodic timer. 18 | // The host may adjust the period if it is under a certain threshold. 19 | // 30 Hz should be allowed. 20 | // Returns true on success. 21 | // [main-thread] 22 | bool(CLAP_ABI *register_timer)(const clap_host_t *host, uint32_t period_ms, clap_id *timer_id); 23 | 24 | // Returns true on success. 25 | // [main-thread] 26 | bool(CLAP_ABI *unregister_timer)(const clap_host_t *host, clap_id timer_id); 27 | } clap_host_timer_support_t; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/note-name.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | #include "../string-sizes.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | static CLAP_CONSTEXPR const char CLAP_EXT_NOTE_NAME[] = "clap.note-name"; 11 | 12 | typedef struct clap_note_name { 13 | char name[CLAP_NAME_SIZE]; 14 | int16_t port; // -1 for every port 15 | int16_t key; // -1 for every key 16 | int16_t channel; // -1 for every channel 17 | } clap_note_name_t; 18 | 19 | typedef struct clap_plugin_note_name { 20 | // Return the number of note names 21 | // [main-thread] 22 | uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin); 23 | 24 | // Returns true on success and stores the result into note_name 25 | // [main-thread] 26 | bool(CLAP_ABI *get)(const clap_plugin_t *plugin, uint32_t index, clap_note_name_t *note_name); 27 | } clap_plugin_note_name_t; 28 | 29 | typedef struct clap_host_note_name { 30 | // Informs the host that the note names have changed. 31 | // [main-thread] 32 | void(CLAP_ABI *changed)(const clap_host_t *host); 33 | } clap_host_note_name_t; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/audio-buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/std.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | // Sample code for reading a stereo buffer: 10 | // 11 | // bool isLeftConstant = (buffer->constant_mask & (1 << 0)) != 0; 12 | // bool isRightConstant = (buffer->constant_mask & (1 << 1)) != 0; 13 | // 14 | // for (int i = 0; i < N; ++i) { 15 | // float l = data32[0][isLeftConstant ? 0 : i]; 16 | // float r = data32[1][isRightConstant ? 0 : i]; 17 | // } 18 | // 19 | // Note: checking the constant mask is optional, and this implies that 20 | // the buffer must be filled with the constant value. 21 | // Rationale: if a buffer reader doesn't check the constant mask, then it may 22 | // process garbage samples and in result, garbage samples may be transmitted 23 | // to the audio interface with all the bad consequences it can have. 24 | // 25 | // The constant mask is a hint. 26 | typedef struct clap_audio_buffer { 27 | // Either data32 or data64 pointer will be set. 28 | float **data32; 29 | double **data64; 30 | uint32_t channel_count; 31 | uint32_t latency; // latency from/to the audio interface 32 | uint64_t constant_mask; 33 | } clap_audio_buffer_t; 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /ImpulseLoader/engine/dry_wet.cc: -------------------------------------------------------------------------------- 1 | // generated from file '/home/brummer/projecte/XUiDesigner/tools/wet_dry.dsp' by dsp2cc: 2 | // Code generated with Faust 2.69.3 (https://faust.grame.fr) 3 | 4 | #include 5 | 6 | 7 | namespace wet_dry { 8 | 9 | class Dsp { 10 | private: 11 | uint32_t fSampleRate; 12 | float fVslider0; 13 | float *fVslider0_; 14 | 15 | 16 | public: 17 | float dry_wet; 18 | void connect(uint32_t port,void* data); 19 | void del_instance(Dsp *p); 20 | void init(uint32_t sample_rate); 21 | void compute(int count, float *input0, float *input1, float *output0); 22 | Dsp(); 23 | ~Dsp(); 24 | }; 25 | 26 | 27 | 28 | Dsp::Dsp() { 29 | dry_wet = 100.0; 30 | } 31 | 32 | Dsp::~Dsp() { 33 | } 34 | 35 | inline void Dsp::init(uint32_t sample_rate) 36 | { 37 | fSampleRate = sample_rate; 38 | } 39 | 40 | void Dsp::compute(int count, float *input0, float *input1, float *output0) 41 | { 42 | float fSlow0 = 0.01f * dry_wet; 43 | float fSlow1 = 1.0f - fSlow0; 44 | for (int i0 = 0; i0 < count; i0 = i0 + 1) { 45 | output0[i0] = fSlow1 * input0[i0] + fSlow0 * input1[i0]; 46 | } 47 | } 48 | 49 | 50 | Dsp *plugin() { 51 | return new Dsp(); 52 | } 53 | 54 | void Dsp::del_instance(Dsp *p) 55 | { 56 | delete p; 57 | } 58 | } // end namespace wet_dry 59 | -------------------------------------------------------------------------------- /ImpulseLoader/engine/gain.cc: -------------------------------------------------------------------------------- 1 | // generated from file '/home/brummer/projecte/PreAmpImpulses/gain.dsp' by dsp2cc: 2 | // Code generated with Faust 2.54.9 (https://faust.grame.fr) 3 | 4 | #include 5 | 6 | namespace gain { 7 | 8 | class Dsp { 9 | private: 10 | uint32_t fSampleRate; 11 | double fRec0[2]; 12 | 13 | public: 14 | float gain; 15 | void del_instance(Dsp *p); 16 | void clear_state_f(); 17 | void init(uint32_t sample_rate); 18 | void compute(int count, float *input0, float *output0); 19 | Dsp(); 20 | ~Dsp(); 21 | }; 22 | 23 | Dsp::Dsp() { 24 | gain = 0.0; 25 | } 26 | 27 | Dsp::~Dsp() { 28 | } 29 | 30 | inline void Dsp::clear_state_f() 31 | { 32 | for (int l0 = 0; l0 < 2; l0 = l0 + 1) fRec0[l0] = 0.0; 33 | } 34 | 35 | inline void Dsp::init(uint32_t sample_rate) 36 | { 37 | fSampleRate = sample_rate; 38 | clear_state_f(); 39 | } 40 | 41 | void Dsp::compute(int count, float *input0, float *output0) 42 | { 43 | float fSlow0 = 0.0010000000000000009 * std::pow(1e+01, 0.05 * gain); 44 | for (int i0 = 0; i0 < count; i0 = i0 + 1) { 45 | fRec0[0] = fSlow0 + 0.999 * fRec0[1]; 46 | output0[i0] = input0[i0] * fRec0[0]; 47 | fRec0[1] = fRec0[0]; 48 | } 49 | } 50 | 51 | Dsp *plugin() { 52 | return new Dsp(); 53 | } 54 | 55 | void Dsp::del_instance(Dsp *p) 56 | { 57 | delete p; 58 | } 59 | } // end namespace gain 60 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/render.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_RENDER[] = "clap.render"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | enum { 12 | // Default setting, for "realtime" processing 13 | CLAP_RENDER_REALTIME = 0, 14 | 15 | // For processing without realtime pressure 16 | // The plugin may use more expensive algorithms for higher sound quality. 17 | CLAP_RENDER_OFFLINE = 1, 18 | }; 19 | typedef int32_t clap_plugin_render_mode; 20 | 21 | // The render extension is used to let the plugin know if it has "realtime" 22 | // pressure to process. 23 | // 24 | // If this information does not influence your rendering code, then don't 25 | // implement this extension. 26 | typedef struct clap_plugin_render { 27 | // Returns true if the plugin has a hard requirement to process in real-time. 28 | // This is especially useful for plugin acting as a proxy to an hardware device. 29 | // [main-thread] 30 | bool(CLAP_ABI *has_hard_realtime_requirement)(const clap_plugin_t *plugin); 31 | 32 | // Returns true if the rendering mode could be applied. 33 | // [main-thread] 34 | bool(CLAP_ABI *set)(const clap_plugin_t *plugin, clap_plugin_render_mode mode); 35 | } clap_plugin_render_t; 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/draft/extensible-audio-ports.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../audio-ports.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | // This extension lets the host add and remove audio ports to the plugin. 10 | static CLAP_CONSTEXPR const char CLAP_EXT_EXTENSIBLE_AUDIO_PORTS[] = 11 | "clap.extensible-audio-ports/1"; 12 | 13 | typedef struct clap_plugin_extensible_audio_ports { 14 | // Asks the plugin to add a new port (at the end of the list), with the following settings. 15 | // port_type: see clap_audio_port_info.port_type for interpretation. 16 | // port_details: see clap_audio_port_configuration_request.port_details for interpretation. 17 | // Returns true on success. 18 | // [main-thread && !is_active] 19 | bool(CLAP_ABI *add_port)(const clap_plugin_t *plugin, 20 | bool is_input, 21 | uint32_t channel_count, 22 | const char *port_type, 23 | const void *port_details); 24 | 25 | // Asks the plugin to remove a port. 26 | // Returns true on success. 27 | // [main-thread && !is_active] 28 | bool(CLAP_ABI *remove_port)(const clap_plugin_t *plugin, bool is_input, uint32_t index); 29 | } clap_plugin_extensible_audio_ports_t; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/private/macros.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Define CLAP_EXPORT 4 | #if !defined(CLAP_EXPORT) 5 | # if defined _WIN32 || defined __CYGWIN__ 6 | # ifdef __GNUC__ 7 | # define CLAP_EXPORT __attribute__((dllexport)) 8 | # else 9 | # define CLAP_EXPORT __declspec(dllexport) 10 | # endif 11 | # else 12 | # if __GNUC__ >= 4 || defined(__clang__) 13 | # define CLAP_EXPORT __attribute__((visibility("default"))) 14 | # else 15 | # define CLAP_EXPORT 16 | # endif 17 | # endif 18 | #endif 19 | 20 | #if !defined(CLAP_ABI) 21 | # if defined _WIN32 || defined __CYGWIN__ 22 | # define CLAP_ABI __cdecl 23 | # else 24 | # define CLAP_ABI 25 | # endif 26 | #endif 27 | 28 | #if defined(_MSVC_LANG) 29 | # define CLAP_CPLUSPLUS _MSVC_LANG 30 | #elif defined(__cplusplus) 31 | # define CLAP_CPLUSPLUS __cplusplus 32 | #endif 33 | 34 | #if defined(CLAP_CPLUSPLUS) && CLAP_CPLUSPLUS >= 201103L 35 | # define CLAP_HAS_CXX11 36 | # define CLAP_CONSTEXPR constexpr 37 | #else 38 | # define CLAP_CONSTEXPR 39 | #endif 40 | 41 | #if defined(CLAP_CPLUSPLUS) && CLAP_CPLUSPLUS >= 201703L 42 | # define CLAP_HAS_CXX17 43 | # define CLAP_NODISCARD [[nodiscard]] 44 | #else 45 | # define CLAP_NODISCARD 46 | #endif 47 | 48 | #if defined(CLAP_CPLUSPLUS) && CLAP_CPLUSPLUS >= 202002L 49 | # define CLAP_HAS_CXX20 50 | #endif 51 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/stream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/std.h" 4 | #include "private/macros.h" 5 | 6 | /// @page Streams 7 | /// 8 | /// ## Notes on using streams 9 | /// 10 | /// When working with `clap_istream` and `clap_ostream` objects to load and save 11 | /// state, it is important to keep in mind that the host may limit the number of 12 | /// bytes that can be read or written at a time. The return values for the 13 | /// stream read and write functions indicate how many bytes were actually read 14 | /// or written. You need to use a loop to ensure that you read or write the 15 | /// entirety of your state. Don't forget to also consider the negative return 16 | /// values for the end of file and IO error codes. 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | typedef struct clap_istream { 23 | void *ctx; // reserved pointer for the stream 24 | 25 | // returns the number of bytes read; 0 indicates end of file and -1 a read error 26 | int64_t(CLAP_ABI *read)(const struct clap_istream *stream, void *buffer, uint64_t size); 27 | } clap_istream_t; 28 | 29 | typedef struct clap_ostream { 30 | void *ctx; // reserved pointer for the stream 31 | 32 | // returns the number of bytes written; -1 on write error 33 | int64_t(CLAP_ABI *write)(const struct clap_ostream *stream, const void *buffer, uint64_t size); 34 | } clap_ostream_t; 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/dry_wet.cc: -------------------------------------------------------------------------------- 1 | // generated from file '/home/brummer/projecte/XUiDesigner/tools/wet_dry.dsp' by dsp2cc: 2 | // Code generated with Faust 2.69.3 (https://faust.grame.fr) 3 | 4 | #include 5 | 6 | #define FAUSTFLOAT float 7 | 8 | namespace wet_dry { 9 | 10 | class Dsp { 11 | private: 12 | uint32_t fSampleRate; 13 | FAUSTFLOAT fVslider0; 14 | FAUSTFLOAT *fVslider0_; 15 | 16 | 17 | public: 18 | void connect(uint32_t port,void* data); 19 | void del_instance(Dsp *p); 20 | void init(uint32_t sample_rate); 21 | void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0); 22 | Dsp(); 23 | ~Dsp(); 24 | }; 25 | 26 | 27 | 28 | Dsp::Dsp() { 29 | } 30 | 31 | Dsp::~Dsp() { 32 | } 33 | 34 | inline void Dsp::init(uint32_t sample_rate) 35 | { 36 | fSampleRate = sample_rate; 37 | } 38 | 39 | void Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0) 40 | { 41 | #define fVslider0 (*fVslider0_) 42 | float fSlow0 = 0.01f * float(fVslider0); 43 | float fSlow1 = 1.0f - fSlow0; 44 | for (int i0 = 0; i0 < count; i0 = i0 + 1) { 45 | output0[i0] = FAUSTFLOAT(fSlow1 * float(input0[i0]) + fSlow0 * float(input1[i0])); 46 | } 47 | #undef fVslider0 48 | } 49 | 50 | 51 | void Dsp::connect(uint32_t port,void* data) 52 | { 53 | switch ((PortIndex)port) 54 | { 55 | case 4: 56 | fVslider0_ = static_cast(data); // , 5e+01f, 0.0f, 1e+02f, 1.0f 57 | break; 58 | default: 59 | break; 60 | } 61 | } 62 | 63 | Dsp *plugin() { 64 | return new Dsp(); 65 | } 66 | 67 | void Dsp::del_instance(Dsp *p) 68 | { 69 | delete p; 70 | } 71 | } // end namespace wet_dry 72 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/host.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "version.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct clap_host { 10 | clap_version_t clap_version; // initialized to CLAP_VERSION 11 | 12 | void *host_data; // reserved pointer for the host 13 | 14 | // name and version are mandatory. 15 | const char *name; // eg: "Bitwig Studio" 16 | const char *vendor; // eg: "Bitwig GmbH" 17 | const char *url; // eg: "https://bitwig.com" 18 | const char *version; // eg: "4.3", see plugin.h for advice on how to format the version 19 | 20 | // Query an extension. 21 | // The returned pointer is owned by the host. 22 | // It is forbidden to call it before plugin->init(). 23 | // You can call it within plugin->init() call, and after. 24 | // [thread-safe] 25 | const void *(CLAP_ABI *get_extension)(const struct clap_host *host, const char *extension_id); 26 | 27 | // Request the host to deactivate and then reactivate the plugin. 28 | // The operation may be delayed by the host. 29 | // [thread-safe] 30 | void(CLAP_ABI *request_restart)(const struct clap_host *host); 31 | 32 | // Request the host to activate and start processing the plugin. 33 | // This is useful if you have external IO and need to wake up the plugin from "sleep". 34 | // [thread-safe] 35 | void(CLAP_ABI *request_process)(const struct clap_host *host); 36 | 37 | // Request the host to schedule a call to plugin->on_main_thread(plugin) on the main thread. 38 | // [thread-safe] 39 | void(CLAP_ABI *request_callback)(const struct clap_host *host); 40 | } clap_host_t; 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/macros.h" 4 | #include "private/std.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct clap_version { 11 | // This is the major ABI and API design 12 | // Version 0.X.Y correspond to the development stage, API and ABI are not stable 13 | // Version 1.X.Y correspond to the release stage, API and ABI are stable 14 | uint32_t major; 15 | uint32_t minor; 16 | uint32_t revision; 17 | } clap_version_t; 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #define CLAP_VERSION_MAJOR 1 24 | #define CLAP_VERSION_MINOR 2 25 | #define CLAP_VERSION_REVISION 1 26 | 27 | #define CLAP_VERSION_INIT \ 28 | { (uint32_t)CLAP_VERSION_MAJOR, (uint32_t)CLAP_VERSION_MINOR, (uint32_t)CLAP_VERSION_REVISION } 29 | 30 | #define CLAP_VERSION_LT(maj,min,rev) ((CLAP_VERSION_MAJOR < (maj)) || \ 31 | ((maj) == CLAP_VERSION_MAJOR && CLAP_VERSION_MINOR < (min)) || \ 32 | ((maj) == CLAP_VERSION_MAJOR && (min) == CLAP_VERSION_MINOR && CLAP_VERSION_REVISION < (rev))) 33 | #define CLAP_VERSION_EQ(maj,min,rev) (((maj) == CLAP_VERSION_MAJOR) && ((min) == CLAP_VERSION_MINOR) && ((rev) == CLAP_VERSION_REVISION)) 34 | #define CLAP_VERSION_GE(maj,min,rev) (!CLAP_VERSION_LT(maj,min,rev)) 35 | 36 | static const CLAP_CONSTEXPR clap_version_t CLAP_VERSION = CLAP_VERSION_INIT; 37 | 38 | CLAP_NODISCARD static inline CLAP_CONSTEXPR bool 39 | clap_version_is_compatible(const clap_version_t v) { 40 | // versions 0.x.y were used during development stage and aren't compatible 41 | return v.major >= 1; 42 | } 43 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/state.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | #include "../stream.h" 5 | 6 | /// @page State 7 | /// @brief state management 8 | /// 9 | /// Plugins can implement this extension to save and restore both parameter 10 | /// values and non-parameter state. This is used to persist a plugin's state 11 | /// between project reloads, when duplicating and copying plugin instances, and 12 | /// for host-side preset management. 13 | /// 14 | /// If you need to know if the save/load operation is meant for duplicating a plugin 15 | /// instance, for saving/loading a plugin preset or while saving/loading the project 16 | /// then consider implementing CLAP_EXT_STATE_CONTEXT in addition to CLAP_EXT_STATE. 17 | 18 | static CLAP_CONSTEXPR const char CLAP_EXT_STATE[] = "clap.state"; 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef struct clap_plugin_state { 25 | // Saves the plugin state into stream. 26 | // Returns true if the state was correctly saved. 27 | // [main-thread] 28 | bool(CLAP_ABI *save)(const clap_plugin_t *plugin, const clap_ostream_t *stream); 29 | 30 | // Loads the plugin state from stream. 31 | // Returns true if the state was correctly restored. 32 | // [main-thread] 33 | bool(CLAP_ABI *load)(const clap_plugin_t *plugin, const clap_istream_t *stream); 34 | } clap_plugin_state_t; 35 | 36 | typedef struct clap_host_state { 37 | // Tell the host that the plugin state has changed and should be saved again. 38 | // If a parameter value changes, then it is implicit that the state is dirty. 39 | // [main-thread] 40 | void(CLAP_ABI *mark_dirty)(const clap_host_t *host); 41 | } clap_host_state_t; 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/factory/plugin-factory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | // Use it to retrieve const clap_plugin_factory_t* from 6 | // clap_plugin_entry.get_factory() 7 | static const CLAP_CONSTEXPR char CLAP_PLUGIN_FACTORY_ID[] = "clap.plugin-factory"; 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | // Every method must be thread-safe. 14 | // It is very important to be able to scan the plugin as quickly as possible. 15 | // 16 | // The host may use clap_plugin_invalidation_factory to detect filesystem changes 17 | // which may change the factory's content. 18 | typedef struct clap_plugin_factory { 19 | // Get the number of plugins available. 20 | // [thread-safe] 21 | uint32_t(CLAP_ABI *get_plugin_count)(const struct clap_plugin_factory *factory); 22 | 23 | // Retrieves a plugin descriptor by its index. 24 | // Returns null in case of error. 25 | // The descriptor must not be freed. 26 | // [thread-safe] 27 | const clap_plugin_descriptor_t *(CLAP_ABI *get_plugin_descriptor)( 28 | const struct clap_plugin_factory *factory, uint32_t index); 29 | 30 | // Create a clap_plugin by its plugin_id. 31 | // The returned pointer must be freed by calling plugin->destroy(plugin); 32 | // The plugin is not allowed to use the host callbacks in the create method. 33 | // Returns null in case of error. 34 | // [thread-safe] 35 | const clap_plugin_t *(CLAP_ABI *create_plugin)(const struct clap_plugin_factory *factory, 36 | const clap_host_t *host, 37 | const char *plugin_id); 38 | } clap_plugin_factory_t; 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/posix-fd-support.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | // This extension let your plugin hook itself into the host select/poll/epoll/kqueue reactor. 6 | // This is useful to handle asynchronous I/O on the main thread. 7 | static CLAP_CONSTEXPR const char CLAP_EXT_POSIX_FD_SUPPORT[] = "clap.posix-fd-support"; 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | enum { 14 | // IO events flags, they can be used to form a mask which describes: 15 | // - which events you are interested in (register_fd/modify_fd) 16 | // - which events happened (on_fd) 17 | CLAP_POSIX_FD_READ = 1 << 0, 18 | CLAP_POSIX_FD_WRITE = 1 << 1, 19 | CLAP_POSIX_FD_ERROR = 1 << 2, 20 | }; 21 | typedef uint32_t clap_posix_fd_flags_t; 22 | 23 | typedef struct clap_plugin_posix_fd_support { 24 | // This callback is "level-triggered". 25 | // It means that a writable fd will continuously produce "on_fd()" events; 26 | // don't forget using modify_fd() to remove the write notification once you're 27 | // done writing. 28 | // 29 | // [main-thread] 30 | void(CLAP_ABI *on_fd)(const clap_plugin_t *plugin, int fd, clap_posix_fd_flags_t flags); 31 | } clap_plugin_posix_fd_support_t; 32 | 33 | typedef struct clap_host_posix_fd_support { 34 | // Returns true on success. 35 | // [main-thread] 36 | bool(CLAP_ABI *register_fd)(const clap_host_t *host, int fd, clap_posix_fd_flags_t flags); 37 | 38 | // Returns true on success. 39 | // [main-thread] 40 | bool(CLAP_ABI *modify_fd)(const clap_host_t *host, int fd, clap_posix_fd_flags_t flags); 41 | 42 | // Returns true on success. 43 | // [main-thread] 44 | bool(CLAP_ABI *unregister_fd)(const clap_host_t *host, int fd); 45 | } clap_host_posix_fd_support_t; 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/gain.cc: -------------------------------------------------------------------------------- 1 | // generated from file '/home/brummer/projecte/PreAmpImpulses/gain.dsp' by dsp2cc: 2 | // Code generated with Faust 2.54.9 (https://faust.grame.fr) 3 | 4 | #include 5 | 6 | #define FAUSTFLOAT float 7 | 8 | using std::signbit; 9 | 10 | namespace gain { 11 | 12 | class Dsp { 13 | private: 14 | uint32_t fSampleRate; 15 | FAUSTFLOAT fVslider0; 16 | FAUSTFLOAT *fVslider0_; 17 | double fRec0[2]; 18 | 19 | 20 | public: 21 | void connect(uint32_t port,void* data); 22 | void del_instance(Dsp *p); 23 | void clear_state_f(); 24 | void init(uint32_t sample_rate); 25 | void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0); 26 | Dsp(); 27 | ~Dsp(); 28 | }; 29 | 30 | 31 | 32 | Dsp::Dsp() { 33 | } 34 | 35 | Dsp::~Dsp() { 36 | } 37 | 38 | inline void Dsp::clear_state_f() 39 | { 40 | for (int l0 = 0; l0 < 2; l0 = l0 + 1) fRec0[l0] = 0.0; 41 | } 42 | 43 | inline void Dsp::init(uint32_t sample_rate) 44 | { 45 | fSampleRate = sample_rate; 46 | clear_state_f(); 47 | } 48 | 49 | void Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0) 50 | { 51 | #define fVslider0 (*fVslider0_) 52 | double fSlow0 = 0.0010000000000000009 * std::pow(1e+01, 0.05 * double(fVslider0)); 53 | for (int i0 = 0; i0 < count; i0 = i0 + 1) { 54 | fRec0[0] = fSlow0 + 0.999 * fRec0[1]; 55 | output0[i0] = FAUSTFLOAT(double(input0[i0]) * fRec0[0]); 56 | fRec0[1] = fRec0[0]; 57 | } 58 | #undef fVslider0 59 | } 60 | 61 | 62 | void Dsp::connect(uint32_t port,void* data) 63 | { 64 | switch ((PortIndex)port) 65 | { 66 | case 3: 67 | fVslider0_ = static_cast(data); // , 0.0, -2e+01, 2e+01, 0.1 68 | break; 69 | default: 70 | break; 71 | } 72 | } 73 | 74 | Dsp *plugin() { 75 | return new Dsp(); 76 | } 77 | 78 | void Dsp::del_instance(Dsp *p) 79 | { 80 | delete p; 81 | } 82 | } // end namespace gain 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImpulseLoader 2 | 3 | This is a simple, mono, IR-File loader/convolution LV2, clap, vst2 plug/ Stans-alone application. 4 | 5 | ![ImpulseLoader](https://raw.githubusercontent.com/brummer10/ImpulseLoader/master/ImpulseLoader.png) 6 | 7 | A Stereo version of ImpulseLoader is here [ImpulseLoaderStereo](https://github.com/brummer10/ImpulseLoaderStereo.lv2) 8 | 9 | ## Supported File Formats: 10 | 11 | - WAF 12 | - AIFF 13 | - WAVEFORMATEX 14 | - CAF 15 | 16 | IR-Files could be loaded via the integrated File Browser, or, when supported by the host, via drag and drop. 17 | 18 | If the IR-File have more then 1 channel, only the first channel will be used. 19 | 20 | IR-Files will be resampled on the fly to match the session Sample Rate. 21 | 22 | ## Dependencies 23 | 24 | - libsndfile1-dev 25 | - libfftw3-dev 26 | - libcairo2-dev 27 | - libx11-dev 28 | - lv2-dev 29 | 30 | ## Build 31 | 32 | [![build](https://github.com/brummer10/ImpulseLoader/actions/workflows/build.yml/badge.svg)](https://github.com/brummer10/ImpulseLoader/actions/workflows/build.yml) 33 | 34 | To build ImpulseLoader only as standalone application run 35 | ```shell 36 | make standalone 37 | ``` 38 | 39 | To build ImpulseLoader only as Clap plugin run 40 | ```shell 41 | make clap 42 | ``` 43 | 44 | To build ImpulseLoader only as vst2 plugin run 45 | ```shell 46 | make vst2 47 | ``` 48 | 49 | To build ImpulseLoader with all favours (currently as LV2, Clap and vst2 plugin and as standalone application) run 50 | ```shell 51 | make 52 | ``` 53 | 54 | ## Building LV2 plug from source code 55 | 56 | ```shell 57 | git clone https://github.com/brummer10/ImpulseLoader 58 | git submodule init 59 | git submodule update 60 | make lv2 # build the LV2 plug 61 | make install # will install into ~/.lv2 ... AND/OR.... 62 | sudo make install # will install into /usr/lib/lv2 63 | ``` 64 | 65 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | 2 | include libxputty/Build/Makefile.base 3 | 4 | NOGOAL := uninstall install all features mod modapp standalone lv2 jack clap vst2 5 | 6 | SWITCHGOAL := all modapp standalone lv2 jack clap vst2 7 | 8 | PASS := features 9 | 10 | SUBDIR := ImpulseLoader 11 | 12 | .PHONY: $(SUBDIR) libxputty recurse 13 | 14 | $(MAKECMDGOALS) recurse: $(SUBDIR) 15 | 16 | check-and-reinit-submodules : 17 | ifeq (,$(filter $(NOGOAL),$(MAKECMDGOALS))) 18 | ifeq (,$(findstring clean,$(MAKECMDGOALS))) 19 | @if git submodule status 2>/dev/null | egrep -q '^[-]|^[+]' ; then \ 20 | echo "$(red)INFO: Need to reinitialize git submodules$(reset)"; \ 21 | git submodule update --init; \ 22 | echo "$(blue)Done$(reset)"; \ 23 | else echo "$(blue) Submodule up to date$(reset)"; \ 24 | fi 25 | endif 26 | endif 27 | 28 | libxputty: check-and-reinit-submodules 29 | ifeq (,$(filter $(NOGOAL),$(MAKECMDGOALS))) 30 | ifeq (,$(wildcard ./libxputty/xputty/resources/ImpulseLoader.png)) 31 | @cp ./ImpulseLoader/resources/*.png ./libxputty/xputty/resources/ 32 | endif 33 | @exec $(MAKE) --no-print-directory -j 1 -C $@ $(MAKECMDGOALS) 34 | endif 35 | ifneq (,$(filter $(SWITCHGOAL),$(MAKECMDGOALS))) 36 | ifeq (,$(wildcard ./libxputty/xputty/resources/ImpulseLoader.png)) 37 | @cp ./ImpulseLoader/resources/*.png ./libxputty/xputty/resources/ 38 | endif 39 | @exec $(MAKE) --no-print-directory -j 1 -C $@ all 40 | endif 41 | 42 | 43 | $(SUBDIR): libxputty 44 | ifeq (,$(filter $(PASS),$(MAKECMDGOALS))) 45 | @exec $(MAKE) --no-print-directory -j 1 -C $@ $(MAKECMDGOALS) 46 | endif 47 | 48 | clean: 49 | @rm -f ./libxputty/xputty/resources/menu.png 50 | @rm -f ./libxputty/xputty/resources/norm.png 51 | @rm -f ./libxputty/xputty/resources/eject.png 52 | @rm -f ./libxputty/xputty/resources/exit_.png 53 | @rm -f ./libxputty/xputty/resources/ImpulseLoader.png 54 | 55 | features: 56 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/factory/draft/plugin-invalidation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../private/std.h" 4 | #include "../../private/macros.h" 5 | 6 | // Use it to retrieve const clap_plugin_invalidation_factory_t* from 7 | // clap_plugin_entry.get_factory() 8 | static const CLAP_CONSTEXPR char CLAP_PLUGIN_INVALIDATION_FACTORY_ID[] = 9 | "clap.plugin-invalidation-factory/1"; 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct clap_plugin_invalidation_source { 16 | // Directory containing the file(s) to scan, must be absolute 17 | const char *directory; 18 | 19 | // globing pattern, in the form *.dll 20 | const char *filename_glob; 21 | 22 | // should the directory be scanned recursively? 23 | bool recursive_scan; 24 | } clap_plugin_invalidation_source_t; 25 | 26 | // Used to figure out when a plugin needs to be scanned again. 27 | // Imagine a situation with a single entry point: my-plugin.clap which then scans itself 28 | // a set of "sub-plugins". New plugin may be available even if my-plugin.clap file doesn't change. 29 | // This interfaces solves this issue and gives a way to the host to monitor additional files. 30 | typedef struct clap_plugin_invalidation_factory { 31 | // Get the number of invalidation source. 32 | uint32_t(CLAP_ABI *count)(const struct clap_plugin_invalidation_factory *factory); 33 | 34 | // Get the invalidation source by its index. 35 | // [thread-safe] 36 | const clap_plugin_invalidation_source_t *(CLAP_ABI *get)( 37 | const struct clap_plugin_invalidation_factory *factory, uint32_t index); 38 | 39 | // In case the host detected a invalidation event, it can call refresh() to let the 40 | // plugin_entry update the set of plugins available. 41 | // If the function returned false, then the plugin needs to be reloaded. 42 | bool(CLAP_ABI *refresh)(const struct clap_plugin_invalidation_factory *factory); 43 | } clap_plugin_invalidation_factory_t; 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /ImpulseLoader/gui/widgets.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * widgets.h 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | * 7 | * Copyright (C) 2025 brummer 8 | */ 9 | 10 | // xwidgets.h includes xputty.h and all defined widgets from Xputty 11 | #include "xwidgets.h" 12 | #include "xfile-dialog.h" 13 | 14 | #pragma once 15 | 16 | #ifndef WIDGETS_H_ 17 | #define WIDGETS_H_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #define CONTROLS 4 24 | 25 | #define GUI_ELEMENTS 0 26 | 27 | #define TAB_ELEMENTS 0 28 | 29 | typedef struct Interface Interface; 30 | 31 | typedef struct { 32 | Widget_t *fbutton; 33 | Widget_t *filebutton; 34 | FilePicker *filepicker; 35 | char *filename; 36 | char *dir_name; 37 | } ModelPicker; 38 | 39 | typedef struct { 40 | ModelPicker ir; 41 | char *fname; 42 | } X11_UI_Private_t; 43 | 44 | // main window struct 45 | typedef struct { 46 | void *parentXwindow; 47 | Xputty main; 48 | Widget_t *win; 49 | Widget_t *widget[CONTROLS]; 50 | unsigned int f_index; 51 | void *private_ptr; 52 | int need_resize; 53 | int loop_counter; 54 | bool uiKnowSampleRate; 55 | int uiSampleRate; 56 | bool setVerbose; 57 | Interface itf; 58 | } X11_UI; 59 | 60 | // set the plugin initial window size 61 | void plugin_set_window_size(int *w,int *h,const char * plugin_uri); 62 | 63 | // set custom theme 64 | void set_custom_theme(X11_UI *ui); 65 | 66 | // create all needed controller 67 | void plugin_create_controller_widgets(X11_UI *ui, const char * plugin_uri); 68 | 69 | // send value changes to the host 70 | void sendValueChanged(X11_UI *ui, int port, float value); 71 | 72 | // send a file name to the host 73 | void sendFileName(X11_UI *ui, ModelPicker* m, int old); 74 | 75 | int ends_with(const char* name, const char* extension); 76 | 77 | // free used mem on exit 78 | void plugin_cleanup(X11_UI *ui); 79 | 80 | // set a callback to NULL 81 | static void dummy_callback(void *w_, void* user_data) {} 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/voice-info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | // This extension indicates the number of voices the synthesizer has. 6 | // It is useful for the host when performing polyphonic modulations, 7 | // because the host needs its own voice management and should try to follow 8 | // what the plugin is doing: 9 | // - make the host's voice pool coherent with what the plugin has 10 | // - turn the host's voice management to mono when the plugin is mono 11 | 12 | static CLAP_CONSTEXPR const char CLAP_EXT_VOICE_INFO[] = "clap.voice-info"; 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | enum { 19 | // Allows the host to send overlapping NOTE_ON events. 20 | // The plugin will then rely upon the note_id to distinguish between them. 21 | CLAP_VOICE_INFO_SUPPORTS_OVERLAPPING_NOTES = 1 << 0, 22 | }; 23 | 24 | typedef struct clap_voice_info { 25 | // voice_count is the current number of voices that the patch can use 26 | // voice_capacity is the number of voices allocated voices 27 | // voice_count should not be confused with the number of active voices. 28 | // 29 | // 1 <= voice_count <= voice_capacity 30 | // 31 | // For example, a synth can have a capacity of 8 voices, but be configured 32 | // to only use 4 voices: {count: 4, capacity: 8}. 33 | // 34 | // If the voice_count is 1, then the synth is working in mono and the host 35 | // can decide to only use global modulation mapping. 36 | uint32_t voice_count; 37 | uint32_t voice_capacity; 38 | 39 | uint64_t flags; 40 | } clap_voice_info_t; 41 | 42 | typedef struct clap_plugin_voice_info { 43 | // gets the voice info, returns true on success 44 | // [main-thread && active] 45 | bool(CLAP_ABI *get)(const clap_plugin_t *plugin, clap_voice_info_t *info); 46 | } clap_plugin_voice_info_t; 47 | 48 | typedef struct clap_host_voice_info { 49 | // informs the host that the voice info has changed 50 | // [main-thread] 51 | void(CLAP_ABI *changed)(const clap_host_t *host); 52 | } clap_host_voice_info_t; 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/preset-load.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_PRESET_LOAD[] = "clap.preset-load/2"; 6 | 7 | // The latest draft is 100% compatible. 8 | // This compat ID may be removed in 2026. 9 | static CLAP_CONSTEXPR const char CLAP_EXT_PRESET_LOAD_COMPAT[] = "clap.preset-load.draft/2"; 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct clap_plugin_preset_load { 16 | // Loads a preset in the plugin native preset file format from a location. 17 | // The preset discovery provider defines the location and load_key to be passed to this function. 18 | // Returns true on success. 19 | // [main-thread] 20 | bool(CLAP_ABI *from_location)(const clap_plugin_t *plugin, 21 | uint32_t location_kind, 22 | const char *location, 23 | const char *load_key); 24 | } clap_plugin_preset_load_t; 25 | 26 | typedef struct clap_host_preset_load { 27 | // Called if clap_plugin_preset_load.load() failed. 28 | // os_error: the operating system error, if applicable. If not applicable set it to a non-error 29 | // value, eg: 0 on unix and Windows. 30 | // 31 | // [main-thread] 32 | void(CLAP_ABI *on_error)(const clap_host_t *host, 33 | uint32_t location_kind, 34 | const char *location, 35 | const char *load_key, 36 | int32_t os_error, 37 | const char *msg); 38 | 39 | // Informs the host that the following preset has been loaded. 40 | // This contributes to keep in sync the host preset browser and plugin preset browser. 41 | // If the preset was loaded from a container file, then the load_key must be set, otherwise it 42 | // must be null. 43 | // 44 | // [main-thread] 45 | void(CLAP_ABI *loaded)(const clap_host_t *host, 46 | uint32_t location_kind, 47 | const char *location, 48 | const char *load_key); 49 | } clap_host_preset_load_t; 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/draft/transport-control.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../plugin.h" 4 | 5 | // This extension lets the plugin submit transport requests to the host. 6 | // The host has no obligation to execute these requests, so the interface may be 7 | // partially working. 8 | 9 | static CLAP_CONSTEXPR const char CLAP_EXT_TRANSPORT_CONTROL[] = "clap.transport-control/1"; 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct clap_host_transport_control { 16 | // Jumps back to the start point and starts the transport 17 | // [main-thread] 18 | void(CLAP_ABI *request_start)(const clap_host_t *host); 19 | 20 | // Stops the transport, and jumps to the start point 21 | // [main-thread] 22 | void(CLAP_ABI *request_stop)(const clap_host_t *host); 23 | 24 | // If not playing, starts the transport from its current position 25 | // [main-thread] 26 | void(CLAP_ABI *request_continue)(const clap_host_t *host); 27 | 28 | // If playing, stops the transport at the current position 29 | // [main-thread] 30 | void(CLAP_ABI *request_pause)(const clap_host_t *host); 31 | 32 | // Equivalent to what "space bar" does with most DAWs 33 | // [main-thread] 34 | void(CLAP_ABI *request_toggle_play)(const clap_host_t *host); 35 | 36 | // Jumps the transport to the given position. 37 | // Does not start the transport. 38 | // [main-thread] 39 | void(CLAP_ABI *request_jump)(const clap_host_t *host, clap_beattime position); 40 | 41 | // Sets the loop region 42 | // [main-thread] 43 | void(CLAP_ABI *request_loop_region)(const clap_host_t *host, 44 | clap_beattime start, 45 | clap_beattime duration); 46 | 47 | // Toggles looping 48 | // [main-thread] 49 | void(CLAP_ABI *request_toggle_loop)(const clap_host_t *host); 50 | 51 | // Enables/Disables looping 52 | // [main-thread] 53 | void(CLAP_ABI *request_enable_loop)(const clap_host_t *host, bool is_enabled); 54 | 55 | // Enables/Disables recording 56 | // [main-thread] 57 | void(CLAP_ABI *request_record)(const clap_host_t *host, bool is_recording); 58 | 59 | // Toggles recording 60 | // [main-thread] 61 | void(CLAP_ABI *request_toggle_record)(const clap_host_t *host); 62 | } clap_host_transport_control_t; 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/ambisonic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | // This extension can be used to specify the channel mapping used by the plugin. 6 | static CLAP_CONSTEXPR const char CLAP_EXT_AMBISONIC[] = "clap.ambisonic/3"; 7 | 8 | // The latest draft is 100% compatible. 9 | // This compat ID may be removed in 2026. 10 | static CLAP_CONSTEXPR const char CLAP_EXT_AMBISONIC_COMPAT[] = "clap.ambisonic.draft/3"; 11 | 12 | static CLAP_CONSTEXPR const char CLAP_PORT_AMBISONIC[] = "ambisonic"; 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | enum clap_ambisonic_ordering { 19 | // FuMa channel ordering 20 | CLAP_AMBISONIC_ORDERING_FUMA = 0, 21 | 22 | // ACN channel ordering 23 | CLAP_AMBISONIC_ORDERING_ACN = 1, 24 | }; 25 | 26 | enum clap_ambisonic_normalization { 27 | CLAP_AMBISONIC_NORMALIZATION_MAXN = 0, 28 | CLAP_AMBISONIC_NORMALIZATION_SN3D = 1, 29 | CLAP_AMBISONIC_NORMALIZATION_N3D = 2, 30 | CLAP_AMBISONIC_NORMALIZATION_SN2D = 3, 31 | CLAP_AMBISONIC_NORMALIZATION_N2D = 4, 32 | }; 33 | 34 | typedef struct clap_ambisonic_config { 35 | uint32_t ordering; // see clap_ambisonic_ordering 36 | uint32_t normalization; // see clap_ambisonic_normalization 37 | } clap_ambisonic_config_t; 38 | 39 | typedef struct clap_plugin_ambisonic { 40 | // Returns true if the given configuration is supported. 41 | // [main-thread] 42 | bool(CLAP_ABI *is_config_supported)(const clap_plugin_t *plugin, 43 | const clap_ambisonic_config_t *config); 44 | 45 | // Returns true on success 46 | // 47 | // config_id: the configuration id, see clap_plugin_audio_ports_config. 48 | // If config_id is CLAP_INVALID_ID, then this function queries the current port info. 49 | // [main-thread] 50 | bool(CLAP_ABI *get_config)(const clap_plugin_t *plugin, 51 | bool is_input, 52 | uint32_t port_index, 53 | clap_ambisonic_config_t *config); 54 | 55 | } clap_plugin_ambisonic_t; 56 | 57 | typedef struct clap_host_ambisonic { 58 | // Informs the host that the info has changed. 59 | // The info can only change when the plugin is de-activated. 60 | // [main-thread] 61 | void(CLAP_ABI *changed)(const clap_host_t *host); 62 | } clap_host_ambisonic_t; 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/thread-pool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | /// @page 6 | /// 7 | /// This extension lets the plugin use the host's thread pool. 8 | /// 9 | /// The plugin must provide @ref clap_plugin_thread_pool, and the host may provide @ref 10 | /// clap_host_thread_pool. If it doesn't, the plugin should process its data by its own means. In 11 | /// the worst case, a single threaded for-loop. 12 | /// 13 | /// Simple example with N voices to process 14 | /// 15 | /// @code 16 | /// void myplug_thread_pool_exec(const clap_plugin *plugin, uint32_t voice_index) 17 | /// { 18 | /// compute_voice(plugin, voice_index); 19 | /// } 20 | /// 21 | /// void myplug_process(const clap_plugin *plugin, const clap_process *process) 22 | /// { 23 | /// ... 24 | /// bool didComputeVoices = false; 25 | /// if (host_thread_pool && host_thread_pool.exec) 26 | /// didComputeVoices = host_thread_pool.request_exec(host, plugin, N); 27 | /// 28 | /// if (!didComputeVoices) 29 | /// for (uint32_t i = 0; i < N; ++i) 30 | /// myplug_thread_pool_exec(plugin, i); 31 | /// ... 32 | /// } 33 | /// @endcode 34 | /// 35 | /// Be aware that using a thread pool may break hard real-time rules due to the thread 36 | /// synchronization involved. 37 | /// 38 | /// If the host knows that it is running under hard real-time pressure it may decide to not 39 | /// provide this interface. 40 | 41 | static CLAP_CONSTEXPR const char CLAP_EXT_THREAD_POOL[] = "clap.thread-pool"; 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | typedef struct clap_plugin_thread_pool { 48 | // Called by the thread pool 49 | void(CLAP_ABI *exec)(const clap_plugin_t *plugin, uint32_t task_index); 50 | } clap_plugin_thread_pool_t; 51 | 52 | typedef struct clap_host_thread_pool { 53 | // Schedule num_tasks jobs in the host thread pool. 54 | // It can't be called concurrently or from the thread pool. 55 | // Will block until all the tasks are processed. 56 | // This must be used exclusively for realtime processing within the process call. 57 | // Returns true if the host did execute all the tasks, false if it rejected the request. 58 | // The host should check that the plugin is within the process call, and if not, reject the exec 59 | // request. 60 | // [audio-thread] 61 | bool(CLAP_ABI *request_exec)(const clap_host_t *host, uint32_t num_tasks); 62 | } clap_host_thread_pool_t; 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/process.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "events.h" 4 | #include "audio-buffer.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | enum { 11 | // Processing failed. The output buffer must be discarded. 12 | CLAP_PROCESS_ERROR = 0, 13 | 14 | // Processing succeeded, keep processing. 15 | CLAP_PROCESS_CONTINUE = 1, 16 | 17 | // Processing succeeded, keep processing if the output is not quiet. 18 | CLAP_PROCESS_CONTINUE_IF_NOT_QUIET = 2, 19 | 20 | // Rely upon the plugin's tail to determine if the plugin should continue to process. 21 | // see clap_plugin_tail 22 | CLAP_PROCESS_TAIL = 3, 23 | 24 | // Processing succeeded, but no more processing is required, 25 | // until the next event or variation in audio input. 26 | CLAP_PROCESS_SLEEP = 4, 27 | }; 28 | typedef int32_t clap_process_status; 29 | 30 | typedef struct clap_process { 31 | // A steady sample time counter. 32 | // This field can be used to calculate the sleep duration between two process calls. 33 | // This value may be specific to this plugin instance and have no relation to what 34 | // other plugin instances may receive. 35 | // 36 | // Set to -1 if not available, otherwise the value must be greater or equal to 0, 37 | // and must be increased by at least `frames_count` for the next call to process. 38 | int64_t steady_time; 39 | 40 | // Number of frames to process 41 | uint32_t frames_count; 42 | 43 | // time info at sample 0 44 | // If null, then this is a free running host, no transport events will be provided 45 | const clap_event_transport_t *transport; 46 | 47 | // Audio buffers, they must have the same count as specified 48 | // by clap_plugin_audio_ports->count(). 49 | // The index maps to clap_plugin_audio_ports->get(). 50 | // Input buffer and its contents are read-only. 51 | const clap_audio_buffer_t *audio_inputs; 52 | clap_audio_buffer_t *audio_outputs; 53 | uint32_t audio_inputs_count; 54 | uint32_t audio_outputs_count; 55 | 56 | // The input event list can't be modified. 57 | // Input read-only event list. The host will deliver these sorted in sample order. 58 | const clap_input_events_t *in_events; 59 | 60 | // Output event list. The plugin must insert events in sample sorted order when inserting events 61 | const clap_output_events_t *out_events; 62 | } clap_process_t; 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/clap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CLAP - CLever Audio Plugin 3 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | * 5 | * Copyright (c) 2014...2022 Alexandre BIQUE 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "entry.h" 29 | 30 | #include "factory/plugin-factory.h" 31 | #include "factory/preset-discovery.h" 32 | 33 | #include "plugin.h" 34 | #include "plugin-features.h" 35 | #include "host.h" 36 | #include "universal-plugin-id.h" 37 | 38 | #include "ext/ambisonic.h" 39 | #include "ext/audio-ports-activation.h" 40 | #include "ext/audio-ports-config.h" 41 | #include "ext/audio-ports.h" 42 | #include "ext/configurable-audio-ports.h" 43 | #include "ext/context-menu.h" 44 | #include "ext/event-registry.h" 45 | #include "ext/gui.h" 46 | #include "ext/latency.h" 47 | #include "ext/log.h" 48 | #include "ext/note-name.h" 49 | #include "ext/note-ports.h" 50 | #include "ext/param-indication.h" 51 | #include "ext/params.h" 52 | #include "ext/posix-fd-support.h" 53 | #include "ext/preset-load.h" 54 | #include "ext/remote-controls.h" 55 | #include "ext/render.h" 56 | #include "ext/state-context.h" 57 | #include "ext/state.h" 58 | #include "ext/surround.h" 59 | #include "ext/tail.h" 60 | #include "ext/thread-check.h" 61 | #include "ext/thread-pool.h" 62 | #include "ext/timer-support.h" 63 | #include "ext/track-info.h" 64 | #include "ext/voice-info.h" 65 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/track-info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | #include "../color.h" 5 | #include "../string-sizes.h" 6 | 7 | // This extension let the plugin query info about the track it's in. 8 | // It is useful when the plugin is created, to initialize some parameters (mix, dry, wet) 9 | // and pick a suitable configuration regarding audio port type and channel count. 10 | 11 | static CLAP_CONSTEXPR const char CLAP_EXT_TRACK_INFO[] = "clap.track-info/1"; 12 | 13 | // The latest draft is 100% compatible. 14 | // This compat ID may be removed in 2026. 15 | static CLAP_CONSTEXPR const char CLAP_EXT_TRACK_INFO_COMPAT[] = "clap.track-info.draft/1"; 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | enum { 22 | CLAP_TRACK_INFO_HAS_TRACK_NAME = (1 << 0), 23 | CLAP_TRACK_INFO_HAS_TRACK_COLOR = (1 << 1), 24 | CLAP_TRACK_INFO_HAS_AUDIO_CHANNEL = (1 << 2), 25 | 26 | // This plugin is on a return track, initialize with wet 100% 27 | CLAP_TRACK_INFO_IS_FOR_RETURN_TRACK = (1 << 3), 28 | 29 | // This plugin is on a bus track, initialize with appropriate settings for bus processing 30 | CLAP_TRACK_INFO_IS_FOR_BUS = (1 << 4), 31 | 32 | // This plugin is on the master, initialize with appropriate settings for channel processing 33 | CLAP_TRACK_INFO_IS_FOR_MASTER = (1 << 5), 34 | }; 35 | 36 | typedef struct clap_track_info { 37 | uint64_t flags; // see the flags above 38 | 39 | // track name, available if flags contain CLAP_TRACK_INFO_HAS_TRACK_NAME 40 | char name[CLAP_NAME_SIZE]; 41 | 42 | // track color, available if flags contain CLAP_TRACK_INFO_HAS_TRACK_COLOR 43 | clap_color_t color; 44 | 45 | // available if flags contain CLAP_TRACK_INFO_HAS_AUDIO_CHANNEL 46 | // see audio-ports.h, struct clap_audio_port_info to learn how to use channel count and port type 47 | int32_t audio_channel_count; 48 | const char *audio_port_type; 49 | } clap_track_info_t; 50 | 51 | typedef struct clap_plugin_track_info { 52 | // Called when the info changes. 53 | // [main-thread] 54 | void(CLAP_ABI *changed)(const clap_plugin_t *plugin); 55 | } clap_plugin_track_info_t; 56 | 57 | typedef struct clap_host_track_info { 58 | // Get info about the track the plugin belongs to. 59 | // Returns true on success and stores the result into info. 60 | // [main-thread] 61 | bool(CLAP_ABI *get)(const clap_host_t *host, clap_track_info_t *info); 62 | } clap_host_track_info_t; 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /ImpulseLoader/zita-resampler-1.1.0/zita-resampler/resampler-table.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #ifndef __RESAMPLER_TABLE_H 22 | #define __RESAMPLER_TABLE_H 23 | 24 | 25 | #include 26 | 27 | 28 | #define ZITA_RESAMPLER_MAJOR_VERSION 1 29 | #define ZITA_RESAMPLER_MINOR_VERSION 1 30 | 31 | 32 | extern int zita_resampler_major_version (void); 33 | extern int zita_resampler_minor_version (void); 34 | 35 | 36 | class Resampler_mutex 37 | { 38 | private: 39 | 40 | friend class Resampler_table; 41 | 42 | Resampler_mutex (void) { pthread_mutex_init (&_mutex, 0); } 43 | ~Resampler_mutex (void) { pthread_mutex_destroy (&_mutex); } 44 | void lock (void) { pthread_mutex_lock (&_mutex); } 45 | void unlock (void) { pthread_mutex_unlock (&_mutex); } 46 | 47 | pthread_mutex_t _mutex; 48 | }; 49 | 50 | 51 | class Resampler_table 52 | { 53 | public: 54 | 55 | static void print_list (void); 56 | 57 | private: 58 | 59 | Resampler_table (double fr, unsigned int hl, unsigned int np); 60 | ~Resampler_table (void); 61 | 62 | friend class Resampler; 63 | friend class VResampler; 64 | 65 | Resampler_table *_next; 66 | unsigned int _refc; 67 | float *_ctab; 68 | double _fr; 69 | unsigned int _hl; 70 | unsigned int _np; 71 | 72 | static Resampler_table *create (double fr, unsigned int hl, unsigned int np); 73 | static void destroy (Resampler_table *T); 74 | 75 | static Resampler_table *_list; 76 | static Resampler_mutex _mutex; 77 | }; 78 | 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/zita-resampler-1.1.0/zita-resampler/resampler-table.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #ifndef __RESAMPLER_TABLE_H 22 | #define __RESAMPLER_TABLE_H 23 | 24 | 25 | #include 26 | 27 | 28 | #define ZITA_RESAMPLER_MAJOR_VERSION 1 29 | #define ZITA_RESAMPLER_MINOR_VERSION 1 30 | 31 | 32 | extern int zita_resampler_major_version (void); 33 | extern int zita_resampler_minor_version (void); 34 | 35 | 36 | class Resampler_mutex 37 | { 38 | private: 39 | 40 | friend class Resampler_table; 41 | 42 | Resampler_mutex (void) { pthread_mutex_init (&_mutex, 0); } 43 | ~Resampler_mutex (void) { pthread_mutex_destroy (&_mutex); } 44 | void lock (void) { pthread_mutex_lock (&_mutex); } 45 | void unlock (void) { pthread_mutex_unlock (&_mutex); } 46 | 47 | pthread_mutex_t _mutex; 48 | }; 49 | 50 | 51 | class Resampler_table 52 | { 53 | public: 54 | 55 | static void print_list (void); 56 | 57 | private: 58 | 59 | Resampler_table (double fr, unsigned int hl, unsigned int np); 60 | ~Resampler_table (void); 61 | 62 | friend class Resampler; 63 | friend class VResampler; 64 | 65 | Resampler_table *_next; 66 | unsigned int _refc; 67 | float *_ctab; 68 | double _fr; 69 | unsigned int _hl; 70 | unsigned int _np; 71 | 72 | static Resampler_table *create (double fr, unsigned int hl, unsigned int np); 73 | static void destroy (Resampler_table *T); 74 | 75 | static Resampler_table *_list; 76 | static Resampler_mutex _mutex; 77 | }; 78 | 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /ImpulseLoader/zita-resampler-1.1.0/zita-resampler/resampler.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #ifndef __RESAMPLER_H 22 | #define __RESAMPLER_H 23 | 24 | 25 | #include 26 | 27 | 28 | class Resampler 29 | { 30 | public: 31 | 32 | Resampler (void); 33 | ~Resampler (void); 34 | 35 | int setup (unsigned int fs_inp, 36 | unsigned int fs_out, 37 | unsigned int nchan, 38 | unsigned int hlen); 39 | 40 | int setup (unsigned int fs_inp, 41 | unsigned int fs_out, 42 | unsigned int nchan, 43 | unsigned int hlen, 44 | double frel); 45 | 46 | void clear (void); 47 | int reset (void); 48 | int nchan (void) const { return _nchan; } 49 | int filtlen (void) const { return inpsize (); } // Deprecated 50 | int inpsize (void) const; 51 | double inpdist (void) const; 52 | int process (void); 53 | 54 | unsigned int inp_count; 55 | unsigned int out_count; 56 | float *inp_data; 57 | float *out_data; 58 | void *inp_list; 59 | void *out_list; 60 | 61 | private: 62 | 63 | Resampler_table *_table; 64 | unsigned int _nchan; 65 | unsigned int _inmax; 66 | unsigned int _index; 67 | unsigned int _nread; 68 | unsigned int _nzero; 69 | unsigned int _phase; 70 | unsigned int _pstep; 71 | float *_buff; 72 | void *_dummy [8]; 73 | }; 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/zita-resampler-1.1.0/zita-resampler/resampler.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #ifndef __RESAMPLER_H 22 | #define __RESAMPLER_H 23 | 24 | 25 | #include 26 | 27 | 28 | class Resampler 29 | { 30 | public: 31 | 32 | Resampler (void); 33 | ~Resampler (void); 34 | 35 | int setup (unsigned int fs_inp, 36 | unsigned int fs_out, 37 | unsigned int nchan, 38 | unsigned int hlen); 39 | 40 | int setup (unsigned int fs_inp, 41 | unsigned int fs_out, 42 | unsigned int nchan, 43 | unsigned int hlen, 44 | double frel); 45 | 46 | void clear (void); 47 | int reset (void); 48 | int nchan (void) const { return _nchan; } 49 | int filtlen (void) const { return inpsize (); } // Deprecated 50 | int inpsize (void) const; 51 | double inpdist (void) const; 52 | int process (void); 53 | 54 | unsigned int inp_count; 55 | unsigned int out_count; 56 | float *inp_data; 57 | float *out_data; 58 | void *inp_list; 59 | void *out_list; 60 | 61 | private: 62 | 63 | Resampler_table *_table; 64 | unsigned int _nchan; 65 | unsigned int _inmax; 66 | unsigned int _index; 67 | unsigned int _nread; 68 | unsigned int _nzero; 69 | unsigned int _phase; 70 | unsigned int _pstep; 71 | float *_buff; 72 | void *_dummy [8]; 73 | }; 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/configurable-audio-ports.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "audio-ports.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | // This extension lets the host configure the plugin's input and output audio ports. 10 | // This is a "push" approach to audio ports configuration. 11 | 12 | static CLAP_CONSTEXPR const char CLAP_EXT_CONFIGURABLE_AUDIO_PORTS[] = 13 | "clap.configurable-audio-ports/1"; 14 | 15 | // The latest draft is 100% compatible. 16 | // This compat ID may be removed in 2026. 17 | static CLAP_CONSTEXPR const char CLAP_EXT_CONFIGURABLE_AUDIO_PORTS_COMPAT[] = 18 | "clap.configurable-audio-ports.draft1"; 19 | 20 | typedef struct clap_audio_port_configuration_request { 21 | // Identifies the port by is_input and port_index 22 | bool is_input; 23 | uint32_t port_index; 24 | 25 | // The requested number of channels. 26 | uint32_t channel_count; 27 | 28 | // The port type, see audio-ports.h, clap_audio_port_info.port_type for interpretation. 29 | const char *port_type; 30 | 31 | // cast port_details according to port_type: 32 | // - CLAP_PORT_MONO: (discard) 33 | // - CLAP_PORT_STEREO: (discard) 34 | // - CLAP_PORT_SURROUND: const uint8_t *channel_map 35 | // - CLAP_PORT_AMBISONIC: const clap_ambisonic_config_t *info 36 | const void *port_details; 37 | } clap_audio_port_configuration_request_t; 38 | 39 | typedef struct clap_plugin_configurable_audio_ports { 40 | // Returns true if the given configurations can be applied using apply_configuration(). 41 | // [main-thread && !active] 42 | bool(CLAP_ABI *can_apply_configuration)( 43 | const clap_plugin_t *plugin, 44 | const struct clap_audio_port_configuration_request *requests, 45 | uint32_t request_count); 46 | 47 | // Submit a bunch of configuration requests which will atomically be applied together, 48 | // or discarded together. 49 | // 50 | // Once the configuration is successfully applied, it isn't necessary for the plugin to call 51 | // clap_host_audio_ports->changed(); and it isn't necessary for the host to scan the 52 | // audio ports. 53 | // 54 | // Returns true if applied. 55 | // [main-thread && !active] 56 | bool(CLAP_ABI *apply_configuration)(const clap_plugin_t *plugin, 57 | const struct clap_audio_port_configuration_request *requests, 58 | uint32_t request_count); 59 | } clap_plugin_configurable_audio_ports_t; 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/lv2_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 0BSD 3 | * 4 | * BSD Zero Clause License 5 | * 6 | * Copyright (c) 2019 Hermann Meyer 7 | * 8 | * Permission to use, copy, modify, and/or distribute this software for any 9 | * purpose with or without fee is hereby granted. 10 | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 12 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 | * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 14 | * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 | * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 16 | * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 | * PERFORMANCE OF THIS SOFTWARE. 18 | * 19 | */ 20 | 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #if defined USE_ATOM || defined USE_MIDI 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef LV2_UI__scaleFactor 38 | #define LV2_UI__scaleFactor "http://lv2plug.in/ns/extensions/ui#scaleFactor" 39 | #endif 40 | 41 | 42 | 43 | #define PLUGIN_UI_URI "urn:brummer:ImpulseLoader_ui" 44 | 45 | #define XLV2__IRFILE "urn:brummer:ImpulseLoader#irfile" 46 | #define XLV2__GUI "urn:brummer:ImpulseLoader#gui" 47 | 48 | #define OBJ_BUF_SIZE 1024 49 | 50 | 51 | typedef struct { 52 | LV2_URID conv_ir_file; 53 | LV2_URID atom_Object; 54 | LV2_URID atom_Int; 55 | LV2_URID atom_Float; 56 | LV2_URID atom_Bool; 57 | LV2_URID atom_Vector; 58 | LV2_URID atom_Path; 59 | LV2_URID atom_String; 60 | LV2_URID atom_URID; 61 | LV2_URID atom_eventTransfer; 62 | LV2_URID patch_Put; 63 | LV2_URID patch_Get; 64 | LV2_URID patch_Set; 65 | LV2_URID patch_property; 66 | LV2_URID patch_value; 67 | } X11LV2URIs; 68 | 69 | #pragma once 70 | 71 | #ifndef LV2_PLUGIN_H_ 72 | #define LV2_PLUGIN_H_ 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | 79 | struct Interface { 80 | LV2_URID_Map* map; 81 | void *controller; 82 | LV2UI_Write_Function write_function; 83 | LV2UI_Resize* resize; 84 | LV2_Atom_Forge forge; 85 | X11LV2URIs uris; 86 | }; 87 | 88 | #include "widgets.h" 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif //LV2_PLUGIN_H_ 95 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/thread-check.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_THREAD_CHECK[] = "clap.thread-check"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /// @page thread-check 12 | /// 13 | /// CLAP defines two symbolic threads: 14 | /// 15 | /// main-thread: 16 | /// This is the thread in which most of the interaction between the plugin and host happens. 17 | /// This will be the same OS thread throughout the lifetime of the plug-in. 18 | /// On macOS and Windows, this must be the thread on which gui and timer events are received 19 | /// (i.e., the main thread of the program). 20 | /// It isn't a realtime thread, yet this thread needs to respond fast enough to user interaction, 21 | /// so it is recommended to run long and expensive tasks such as preset indexing or asset loading 22 | /// in dedicated background threads. 23 | /// 24 | /// audio-thread: 25 | /// This thread is used for realtime audio processing. Its execution should be as deterministic 26 | /// as possible to meet the audio interface's deadline (can be <1ms). In other words, there is a 27 | /// known set of operations that should be avoided: malloc() and free(), mutexes (spin mutexes 28 | /// are worse), I/O, waiting, ... 29 | /// The audio-thread is something symbolic, there isn't one OS thread that remains the 30 | /// audio-thread for the plugin lifetime. As you may guess, the host is likely to have a 31 | /// thread pool and the plugin.process() call may be scheduled on different OS threads over time. 32 | /// The most important thing is that there can't be two audio-threads at the same time. All the 33 | /// functions marked with [audio-thread] **ARE NOT CONCURRENT**. The host may mark any OS thread, 34 | /// including the main-thread as the audio-thread, as long as it can guarantee that only one OS 35 | /// thread is the audio-thread at a time. The audio-thread can be seen as a concurrency guard for 36 | /// all functions marked with [audio-thread]. 37 | 38 | // This interface is useful to do runtime checks and make 39 | // sure that the functions are called on the correct threads. 40 | // It is highly recommended that hosts implement this extension. 41 | typedef struct clap_host_thread_check { 42 | // Returns true if "this" thread is the main thread. 43 | // [thread-safe] 44 | bool(CLAP_ABI *is_main_thread)(const clap_host_t *host); 45 | 46 | // Returns true if "this" thread is one of the audio threads. 47 | // [thread-safe] 48 | bool(CLAP_ABI *is_audio_thread)(const clap_host_t *host); 49 | } clap_host_thread_check_t; 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/audio-ports-activation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | /// @page Audio Ports Activation 6 | /// 7 | /// This extension provides a way for the host to activate and de-activate audio ports. 8 | /// Deactivating a port provides the following benefits: 9 | /// - the plugin knows ahead of time that a given input is not present and can choose 10 | /// an optimized computation path, 11 | /// - the plugin knows that an output is not consumed by the host, and doesn't need to 12 | /// compute it. 13 | /// 14 | /// Audio ports can only be activated or deactivated when the plugin is deactivated, unless 15 | /// can_activate_while_processing() returns true. 16 | /// 17 | /// Audio buffers must still be provided if the audio port is deactivated. 18 | /// In such case, they shall be filled with 0 (or whatever is the neutral value in your context) 19 | /// and the constant_mask shall be set. 20 | /// 21 | /// Audio ports are initially in the active state after creating the plugin instance. 22 | /// Audio ports state are not saved in the plugin state, so the host must restore the 23 | /// audio ports state after creating the plugin instance. 24 | /// 25 | /// Audio ports state is invalidated by clap_plugin_audio_ports_config.select() and 26 | /// clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_LIST). 27 | 28 | static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_ACTIVATION[] = 29 | "clap.audio-ports-activation/2"; 30 | 31 | // The latest draft is 100% compatible. 32 | // This compat ID may be removed in 2026. 33 | static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_ACTIVATION_COMPAT[] = 34 | "clap.audio-ports-activation/draft-2"; 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | typedef struct clap_plugin_audio_ports_activation { 41 | // Returns true if the plugin supports activation/deactivation while processing. 42 | // [main-thread] 43 | bool(CLAP_ABI *can_activate_while_processing)(const clap_plugin_t *plugin); 44 | 45 | // Activate the given port. 46 | // 47 | // It is only possible to activate and de-activate on the audio-thread if 48 | // can_activate_while_processing() returns true. 49 | // 50 | // sample_size indicate if the host will provide 32 bit audio buffers or 64 bits one. 51 | // Possible values are: 32, 64 or 0 if unspecified. 52 | // 53 | // returns false if failed, or invalid parameters 54 | // [active ? audio-thread : main-thread] 55 | bool(CLAP_ABI *set_active)(const clap_plugin_t *plugin, 56 | bool is_input, 57 | uint32_t port_index, 58 | bool is_active, 59 | uint32_t sample_size); 60 | } clap_plugin_audio_ports_activation_t; 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | -------------------------------------------------------------------------------- /ImpulseLoader/engine/gx_resampler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | * -------------------------------------------------------------------------- 18 | */ 19 | 20 | 21 | #pragma once 22 | 23 | #ifndef SRC_HEADERS_GX_RESAMPLER_H_ 24 | #define SRC_HEADERS_GX_RESAMPLER_H_ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace gx_resample 33 | { 34 | 35 | #define MAX_UPSAMPLE 8 36 | 37 | 38 | class FixedRateResampler { 39 | private: 40 | Resampler r_up, r_down; 41 | int inputRate, outputRate; 42 | public: 43 | int setup(int _inputRate, int _outputRate); 44 | int up(int count, float *input, float *output); 45 | void down(float *input, float *output); 46 | int max_out_count(int in_count) { 47 | return static_cast(ceil((in_count*static_cast(outputRate))/inputRate)); } 48 | }; 49 | 50 | class SimpleResampler 51 | { 52 | private: 53 | Resampler r_up, r_down; 54 | int32_t m_fact; 55 | int32_t ratio_a; 56 | int32_t ratio_b; 57 | public: 58 | SimpleResampler(): r_up(), r_down(), m_fact() {} 59 | void setup(int32_t sampleRate, uint32_t fact); 60 | int32_t up(int32_t count, float *input, float *output); 61 | void down(int32_t count, float *input, float *output); 62 | int32_t get_max_out_size(int32_t i_size) 63 | { 64 | return (i_size * ratio_b) / ratio_a + 1; 65 | } 66 | }; 67 | 68 | class BufferResampler: Resampler 69 | { 70 | public: 71 | float *process(int32_t fs_inp, int32_t ilen, float *input, int32_t fs_outp, int32_t* olen); 72 | }; 73 | 74 | class StreamingResampler: Resampler 75 | { 76 | private: 77 | int32_t ratio_a; 78 | int32_t ratio_b; 79 | public: 80 | bool setup(int32_t srcRate, int32_t dstRate, int32_t nchan); 81 | int32_t get_max_out_size(int32_t i_size) 82 | { 83 | return (i_size * ratio_b) / ratio_a + 1; 84 | } 85 | int32_t process(int32_t count, float *input, float *output); 86 | int32_t flush(float *output); // check source for max. output size 87 | }; 88 | 89 | } 90 | #endif // SRC_HEADERS_GX_RESAMPLER_H_ 91 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/gx_resampler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | * -------------------------------------------------------------------------- 18 | */ 19 | 20 | 21 | #pragma once 22 | 23 | #ifndef SRC_HEADERS_GX_RESAMPLER_H_ 24 | #define SRC_HEADERS_GX_RESAMPLER_H_ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace gx_resample 33 | { 34 | 35 | #define MAX_UPSAMPLE 8 36 | 37 | 38 | class FixedRateResampler { 39 | private: 40 | Resampler r_up, r_down; 41 | int inputRate, outputRate; 42 | public: 43 | int setup(int _inputRate, int _outputRate); 44 | int up(int count, float *input, float *output); 45 | void down(float *input, float *output); 46 | int max_out_count(int in_count) { 47 | return static_cast(ceil((in_count*static_cast(outputRate))/inputRate)); } 48 | }; 49 | 50 | class SimpleResampler 51 | { 52 | private: 53 | Resampler r_up, r_down; 54 | int32_t m_fact; 55 | int32_t ratio_a; 56 | int32_t ratio_b; 57 | public: 58 | SimpleResampler(): r_up(), r_down(), m_fact() {} 59 | void setup(int32_t sampleRate, uint32_t fact); 60 | int32_t up(int32_t count, float *input, float *output); 61 | void down(int32_t count, float *input, float *output); 62 | int32_t get_max_out_size(int32_t i_size) 63 | { 64 | return (i_size * ratio_b) / ratio_a + 1; 65 | } 66 | }; 67 | 68 | class BufferResampler: Resampler 69 | { 70 | public: 71 | float *process(int32_t fs_inp, int32_t ilen, float *input, int32_t fs_outp, int32_t* olen); 72 | }; 73 | 74 | class StreamingResampler: Resampler 75 | { 76 | private: 77 | int32_t ratio_a; 78 | int32_t ratio_b; 79 | public: 80 | bool setup(int32_t srcRate, int32_t dstRate, int32_t nchan); 81 | int32_t get_max_out_size(int32_t i_size) 82 | { 83 | return (i_size * ratio_b) / ratio_a + 1; 84 | } 85 | int32_t process(int32_t count, float *input, float *output); 86 | int32_t flush(float *output); // check source for max. output size 87 | }; 88 | 89 | } 90 | #endif // SRC_HEADERS_GX_RESAMPLER_H_ 91 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/state-context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | #include "../stream.h" 5 | 6 | /// @page state-context extension 7 | /// @brief extended state handling 8 | /// 9 | /// This extension lets the host save and load the plugin state with different semantics depending 10 | /// on the context. 11 | /// 12 | /// Briefly, when loading a preset or duplicating a device, the plugin may want to partially load 13 | /// the state and initialize certain things differently, like handling limited resources or fixed 14 | /// connections to external hardware resources. 15 | /// 16 | /// Save and Load operations may have a different context. 17 | /// All three operations should be equivalent: 18 | /// 1. clap_plugin_state_context.load(clap_plugin_state.save(), CLAP_STATE_CONTEXT_FOR_PRESET) 19 | /// 2. clap_plugin_state.load(clap_plugin_state_context.save(CLAP_STATE_CONTEXT_FOR_PRESET)) 20 | /// 3. clap_plugin_state_context.load( 21 | /// clap_plugin_state_context.save(CLAP_STATE_CONTEXT_FOR_PRESET), 22 | /// CLAP_STATE_CONTEXT_FOR_PRESET) 23 | /// 24 | /// If in doubt, fallback to clap_plugin_state. 25 | /// 26 | /// If the plugin implements CLAP_EXT_STATE_CONTEXT then it is mandatory to also implement 27 | /// CLAP_EXT_STATE. 28 | /// 29 | /// It is unspecified which context is equivalent to clap_plugin_state.{save,load}() 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | static CLAP_CONSTEXPR const char CLAP_EXT_STATE_CONTEXT[] = "clap.state-context/2"; 36 | 37 | enum clap_plugin_state_context_type { 38 | // suitable for storing and loading a state as a preset 39 | CLAP_STATE_CONTEXT_FOR_PRESET = 1, 40 | 41 | // suitable for duplicating a plugin instance 42 | CLAP_STATE_CONTEXT_FOR_DUPLICATE = 2, 43 | 44 | // suitable for storing and loading a state within a project/song 45 | CLAP_STATE_CONTEXT_FOR_PROJECT = 3, 46 | }; 47 | 48 | typedef struct clap_plugin_state_context { 49 | // Saves the plugin state into stream, according to context_type. 50 | // Returns true if the state was correctly saved. 51 | // 52 | // Note that the result may be loaded by both clap_plugin_state.load() and 53 | // clap_plugin_state_context.load(). 54 | // [main-thread] 55 | bool(CLAP_ABI *save)(const clap_plugin_t *plugin, 56 | const clap_ostream_t *stream, 57 | uint32_t context_type); 58 | 59 | // Loads the plugin state from stream, according to context_type. 60 | // Returns true if the state was correctly restored. 61 | // 62 | // Note that the state may have been saved by clap_plugin_state.save() or 63 | // clap_plugin_state_context.save() with a different context_type. 64 | // [main-thread] 65 | bool(CLAP_ABI *load)(const clap_plugin_t *plugin, 66 | const clap_istream_t *stream, 67 | uint32_t context_type); 68 | } clap_plugin_state_context_t; 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/note-ports.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | #include "../string-sizes.h" 5 | 6 | /// @page Note Ports 7 | /// 8 | /// This extension provides a way for the plugin to describe its current note ports. 9 | /// If the plugin does not implement this extension, it won't have note input or output. 10 | /// The plugin is only allowed to change its note ports configuration while it is deactivated. 11 | 12 | static CLAP_CONSTEXPR const char CLAP_EXT_NOTE_PORTS[] = "clap.note-ports"; 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | enum clap_note_dialect { 19 | // Uses clap_event_note and clap_event_note_expression. 20 | CLAP_NOTE_DIALECT_CLAP = 1 << 0, 21 | 22 | // Uses clap_event_midi, no polyphonic expression 23 | CLAP_NOTE_DIALECT_MIDI = 1 << 1, 24 | 25 | // Uses clap_event_midi, with polyphonic expression (MPE) 26 | CLAP_NOTE_DIALECT_MIDI_MPE = 1 << 2, 27 | 28 | // Uses clap_event_midi2 29 | CLAP_NOTE_DIALECT_MIDI2 = 1 << 3, 30 | }; 31 | 32 | typedef struct clap_note_port_info { 33 | // id identifies a port and must be stable. 34 | // id may overlap between input and output ports. 35 | clap_id id; 36 | uint32_t supported_dialects; // bitfield, see clap_note_dialect 37 | uint32_t preferred_dialect; // one value of clap_note_dialect 38 | char name[CLAP_NAME_SIZE]; // displayable name, i18n? 39 | } clap_note_port_info_t; 40 | 41 | // The note ports scan has to be done while the plugin is deactivated. 42 | typedef struct clap_plugin_note_ports { 43 | // Number of ports, for either input or output. 44 | // [main-thread] 45 | uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin, bool is_input); 46 | 47 | // Get info about a note port. 48 | // Returns true on success and stores the result into info. 49 | // [main-thread] 50 | bool(CLAP_ABI *get)(const clap_plugin_t *plugin, 51 | uint32_t index, 52 | bool is_input, 53 | clap_note_port_info_t *info); 54 | } clap_plugin_note_ports_t; 55 | 56 | enum { 57 | // The ports have changed, the host shall perform a full scan of the ports. 58 | // This flag can only be used if the plugin is not active. 59 | // If the plugin active, call host->request_restart() and then call rescan() 60 | // when the host calls deactivate() 61 | CLAP_NOTE_PORTS_RESCAN_ALL = 1 << 0, 62 | 63 | // The ports name did change, the host can scan them right away. 64 | CLAP_NOTE_PORTS_RESCAN_NAMES = 1 << 1, 65 | }; 66 | 67 | typedef struct clap_host_note_ports { 68 | // Query which dialects the host supports 69 | // [main-thread] 70 | uint32_t(CLAP_ABI *supported_dialects)(const clap_host_t *host); 71 | 72 | // Rescan the full list of note ports according to the flags. 73 | // [main-thread] 74 | void(CLAP_ABI *rescan)(const clap_host_t *host, uint32_t flags); 75 | } clap_host_note_ports_t; 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/draft/tuning.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../plugin.h" 4 | #include "../../events.h" 5 | #include "../../string-sizes.h" 6 | 7 | static CLAP_CONSTEXPR const char CLAP_EXT_TUNING[] = "clap.tuning/2"; 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | // Use clap_host_event_registry->query(host, CLAP_EXT_TUNING, &space_id) to know the event space. 14 | // 15 | // This event defines the tuning to be used on the given port/channel. 16 | typedef struct clap_event_tuning { 17 | clap_event_header_t header; 18 | 19 | int16_t port_index; // -1 global 20 | int16_t channel; // 0..15, -1 global 21 | clap_id tunning_id; 22 | } clap_event_tuning_t; 23 | 24 | typedef struct clap_tuning_info { 25 | clap_id tuning_id; 26 | char name[CLAP_NAME_SIZE]; 27 | bool is_dynamic; // true if the values may vary with time 28 | } clap_tuning_info_t; 29 | 30 | typedef struct clap_plugin_tuning { 31 | // Called when a tuning is added or removed from the pool. 32 | // [main-thread] 33 | void(CLAP_ABI *changed)(const clap_plugin_t *plugin); 34 | } clap_plugin_tuning_t; 35 | 36 | // This extension provides a dynamic tuning table to the plugin. 37 | typedef struct clap_host_tuning { 38 | // Gets the relative tuning in semitones against equal temperament with A4=440Hz. 39 | // The plugin may query the tuning at a rate that makes sense for *low* frequency modulations. 40 | // 41 | // If the tuning_id is not found or equals to CLAP_INVALID_ID, 42 | // then the function shall gracefully return a sensible value. 43 | // 44 | // sample_offset is the sample offset from the beginning of the current process block. 45 | // 46 | // should_play(...) should be checked before calling this function. 47 | // 48 | // [audio-thread & in-process] 49 | double(CLAP_ABI *get_relative)(const clap_host_t *host, 50 | clap_id tuning_id, 51 | int32_t channel, 52 | int32_t key, 53 | uint32_t sample_offset); 54 | 55 | // Returns true if the note should be played. 56 | // [audio-thread & in-process] 57 | bool(CLAP_ABI *should_play)(const clap_host_t *host, 58 | clap_id tuning_id, 59 | int32_t channel, 60 | int32_t key); 61 | 62 | // Returns the number of tunings in the pool. 63 | // [main-thread] 64 | uint32_t(CLAP_ABI *get_tuning_count)(const clap_host_t *host); 65 | 66 | // Gets info about a tuning 67 | // Returns true on success and stores the result into info. 68 | // [main-thread] 69 | bool(CLAP_ABI *get_info)(const clap_host_t *host, 70 | uint32_t tuning_index, 71 | clap_tuning_info_t *info); 72 | } clap_host_tuning_t; 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/remote-controls.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | #include "../string-sizes.h" 5 | 6 | // This extension let the plugin provide a structured way of mapping parameters to an hardware 7 | // controller. 8 | // 9 | // This is done by providing a set of remote control pages organized by section. 10 | // A page contains up to 8 controls, which references parameters using param_id. 11 | // 12 | // |`- [section:main] 13 | // | `- [name:main] performance controls 14 | // |`- [section:osc] 15 | // | |`- [name:osc1] osc1 page 16 | // | |`- [name:osc2] osc2 page 17 | // | |`- [name:osc-sync] osc sync page 18 | // | `- [name:osc-noise] osc noise page 19 | // |`- [section:filter] 20 | // | |`- [name:flt1] filter 1 page 21 | // | `- [name:flt2] filter 2 page 22 | // |`- [section:env] 23 | // | |`- [name:env1] env1 page 24 | // | `- [name:env2] env2 page 25 | // |`- [section:lfo] 26 | // | |`- [name:lfo1] env1 page 27 | // | `- [name:lfo2] env2 page 28 | // `- etc... 29 | // 30 | // One possible workflow is to have a set of buttons, which correspond to a section. 31 | // Pressing that button once gets you to the first page of the section. 32 | // Press it again to cycle through the section's pages. 33 | 34 | static CLAP_CONSTEXPR const char CLAP_EXT_REMOTE_CONTROLS[] = "clap.remote-controls/2"; 35 | 36 | // The latest draft is 100% compatible 37 | // This compat ID may be removed in 2026. 38 | static CLAP_CONSTEXPR const char CLAP_EXT_REMOTE_CONTROLS_COMPAT[] = "clap.remote-controls.draft/2"; 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | enum { CLAP_REMOTE_CONTROLS_COUNT = 8 }; 45 | 46 | typedef struct clap_remote_controls_page { 47 | char section_name[CLAP_NAME_SIZE]; 48 | clap_id page_id; 49 | char page_name[CLAP_NAME_SIZE]; 50 | clap_id param_ids[CLAP_REMOTE_CONTROLS_COUNT]; 51 | 52 | // This is used to separate device pages versus preset pages. 53 | // If true, then this page is specific to this preset. 54 | bool is_for_preset; 55 | } clap_remote_controls_page_t; 56 | 57 | typedef struct clap_plugin_remote_controls { 58 | // Returns the number of pages. 59 | // [main-thread] 60 | uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin); 61 | 62 | // Get a page by index. 63 | // Returns true on success and stores the result into page. 64 | // [main-thread] 65 | bool(CLAP_ABI *get)(const clap_plugin_t *plugin, 66 | uint32_t page_index, 67 | clap_remote_controls_page_t *page); 68 | } clap_plugin_remote_controls_t; 69 | 70 | typedef struct clap_host_remote_controls { 71 | // Informs the host that the remote controls have changed. 72 | // [main-thread] 73 | void(CLAP_ABI *changed)(const clap_host_t *host); 74 | 75 | // Suggest a page to the host because it corresponds to what the user is currently editing in the 76 | // plugin's GUI. 77 | // [main-thread] 78 | void(CLAP_ABI *suggest_page)(const clap_host_t *host, clap_id page_id); 79 | } clap_host_remote_controls_t; 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/plugin-features.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // This file provides a set of standard plugin features meant to be used 4 | // within clap_plugin_descriptor.features. 5 | // 6 | // For practical reasons we'll avoid spaces and use `-` instead to facilitate 7 | // scripts that generate the feature array. 8 | // 9 | // Non-standard features should be formatted as follow: "$namespace:$feature" 10 | 11 | ///////////////////// 12 | // Plugin category // 13 | ///////////////////// 14 | 15 | // Add this feature if your plugin can process note events and then produce audio 16 | #define CLAP_PLUGIN_FEATURE_INSTRUMENT "instrument" 17 | 18 | // Add this feature if your plugin is an audio effect 19 | #define CLAP_PLUGIN_FEATURE_AUDIO_EFFECT "audio-effect" 20 | 21 | // Add this feature if your plugin is a note effect or a note generator/sequencer 22 | #define CLAP_PLUGIN_FEATURE_NOTE_EFFECT "note-effect" 23 | 24 | // Add this feature if your plugin converts audio to notes 25 | #define CLAP_PLUGIN_FEATURE_NOTE_DETECTOR "note-detector" 26 | 27 | // Add this feature if your plugin is an analyzer 28 | #define CLAP_PLUGIN_FEATURE_ANALYZER "analyzer" 29 | 30 | ///////////////////////// 31 | // Plugin sub-category // 32 | ///////////////////////// 33 | 34 | #define CLAP_PLUGIN_FEATURE_SYNTHESIZER "synthesizer" 35 | #define CLAP_PLUGIN_FEATURE_SAMPLER "sampler" 36 | #define CLAP_PLUGIN_FEATURE_DRUM "drum" // For single drum 37 | #define CLAP_PLUGIN_FEATURE_DRUM_MACHINE "drum-machine" 38 | 39 | #define CLAP_PLUGIN_FEATURE_FILTER "filter" 40 | #define CLAP_PLUGIN_FEATURE_PHASER "phaser" 41 | #define CLAP_PLUGIN_FEATURE_EQUALIZER "equalizer" 42 | #define CLAP_PLUGIN_FEATURE_DEESSER "de-esser" 43 | #define CLAP_PLUGIN_FEATURE_PHASE_VOCODER "phase-vocoder" 44 | #define CLAP_PLUGIN_FEATURE_GRANULAR "granular" 45 | #define CLAP_PLUGIN_FEATURE_FREQUENCY_SHIFTER "frequency-shifter" 46 | #define CLAP_PLUGIN_FEATURE_PITCH_SHIFTER "pitch-shifter" 47 | 48 | #define CLAP_PLUGIN_FEATURE_DISTORTION "distortion" 49 | #define CLAP_PLUGIN_FEATURE_TRANSIENT_SHAPER "transient-shaper" 50 | #define CLAP_PLUGIN_FEATURE_COMPRESSOR "compressor" 51 | #define CLAP_PLUGIN_FEATURE_EXPANDER "expander" 52 | #define CLAP_PLUGIN_FEATURE_GATE "gate" 53 | #define CLAP_PLUGIN_FEATURE_LIMITER "limiter" 54 | 55 | #define CLAP_PLUGIN_FEATURE_FLANGER "flanger" 56 | #define CLAP_PLUGIN_FEATURE_CHORUS "chorus" 57 | #define CLAP_PLUGIN_FEATURE_DELAY "delay" 58 | #define CLAP_PLUGIN_FEATURE_REVERB "reverb" 59 | 60 | #define CLAP_PLUGIN_FEATURE_TREMOLO "tremolo" 61 | #define CLAP_PLUGIN_FEATURE_GLITCH "glitch" 62 | 63 | #define CLAP_PLUGIN_FEATURE_UTILITY "utility" 64 | #define CLAP_PLUGIN_FEATURE_PITCH_CORRECTION "pitch-correction" 65 | #define CLAP_PLUGIN_FEATURE_RESTORATION "restoration" // repair the sound 66 | 67 | #define CLAP_PLUGIN_FEATURE_MULTI_EFFECTS "multi-effects" 68 | 69 | #define CLAP_PLUGIN_FEATURE_MIXING "mixing" 70 | #define CLAP_PLUGIN_FEATURE_MASTERING "mastering" 71 | 72 | //////////////////////// 73 | // Audio Capabilities // 74 | //////////////////////// 75 | 76 | #define CLAP_PLUGIN_FEATURE_MONO "mono" 77 | #define CLAP_PLUGIN_FEATURE_STEREO "stereo" 78 | #define CLAP_PLUGIN_FEATURE_SURROUND "surround" 79 | #define CLAP_PLUGIN_FEATURE_AMBISONIC "ambisonic" 80 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/param-indication.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "params.h" 4 | #include "../color.h" 5 | 6 | // This extension lets the host tell the plugin to display a little color based indication on the 7 | // parameter. This can be used to indicate: 8 | // - a physical controller is mapped to a parameter 9 | // - the parameter is current playing an automation 10 | // - the parameter is overriding the automation 11 | // - etc... 12 | // 13 | // The color semantic depends upon the host here and the goal is to have a consistent experience 14 | // across all plugins. 15 | 16 | static CLAP_CONSTEXPR const char CLAP_EXT_PARAM_INDICATION[] = "clap.param-indication/4"; 17 | 18 | // The latest draft is 100% compatible. 19 | // This compat ID may be removed in 2026. 20 | static CLAP_CONSTEXPR const char CLAP_EXT_PARAM_INDICATION_COMPAT[] = "clap.param-indication.draft/4"; 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | enum { 27 | // The host doesn't have an automation for this parameter 28 | CLAP_PARAM_INDICATION_AUTOMATION_NONE = 0, 29 | 30 | // The host has an automation for this parameter, but it isn't playing it 31 | CLAP_PARAM_INDICATION_AUTOMATION_PRESENT = 1, 32 | 33 | // The host is playing an automation for this parameter 34 | CLAP_PARAM_INDICATION_AUTOMATION_PLAYING = 2, 35 | 36 | // The host is recording an automation on this parameter 37 | CLAP_PARAM_INDICATION_AUTOMATION_RECORDING = 3, 38 | 39 | // The host should play an automation for this parameter, but the user has started to adjust this 40 | // parameter and is overriding the automation playback 41 | CLAP_PARAM_INDICATION_AUTOMATION_OVERRIDING = 4, 42 | }; 43 | 44 | typedef struct clap_plugin_param_indication { 45 | // Sets or clears a mapping indication. 46 | // 47 | // has_mapping: does the parameter currently has a mapping? 48 | // color: if set, the color to use to highlight the control in the plugin GUI 49 | // label: if set, a small string to display on top of the knob which identifies the hardware 50 | // controller description: if set, a string which can be used in a tooltip, which describes the 51 | // current mapping 52 | // 53 | // Parameter indications should not be saved in the plugin context, and are off by default. 54 | // [main-thread] 55 | void(CLAP_ABI *set_mapping)(const clap_plugin_t *plugin, 56 | clap_id param_id, 57 | bool has_mapping, 58 | const clap_color_t *color, 59 | const char *label, 60 | const char *description); 61 | 62 | // Sets or clears an automation indication. 63 | // 64 | // automation_state: current automation state for the given parameter 65 | // color: if set, the color to use to display the automation indication in the plugin GUI 66 | // 67 | // Parameter indications should not be saved in the plugin context, and are off by default. 68 | // [main-thread] 69 | void(CLAP_ABI *set_automation)(const clap_plugin_t *plugin, 70 | clap_id param_id, 71 | uint32_t automation_state, 72 | const clap_color_t *color); 73 | } clap_plugin_param_indication_t; 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/uris.h: -------------------------------------------------------------------------------- 1 | /* 2 | * uris.h 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | #define PLUGIN_URI "urn:brummer:ImpulseLoader" 29 | #define PLUGIN_UI_URI "urn:brummer:ImpulseLoader_ui" 30 | 31 | #define XLV2__IRFILE "urn:brummer:ImpulseLoader#irfile" 32 | #define XLV2__GUI "urn:brummer:ImpulseLoader#gui" 33 | 34 | 35 | #pragma once 36 | 37 | #ifndef URIS_H_ 38 | #define URIS_H_ 39 | 40 | class uris 41 | { 42 | public: 43 | 44 | // LV2 stuff 45 | LV2_URID_Map* map; 46 | LV2_Worker_Schedule* schedule; 47 | const LV2_Atom_Sequence* control; 48 | LV2_Atom_Sequence* notify; 49 | LV2_Atom_Forge forge; 50 | LV2_Atom_Forge_Frame notify_frame; 51 | LV2_Log_Log* log; 52 | LV2_Log_Logger logger; 53 | 54 | LV2_URID xlv2_ir_file; 55 | LV2_URID xlv2_gui; 56 | LV2_URID atom_Object; 57 | LV2_URID atom_Int; 58 | LV2_URID atom_Float; 59 | LV2_URID atom_Bool; 60 | LV2_URID atom_Vector; 61 | LV2_URID atom_Path; 62 | LV2_URID atom_String; 63 | LV2_URID atom_URID; 64 | LV2_URID atom_eventTransfer; 65 | LV2_URID patch_Put; 66 | LV2_URID patch_Get; 67 | LV2_URID patch_Set; 68 | LV2_URID patch_property; 69 | LV2_URID patch_value; 70 | 71 | inline void map_uris(LV2_URID_Map* map) { 72 | xlv2_ir_file = map->map(map->handle, XLV2__IRFILE); 73 | xlv2_gui = map->map(map->handle, XLV2__GUI); 74 | atom_Object = map->map(map->handle, LV2_ATOM__Object); 75 | atom_Int = map->map(map->handle, LV2_ATOM__Int); 76 | atom_Float = map->map(map->handle, LV2_ATOM__Float); 77 | atom_Bool = map->map(map->handle, LV2_ATOM__Bool); 78 | atom_Vector = map->map(map->handle, LV2_ATOM__Vector); 79 | atom_Path = map->map(map->handle, LV2_ATOM__Path); 80 | atom_String = map->map(map->handle, LV2_ATOM__String); 81 | atom_URID = map->map(map->handle, LV2_ATOM__URID); 82 | atom_eventTransfer = map->map(map->handle, LV2_ATOM__eventTransfer); 83 | patch_Put = map->map(map->handle, LV2_PATCH__Put); 84 | patch_Get = map->map(map->handle, LV2_PATCH__Get); 85 | patch_Set = map->map(map->handle, LV2_PATCH__Set); 86 | patch_property = map->map(map->handle, LV2_PATCH__property); 87 | patch_value = map->map(map->handle, LV2_PATCH__value); 88 | } 89 | 90 | }; 91 | 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /ImpulseLoader/standalone/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * main.cpp 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #if defined(HAVE_PA) 21 | #include "xpa.h" 22 | #endif 23 | 24 | 25 | #include "ImpulseLoader.cc" 26 | 27 | ImpulseLoader *r; 28 | 29 | #if defined(HAVE_JACK) 30 | #include "jack.cc" 31 | #endif 32 | 33 | // send value changes from GUI to the engine 34 | void sendValueChanged(X11_UI *ui, int port, float value) { 35 | r->sendValueChanged(port, value); 36 | } 37 | 38 | // send a file name from GUI to the engine 39 | void sendFileName(X11_UI *ui, ModelPicker* m, int old){ 40 | r->sendFileName(m, old); 41 | } 42 | 43 | // the portaudio server process callback 44 | #if defined(HAVE_PA) 45 | static int process(const void* inputBuffer, void* outputBuffer, 46 | unsigned long nframes, const PaStreamCallbackTimeInfo* timeInfo, 47 | PaStreamCallbackFlags statusFlags, void* data) { 48 | 49 | const float* input = ((const float**)inputBuffer)[0]; 50 | float* output = ((float**)outputBuffer)[0]; 51 | 52 | if(output != input) 53 | memcpy(output, input, nframes*sizeof(float)); 54 | 55 | r->process(nframes, output); 56 | 57 | return 0; 58 | } 59 | #endif 60 | 61 | #if defined(__linux__) || defined(__FreeBSD__) || \ 62 | defined(__NetBSD__) || defined(__OpenBSD__) 63 | void signal_handler (int sig) { 64 | switch (sig) { 65 | case SIGINT: 66 | case SIGHUP: 67 | case SIGTERM: 68 | case SIGQUIT: 69 | fprintf (stderr, "\nsignal %i received, exiting ...\n", sig); 70 | r->quitGui(); 71 | break; 72 | default: 73 | break; 74 | } 75 | } 76 | #endif 77 | 78 | int main(int argc, char *argv[]){ 79 | 80 | #if defined(__linux__) || defined(__FreeBSD__) || \ 81 | defined(__NetBSD__) || defined(__OpenBSD__) 82 | #if defined(PAWPAW) 83 | setenv("FONTCONFIG_PATH", "/etc/fonts", true); 84 | #endif 85 | if(0 == XInitThreads()) 86 | fprintf(stderr, "Warning: XInitThreads() failed\n"); 87 | #endif 88 | #if defined(HAVE_PA) 89 | bool runPA = false; 90 | #endif 91 | r = new ImpulseLoader(); 92 | r->startGui(); 93 | 94 | #if defined(__linux__) || defined(__FreeBSD__) || \ 95 | defined(__NetBSD__) || defined(__OpenBSD__) 96 | signal (SIGQUIT, signal_handler); 97 | signal (SIGTERM, signal_handler); 98 | signal (SIGHUP, signal_handler); 99 | signal (SIGINT, signal_handler); 100 | #endif 101 | 102 | #if defined(HAVE_PA) 103 | XPa xpa ("ImpulseLoader"); 104 | if(!xpa.openStream(1, 2, &process, nullptr)) { 105 | #if defined(HAVE_JACK) 106 | startJack(); 107 | #else 108 | r->quitGui(); 109 | #endif 110 | } else { 111 | runPA = true; 112 | r->initEngine(xpa.getSampleRate(), 25, 1); 113 | r->enableEngine(1); 114 | r->readConfig(); 115 | if(!xpa.startStream()) r->quitGui(); 116 | } 117 | #else 118 | startJack(); 119 | #endif 120 | 121 | main_run(r->getMain()); 122 | 123 | #if defined(HAVE_PA) 124 | if (runPA) xpa.stopStream(); 125 | #if defined(HAVE_JACK) 126 | else quitJack(); 127 | #endif 128 | #else 129 | quitJack(); 130 | #endif 131 | 132 | r->cleanup(); 133 | delete r; 134 | 135 | printf("bye bye\n"); 136 | return 0; 137 | } 138 | 139 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/surround.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | // This extension can be used to specify the channel mapping used by the plugin. 6 | // 7 | // To have consistent surround features across all the plugin instances, 8 | // here is the proposed workflow: 9 | // 1. the plugin queries the host preferred channel mapping and 10 | // adjusts its configuration to match it. 11 | // 2. the host checks how the plugin is effectively configured and honors it. 12 | // 13 | // If the host decides to change the project's surround setup: 14 | // 1. deactivate the plugin 15 | // 2. host calls clap_plugin_surround->changed() 16 | // 3. plugin calls clap_host_surround->get_preferred_channel_map() 17 | // 4. plugin eventually calls clap_host_surround->changed() 18 | // 5. host calls clap_plugin_surround->get_channel_map() if changed 19 | // 6. host activates the plugin and can start processing audio 20 | // 21 | // If the plugin wants to change its surround setup: 22 | // 1. call host->request_restart() if the plugin is active 23 | // 2. once deactivated plugin calls clap_host_surround->changed() 24 | // 3. host calls clap_plugin_surround->get_channel_map() 25 | // 4. host activates the plugin and can start processing audio 26 | 27 | static CLAP_CONSTEXPR const char CLAP_EXT_SURROUND[] = "clap.surround/4"; 28 | 29 | // The latest draft is 100% compatible. 30 | // This compat ID may be removed in 2026. 31 | static CLAP_CONSTEXPR const char CLAP_EXT_SURROUND_COMPAT[] = "clap.surround.draft/4"; 32 | 33 | static CLAP_CONSTEXPR const char CLAP_PORT_SURROUND[] = "surround"; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | enum { 40 | CLAP_SURROUND_FL = 0, // Front Left 41 | CLAP_SURROUND_FR = 1, // Front Right 42 | CLAP_SURROUND_FC = 2, // Front Center 43 | CLAP_SURROUND_LFE = 3, // Low Frequency 44 | CLAP_SURROUND_BL = 4, // Back Left 45 | CLAP_SURROUND_BR = 5, // Back Right 46 | CLAP_SURROUND_FLC = 6, // Front Left of Center 47 | CLAP_SURROUND_FRC = 7, // Front Right of Center 48 | CLAP_SURROUND_BC = 8, // Back Center 49 | CLAP_SURROUND_SL = 9, // Side Left 50 | CLAP_SURROUND_SR = 10, // Side Right 51 | CLAP_SURROUND_TC = 11, // Top Center 52 | CLAP_SURROUND_TFL = 12, // Front Left Height 53 | CLAP_SURROUND_TFC = 13, // Front Center Height 54 | CLAP_SURROUND_TFR = 14, // Front Right Height 55 | CLAP_SURROUND_TBL = 15, // Rear Left Height 56 | CLAP_SURROUND_TBC = 16, // Rear Center Height 57 | CLAP_SURROUND_TBR = 17, // Rear Right Height 58 | }; 59 | 60 | typedef struct clap_plugin_surround { 61 | // Checks if a given channel mask is supported. 62 | // The channel mask is a bitmask, for example: 63 | // (1 << CLAP_SURROUND_FL) | (1 << CLAP_SURROUND_FR) | ... 64 | // [main-thread] 65 | bool(CLAP_ABI *is_channel_mask_supported)(const clap_plugin_t *plugin, uint64_t channel_mask); 66 | 67 | // Stores the surround identifier of each channel into the channel_map array. 68 | // Returns the number of elements stored in channel_map. 69 | // channel_map_capacity must be greater or equal to the channel count of the given port. 70 | // [main-thread] 71 | uint32_t(CLAP_ABI *get_channel_map)(const clap_plugin_t *plugin, 72 | bool is_input, 73 | uint32_t port_index, 74 | uint8_t *channel_map, 75 | uint32_t channel_map_capacity); 76 | } clap_plugin_surround_t; 77 | 78 | typedef struct clap_host_surround { 79 | // Informs the host that the channel map has changed. 80 | // The channel map can only change when the plugin is de-activated. 81 | // [main-thread] 82 | void(CLAP_ABI *changed)(const clap_host_t *host); 83 | } clap_host_surround_t; 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | -------------------------------------------------------------------------------- /ImpulseLoader/zita-resampler-1.1.0/resampler-table.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | int zita_resampler_major_version (void) 29 | { 30 | return ZITA_RESAMPLER_MAJOR_VERSION; 31 | } 32 | 33 | 34 | int zita_resampler_minor_version (void) 35 | { 36 | return ZITA_RESAMPLER_MINOR_VERSION; 37 | } 38 | 39 | 40 | static double sinc (double x) 41 | { 42 | x = fabs (x); 43 | if (x < 1e-6) return 1.0; 44 | x *= M_PI; 45 | return sin (x) / x; 46 | } 47 | 48 | 49 | static double wind (double x) 50 | { 51 | x = fabs (x); 52 | if (x >= 1.0) return 0.0f; 53 | x *= M_PI; 54 | return 0.384 + 0.500 * cos (x) + 0.116 * cos (2 * x); 55 | } 56 | 57 | 58 | 59 | Resampler_table *Resampler_table::_list = 0; 60 | Resampler_mutex Resampler_table::_mutex; 61 | 62 | 63 | Resampler_table::Resampler_table (double fr, unsigned int hl, unsigned int np) : 64 | _next (0), 65 | _refc (0), 66 | _fr (fr), 67 | _hl (hl), 68 | _np (np) 69 | { 70 | unsigned int i, j; 71 | double t; 72 | float *p; 73 | 74 | _ctab = new float [hl * (np + 1)]; 75 | p = _ctab; 76 | for (j = 0; j <= np; j++) 77 | { 78 | t = (double) j / (double) np; 79 | for (i = 0; i < hl; i++) 80 | { 81 | p [hl - i - 1] = (float)(fr * sinc (t * fr) * wind (t / hl)); 82 | t += 1; 83 | } 84 | p += hl; 85 | } 86 | } 87 | 88 | 89 | Resampler_table::~Resampler_table (void) 90 | { 91 | delete[] _ctab; 92 | } 93 | 94 | 95 | Resampler_table *Resampler_table::create (double fr, unsigned int hl, unsigned int np) 96 | { 97 | Resampler_table *P; 98 | 99 | _mutex.lock (); 100 | P = _list; 101 | while (P) 102 | { 103 | if ((fr >= P->_fr * 0.999) && (fr <= P->_fr * 1.001) && (hl == P->_hl) && (np == P->_np)) 104 | { 105 | P->_refc++; 106 | _mutex.unlock (); 107 | return P; 108 | } 109 | P = P->_next; 110 | } 111 | P = new Resampler_table (fr, hl, np); 112 | P->_refc = 1; 113 | P->_next = _list; 114 | _list = P; 115 | _mutex.unlock (); 116 | return P; 117 | } 118 | 119 | 120 | void Resampler_table::destroy (Resampler_table *T) 121 | { 122 | Resampler_table *P, *Q; 123 | 124 | _mutex.lock (); 125 | if (T) 126 | { 127 | T->_refc--; 128 | if (T->_refc == 0) 129 | { 130 | P = _list; 131 | Q = 0; 132 | while (P) 133 | { 134 | if (P == T) 135 | { 136 | if (Q) Q->_next = T->_next; 137 | else _list = T->_next; 138 | break; 139 | } 140 | Q = P; 141 | P = P->_next; 142 | } 143 | delete T; 144 | } 145 | } 146 | _mutex.unlock (); 147 | } 148 | 149 | 150 | void Resampler_table::print_list (void) 151 | { 152 | Resampler_table *P; 153 | 154 | printf ("Resampler table\n----\n"); 155 | for (P = _list; P; P = P->_next) 156 | { 157 | printf ("refc = %3d fr = %10.6lf hl = %4d np = %4d\n", P->_refc, P->_fr, P->_hl, P->_np); 158 | } 159 | printf ("----\n\n"); 160 | } 161 | 162 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/zita-resampler-1.1.0/resampler-table.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | int zita_resampler_major_version (void) 29 | { 30 | return ZITA_RESAMPLER_MAJOR_VERSION; 31 | } 32 | 33 | 34 | int zita_resampler_minor_version (void) 35 | { 36 | return ZITA_RESAMPLER_MINOR_VERSION; 37 | } 38 | 39 | 40 | static double sinc (double x) 41 | { 42 | x = fabs (x); 43 | if (x < 1e-6) return 1.0; 44 | x *= M_PI; 45 | return sin (x) / x; 46 | } 47 | 48 | 49 | static double wind (double x) 50 | { 51 | x = fabs (x); 52 | if (x >= 1.0) return 0.0f; 53 | x *= M_PI; 54 | return 0.384 + 0.500 * cos (x) + 0.116 * cos (2 * x); 55 | } 56 | 57 | 58 | 59 | Resampler_table *Resampler_table::_list = 0; 60 | Resampler_mutex Resampler_table::_mutex; 61 | 62 | 63 | Resampler_table::Resampler_table (double fr, unsigned int hl, unsigned int np) : 64 | _next (0), 65 | _refc (0), 66 | _fr (fr), 67 | _hl (hl), 68 | _np (np) 69 | { 70 | unsigned int i, j; 71 | double t; 72 | float *p; 73 | 74 | _ctab = new float [hl * (np + 1)]; 75 | p = _ctab; 76 | for (j = 0; j <= np; j++) 77 | { 78 | t = (double) j / (double) np; 79 | for (i = 0; i < hl; i++) 80 | { 81 | p [hl - i - 1] = (float)(fr * sinc (t * fr) * wind (t / hl)); 82 | t += 1; 83 | } 84 | p += hl; 85 | } 86 | } 87 | 88 | 89 | Resampler_table::~Resampler_table (void) 90 | { 91 | delete[] _ctab; 92 | } 93 | 94 | 95 | Resampler_table *Resampler_table::create (double fr, unsigned int hl, unsigned int np) 96 | { 97 | Resampler_table *P; 98 | 99 | _mutex.lock (); 100 | P = _list; 101 | while (P) 102 | { 103 | if ((fr >= P->_fr * 0.999) && (fr <= P->_fr * 1.001) && (hl == P->_hl) && (np == P->_np)) 104 | { 105 | P->_refc++; 106 | _mutex.unlock (); 107 | return P; 108 | } 109 | P = P->_next; 110 | } 111 | P = new Resampler_table (fr, hl, np); 112 | P->_refc = 1; 113 | P->_next = _list; 114 | _list = P; 115 | _mutex.unlock (); 116 | return P; 117 | } 118 | 119 | 120 | void Resampler_table::destroy (Resampler_table *T) 121 | { 122 | Resampler_table *P, *Q; 123 | 124 | _mutex.lock (); 125 | if (T) 126 | { 127 | T->_refc--; 128 | if (T->_refc == 0) 129 | { 130 | P = _list; 131 | Q = 0; 132 | while (P) 133 | { 134 | if (P == T) 135 | { 136 | if (Q) Q->_next = T->_next; 137 | else _list = T->_next; 138 | break; 139 | } 140 | Q = P; 141 | P = P->_next; 142 | } 143 | delete T; 144 | } 145 | } 146 | _mutex.unlock (); 147 | } 148 | 149 | 150 | void Resampler_table::print_list (void) 151 | { 152 | Resampler_table *P; 153 | 154 | printf ("Resampler table\n----\n"); 155 | for (P = _list; P; P = P->_next) 156 | { 157 | printf ("refc = %3d fr = %10.6lf hl = %4d np = %4d\n", P->_refc, P->_fr, P->_hl, P->_np); 158 | } 159 | printf ("----\n\n"); 160 | } 161 | 162 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/draft/resource-directory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../plugin.h" 4 | 5 | static CLAP_CONSTEXPR const char CLAP_EXT_RESOURCE_DIRECTORY[] = "clap.resource-directory/1"; 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /// @page Resource Directory 12 | /// 13 | /// This extension provides a way for the plugin to store its resources as file in a directory 14 | /// provided by the host and recover them later on. 15 | /// 16 | /// The plugin **must** store relative path in its state toward resource directories. 17 | /// 18 | /// Resource sharing: 19 | /// - shared directory is shared among all plugin instances, hence mostly appropriate for read-only 20 | /// content 21 | /// -> suitable for read-only content 22 | /// - exclusive directory is exclusive to the plugin instance 23 | /// -> if the plugin, then its exclusive directory must be duplicated too 24 | /// -> suitable for read-write content 25 | /// 26 | /// Keeping the shared directory clean: 27 | /// - to avoid clashes in the shared directory, plugins are encouraged to organize their files in 28 | /// sub-folders, for example create one subdirectory using the vendor name 29 | /// - don't use symbolic links or hard links which points outside of the directory 30 | /// 31 | /// Resource life-time: 32 | /// - exclusive folder content is managed by the plugin instance 33 | /// - exclusive folder content is deleted when the plugin instance is removed from the project 34 | /// - shared folder content isn't managed by the host, until all plugins using the shared directory 35 | /// are removed from the project 36 | /// 37 | /// Note for the host 38 | /// - try to use the filesystem's copy-on-write feature when possible for reducing exclusive folder 39 | /// space usage on duplication 40 | /// - host can "garbage collect" the files in the shared folder using: 41 | /// clap_plugin_resource_directory.get_files_count() 42 | /// clap_plugin_resource_directory.get_file_path() 43 | /// but be **very** careful before deleting any resources 44 | 45 | typedef struct clap_plugin_resource_directory { 46 | // Sets the directory in which the plugin can save its resources. 47 | // The directory remains valid until it is overridden or the plugin is destroyed. 48 | // If path is null or blank, it clears the directory location. 49 | // path must be absolute. 50 | // [main-thread] 51 | void(CLAP_ABI *set_directory)(const clap_plugin_t *plugin, const char *path, bool is_shared); 52 | 53 | // Asks the plugin to put its resources into the resource directory. 54 | // It is not necessary to collect files which belongs to the plugin's 55 | // factory content unless the param all is true. 56 | // [main-thread] 57 | void(CLAP_ABI *collect)(const clap_plugin_t *plugin, bool all); 58 | 59 | // Returns the number of files used by the plugin in the shared resource folder. 60 | // [main-thread] 61 | uint32_t(CLAP_ABI *get_files_count)(const clap_plugin_t *plugin); 62 | 63 | // Retrieves relative file path to the resource directory. 64 | // @param path writable memory to store the path 65 | // @param path_size number of available bytes in path 66 | // Returns the number of bytes in the path, or -1 on error 67 | // [main-thread] 68 | int32_t(CLAP_ABI *get_file_path)(const clap_plugin_t *plugin, 69 | uint32_t index, 70 | char *path, 71 | uint32_t path_size); 72 | } clap_plugin_resource_directory_t; 73 | 74 | typedef struct clap_host_resource_directory { 75 | // Request the host to setup a resource directory with the specified sharing. 76 | // Returns true if the host will perform the request. 77 | // [main-thread] 78 | bool(CLAP_ABI *request_directory)(const clap_host_t *host, bool is_shared); 79 | 80 | // Tell the host that the resource directory of the specified sharing is no longer required. 81 | // If is_shared = false, then the host may delete the directory content. 82 | // [main-thread] 83 | void(CLAP_ABI *release_directory)(const clap_host_t *host, bool is_shared); 84 | } clap_host_resource_directory_t; 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/audio-ports-config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../string-sizes.h" 4 | #include "../plugin.h" 5 | #include "audio-ports.h" 6 | 7 | /// @page Audio Ports Config 8 | /// 9 | /// This extension let the plugin provide port configurations presets. 10 | /// For example mono, stereo, surround, ambisonic, ... 11 | /// 12 | /// After the plugin initialization, the host may scan the list of configurations and eventually 13 | /// select one that fits the plugin context. The host can only select a configuration if the plugin 14 | /// is deactivated. 15 | /// 16 | /// A configuration is a very simple description of the audio ports: 17 | /// - it describes the main input and output ports 18 | /// - it has a name that can be displayed to the user 19 | /// 20 | /// The idea behind the configurations, is to let the user choose one via a menu. 21 | /// 22 | /// Plugins with very complex configuration possibilities should let the user configure the ports 23 | /// from the plugin GUI, and call @ref clap_host_audio_ports.rescan(CLAP_AUDIO_PORTS_RESCAN_ALL). 24 | /// 25 | /// To inquire the exact bus layout, the plugin implements the clap_plugin_audio_ports_config_info_t 26 | /// extension where all busses can be retrieved in the same way as in the audio-port extension. 27 | 28 | static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_CONFIG[] = "clap.audio-ports-config"; 29 | 30 | static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_CONFIG_INFO[] = 31 | "clap.audio-ports-config-info/1"; 32 | 33 | // The latest draft is 100% compatible. 34 | // This compat ID may be removed in 2026. 35 | static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS_CONFIG_INFO_COMPAT[] = 36 | "clap.audio-ports-config-info/draft-0"; 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | // Minimalistic description of ports configuration 43 | typedef struct clap_audio_ports_config { 44 | clap_id id; 45 | char name[CLAP_NAME_SIZE]; 46 | 47 | uint32_t input_port_count; 48 | uint32_t output_port_count; 49 | 50 | // main input info 51 | bool has_main_input; 52 | uint32_t main_input_channel_count; 53 | const char *main_input_port_type; 54 | 55 | // main output info 56 | bool has_main_output; 57 | uint32_t main_output_channel_count; 58 | const char *main_output_port_type; 59 | } clap_audio_ports_config_t; 60 | 61 | // The audio ports config scan has to be done while the plugin is deactivated. 62 | typedef struct clap_plugin_audio_ports_config { 63 | // Gets the number of available configurations 64 | // [main-thread] 65 | uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin); 66 | 67 | // Gets information about a configuration 68 | // Returns true on success and stores the result into config. 69 | // [main-thread] 70 | bool(CLAP_ABI *get)(const clap_plugin_t *plugin, 71 | uint32_t index, 72 | clap_audio_ports_config_t *config); 73 | 74 | // Selects the configuration designated by id 75 | // Returns true if the configuration could be applied. 76 | // Once applied the host should scan again the audio ports. 77 | // [main-thread & plugin-deactivated] 78 | bool(CLAP_ABI *select)(const clap_plugin_t *plugin, clap_id config_id); 79 | } clap_plugin_audio_ports_config_t; 80 | 81 | // Extended config info 82 | typedef struct clap_plugin_audio_ports_config_info { 83 | 84 | // Gets the id of the currently selected config, or CLAP_INVALID_ID if the current port 85 | // layout isn't part of the config list. 86 | // 87 | // [main-thread] 88 | clap_id(CLAP_ABI *current_config)(const clap_plugin_t *plugin); 89 | 90 | // Get info about an audio port, for a given config_id. 91 | // This is analogous to clap_plugin_audio_ports.get(). 92 | // Returns true on success and stores the result into info. 93 | // [main-thread] 94 | bool(CLAP_ABI *get)(const clap_plugin_t *plugin, 95 | clap_id config_id, 96 | uint32_t port_index, 97 | bool is_input, 98 | clap_audio_port_info_t *info); 99 | } clap_plugin_audio_ports_config_info_t; 100 | 101 | typedef struct clap_host_audio_ports_config { 102 | // Rescan the full list of configs. 103 | // [main-thread] 104 | void(CLAP_ABI *rescan)(const clap_host_t *host); 105 | } clap_host_audio_ports_config_t; 106 | 107 | #ifdef __cplusplus 108 | } 109 | #endif 110 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/factory/draft/plugin-state-converter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../id.h" 4 | #include "../../universal-plugin-id.h" 5 | #include "../../stream.h" 6 | #include "../../version.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct clap_plugin_state_converter_descriptor { 13 | clap_version_t clap_version; 14 | 15 | clap_universal_plugin_id_t src_plugin_id; 16 | clap_universal_plugin_id_t dst_plugin_id; 17 | 18 | const char *id; // eg: "com.u-he.diva-converter", mandatory 19 | const char *name; // eg: "Diva Converter", mandatory 20 | const char *vendor; // eg: "u-he" 21 | const char *version; // eg: 1.1.5 22 | const char *description; // eg: "Official state converter for u-he Diva." 23 | } clap_plugin_state_converter_descriptor_t; 24 | 25 | // This interface provides a mechanism for the host to convert a plugin state and its automation 26 | // points to a new plugin. 27 | // 28 | // This is useful to convert from one plugin ABI to another one. 29 | // This is also useful to offer an upgrade path: from EQ version 1 to EQ version 2. 30 | // This can also be used to convert the state of a plugin that isn't maintained anymore into 31 | // another plugin that would be similar. 32 | typedef struct clap_plugin_state_converter { 33 | const clap_plugin_state_converter_descriptor_t *desc; 34 | 35 | void *converter_data; 36 | 37 | // Destroy the converter. 38 | void (*destroy)(struct clap_plugin_state_converter *converter); 39 | 40 | // Converts the input state to a state usable by the destination plugin. 41 | // 42 | // error_buffer is a place holder of error_buffer_size bytes for storing a null-terminated 43 | // error message in case of failure, which can be displayed to the user. 44 | // 45 | // Returns true on success. 46 | // [thread-safe] 47 | bool (*convert_state)(struct clap_plugin_state_converter *converter, 48 | const clap_istream_t *src, 49 | const clap_ostream_t *dst, 50 | char *error_buffer, 51 | size_t error_buffer_size); 52 | 53 | // Converts a normalized value. 54 | // Returns true on success. 55 | // [thread-safe] 56 | bool (*convert_normalized_value)(struct clap_plugin_state_converter *converter, 57 | clap_id src_param_id, 58 | double src_normalized_value, 59 | clap_id *dst_param_id, 60 | double *dst_normalized_value); 61 | 62 | // Converts a plain value. 63 | // Returns true on success. 64 | // [thread-safe] 65 | bool (*convert_plain_value)(struct clap_plugin_state_converter *converter, 66 | clap_id src_param_id, 67 | double src_plain_value, 68 | clap_id *dst_param_id, 69 | double *dst_plain_value); 70 | } clap_plugin_state_converter_t; 71 | 72 | // Factory identifier 73 | static CLAP_CONSTEXPR const char CLAP_PLUGIN_STATE_CONVERTER_FACTORY_ID[] = 74 | "clap.plugin-state-converter-factory/1"; 75 | 76 | // List all the plugin state converters available in the current DSO. 77 | typedef struct clap_plugin_state_converter_factory { 78 | // Get the number of converters. 79 | // [thread-safe] 80 | uint32_t (*count)(const struct clap_plugin_state_converter_factory *factory); 81 | 82 | // Retrieves a plugin state converter descriptor by its index. 83 | // Returns null in case of error. 84 | // The descriptor must not be freed. 85 | // [thread-safe] 86 | const clap_plugin_state_converter_descriptor_t *(*get_descriptor)( 87 | const struct clap_plugin_state_converter_factory *factory, uint32_t index); 88 | 89 | // Create a plugin state converter by its converter_id. 90 | // The returned pointer must be freed by calling converter->destroy(converter); 91 | // Returns null in case of error. 92 | // [thread-safe] 93 | clap_plugin_state_converter_t *(*create)( 94 | const struct clap_plugin_state_converter_factory *factory, const char *converter_id); 95 | } clap_plugin_state_converter_factory_t; 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/audio-ports.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | #include "../string-sizes.h" 5 | 6 | /// @page Audio Ports 7 | /// 8 | /// This extension provides a way for the plugin to describe its current audio ports. 9 | /// 10 | /// If the plugin does not implement this extension, it won't have audio ports. 11 | /// 12 | /// 32 bits support is required for both host and plugins. 64 bits audio is optional. 13 | /// 14 | /// The plugin is only allowed to change its ports configuration while it is deactivated. 15 | 16 | static CLAP_CONSTEXPR const char CLAP_EXT_AUDIO_PORTS[] = "clap.audio-ports"; 17 | static CLAP_CONSTEXPR const char CLAP_PORT_MONO[] = "mono"; 18 | static CLAP_CONSTEXPR const char CLAP_PORT_STEREO[] = "stereo"; 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | enum { 25 | // This port is the main audio input or output. 26 | // There can be only one main input and main output. 27 | // Main port must be at index 0. 28 | CLAP_AUDIO_PORT_IS_MAIN = 1 << 0, 29 | 30 | // This port can be used with 64 bits audio 31 | CLAP_AUDIO_PORT_SUPPORTS_64BITS = 1 << 1, 32 | 33 | // 64 bits audio is preferred with this port 34 | CLAP_AUDIO_PORT_PREFERS_64BITS = 1 << 2, 35 | 36 | // This port must be used with the same sample size as all the other ports which have this flag. 37 | // In other words if all ports have this flag then the plugin may either be used entirely with 38 | // 64 bits audio or 32 bits audio, but it can't be mixed. 39 | CLAP_AUDIO_PORT_REQUIRES_COMMON_SAMPLE_SIZE = 1 << 3, 40 | }; 41 | 42 | typedef struct clap_audio_port_info { 43 | // id identifies a port and must be stable. 44 | // id may overlap between input and output ports. 45 | clap_id id; 46 | char name[CLAP_NAME_SIZE]; // displayable name 47 | 48 | uint32_t flags; 49 | uint32_t channel_count; 50 | 51 | // If null or empty then it is unspecified (arbitrary audio). 52 | // This field can be compared against: 53 | // - CLAP_PORT_MONO 54 | // - CLAP_PORT_STEREO 55 | // - CLAP_PORT_SURROUND (defined in the surround extension) 56 | // - CLAP_PORT_AMBISONIC (defined in the ambisonic extension) 57 | // 58 | // An extension can provide its own port type and way to inspect the channels. 59 | const char *port_type; 60 | 61 | // in-place processing: allow the host to use the same buffer for input and output 62 | // if supported set the pair port id. 63 | // if not supported set to CLAP_INVALID_ID 64 | clap_id in_place_pair; 65 | } clap_audio_port_info_t; 66 | 67 | // The audio ports scan has to be done while the plugin is deactivated. 68 | typedef struct clap_plugin_audio_ports { 69 | // Number of ports, for either input or output 70 | // [main-thread] 71 | uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin, bool is_input); 72 | 73 | // Get info about an audio port. 74 | // Returns true on success and stores the result into info. 75 | // [main-thread] 76 | bool(CLAP_ABI *get)(const clap_plugin_t *plugin, 77 | uint32_t index, 78 | bool is_input, 79 | clap_audio_port_info_t *info); 80 | } clap_plugin_audio_ports_t; 81 | 82 | enum { 83 | // The ports name did change, the host can scan them right away. 84 | CLAP_AUDIO_PORTS_RESCAN_NAMES = 1 << 0, 85 | 86 | // [!active] The flags did change 87 | CLAP_AUDIO_PORTS_RESCAN_FLAGS = 1 << 1, 88 | 89 | // [!active] The channel_count did change 90 | CLAP_AUDIO_PORTS_RESCAN_CHANNEL_COUNT = 1 << 2, 91 | 92 | // [!active] The port type did change 93 | CLAP_AUDIO_PORTS_RESCAN_PORT_TYPE = 1 << 3, 94 | 95 | // [!active] The in-place pair did change, this requires. 96 | CLAP_AUDIO_PORTS_RESCAN_IN_PLACE_PAIR = 1 << 4, 97 | 98 | // [!active] The list of ports have changed: entries have been removed/added. 99 | CLAP_AUDIO_PORTS_RESCAN_LIST = 1 << 5, 100 | }; 101 | 102 | typedef struct clap_host_audio_ports { 103 | // Checks if the host allows a plugin to change a given aspect of the audio ports definition. 104 | // [main-thread] 105 | bool(CLAP_ABI *is_rescan_flag_supported)(const clap_host_t *host, uint32_t flag); 106 | 107 | // Rescan the full list of audio ports according to the flags. 108 | // It is illegal to ask the host to rescan with a flag that is not supported. 109 | // Certain flags require the plugin to be de-activated. 110 | // [main-thread] 111 | void(CLAP_ABI *rescan)(const clap_host_t *host, uint32_t flags); 112 | } clap_host_audio_ports_t; 113 | 114 | #ifdef __cplusplus 115 | } 116 | #endif 117 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | env: 6 | PAWPAW_SKIP_LV2: 0 7 | 8 | jobs: 9 | linux: 10 | strategy: 11 | matrix: 12 | target: [linux-x86_64] 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: write 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | submodules: recursive 20 | - uses: ./.github/actions 21 | with: 22 | target: ${{ matrix.target }} 23 | extraargs: lv2 24 | lto: false 25 | pawpaw: true 26 | 27 | arm64: 28 | strategy: 29 | matrix: 30 | target: [linux-arm64] 31 | runs-on: ubuntu-22.04 32 | permissions: 33 | contents: write 34 | steps: 35 | - uses: actions/checkout@v4 36 | with: 37 | submodules: recursive 38 | - uses: ./.github/actions 39 | with: 40 | target: ${{ matrix.target }} 41 | extraargs: lv2 42 | pawpaw: true 43 | 44 | linux-standalone: 45 | strategy: 46 | matrix: 47 | target: [linux-x86_64] 48 | runs-on: ubuntu-latest 49 | permissions: 50 | contents: write 51 | steps: 52 | - uses: actions/checkout@v4 53 | with: 54 | submodules: recursive 55 | - uses: ./.github/actions 56 | with: 57 | target: ${{ matrix.target }} 58 | postfix: -app 59 | extraargs: standalone 60 | lto: false 61 | pawpaw: true 62 | 63 | linux-clap: 64 | strategy: 65 | matrix: 66 | target: [linux-x86_64] 67 | runs-on: ubuntu-latest 68 | permissions: 69 | contents: write 70 | steps: 71 | - uses: actions/checkout@v4 72 | with: 73 | submodules: recursive 74 | - uses: ./.github/actions 75 | with: 76 | target: ${{ matrix.target }} 77 | postfix: -clap 78 | extraargs: clap 79 | lto: false 80 | pawpaw: true 81 | 82 | linux-vst2: 83 | strategy: 84 | matrix: 85 | target: [linux-x86_64] 86 | runs-on: ubuntu-latest 87 | permissions: 88 | contents: write 89 | steps: 90 | - uses: actions/checkout@v4 91 | with: 92 | submodules: recursive 93 | - uses: ./.github/actions 94 | with: 95 | target: ${{ matrix.target }} 96 | postfix: -vst2 97 | extraargs: vst2 98 | lto: false 99 | pawpaw: true 100 | 101 | windows: 102 | strategy: 103 | matrix: 104 | target: [win64] 105 | runs-on: ubuntu-latest 106 | permissions: 107 | contents: write 108 | steps: 109 | - uses: actions/checkout@v4 110 | with: 111 | submodules: recursive 112 | - uses: ./.github/actions 113 | with: 114 | target: ${{ matrix.target }} 115 | extraargs: lv2 116 | pawpaw: true 117 | 118 | windows-standalone: 119 | strategy: 120 | matrix: 121 | target: [win64] 122 | runs-on: ubuntu-latest 123 | permissions: 124 | contents: write 125 | steps: 126 | - uses: actions/checkout@v4 127 | with: 128 | submodules: recursive 129 | - uses: ./.github/actions 130 | with: 131 | target: ${{ matrix.target }} 132 | postfix: -app 133 | extraargs: standalone 134 | pawpaw: true 135 | 136 | windows-clap: 137 | strategy: 138 | matrix: 139 | target: [win64] 140 | runs-on: ubuntu-latest 141 | permissions: 142 | contents: write 143 | steps: 144 | - uses: actions/checkout@v4 145 | with: 146 | submodules: recursive 147 | - uses: ./.github/actions 148 | with: 149 | target: ${{ matrix.target }} 150 | postfix: -clap 151 | extraargs: clap 152 | pawpaw: true 153 | 154 | windows-vst2: 155 | strategy: 156 | matrix: 157 | target: [win64] 158 | runs-on: ubuntu-latest 159 | permissions: 160 | contents: write 161 | steps: 162 | - uses: actions/checkout@v4 163 | with: 164 | submodules: recursive 165 | - uses: ./.github/actions 166 | with: 167 | target: ${{ matrix.target }} 168 | postfix: -vst2 169 | extraargs: vst2 170 | pawpaw: true 171 | 172 | source: 173 | runs-on: ubuntu-22.04 174 | permissions: 175 | contents: write 176 | steps: 177 | - uses: actions/checkout@v4 178 | with: 179 | submodules: recursive 180 | - uses: ./.github/actions 181 | with: 182 | target: source 183 | 184 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/draft/triggers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../plugin.h" 4 | #include "../../events.h" 5 | #include "../../string-sizes.h" 6 | 7 | static CLAP_CONSTEXPR const char CLAP_EXT_TRIGGERS[] = "clap.triggers/1"; 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /// @page Trigger events 14 | /// 15 | /// This extension enables the plugin to expose a set of triggers to the host. 16 | /// 17 | /// Some examples for triggers: 18 | /// - trigger an envelope which is independent of the notes 19 | /// - trigger a sample-and-hold unit (maybe even per-voice) 20 | 21 | enum { 22 | // Does this trigger support per note automations? 23 | CLAP_TRIGGER_IS_AUTOMATABLE_PER_NOTE_ID = 1 << 0, 24 | 25 | // Does this trigger support per key automations? 26 | CLAP_TRIGGER_IS_AUTOMATABLE_PER_KEY = 1 << 1, 27 | 28 | // Does this trigger support per channel automations? 29 | CLAP_TRIGGER_IS_AUTOMATABLE_PER_CHANNEL = 1 << 2, 30 | 31 | // Does this trigger support per port automations? 32 | CLAP_TRIGGER_IS_AUTOMATABLE_PER_PORT = 1 << 3, 33 | }; 34 | typedef uint32_t clap_trigger_info_flags; 35 | 36 | // Given that this extension is still draft, it'll use the event-registry and its own event 37 | // namespace until we stabilize it. 38 | // 39 | // #include 40 | // 41 | // uint16_t CLAP_EXT_TRIGGER_EVENT_SPACE_ID = UINT16_MAX; 42 | // if (host_event_registry->query(host, CLAP_EXT_TRIGGERS, &CLAP_EXT_TRIGGER_EVENT_SPACE_ID)) { 43 | // /* we can use trigger events */ 44 | // } 45 | // 46 | // /* later on */ 47 | // clap_event_trigger ev; 48 | // ev.header.space_id = CLAP_EXT_TRIGGER_EVENT_SPACE_ID; 49 | // ev.header.type = CLAP_EVENT_TRIGGER; 50 | 51 | enum { CLAP_EVENT_TRIGGER = 0 }; 52 | 53 | typedef struct clap_event_trigger { 54 | clap_event_header_t header; 55 | 56 | // target trigger 57 | clap_id trigger_id; // @ref clap_trigger_info.id 58 | void *cookie; // @ref clap_trigger_info.cookie 59 | 60 | // target a specific note_id, port, key and channel, -1 for global 61 | int32_t note_id; 62 | int16_t port_index; 63 | int16_t channel; 64 | int16_t key; 65 | } clap_event_trigger_t; 66 | 67 | /* This describes a trigger */ 68 | typedef struct clap_trigger_info { 69 | // stable trigger identifier, it must never change. 70 | clap_id id; 71 | 72 | clap_trigger_info_flags flags; 73 | 74 | // in analogy to clap_param_info.cookie 75 | void *cookie; 76 | 77 | // displayable name 78 | char name[CLAP_NAME_SIZE]; 79 | 80 | // the module path containing the trigger, eg:"sequencers/seq1" 81 | // '/' will be used as a separator to show a tree like structure. 82 | char module[CLAP_PATH_SIZE]; 83 | } clap_trigger_info_t; 84 | 85 | typedef struct clap_plugin_triggers { 86 | // Returns the number of triggers. 87 | // [main-thread] 88 | uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin); 89 | 90 | // Copies the trigger's info to trigger_info and returns true on success. 91 | // [main-thread] 92 | bool(CLAP_ABI *get_info)(const clap_plugin_t *plugin, 93 | uint32_t index, 94 | clap_trigger_info_t *trigger_info); 95 | } clap_plugin_triggers_t; 96 | 97 | enum { 98 | // The trigger info did change, use this flag for: 99 | // - name change 100 | // - module change 101 | // New info takes effect immediately. 102 | CLAP_TRIGGER_RESCAN_INFO = 1 << 0, 103 | 104 | // Invalidates everything the host knows about triggers. 105 | // It can only be used while the plugin is deactivated. 106 | // If the plugin is activated use clap_host->restart() and delay any change until the host calls 107 | // clap_plugin->deactivate(). 108 | // 109 | // You must use this flag if: 110 | // - some triggers were added or removed. 111 | // - some triggers had critical changes: 112 | // - is_per_note (flag) 113 | // - is_per_key (flag) 114 | // - is_per_channel (flag) 115 | // - is_per_port (flag) 116 | // - cookie 117 | CLAP_TRIGGER_RESCAN_ALL = 1 << 1, 118 | }; 119 | typedef uint32_t clap_trigger_rescan_flags; 120 | 121 | enum { 122 | // Clears all possible references to a trigger 123 | CLAP_TRIGGER_CLEAR_ALL = 1 << 0, 124 | 125 | // Clears all automations to a trigger 126 | CLAP_TRIGGER_CLEAR_AUTOMATIONS = 1 << 1, 127 | }; 128 | typedef uint32_t clap_trigger_clear_flags; 129 | 130 | typedef struct clap_host_triggers { 131 | // Rescan the full list of triggers according to the flags. 132 | // [main-thread] 133 | void(CLAP_ABI *rescan)(const clap_host_t *host, clap_trigger_rescan_flags flags); 134 | 135 | // Clears references to a trigger. 136 | // [main-thread] 137 | void(CLAP_ABI *clear)(const clap_host_t *host, 138 | clap_id trigger_id, 139 | clap_trigger_clear_flags flags); 140 | } clap_host_triggers_t; 141 | 142 | #ifdef __cplusplus 143 | } 144 | #endif 145 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/ImpulseLoader.ttl: -------------------------------------------------------------------------------- 1 | 2 | @prefix doap: . 3 | @prefix foaf: . 4 | @prefix lv2: . 5 | @prefix rdf: . 6 | @prefix rdfs: . 7 | @prefix guiext: . 8 | @prefix opts: . 9 | @prefix time: . 10 | @prefix units: . 11 | @prefix atom: . 12 | @prefix urid: . 13 | @prefix pprop: . 14 | @prefix midi: . 15 | @prefix patch: . 16 | @prefix work: . 17 | @prefix bufsz: . 18 | @prefix state: . 19 | @prefix mod: . 20 | 21 | 22 | 23 | a foaf:Person ; 24 | foaf:name "brummer" . 25 | 26 | 27 | a lv2:Parameter; 28 | mod:fileTypes "wav,audio"; 29 | rdfs:label "IR File"; 30 | rdfs:range atom:Path. 31 | 32 | 33 | a lv2:Plugin , 34 | lv2:ReverbPlugin ; 35 | doap:maintainer ; 36 | doap:name "ImpulseLoader" ; 37 | lv2:project ; 38 | lv2:requiredFeature urid:map ; 39 | lv2:optionalFeature lv2:hardRTCapable ; 40 | lv2:requiredFeature urid:map , 41 | bufsz:boundedBlockLength , 42 | work:schedule ; 43 | bufsz:minBlockLength 64 ; 44 | bufsz:maxBlockLength 8192 ; 45 | lv2:extensionData work:interface , 46 | state:interface ; 47 | lv2:minorVersion 1 ; 48 | lv2:microVersion 0 ; 49 | 50 | guiext:ui ; 51 | 52 | rdfs:comment """ 53 | ImpulseLoader is a simple mono IR-File loader/convolver. 54 | IR-File could be loaded via the internal File browser or, when supported by the host, via drag and drop. 55 | The Input controls the gain input for the convolution engine, it didn't affect the dry part of the Dry/Wet control. 56 | IR-Files will be resampled on the fly, when needed. 57 | If there are more then 1 channel in the IR-File, only the first channel will be loaded. 58 | """; 59 | 60 | patch:writable ; 61 | 62 | lv2:port [ 63 | a lv2:AudioPort , 64 | lv2:InputPort ; 65 | lv2:index 0 ; 66 | lv2:symbol "in0" ; 67 | lv2:name "In0" ; 68 | ], [ 69 | a lv2:AudioPort , 70 | lv2:OutputPort ; 71 | lv2:index 1 ; 72 | lv2:symbol "out0" ; 73 | lv2:name "Out0" ; 74 | ], [ 75 | a lv2:InputPort , 76 | lv2:ControlPort ; 77 | lv2:index 2 ; 78 | lv2:designation lv2:enabled; 79 | lv2:portProperty lv2:toggled ; 80 | lv2:symbol "Bypass" ; 81 | lv2:name "bypass" ; 82 | lv2:default 1.0 ; 83 | lv2:minimum 0.0 ; 84 | lv2:maximum 1.0 ; 85 | ], [ 86 | a lv2:InputPort , 87 | lv2:ControlPort ; 88 | lv2:index 3 ; 89 | lv2:symbol "INPUT" ; 90 | lv2:name "input" ; 91 | lv2:default 0.0 ; 92 | lv2:minimum -20.0 ; 93 | lv2:maximum 20.0 ; 94 | ], [ 95 | a lv2:InputPort , 96 | lv2:ControlPort ; 97 | lv2:index 4 ; 98 | lv2:symbol "DRY_WET" ; 99 | lv2:name "dry_wet" ; 100 | lv2:default 100.0 ; 101 | lv2:minimum 0.0 ; 102 | lv2:maximum 100.0 ; 103 | ], [ 104 | a lv2:InputPort , 105 | atom:AtomPort ; 106 | 8192 ; 107 | atom:bufferType atom:Sequence ; 108 | atom:supports patch:Message ; 109 | lv2:designation lv2:control ; 110 | lv2:index 5 ; 111 | lv2:symbol "CONTROL" ; 112 | lv2:name "CONTROL" ; 113 | ], [ 114 | a lv2:OutputPort , 115 | atom:AtomPort ; 116 | 8192 ; 117 | atom:bufferType atom:Sequence ; 118 | atom:supports patch:Message ; 119 | lv2:designation lv2:control ; 120 | lv2:index 6 ; 121 | lv2:symbol "NOTIFY" ; 122 | lv2:name "NOTIFY"; 123 | ], [ 124 | a lv2:InputPort , 125 | lv2:ControlPort ; 126 | lv2:index 7 ; 127 | lv2:portProperty lv2:toggled ; 128 | lv2:symbol "Normalize" ; 129 | lv2:name "Normalize" ; 130 | lv2:default 0.0 ; 131 | lv2:minimum 0.0 ; 132 | lv2:maximum 1.0 ; 133 | ] . 134 | 135 | 136 | 137 | a guiext:X11UI; 138 | guiext:binary ; 139 | lv2:extensionData guiext::idle ; 140 | lv2:extensionData guiext:resize ; 141 | lv2:extensionData guiext:idleInterface ; 142 | lv2:requiredFeature guiext:idleInterface ; 143 | lv2:optionalFeature opts:options ; 144 | opts:supportedOption guiext:scaleFactor ; 145 | guiext:portNotification [ 146 | guiext:plugin ; 147 | lv2:symbol "NOTIFY" ; 148 | guiext:notifyType atom:Blank 149 | ] . 150 | 151 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/plugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "private/macros.h" 4 | #include "host.h" 5 | #include "process.h" 6 | #include "plugin-features.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct clap_plugin_descriptor { 13 | clap_version_t clap_version; // initialized to CLAP_VERSION 14 | 15 | // Mandatory fields must be set and must not be blank. 16 | // Otherwise the fields can be null or blank, though it is safer to make them blank. 17 | // 18 | // Some indications regarding id and version 19 | // - id is an arbitrary string which should be unique to your plugin, 20 | // we encourage you to use a reverse URI eg: "com.u-he.diva" 21 | // - version is an arbitrary string which describes a plugin, 22 | // it is useful for the host to understand and be able to compare two different 23 | // version strings, so here is a regex like expression which is likely to be 24 | // understood by most hosts: MAJOR(.MINOR(.REVISION)?)?( (Alpha|Beta) XREV)? 25 | const char *id; // eg: "com.u-he.diva", mandatory 26 | const char *name; // eg: "Diva", mandatory 27 | const char *vendor; // eg: "u-he" 28 | const char *url; // eg: "https://u-he.com/products/diva/" 29 | const char *manual_url; // eg: "https://dl.u-he.com/manuals/plugins/diva/Diva-user-guide.pdf" 30 | const char *support_url; // eg: "https://u-he.com/support/" 31 | const char *version; // eg: "1.4.4" 32 | const char *description; // eg: "The spirit of analogue" 33 | 34 | // Arbitrary list of keywords. 35 | // They can be matched by the host indexer and used to classify the plugin. 36 | // The array of pointers must be null terminated. 37 | // For some standard features see plugin-features.h 38 | const char *const *features; 39 | } clap_plugin_descriptor_t; 40 | 41 | typedef struct clap_plugin { 42 | const clap_plugin_descriptor_t *desc; 43 | 44 | void *plugin_data; // reserved pointer for the plugin 45 | 46 | // Must be called after creating the plugin. 47 | // If init returns false, the host must destroy the plugin instance. 48 | // If init returns true, then the plugin is initialized and in the deactivated state. 49 | // Unlike in `plugin-factory::create_plugin`, in init you have complete access to the host 50 | // and host extensions, so clap related setup activities should be done here rather than in 51 | // create_plugin. 52 | // [main-thread] 53 | bool(CLAP_ABI *init)(const struct clap_plugin *plugin); 54 | 55 | // Free the plugin and its resources. 56 | // It is required to deactivate the plugin prior to this call. 57 | // [main-thread & !active] 58 | void(CLAP_ABI *destroy)(const struct clap_plugin *plugin); 59 | 60 | // Activate and deactivate the plugin. 61 | // In this call the plugin may allocate memory and prepare everything needed for the process 62 | // call. The process's sample rate will be constant and process's frame count will included in 63 | // the [min, max] range, which is bounded by [1, INT32_MAX]. 64 | // Once activated the latency and port configuration must remain constant, until deactivation. 65 | // Returns true on success. 66 | // [main-thread & !active] 67 | bool(CLAP_ABI *activate)(const struct clap_plugin *plugin, 68 | double sample_rate, 69 | uint32_t min_frames_count, 70 | uint32_t max_frames_count); 71 | // [main-thread & active] 72 | void(CLAP_ABI *deactivate)(const struct clap_plugin *plugin); 73 | 74 | // Call start processing before processing. 75 | // Returns true on success. 76 | // [audio-thread & active & !processing] 77 | bool(CLAP_ABI *start_processing)(const struct clap_plugin *plugin); 78 | 79 | // Call stop processing before sending the plugin to sleep. 80 | // [audio-thread & active & processing] 81 | void(CLAP_ABI *stop_processing)(const struct clap_plugin *plugin); 82 | 83 | // - Clears all buffers, performs a full reset of the processing state (filters, oscillators, 84 | // envelopes, lfo, ...) and kills all voices. 85 | // - The parameter's value remain unchanged. 86 | // - clap_process.steady_time may jump backward. 87 | // 88 | // [audio-thread & active] 89 | void(CLAP_ABI *reset)(const struct clap_plugin *plugin); 90 | 91 | // process audio, events, ... 92 | // All the pointers coming from clap_process_t and its nested attributes, 93 | // are valid until process() returns. 94 | // [audio-thread & active & processing] 95 | clap_process_status(CLAP_ABI *process)(const struct clap_plugin *plugin, 96 | const clap_process_t *process); 97 | 98 | // Query an extension. 99 | // The returned pointer is owned by the plugin. 100 | // It is forbidden to call it before plugin->init(). 101 | // You can call it within plugin->init() call, and after. 102 | // [thread-safe] 103 | const void *(CLAP_ABI *get_extension)(const struct clap_plugin *plugin, const char *id); 104 | 105 | // Called by the host on the main thread in response to a previous call to: 106 | // host->request_callback(host); 107 | // [main-thread] 108 | void(CLAP_ABI *on_main_thread)(const struct clap_plugin *plugin); 109 | } clap_plugin_t; 110 | 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/Parameter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Parameter.h 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #pragma once 16 | #ifndef PARAMETER_H_ 17 | #define PARAMETER_H_ 18 | 19 | enum ParameterType { 20 | Is_FLOAT = 0, 21 | IS_DOUBLE, 22 | IS_INT, 23 | IS_UINT, 24 | }; 25 | 26 | struct Parameter { 27 | int id; // clap_id set during register 28 | std::string name; // name of the parameter 29 | std::string group; // group of the parameter 30 | double min; // min value 31 | double max; // max value 32 | double def; // default value 33 | double step; // default step from controller 34 | void* value; // void pointer to the variable holding the value 35 | bool isStepped; // is parameter toggled or use integer steps 36 | int type; // controller type 0 = float, 1 = double, 2 = int32_t, 3 = uint32_t, 37 | bool isDirty; // a parameter have changed by the user (GUI) 38 | }; 39 | 40 | class Params { 41 | public: 42 | std::atomic paramChanged; // indicate parameter changed by the host 43 | std::atomic controllerChanged; // indicate parameter changed by the GUI 44 | 45 | Params() { 46 | paramChanged.store(false, std::memory_order_release); 47 | controllerChanged.store(false, std::memory_order_release); 48 | } 49 | 50 | ~Params() {} 51 | 52 | // register a parameter 53 | void registerParam(Parameter p) { 54 | parameter.push_back(p); 55 | } 56 | 57 | // register a variable as parameter 58 | void registerParam(std::string name, std::string group, 59 | double min, double max, double def, double step, 60 | void* value, bool isStepped, int type) { 61 | int id = static_cast(parameter.size()); 62 | Parameter p = {id, name, group, min, max, def, step, value, isStepped, type, false}; 63 | parameter.push_back(p); 64 | } 65 | 66 | // register a variable as parameter 67 | void registerParam(const char* name, const char* group, 68 | double min, double max, double def, double step, 69 | void* value, bool isStepped, int type) { 70 | int id = static_cast(parameter.size()); 71 | Parameter p = {id, name, group, min, max, def, step, value, isStepped, type, false}; 72 | parameter.push_back(p); 73 | } 74 | 75 | // indicate a parameter change by the user 76 | void setParamDirty(int idx, bool dirty) { 77 | if (idx >= static_cast(parameter.size())) return; 78 | parameter[idx].isDirty = dirty; 79 | } 80 | 81 | // get if a parameter was changed by the user 82 | bool isParamDirty(int idx) const { 83 | if (idx >= static_cast(parameter.size())) return false; 84 | return parameter[idx].isDirty; 85 | } 86 | 87 | // get the parameter count 88 | int getParamCount() { 89 | return static_cast(parameter.size()); 90 | } 91 | 92 | // get a parameter 93 | const Parameter& getParameter(int idx) const { 94 | return parameter[idx]; 95 | } 96 | 97 | // reset all parameters to default values 98 | void reset() { 99 | uint32_t count = parameter.size(); 100 | for (uint32_t i = 0; i < count; i++) { 101 | const auto& def = parameter[i]; 102 | setParam(i, def.def); 103 | setParamDirty(i, true); 104 | } 105 | } 106 | 107 | // get the parameter value as double 108 | double getParam(int idx) const { 109 | if (idx >= static_cast(parameter.size())) return 0.0; 110 | switch(parameter[idx].type) { 111 | case Is_FLOAT: 112 | { 113 | float* pvalue = static_cast(parameter[idx].value); 114 | return static_cast(*pvalue); 115 | } 116 | case IS_DOUBLE: 117 | { 118 | double* pvalue = static_cast(parameter[idx].value); 119 | return *pvalue; 120 | } 121 | case IS_INT: 122 | { 123 | int32_t* pvalue = static_cast(parameter[idx].value); 124 | return static_cast(*pvalue); 125 | } 126 | case IS_UINT: 127 | { 128 | uint32_t* pvalue = static_cast(parameter[idx].value); 129 | return static_cast(*pvalue); 130 | } 131 | default: 132 | return 0.0; 133 | } 134 | } 135 | 136 | // set the parameter value as double 137 | void setParam(int idx, double value) { 138 | if (idx >= static_cast(parameter.size())) return; 139 | switch(parameter[idx].type) { 140 | case Is_FLOAT: 141 | { 142 | float* pvalue = static_cast(parameter[idx].value); 143 | *pvalue = static_cast(value); 144 | break; 145 | } 146 | case IS_DOUBLE: 147 | { 148 | double* pvalue = static_cast(parameter[idx].value); 149 | *pvalue = value; 150 | break; 151 | } 152 | case IS_INT: 153 | { 154 | int32_t* pvalue = static_cast(parameter[idx].value); 155 | *pvalue = static_cast(value); 156 | break; 157 | } 158 | case IS_UINT: 159 | { 160 | uint32_t* pvalue = static_cast(parameter[idx].value); 161 | *pvalue = static_cast(value); 162 | break; 163 | } 164 | default: 165 | break; 166 | } 167 | // inform the GUI thread that a parameter was changed by the host 168 | paramChanged.store(true, std::memory_order_release); 169 | } 170 | private: 171 | std::vector parameter; // vector holding all parameters 172 | 173 | }; 174 | 175 | 176 | #endif 177 | -------------------------------------------------------------------------------- /ImpulseLoader/zita-resampler-1.1.0/resampler.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | static unsigned int gcd (unsigned int a, unsigned int b) 29 | { 30 | if (a == 0) return b; 31 | if (b == 0) return a; 32 | while (1) 33 | { 34 | if (a > b) 35 | { 36 | a = a % b; 37 | if (a == 0) return b; 38 | if (a == 1) return 1; 39 | } 40 | else 41 | { 42 | b = b % a; 43 | if (b == 0) return a; 44 | if (b == 1) return 1; 45 | } 46 | } 47 | return 1; 48 | } 49 | 50 | 51 | Resampler::Resampler (void) : 52 | _table (0), 53 | _nchan (0), 54 | _buff (0) 55 | { 56 | reset (); 57 | } 58 | 59 | 60 | Resampler::~Resampler (void) 61 | { 62 | clear (); 63 | } 64 | 65 | 66 | int Resampler::setup (unsigned int fs_inp, 67 | unsigned int fs_out, 68 | unsigned int nchan, 69 | unsigned int hlen) 70 | { 71 | if ((hlen < 8) || (hlen > 96)) return 1; 72 | return setup (fs_inp, fs_out, nchan, hlen, 1.0 - 2.6 / hlen); 73 | } 74 | 75 | 76 | int Resampler::setup (unsigned int fs_inp, 77 | unsigned int fs_out, 78 | unsigned int nchan, 79 | unsigned int hlen, 80 | double frel) 81 | { 82 | unsigned int g, h, k, n, s; 83 | double r; 84 | float *B = 0; 85 | Resampler_table *T = 0; 86 | 87 | k = s = 0; 88 | if (fs_inp && fs_out && nchan) 89 | { 90 | r = (double) fs_out / (double) fs_inp; 91 | g = gcd (fs_out, fs_inp); 92 | n = fs_out / g; 93 | s = fs_inp / g; 94 | if ((16 * r >= 1) && (n <= 1000)) 95 | { 96 | h = hlen; 97 | k = 250; 98 | if (r < 1) 99 | { 100 | frel *= r; 101 | h = (unsigned int)(ceil (h / r)); 102 | k = (unsigned int)(ceil (k / r)); 103 | } 104 | T = Resampler_table::create (frel, h, n); 105 | B = new float [nchan * (2 * h - 1 + k)]; 106 | } 107 | } 108 | clear (); 109 | if (T) 110 | { 111 | _table = T; 112 | _buff = B; 113 | _nchan = nchan; 114 | _inmax = k; 115 | _pstep = s; 116 | return reset (); 117 | } 118 | else return 1; 119 | } 120 | 121 | 122 | void Resampler::clear (void) 123 | { 124 | Resampler_table::destroy (_table); 125 | delete[] _buff; 126 | _buff = 0; 127 | _table = 0; 128 | _nchan = 0; 129 | _inmax = 0; 130 | _pstep = 0; 131 | reset (); 132 | } 133 | 134 | 135 | double Resampler::inpdist (void) const 136 | { 137 | if (!_table) return 0; 138 | return (int)(_table->_hl + 1 - _nread) - (double)_phase / _table->_np; 139 | } 140 | 141 | 142 | int Resampler::inpsize (void) const 143 | { 144 | if (!_table) return 0; 145 | return 2 * _table->_hl; 146 | } 147 | 148 | 149 | int Resampler::reset (void) 150 | { 151 | if (!_table) return 1; 152 | 153 | inp_count = 0; 154 | out_count = 0; 155 | inp_data = 0; 156 | out_data = 0; 157 | _index = 0; 158 | _nread = 0; 159 | _nzero = 0; 160 | _phase = 0; 161 | if (_table) 162 | { 163 | _nread = 2 * _table->_hl; 164 | return 0; 165 | } 166 | return 1; 167 | } 168 | 169 | 170 | int Resampler::process (void) 171 | { 172 | unsigned int hl, ph, np, dp, in, nr, nz, i, n, c; 173 | float *p1, *p2; 174 | 175 | if (!_table) return 1; 176 | 177 | hl = _table->_hl; 178 | np = _table->_np; 179 | dp = _pstep; 180 | in = _index; 181 | nr = _nread; 182 | ph = _phase; 183 | nz = _nzero; 184 | n = (2 * hl - nr) * _nchan; 185 | p1 = _buff + in * _nchan; 186 | p2 = p1 + n; 187 | 188 | while (out_count) 189 | { 190 | if (nr) 191 | { 192 | if (inp_count == 0) break; 193 | if (inp_data) 194 | { 195 | for (c = 0; c < _nchan; c++) p2 [c] = inp_data [c]; 196 | inp_data += _nchan; 197 | nz = 0; 198 | } 199 | else 200 | { 201 | for (c = 0; c < _nchan; c++) p2 [c] = 0; 202 | if (nz < 2 * hl) nz++; 203 | } 204 | nr--; 205 | p2 += _nchan; 206 | inp_count--; 207 | } 208 | else 209 | { 210 | if (out_data) 211 | { 212 | if (nz < 2 * hl) 213 | { 214 | float *c1 = _table->_ctab + hl * ph; 215 | float *c2 = _table->_ctab + hl * (np - ph); 216 | for (c = 0; c < _nchan; c++) 217 | { 218 | float *q1 = p1 + c; 219 | float *q2 = p2 + c; 220 | float s = 1e-20f; 221 | for (i = 0; i < hl; i++) 222 | { 223 | q2 -= _nchan; 224 | s += *q1 * c1 [i] + *q2 * c2 [i]; 225 | q1 += _nchan; 226 | } 227 | *out_data++ = s - 1e-20f; 228 | } 229 | } 230 | else 231 | { 232 | for (c = 0; c < _nchan; c++) *out_data++ = 0; 233 | } 234 | } 235 | out_count--; 236 | 237 | ph += dp; 238 | if (ph >= np) 239 | { 240 | nr = ph / np; 241 | ph -= nr * np; 242 | in += nr; 243 | p1 += nr * _nchan;; 244 | if (in >= _inmax) 245 | { 246 | n = (2 * hl - nr) * _nchan; 247 | memcpy (_buff, p1, n * sizeof (float)); 248 | in = 0; 249 | p1 = _buff; 250 | p2 = p1 + n; 251 | } 252 | } 253 | } 254 | } 255 | _index = in; 256 | _nread = nr; 257 | _phase = ph; 258 | _nzero = nz; 259 | 260 | return 0; 261 | } 262 | 263 | 264 | -------------------------------------------------------------------------------- /ImpulseLoader/lv2/DSP/zita-resampler-1.1.0/resampler.cc: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2006-2012 Fons Adriaensen 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | // ---------------------------------------------------------------------------- 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | static unsigned int gcd (unsigned int a, unsigned int b) 29 | { 30 | if (a == 0) return b; 31 | if (b == 0) return a; 32 | while (1) 33 | { 34 | if (a > b) 35 | { 36 | a = a % b; 37 | if (a == 0) return b; 38 | if (a == 1) return 1; 39 | } 40 | else 41 | { 42 | b = b % a; 43 | if (b == 0) return a; 44 | if (b == 1) return 1; 45 | } 46 | } 47 | return 1; 48 | } 49 | 50 | 51 | Resampler::Resampler (void) : 52 | _table (0), 53 | _nchan (0), 54 | _buff (0) 55 | { 56 | reset (); 57 | } 58 | 59 | 60 | Resampler::~Resampler (void) 61 | { 62 | clear (); 63 | } 64 | 65 | 66 | int Resampler::setup (unsigned int fs_inp, 67 | unsigned int fs_out, 68 | unsigned int nchan, 69 | unsigned int hlen) 70 | { 71 | if ((hlen < 8) || (hlen > 96)) return 1; 72 | return setup (fs_inp, fs_out, nchan, hlen, 1.0 - 2.6 / hlen); 73 | } 74 | 75 | 76 | int Resampler::setup (unsigned int fs_inp, 77 | unsigned int fs_out, 78 | unsigned int nchan, 79 | unsigned int hlen, 80 | double frel) 81 | { 82 | unsigned int g, h, k, n, s; 83 | double r; 84 | float *B = 0; 85 | Resampler_table *T = 0; 86 | 87 | k = s = 0; 88 | if (fs_inp && fs_out && nchan) 89 | { 90 | r = (double) fs_out / (double) fs_inp; 91 | g = gcd (fs_out, fs_inp); 92 | n = fs_out / g; 93 | s = fs_inp / g; 94 | if ((16 * r >= 1) && (n <= 1000)) 95 | { 96 | h = hlen; 97 | k = 250; 98 | if (r < 1) 99 | { 100 | frel *= r; 101 | h = (unsigned int)(ceil (h / r)); 102 | k = (unsigned int)(ceil (k / r)); 103 | } 104 | T = Resampler_table::create (frel, h, n); 105 | B = new float [nchan * (2 * h - 1 + k)]; 106 | } 107 | } 108 | clear (); 109 | if (T) 110 | { 111 | _table = T; 112 | _buff = B; 113 | _nchan = nchan; 114 | _inmax = k; 115 | _pstep = s; 116 | return reset (); 117 | } 118 | else return 1; 119 | } 120 | 121 | 122 | void Resampler::clear (void) 123 | { 124 | Resampler_table::destroy (_table); 125 | delete[] _buff; 126 | _buff = 0; 127 | _table = 0; 128 | _nchan = 0; 129 | _inmax = 0; 130 | _pstep = 0; 131 | reset (); 132 | } 133 | 134 | 135 | double Resampler::inpdist (void) const 136 | { 137 | if (!_table) return 0; 138 | return (int)(_table->_hl + 1 - _nread) - (double)_phase / _table->_np; 139 | } 140 | 141 | 142 | int Resampler::inpsize (void) const 143 | { 144 | if (!_table) return 0; 145 | return 2 * _table->_hl; 146 | } 147 | 148 | 149 | int Resampler::reset (void) 150 | { 151 | if (!_table) return 1; 152 | 153 | inp_count = 0; 154 | out_count = 0; 155 | inp_data = 0; 156 | out_data = 0; 157 | _index = 0; 158 | _nread = 0; 159 | _nzero = 0; 160 | _phase = 0; 161 | if (_table) 162 | { 163 | _nread = 2 * _table->_hl; 164 | return 0; 165 | } 166 | return 1; 167 | } 168 | 169 | 170 | int Resampler::process (void) 171 | { 172 | unsigned int hl, ph, np, dp, in, nr, nz, i, n, c; 173 | float *p1, *p2; 174 | 175 | if (!_table) return 1; 176 | 177 | hl = _table->_hl; 178 | np = _table->_np; 179 | dp = _pstep; 180 | in = _index; 181 | nr = _nread; 182 | ph = _phase; 183 | nz = _nzero; 184 | n = (2 * hl - nr) * _nchan; 185 | p1 = _buff + in * _nchan; 186 | p2 = p1 + n; 187 | 188 | while (out_count) 189 | { 190 | if (nr) 191 | { 192 | if (inp_count == 0) break; 193 | if (inp_data) 194 | { 195 | for (c = 0; c < _nchan; c++) p2 [c] = inp_data [c]; 196 | inp_data += _nchan; 197 | nz = 0; 198 | } 199 | else 200 | { 201 | for (c = 0; c < _nchan; c++) p2 [c] = 0; 202 | if (nz < 2 * hl) nz++; 203 | } 204 | nr--; 205 | p2 += _nchan; 206 | inp_count--; 207 | } 208 | else 209 | { 210 | if (out_data) 211 | { 212 | if (nz < 2 * hl) 213 | { 214 | float *c1 = _table->_ctab + hl * ph; 215 | float *c2 = _table->_ctab + hl * (np - ph); 216 | for (c = 0; c < _nchan; c++) 217 | { 218 | float *q1 = p1 + c; 219 | float *q2 = p2 + c; 220 | float s = 1e-20f; 221 | for (i = 0; i < hl; i++) 222 | { 223 | q2 -= _nchan; 224 | s += *q1 * c1 [i] + *q2 * c2 [i]; 225 | q1 += _nchan; 226 | } 227 | *out_data++ = s - 1e-20f; 228 | } 229 | } 230 | else 231 | { 232 | for (c = 0; c < _nchan; c++) *out_data++ = 0; 233 | } 234 | } 235 | out_count--; 236 | 237 | ph += dp; 238 | if (ph >= np) 239 | { 240 | nr = ph / np; 241 | ph -= nr * np; 242 | in += nr; 243 | p1 += nr * _nchan;; 244 | if (in >= _inmax) 245 | { 246 | n = (2 * hl - nr) * _nchan; 247 | memcpy (_buff, p1, n * sizeof (float)); 248 | in = 0; 249 | p1 = _buff; 250 | p2 = p1 + n; 251 | } 252 | } 253 | } 254 | } 255 | _index = in; 256 | _nread = nr; 257 | _phase = ph; 258 | _nzero = nz; 259 | 260 | return 0; 261 | } 262 | 263 | 264 | -------------------------------------------------------------------------------- /ImpulseLoader/engine/engine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * engine.h 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef __SSE__ 22 | #include 23 | #ifndef _IMMINTRIN_H_INCLUDED 24 | #include 25 | #endif 26 | #ifdef __SSE3__ 27 | #ifndef _PMMINTRIN_H_INCLUDED 28 | #include 29 | #endif 30 | #else 31 | #ifndef _XMMINTRIN_H_INCLUDED 32 | #include 33 | #endif 34 | #endif //__SSE3__ 35 | #endif //__SSE__ 36 | 37 | #include "dry_wet.cc" 38 | #include "gain.cc" 39 | 40 | #include "fftconvolver.h" 41 | 42 | #pragma once 43 | 44 | #ifndef ENGINE_H_ 45 | #define ENGINE_H_ 46 | namespace impulseloader { 47 | 48 | /////////////////////////// DENORMAL PROTECTION ////////////////////// 49 | 50 | class DenormalProtection { 51 | private: 52 | #ifdef USE_SSE 53 | uint32_t mxcsr_mask; 54 | uint32_t mxcsr; 55 | uint32_t old_mxcsr; 56 | #endif 57 | 58 | public: 59 | inline void set_() { 60 | #ifdef USE_SSE 61 | old_mxcsr = _mm_getcsr(); 62 | mxcsr = old_mxcsr; 63 | _mm_setcsr((mxcsr | _MM_DENORMALS_ZERO_MASK | _MM_FLUSH_ZERO_MASK) & mxcsr_mask); 64 | #endif 65 | }; 66 | inline void reset_() { 67 | #ifdef USE_SSE 68 | _mm_setcsr(old_mxcsr); 69 | #endif 70 | }; 71 | 72 | inline DenormalProtection() { 73 | #ifdef USE_SSE 74 | mxcsr_mask = 0xffbf; // Default MXCSR mask 75 | mxcsr = 0; 76 | uint8_t fxsave[512] __attribute__ ((aligned (16))); // Structure for storing FPU state with FXSAVE command 77 | 78 | memset(fxsave, 0, sizeof(fxsave)); 79 | __builtin_ia32_fxsave(&fxsave); 80 | uint32_t mask = *(reinterpret_cast(&fxsave[0x1c])); // Obtain the MXCSR mask from FXSAVE structure 81 | if (mask != 0) 82 | mxcsr_mask = mask; 83 | #endif 84 | }; 85 | 86 | inline ~DenormalProtection() {}; 87 | }; 88 | 89 | class Engine 90 | { 91 | public: 92 | ParallelThread xrworker; 93 | ConvolverSelector conv; 94 | gain::Dsp* plugin1; 95 | wet_dry::Dsp* plugin2; 96 | 97 | int32_t rt_prio; 98 | int32_t rt_policy; 99 | uint32_t s_rate; 100 | uint32_t bypass; 101 | uint32_t bufsize; 102 | uint32_t normA; 103 | 104 | std::string ir_file; 105 | 106 | std::atomic _execute; 107 | std::atomic _notify_ui; 108 | std::atomic _cd; 109 | 110 | inline Engine(); 111 | inline ~Engine(); 112 | 113 | inline void init(uint32_t rate, int32_t rt_prio_, int32_t rt_policy_); 114 | inline void clean_up(); 115 | inline void do_work_mono(); 116 | inline void process(uint32_t n_samples, float* output0, float* output1); 117 | 118 | private: 119 | DenormalProtection MXCSR; 120 | std::condition_variable Sync; 121 | std::mutex WMutex; 122 | 123 | inline void setIRFile(ConvolverSelector *co, std::string *file); 124 | }; 125 | 126 | inline Engine::Engine() : 127 | xrworker(), 128 | plugin1(gain::plugin()), 129 | plugin2(wet_dry::plugin()) { 130 | bypass = 0; 131 | bufsize = 0; 132 | normA = 0; 133 | ir_file = "None"; 134 | xrworker.start(); 135 | }; 136 | 137 | inline Engine::~Engine(){ 138 | xrworker.stop(); 139 | conv.stop_process(); 140 | conv.cleanup(); 141 | plugin1->del_instance(plugin1); 142 | plugin2->del_instance(plugin2); 143 | }; 144 | 145 | inline void Engine::init(uint32_t rate, int32_t rt_prio_, int32_t rt_policy_) { 146 | s_rate = rate; 147 | plugin1->init(rate); 148 | plugin2->init(rate); 149 | 150 | rt_prio = rt_prio_; 151 | rt_policy = rt_policy_; 152 | 153 | _execute.store(false, std::memory_order_release); 154 | _notify_ui.store(false, std::memory_order_release); 155 | _cd.store(0, std::memory_order_release); 156 | 157 | xrworker.setThreadName("Worker"); 158 | xrworker.set(this); 159 | }; 160 | 161 | void Engine::clean_up() 162 | { 163 | } 164 | 165 | inline void Engine::setIRFile(ConvolverSelector *co, std::string *file) { 166 | if (co->is_runnable()) { 167 | co->set_not_runnable(); 168 | co->stop_process(); 169 | std::unique_lock lk(WMutex); 170 | Sync.wait_for(lk, std::chrono::milliseconds(160)); 171 | } 172 | 173 | co->cleanup(); 174 | co->set_samplerate(s_rate); 175 | co->set_buffersize(bufsize); 176 | 177 | if (*file != "None") { 178 | co->configure(*file, 1.0, 0, 0, 0, 0, 0); 179 | while (!co->checkstate()); 180 | if(!co->start(rt_prio, rt_policy)) { 181 | *file = "None"; 182 | // lv2_log_error(&logger,"impulse convolver update fail\n"); 183 | } 184 | } 185 | } 186 | 187 | void Engine::do_work_mono() { 188 | // set ir files 189 | if (_cd.load(std::memory_order_acquire) == 1) { 190 | setIRFile(&conv, &ir_file); 191 | } 192 | // set flag that work is done ready 193 | _execute.store(false, std::memory_order_release); 194 | // set flag that GUI need information about changed state 195 | _notify_ui.store(true, std::memory_order_release); 196 | } 197 | 198 | inline void Engine::process(uint32_t n_samples, float* input0, float* output0) { 199 | if(n_samples<1) return; 200 | 201 | // basic bypass 202 | if (!bypass) { 203 | Sync.notify_all(); 204 | return; 205 | } 206 | // do inplace processing on default 207 | if(output0 != input0) 208 | memcpy(output0, input0, n_samples*sizeof(float)); 209 | 210 | bufsize = n_samples; 211 | float buf0[n_samples]; 212 | memcpy(buf0, input0, n_samples*sizeof(float)); 213 | 214 | MXCSR.set_(); 215 | 216 | // process conv 217 | plugin1->compute(n_samples, output0, output0); 218 | if (!_execute.load(std::memory_order_acquire) && conv.is_runnable()) 219 | conv.compute(n_samples, output0, output0); 220 | plugin2->compute(n_samples, buf0, output0, output0); 221 | 222 | 223 | // notify neural modeller that process cycle is done 224 | Sync.notify_all(); 225 | MXCSR.reset_(); 226 | 227 | } 228 | 229 | }; // end namespace neuralrack 230 | #endif 231 | -------------------------------------------------------------------------------- /ImpulseLoader/vst2/VstPlug.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * VstPlug.cpp 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | #include "vestige.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #define IS_VST2 18 | #include "ImpulseLoader.cc" 19 | 20 | typedef struct ERect { 21 | short top; 22 | short left; 23 | short bottom; 24 | short right; 25 | } ERect; 26 | 27 | #define PLUGIN_UID 'Irbr' 28 | 29 | #define WINDOW_WIDTH 500 30 | #define WINDOW_HEIGHT 309 31 | 32 | #define FlagsChunks (1 << 5) 33 | 34 | /**************************************************************** 35 | ** plugin_t -> the plugin struct 36 | */ 37 | 38 | struct plugin_t { 39 | AEffect* effect; 40 | ImpulseLoader *r; 41 | ERect editorRect; 42 | int width, height; 43 | float SampleRate; 44 | std::string state; 45 | bool isInited; 46 | bool guiIsCreated; 47 | }; 48 | 49 | /**************************************************************** 50 | ** Parameter handling not used here 51 | */ 52 | 53 | static void setParameter(AEffect* effect, int32_t index, float value) { 54 | } 55 | 56 | static float getParameter(AEffect* effect, int32_t index) { 57 | return 0.0; 58 | } 59 | 60 | static void getParameterName(AEffect*, int32_t index, char* label) { 61 | } 62 | 63 | /**************************************************************** 64 | ** The audio process 65 | */ 66 | 67 | static void processReplacing(AEffect* effect, float** inputs, float** outputs, int32_t sampleFrames) { 68 | plugin_t* plug = (plugin_t*)effect->object; 69 | 70 | float* input = inputs[0]; 71 | float* output = outputs[0]; 72 | if(output != input) 73 | memcpy(output, input, sampleFrames*sizeof(float)); 74 | 75 | plug->r->process(sampleFrames, output, output); 76 | } 77 | 78 | /**************************************************************** 79 | ** Save and load state 80 | */ 81 | 82 | void saveState(plugin_t* plug, void** data, int* size, int isBank) { 83 | plug->r->saveState(&plug->state); 84 | *size = strlen(plug->state.c_str()); 85 | // only save data here for later loading 86 | *data = (void*)plug->state.c_str(); 87 | } 88 | 89 | void loadState(plugin_t* plug, int size, int isBank) { 90 | if (plug->state.empty()) return; 91 | plug->r->readState(plug->state); 92 | } 93 | 94 | /**************************************************************** 95 | ** The Dispatcher 96 | */ 97 | 98 | static intptr_t dispatcher(AEffect* effect, int32_t opCode, int32_t index, intptr_t value, void* ptr, float opt) { 99 | plugin_t* plug = (plugin_t*)effect->object; 100 | switch (opCode) { 101 | case effEditGetRect: 102 | if (ptr) *(ERect**)ptr = &plug->editorRect; 103 | return 1; 104 | case effGetEffectName: 105 | strncpy((char*)ptr, "ImpulseLoader", VestigeMaxNameLen - 1); 106 | ((char*)ptr)[VestigeMaxNameLen - 1] = '\0'; 107 | return 1; 108 | case effGetVendorString: 109 | strncpy((char*)ptr, "brummer", VestigeMaxNameLen - 1); 110 | ((char*)ptr)[VestigeMaxNameLen - 1] = '\0'; 111 | return 1; 112 | case effGetProductString: 113 | strncpy((char*)ptr, "brummer", VestigeMaxNameLen - 1); 114 | ((char*)ptr)[VestigeMaxNameLen - 1] = '\0'; 115 | return 1; 116 | case effGetPlugCategory: 117 | return kPlugCategEffect; 118 | case effOpen: 119 | break; 120 | case effClose: 121 | if (plug->guiIsCreated) { 122 | plug->r->quitGui(); 123 | } 124 | delete plug->r; 125 | free(plug); 126 | break; 127 | case effGetParamName: 128 | getParameterName(effect, index, (char*)ptr); 129 | break; 130 | case effSetSampleRate: 131 | plug->SampleRate = opt; 132 | plug->r->initEngine((uint32_t)plug->SampleRate, 25, 1); 133 | plug->isInited = true; 134 | loadState(plug, 0, 0); 135 | break; 136 | case effEditOpen: { 137 | Window hostWin = (Window)(size_t)ptr; 138 | plug->r->startGui(); 139 | plug->r->setParent(hostWin); 140 | plug->r->showGui(); 141 | plug->guiIsCreated = true; 142 | break; 143 | } 144 | case effEditClose: { 145 | if (plug->guiIsCreated) { 146 | plug->r->quitGui(); 147 | } 148 | plug->guiIsCreated = false; 149 | break; 150 | } 151 | case effEditIdle: 152 | break; 153 | //case effGetProgram: 154 | case 23: { // effGetChunk 155 | void* chunkData = nullptr; 156 | int chunkSize = 0; 157 | saveState(plug, &chunkData, &chunkSize, index); // index=0: program, 1: bank 158 | *(void**)ptr = chunkData; 159 | return chunkSize; 160 | } 161 | //case effSetProgram: 162 | case 24: { // effSetChunk 163 | plug->state = (const char*) ptr; 164 | // read state, but load it only after we got the sample rate 165 | if (plug->isInited) loadState(plug, 0, 0); 166 | break; 167 | } 168 | default: break; 169 | } 170 | return 0; 171 | } 172 | 173 | /**************************************************************** 174 | ** The Main Entry 175 | */ 176 | 177 | extern "C" __attribute__ ((visibility ("default"))) 178 | AEffect* VSTPluginMain(audioMasterCallback audioMaster) { 179 | plugin_t* plug = (plugin_t*)calloc(1, sizeof(plugin_t)); 180 | AEffect* effect = (AEffect*)calloc(1, sizeof(AEffect)); 181 | plug->r = new ImpulseLoader(); 182 | effect->object = plug; 183 | plug->effect = effect; 184 | plug->width = WINDOW_WIDTH; 185 | plug->height = WINDOW_HEIGHT; 186 | plug->editorRect = {0, 0, (short) plug->height, (short) plug->width}; 187 | plug->SampleRate = 48000.0; 188 | plug->isInited = false; 189 | plug->guiIsCreated = false; 190 | 191 | effect->magic = kEffectMagic; 192 | effect->dispatcher = dispatcher; 193 | effect->processReplacing = processReplacing; 194 | effect->setParameter = setParameter; 195 | effect->getParameter = getParameter; 196 | effect->numPrograms = 1; 197 | effect->numParams = 0; 198 | effect->numInputs = 1; 199 | effect->numOutputs = 1; 200 | effect->flags = effFlagsHasEditor | effFlagsCanReplacing | FlagsChunks; 201 | effect->uniqueID = PLUGIN_UID; 202 | return effect; 203 | } 204 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/ext/context-menu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../plugin.h" 4 | 5 | // This extension lets the host and plugin exchange menu items and let the plugin ask the host to 6 | // show its context menu. 7 | 8 | static CLAP_CONSTEXPR const char CLAP_EXT_CONTEXT_MENU[] = "clap.context-menu/1"; 9 | 10 | // The latest draft is 100% compatible. 11 | // This compat ID may be removed in 2026. 12 | static CLAP_CONSTEXPR const char CLAP_EXT_CONTEXT_MENU_COMPAT[] = "clap.context-menu.draft/0"; 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | // There can be different target kind for a context menu 19 | enum { 20 | CLAP_CONTEXT_MENU_TARGET_KIND_GLOBAL = 0, 21 | CLAP_CONTEXT_MENU_TARGET_KIND_PARAM = 1, 22 | }; 23 | 24 | // Describes the context menu target 25 | typedef struct clap_context_menu_target { 26 | uint32_t kind; 27 | clap_id id; 28 | } clap_context_menu_target_t; 29 | 30 | enum { 31 | // Adds a clickable menu entry. 32 | // data: const clap_context_menu_item_entry_t* 33 | CLAP_CONTEXT_MENU_ITEM_ENTRY, 34 | 35 | // Adds a clickable menu entry which will feature both a checkmark and a label. 36 | // data: const clap_context_menu_item_check_entry_t* 37 | CLAP_CONTEXT_MENU_ITEM_CHECK_ENTRY, 38 | 39 | // Adds a separator line. 40 | // data: NULL 41 | CLAP_CONTEXT_MENU_ITEM_SEPARATOR, 42 | 43 | // Starts a sub menu with the given label. 44 | // data: const clap_context_menu_item_begin_submenu_t* 45 | CLAP_CONTEXT_MENU_ITEM_BEGIN_SUBMENU, 46 | 47 | // Ends the current sub menu. 48 | // data: NULL 49 | CLAP_CONTEXT_MENU_ITEM_END_SUBMENU, 50 | 51 | // Adds a title entry 52 | // data: const clap_context_menu_item_title_t * 53 | CLAP_CONTEXT_MENU_ITEM_TITLE, 54 | }; 55 | typedef uint32_t clap_context_menu_item_kind_t; 56 | 57 | typedef struct clap_context_menu_entry { 58 | // text to be displayed 59 | const char *label; 60 | 61 | // if false, then the menu entry is greyed out and not clickable 62 | bool is_enabled; 63 | clap_id action_id; 64 | } clap_context_menu_entry_t; 65 | 66 | typedef struct clap_context_menu_check_entry { 67 | // text to be displayed 68 | const char *label; 69 | 70 | // if false, then the menu entry is greyed out and not clickable 71 | bool is_enabled; 72 | 73 | // if true, then the menu entry will be displayed as checked 74 | bool is_checked; 75 | clap_id action_id; 76 | } clap_context_menu_check_entry_t; 77 | 78 | typedef struct clap_context_menu_item_title { 79 | // text to be displayed 80 | const char *title; 81 | 82 | // if false, then the menu entry is greyed out 83 | bool is_enabled; 84 | } clap_context_menu_item_title_t; 85 | 86 | typedef struct clap_context_menu_submenu { 87 | // text to be displayed 88 | const char *label; 89 | 90 | // if false, then the menu entry is greyed out and won't show submenu 91 | bool is_enabled; 92 | } clap_context_menu_submenu_t; 93 | 94 | // Context menu builder. 95 | // This object isn't thread-safe and must be used on the same thread as it was provided. 96 | typedef struct clap_context_menu_builder { 97 | void *ctx; 98 | 99 | // Adds an entry to the menu. 100 | // item_data type is determined by item_kind. 101 | // Returns true on success. 102 | bool(CLAP_ABI *add_item)(const struct clap_context_menu_builder *builder, 103 | clap_context_menu_item_kind_t item_kind, 104 | const void *item_data); 105 | 106 | // Returns true if the menu builder supports the given item kind 107 | bool(CLAP_ABI *supports)(const struct clap_context_menu_builder *builder, 108 | clap_context_menu_item_kind_t item_kind); 109 | } clap_context_menu_builder_t; 110 | 111 | typedef struct clap_plugin_context_menu { 112 | // Insert plugin's menu items into the menu builder. 113 | // If target is null, assume global context. 114 | // Returns true on success. 115 | // [main-thread] 116 | bool(CLAP_ABI *populate)(const clap_plugin_t *plugin, 117 | const clap_context_menu_target_t *target, 118 | const clap_context_menu_builder_t *builder); 119 | 120 | // Performs the given action, which was previously provided to the host via populate(). 121 | // If target is null, assume global context. 122 | // Returns true on success. 123 | // [main-thread] 124 | bool(CLAP_ABI *perform)(const clap_plugin_t *plugin, 125 | const clap_context_menu_target_t *target, 126 | clap_id action_id); 127 | } clap_plugin_context_menu_t; 128 | 129 | typedef struct clap_host_context_menu { 130 | // Insert host's menu items into the menu builder. 131 | // If target is null, assume global context. 132 | // Returns true on success. 133 | // [main-thread] 134 | bool(CLAP_ABI *populate)(const clap_host_t *host, 135 | const clap_context_menu_target_t *target, 136 | const clap_context_menu_builder_t *builder); 137 | 138 | // Performs the given action, which was previously provided to the plugin via populate(). 139 | // If target is null, assume global context. 140 | // Returns true on success. 141 | // [main-thread] 142 | bool(CLAP_ABI *perform)(const clap_host_t *host, 143 | const clap_context_menu_target_t *target, 144 | clap_id action_id); 145 | 146 | // Returns true if the host can display a popup menu for the plugin. 147 | // This may depend upon the current windowing system used to display the plugin, so the 148 | // return value is invalidated after creating the plugin window. 149 | // [main-thread] 150 | bool(CLAP_ABI *can_popup)(const clap_host_t *host); 151 | 152 | // Shows the host popup menu for a given parameter. 153 | // If the plugin is using embedded GUI, then x and y are relative to the plugin's window, 154 | // otherwise they're absolute coordinate, and screen index might be set accordingly. 155 | // If target is null, assume global context. 156 | // Returns true on success. 157 | // [main-thread] 158 | bool(CLAP_ABI *popup)(const clap_host_t *host, 159 | const clap_context_menu_target_t *target, 160 | int32_t screen_index, 161 | int32_t x, 162 | int32_t y); 163 | } clap_host_context_menu_t; 164 | 165 | #ifdef __cplusplus 166 | } 167 | #endif 168 | -------------------------------------------------------------------------------- /ImpulseLoader/clap/clap/entry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "version.h" 4 | #include "private/macros.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | // This interface is the entry point of the dynamic library. 11 | // 12 | // CLAP plugins standard search path: 13 | // 14 | // Linux 15 | // - ~/.clap 16 | // - /usr/lib/clap 17 | // 18 | // Windows 19 | // - %COMMONPROGRAMFILES%\CLAP 20 | // - %LOCALAPPDATA%\Programs\Common\CLAP 21 | // 22 | // MacOS 23 | // - /Library/Audio/Plug-Ins/CLAP 24 | // - ~/Library/Audio/Plug-Ins/CLAP 25 | // 26 | // In addition to the OS-specific default locations above, a CLAP host must query the environment 27 | // for a CLAP_PATH variable, which is a list of directories formatted in the same manner as the host 28 | // OS binary search path (PATH on Unix, separated by `:` and Path on Windows, separated by ';', as 29 | // of this writing). 30 | // 31 | // Each directory should be recursively searched for files and/or bundles as appropriate in your OS 32 | // ending with the extension `.clap`. 33 | // 34 | // init and deinit in most cases are called once, in a matched pair, when the dso is loaded / unloaded. 35 | // In some rare situations it may be called multiple times in a process, so the functions must be defensive, 36 | // mutex locking and counting calls if undertaking non trivial non idempotent actions. 37 | // 38 | // Rationale: 39 | // 40 | // The intent of the init() and deinit() functions is to provide a "normal" initialization patterh 41 | // which occurs when the shared object is loaded or unloaded. As such, hosts will call each once and 42 | // in matched pairs. In CLAP specifications prior to 1.2.0, this single-call was documented as a 43 | // requirement. 44 | // 45 | // We realized, though, that this is not a requirement hosts can meet. If hosts load a plugin 46 | // which itself wraps another CLAP for instance, while also loading that same clap in its memory 47 | // space, both the host and the wrapper will call init() and deinit() and have no means to communicate 48 | // the state. 49 | // 50 | // With CLAP 1.2.0 and beyond we are changing the spec to indicate that a host should make an 51 | // absolute best effort to call init() and deinit() once, and always in matched pairs (for every 52 | // init() which returns true, one deinit() should be called). 53 | // 54 | // This takes the de-facto burden on plugin writers to deal with multiple calls into a hard requirement. 55 | // 56 | // Most init() / deinit() pairs we have seen are the relatively trivial {return true;} and {}. But 57 | // if your init() function does non-trivial one time work, the plugin author must maintain a counter 58 | // and must manage a mutex lock. The most obvious implementation will maintain a static counter and a 59 | // global mutex, increment the counter on each init, decrement it on each deinit, and only undertake 60 | // the init or deinit action when the counter is zero. 61 | typedef struct clap_plugin_entry { 62 | clap_version_t clap_version; // initialized to CLAP_VERSION 63 | 64 | // Initializes the DSO. 65 | // 66 | // This function must be called first, before any-other CLAP-related function or symbol from this 67 | // DSO. 68 | // 69 | // It also must only be called once, until a later call to deinit() is made, after which init() 70 | // can be called once more to re-initialize the DSO. 71 | // This enables hosts to e.g. quickly load and unload a DSO for scanning its plugins, and then 72 | // load it again later to actually use the plugins if needed. 73 | // 74 | // As stated above, even though hosts are forbidden to do so directly, multiple calls before any 75 | // deinit() call may still happen. Implementations *should* take this into account, and *must* 76 | // do so as of CLAP 1.2.0. 77 | // 78 | // It should be as fast as possible, in order to perform a very quick scan of the plugin 79 | // descriptors. 80 | // 81 | // It is forbidden to display graphical user interfaces in this call. 82 | // It is forbidden to perform any user interaction in this call. 83 | // 84 | // If the initialization depends upon expensive computation, maybe try to do them ahead of time 85 | // and cache the result. 86 | // 87 | // Returns true on success. If init() returns false, then the DSO must be considered 88 | // uninitialized, and the host must not call deinit() nor any other CLAP-related symbols from the 89 | // DSO. 90 | // This function also returns true in the case where the DSO is already initialized, and no 91 | // actual initialization work is done in this call, as explain above. 92 | // 93 | // plugin_path is the path to the DSO (Linux, Windows), or the bundle (macOS). 94 | // 95 | // This function may be called on any thread, including a different one from the one a later call 96 | // to deinit() (or a later init()) can be made. 97 | // However, it is forbidden to call this function simultaneously from multiple threads. 98 | // It is also forbidden to call it simultaneously with *any* other CLAP-related symbols from the 99 | // DSO, including (but not limited to) deinit(). 100 | bool(CLAP_ABI *init)(const char *plugin_path); 101 | 102 | // De-initializes the DSO, freeing any resources allocated or initialized by init(). 103 | // 104 | // After this function is called, no more calls into the DSO must be made, except calling init() 105 | // again to re-initialize the DSO. 106 | // This means that after deinit() is called, the DSO can be considered to be in the same state 107 | // as if init() was never called at all yet, enabling it to be re-initialized as needed. 108 | // 109 | // As stated above, even though hosts are forbidden to do so directly, multiple calls before any 110 | // new init() call may still happen. Implementations *should* take this into account, and *must* 111 | // do so as of CLAP 1.2.0. 112 | // 113 | // Just like init(), this function may be called on any thread, including a different one from 114 | // the one init() was called from, or from the one a later init() call can be made. 115 | // However, it is forbidden to call this function simultaneously from multiple threads. 116 | // It is also forbidden to call it simultaneously with *any* other CLAP-related symbols from the 117 | // DSO, including (but not limited to) deinit(). 118 | void(CLAP_ABI *deinit)(void); 119 | 120 | // Get the pointer to a factory. See factory/plugin-factory.h for an example. 121 | // 122 | // Returns null if the factory is not provided. 123 | // The returned pointer must *not* be freed by the caller. 124 | // 125 | // Unlike init() and deinit(), this function can be called simultaneously by multiple threads. 126 | // 127 | // [thread-safe] 128 | const void *(CLAP_ABI *get_factory)(const char *factory_id); 129 | } clap_plugin_entry_t; 130 | 131 | /* Entry point */ 132 | CLAP_EXPORT extern const clap_plugin_entry_t clap_entry; 133 | 134 | #ifdef __cplusplus 135 | } 136 | #endif 137 | -------------------------------------------------------------------------------- /ImpulseLoader/standalone/jack.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * jack.cc 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | * 6 | * Copyright (C) 2025 brummer 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | /**************************************************************** 15 | jack.cc native jackd support for Ratatouille 16 | 17 | this file is meant to be included in main. 18 | ****************************************************************/ 19 | 20 | jack_client_t *client; 21 | jack_port_t *in_port; 22 | jack_port_t *midi_port; 23 | jack_port_t *out_port; 24 | bool runProcess = false; 25 | 26 | void jack_shutdown (void *arg) { 27 | runProcess = false; 28 | fprintf (stderr, "jack shutdown, exit now \n"); 29 | r->quitGui(); 30 | } 31 | 32 | int jack_xrun_callback(void *arg) { 33 | fprintf (stderr, "Xrun \r"); 34 | return 0; 35 | } 36 | 37 | int jack_srate_callback(jack_nframes_t samplerate, void* arg) { 38 | int prio = jack_client_real_time_priority(client); 39 | if (prio < 0) prio = 25; 40 | fprintf (stderr, "Samplerate %iHz \n", samplerate); 41 | r->initEngine(samplerate, prio, 1); 42 | return 0; 43 | } 44 | 45 | int jack_buffersize_callback(jack_nframes_t nframes, void* arg) { 46 | fprintf (stderr, "Buffersize is %i samples \n", nframes); 47 | return 0; 48 | } 49 | 50 | void process_midi(void* midi_input_port_buf) { 51 | jack_midi_event_t in_event; 52 | jack_nframes_t event_count = jack_midi_get_event_count(midi_input_port_buf); 53 | unsigned int i; 54 | for (i = 0; i < event_count; i++) { 55 | jack_midi_event_get(&in_event, midi_input_port_buf, i); 56 | if ((in_event.buffer[0] & 0xf0) == 0xc0) { // program change on any midi channel 57 | //fprintf(stderr,"program changed %i", (int)in_event.buffer[1]); 58 | r->loadPreset((int)in_event.buffer[1]); 59 | } else if ((in_event.buffer[0] & 0xf0) == 0xb0) { // controller 60 | if (in_event.buffer[1]== 120) { // engine mute by All Sound Off on any midi channel 61 | //fprintf(stderr,"mute %i", (int)in_event.buffer[2]); 62 | } else if ((in_event.buffer[1]== 32 || 63 | in_event.buffer[1]== 0)) { // bank change (LSB/MSB) on any midi channel 64 | //fprintf(stderr,"bank changed %i", (int)in_event.buffer[2]); 65 | } else { 66 | // fprintf(stderr,"controller changed %i value %i", (int)in_event.buffer[1], (int)in_event.buffer[2]); 67 | } 68 | } else if ((in_event.buffer[0] & 0xf0) == 0x90) { // Note On 69 | //fprintf(stderr,"Note On %i", (int)in_event.buffer[1]); 70 | } 71 | } 72 | 73 | } 74 | 75 | int jack_process(jack_nframes_t nframes, void *arg) { 76 | if (!runProcess) return 0; 77 | void *midi_in = jack_port_get_buffer (midi_port, nframes); 78 | float *input = static_cast(jack_port_get_buffer (in_port, nframes)); 79 | float *output = static_cast(jack_port_get_buffer (out_port, nframes)); 80 | 81 | if(output != input) 82 | memcpy(output, input, nframes*sizeof(float)); 83 | process_midi(midi_in); 84 | r->process(nframes, output); 85 | 86 | return 0; 87 | } 88 | 89 | void replace(std::string& str, const std::string& from, const std::string& to) { 90 | size_t start_pos = str.find(from); 91 | if(start_pos == std::string::npos) 92 | return ; 93 | str.replace(start_pos, from.length(), to); 94 | return ; 95 | } 96 | 97 | void connectPorts() { 98 | std::string port = ""; 99 | std::vector > connections; 100 | r->getConnections(&connections); 101 | for (auto it = connections.begin(); it != connections.end(); it++) { 102 | std::string portname0 = std::get<0>(*it); 103 | std::string portname1 = std::get<1>(*it); 104 | replace(portname0, "@XXCLIENTXX@", jack_get_client_name(client)); 105 | replace(portname1, "@XXCLIENTXX@", jack_get_client_name(client)); 106 | jack_connect(client,portname0.c_str(), portname1.c_str()); 107 | } 108 | connections.clear(); 109 | r->clearConnections(); 110 | } 111 | 112 | void startJack() { 113 | 114 | if ((client = jack_client_open ("impulseloader", JackNoStartServer, NULL)) == 0) { 115 | fprintf (stderr, "jack server not running?\n"); 116 | r->quitGui(); 117 | } 118 | 119 | if (client) { 120 | midi_port = jack_port_register( 121 | client, "in", JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); 122 | in_port = jack_port_register( 123 | client, "in_0", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); 124 | out_port = jack_port_register( 125 | client, "out_0", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); 126 | 127 | jack_set_xrun_callback(client, jack_xrun_callback, 0); 128 | jack_set_sample_rate_callback(client, jack_srate_callback, 0); 129 | jack_set_buffer_size_callback(client, jack_buffersize_callback, 0); 130 | jack_set_process_callback(client, jack_process, 0); 131 | jack_on_shutdown (client, jack_shutdown, 0); 132 | 133 | if (jack_activate (client)) { 134 | fprintf (stderr, "cannot activate client"); 135 | r->quitGui(); 136 | } 137 | 138 | if (!jack_is_realtime(client)) { 139 | fprintf (stderr, "jack isn't running with realtime priority\n"); 140 | } else { 141 | fprintf (stderr, "jack running with realtime priority\n"); 142 | } 143 | r->enableEngine(1); 144 | r->readConfig(); 145 | connectPorts(); 146 | runProcess = true; 147 | } 148 | } 149 | 150 | void saveConnections(jack_port_t *port, bool isInput) { 151 | const char** pl = jack_port_get_connections(port); 152 | std::string portname = jack_port_name(port); 153 | replace(portname, jack_get_client_name(client), "@XXCLIENTXX@"); 154 | if (pl) { 155 | for (const char **p = pl; *p; p++) { 156 | if (!isInput) 157 | r->saveConnections(portname, *p); 158 | else 159 | r->saveConnections(*p, portname); 160 | } 161 | free(pl); 162 | } 163 | } 164 | 165 | void quitJack() { 166 | runProcess = false; 167 | if (client) { 168 | if (jack_port_connected(midi_port)) { 169 | saveConnections(midi_port, true); 170 | jack_port_disconnect(client,midi_port); 171 | } 172 | jack_port_unregister(client,midi_port); 173 | if (jack_port_connected(in_port)) { 174 | saveConnections(in_port, true); 175 | jack_port_disconnect(client,in_port); 176 | } 177 | jack_port_unregister(client,in_port); 178 | if (jack_port_connected(out_port)) { 179 | saveConnections(out_port, false); 180 | jack_port_disconnect(client,out_port); 181 | } 182 | jack_port_unregister(client,out_port); 183 | jack_client_close(client); 184 | } 185 | } 186 | --------------------------------------------------------------------------------