From 75eeea14f34ef7b309fca36b022933cd2ad12c45 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 6 Aug 2019 19:25:31 -0300 Subject: [PATCH] add check for n_audio_out>2 --- doc/README.md | 8 ++++++-- src/custom.zig | 4 ++++ src/image.zig | 7 +++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/README.md b/doc/README.md index 3620102..8330e43 100644 --- a/doc/README.md +++ b/doc/README.md @@ -38,13 +38,17 @@ Run the eg-amp plugin over the given slice of the file. Run the Retro Flanger script from the SWH plugins. - - `delay_depth_avg` is for the `Average stall (ms)` parameter of the plugin. - - `law_freq` is for the `Flange frequency` parameter of the plugin. +Parameters: + - `delay_depth_avg`: Average stall (ms), 0..10, default 2.5 + - `law_freq`: Flange frequency (Hz), 0.5..8, default 1 ## `eq split index lo mid hi` Run the DJ EQ plugin from the SWH plugins. +Parameters: + - `lo`: Low range + `lo`, `mid`, and `hi` are the respective dB gains for each frequency range. All three ranges accept gains from -70dB to +6dB. diff --git a/src/custom.zig b/src/custom.zig index df9f331..2fc5a09 100644 --- a/src/custom.zig +++ b/src/custom.zig @@ -95,6 +95,10 @@ pub const WildNoise = struct { } }; +/// Write any float to the image. +/// Keep in mind that the bit representation of the float will clash with +/// the format of BMP pixel data, which means writing 0 everywhere won't give +/// you the black color. pub const Write = struct { data: f32, diff --git a/src/image.zig b/src/image.zig index 8686e12..5d4467a 100644 --- a/src/image.zig +++ b/src/image.zig @@ -249,11 +249,14 @@ pub const Image = struct { var ports = try lv2.setupPorts(&ctx); if (ctx.n_audio_in > 2) { - std.debug.warn("plugin <{}> accepts more than two channels.\n", plugin_uri); + std.debug.warn("plugin <{}> has more than two inputs.\n", plugin_uri); return ImageError.InvalidPlugin; } - // TODO check n_audio_out > 2 + if (ctx.n_audio_out > 2) { + std.debug.warn("plugin <{}> has more than two outputs.\n", plugin_uri); + return ImageError.InvalidPlugin; + } // now, for each param for the plugin, we find its port, and set // the value for the port there.