-
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.
Using proper struct casting for event header when processing. (#2)
Also smaller stuff: * Added logging; auto-configured at library load. * Build target for generating intermediary C form. * Extended `DEBUG` flag for tracing all calls. * Less copying in the example audio buffer processing.
- Loading branch information
Showing
9 changed files
with
54 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
SOURCEDIR = src | ||
BUILDDIR = build | ||
TARGET = $(BUILDDIR)/hello_world.clap | ||
V_CMD = v -cc gcc -shared -enable-globals | ||
|
||
# List all V source files | ||
V_SRC = $(wildcard $(SOURCEDIR)/*.v) | ||
|
@@ -10,6 +11,9 @@ V_SRC = $(wildcard $(SOURCEDIR)/*.v) | |
DEBUG ?= 0 | ||
RELEASE ?= 0 | ||
ifeq ($(DEBUG),1) | ||
V_FLAGS = -cg -show-c-output | ||
else ifeq ($(DEBUG),2) | ||
# Even more debug! Very noisy. | ||
V_FLAGS = -cg -show-c-output -trace-calls | ||
else ifeq ($(RELEASE),1) | ||
V_FLAGS = -prod -skip-unused -cflags -fvisibility=hidden | ||
|
@@ -20,7 +24,7 @@ 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 | ||
$(V_CMD) $(V_FLAGS) $(SOURCEDIR) -o $@.so | ||
ifeq ($(RELEASE),1) | ||
strip [email protected] | ||
endif | ||
|
@@ -35,6 +39,9 @@ clean: | |
info: $(TARGET) | ||
clap-info $< | ||
|
||
genc: $(V_SRC) | dir | ||
$(V_CMD) $(V_FLAGS) $(SOURCEDIR) -o $(TARGET).c | ||
|
||
install: $(TARGET) | ||
mkdir -p ~/.clap | ||
cp $(TARGET) ~/.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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
module plugin | ||
|
||
const clap_ext_latency = unsafe { (&char(C.CLAP_EXT_LATENCY)).vstring() } | ||
|
||
@[typedef] | ||
|
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,5 +1,3 @@ | ||
module plugin | ||
|
||
const clap_ext_note_ports = unsafe { (&char(C.CLAP_EXT_NOTE_PORTS)).vstring() } | ||
|
||
@[typedef] | ||
|
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,9 +1,16 @@ | ||
module plugin | ||
|
||
import log | ||
// Exposes the plugin to the host (DAW). | ||
|
||
// This requires modification to `clap/entry.h`. | ||
// Remove "const" so you get: | ||
// CLAP_EXPORT extern clap_plugin_entry_t clap_entry; | ||
@[markused] | ||
__global clap_entry = plugin_entry | ||
|
||
fn init() { | ||
$if debug { | ||
log.set_level(log.Level.debug) | ||
} $else { | ||
log.set_level(log.Level.info) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters