-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
4,394 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.v] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
* text=auto eol=lf | ||
*.bat eol=crlf | ||
|
||
**/*.v linguist-language=V | ||
**/*.vv linguist-language=V | ||
**/*.vsh linguist-language=V | ||
**/v.mod linguist-language=V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,10 @@ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
# V-specific | ||
c2v_output/ | ||
|
||
# Build artifacts | ||
build/ | ||
*.clap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
SOURCEDIR = src | ||
BUILDDIR = build | ||
TARGET = $(BUILDDIR)/hello_world.clap | ||
|
||
# List all V source files | ||
V_SRC = $(wildcard $(SOURCEDIR)/*.v) | ||
|
||
|
||
# Debug and Release build options | ||
DEBUG ?= 0 | ||
RELEASE ?= 0 | ||
ifeq ($(DEBUG),1) | ||
V_FLAGS = -cg -show-c-output | ||
else ifeq ($(RELEASE),1) | ||
V_FLAGS = -prod -skip-unused -cflags -fvisibility=hidden | ||
endif | ||
|
||
|
||
all: $(TARGET) | ||
|
||
# Use dependency on V source files to avoid recompilation | ||
$(TARGET): $(V_SRC) | dir | ||
v -cc gcc -shared -enable-globals $(V_FLAGS) $(SOURCEDIR) -o $@.so | ||
ifeq ($(RELEASE),1) | ||
strip [email protected] | ||
endif | ||
mv [email protected] $@ | ||
|
||
dir: | ||
mkdir -p $(BUILDDIR) | ||
|
||
clean: | ||
rm -rf $(BUILDDIR) | ||
|
||
info: $(TARGET) | ||
clap-info $< | ||
|
||
install: $(TARGET) | ||
mkdir -p ~/.clap | ||
cp $(TARGET) ~/.clap/ | ||
|
||
.PHONY: all clean dir info install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
# vclap | ||
Demonstration of a CLAP audio plugin in V | ||
Demonstration of a [CLAP](https://github.com/free-audio/clap) audio plugin in V. | ||
|
||
Currently it does nothing besides being correctly built against official | ||
CLAP headers and loading into a DAW without any errors. | ||
|
||
**Note**: Only tested on Linux. | ||
|
||
## Quickstart | ||
|
||
Ensure you have a working [V language](https://vlang.io/) environment. | ||
|
||
On top of that you'd need: | ||
|
||
- GNU Make | ||
- GCC | ||
|
||
Start with: | ||
```sh | ||
git clone https://github.com/mo-foss/vclap.git | ||
cd vclap | ||
make | ||
``` | ||
|
||
To confirm the plugin was built correctly you can use | ||
[this tool](https://github.com/free-audio/clap-info/): | ||
```sh | ||
clap-info build/hello_world.clap | ||
``` | ||
|
||
To test with your DAW, you have to make it discoverable: | ||
``` | ||
make install | ||
``` | ||
|
||
Here is the plugin being correctly loaded in Bitwig Studio 5.1: | ||
![](./assets/running.png) | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include "private/std.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// Sample code for reading a stereo buffer: | ||
// | ||
// bool isLeftConstant = (buffer->constant_mask & (1 << 0)) != 0; | ||
// bool isRightConstant = (buffer->constant_mask & (1 << 1)) != 0; | ||
// | ||
// for (int i = 0; i < N; ++i) { | ||
// float l = data32[0][isLeftConstant ? 0 : i]; | ||
// float r = data32[1][isRightConstant ? 0 : i]; | ||
// } | ||
// | ||
// Note: checking the constant mask is optional, and this implies that | ||
// the buffer must be filled with the constant value. | ||
// Rationale: if a buffer reader doesn't check the constant mask, then it may | ||
// process garbage samples and in result, garbage samples may be transmitted | ||
// to the audio interface with all the bad consequences it can have. | ||
// | ||
// The constant mask is a hint. | ||
typedef struct clap_audio_buffer { | ||
// Either data32 or data64 pointer will be set. | ||
float **data32; | ||
double **data64; | ||
uint32_t channel_count; | ||
uint32_t latency; // latency from/to the audio interface | ||
uint64_t constant_mask; | ||
} clap_audio_buffer_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* CLAP - CLever Audio Plugin | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* | ||
* Copyright (c) 2014...2022 Alexandre BIQUE <[email protected]> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "entry.h" | ||
|
||
#include "factory/plugin-factory.h" | ||
#include "factory/draft/plugin-invalidation.h" | ||
#include "factory/draft/preset-discovery.h" | ||
|
||
#include "plugin.h" | ||
#include "plugin-features.h" | ||
#include "host.h" | ||
|
||
#include "ext/audio-ports-config.h" | ||
#include "ext/audio-ports.h" | ||
#include "ext/event-registry.h" | ||
#include "ext/gui.h" | ||
#include "ext/latency.h" | ||
#include "ext/log.h" | ||
#include "ext/note-name.h" | ||
#include "ext/note-ports.h" | ||
#include "ext/params.h" | ||
#include "ext/posix-fd-support.h" | ||
#include "ext/render.h" | ||
#include "ext/state.h" | ||
#include "ext/tail.h" | ||
#include "ext/thread-check.h" | ||
#include "ext/thread-pool.h" | ||
#include "ext/timer-support.h" | ||
#include "ext/voice-info.h" | ||
|
||
#include "ext/draft/ambisonic.h" | ||
#include "ext/draft/audio-ports-activation.h" | ||
#include "ext/draft/context-menu.h" | ||
#include "ext/draft/cv.h" | ||
#include "ext/draft/midi-mappings.h" | ||
#include "ext/draft/param-indication.h" | ||
#include "ext/draft/preset-load.h" | ||
#include "ext/draft/remote-controls.h" | ||
#include "ext/draft/resource-directory.h" | ||
#include "ext/draft/state-context.h" | ||
#include "ext/draft/surround.h" | ||
#include "ext/draft/track-info.h" | ||
#include "ext/draft/triggers.h" | ||
#include "ext/draft/tuning.h" | ||
#include "ext/draft/configurable-audio-ports.h" | ||
#include "ext/draft/extensible-audio-ports.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "private/std.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct clap_color { | ||
uint8_t alpha; | ||
uint8_t red; | ||
uint8_t green; | ||
uint8_t blue; | ||
} clap_color_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#pragma once | ||
|
||
#include "version.h" | ||
#include "private/macros.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// This interface is the entry point of the dynamic library. | ||
// | ||
// CLAP plugins standard search path: | ||
// | ||
// Linux | ||
// - ~/.clap | ||
// - /usr/lib/clap | ||
// | ||
// Windows | ||
// - %COMMONPROGRAMFILES%\CLAP | ||
// - %LOCALAPPDATA%\Programs\Common\CLAP | ||
// | ||
// MacOS | ||
// - /Library/Audio/Plug-Ins/CLAP | ||
// - ~/Library/Audio/Plug-Ins/CLAP | ||
// | ||
// In addition to the OS-specific default locations above, a CLAP host must query the environment | ||
// for a CLAP_PATH variable, which is a list of directories formatted in the same manner as the host | ||
// OS binary search path (PATH on Unix, separated by `:` and Path on Windows, separated by ';', as | ||
// of this writing). | ||
// | ||
// Each directory should be recursively searched for files and/or bundles as appropriate in your OS | ||
// ending with the extension `.clap`. | ||
// | ||
// Every method must be thread-safe. | ||
typedef struct clap_plugin_entry { | ||
clap_version_t clap_version; // initialized to CLAP_VERSION | ||
|
||
// This function must be called first, and can only be called once. | ||
// | ||
// It should be as fast as possible, in order to perform a very quick scan of the plugin | ||
// descriptors. | ||
// | ||
// It is forbidden to display graphical user interface in this call. | ||
// It is forbidden to perform user interaction in this call. | ||
// | ||
// If the initialization depends upon expensive computation, maybe try to do them ahead of time | ||
// and cache the result. | ||
// | ||
// If init() returns false, then the host must not call deinit() nor any other clap | ||
// related symbols from the DSO. | ||
// | ||
// plugin_path is the path to the DSO (Linux, Windows), or the bundle (macOS). | ||
bool(CLAP_ABI *init)(const char *plugin_path); | ||
|
||
// No more calls into the DSO must be made after calling deinit(). | ||
void(CLAP_ABI *deinit)(void); | ||
|
||
// Get the pointer to a factory. See factory/plugin-factory.h for an example. | ||
// | ||
// Returns null if the factory is not provided. | ||
// The returned pointer must *not* be freed by the caller. | ||
const void *(CLAP_ABI *get_factory)(const char *factory_id); | ||
} clap_plugin_entry_t; | ||
|
||
/* Entry point */ | ||
CLAP_EXPORT extern clap_plugin_entry_t clap_entry; | ||
// CLAP_EXPORT extern const clap_plugin_entry_t clap_entry; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.