Compare commits

...

2 commits

Author SHA1 Message Date
299a39fc27 add gverb cmd 2020-01-26 00:03:15 -03:00
c73b7440a6 add foverdrive cmd
- lang: remove oldGetCommand
2020-01-25 23:52:22 -03:00
6 changed files with 61 additions and 65 deletions

View file

@ -23,7 +23,8 @@ where in the file you want the plugin to be ran.
so, if you did `plugin 3 1...`, it would split the file in 3, then get the so, if you did `plugin 3 1...`, it would split the file in 3, then get the
part that is of index 1 (starting at 0). part that is of index 1 (starting at 0).
**Keep in mind parts start from the bottom of the file.** **Keep in mind parts can start from either top or bottom of the image,
it depends of the file format**
## `load path_or_arg` ## `load path_or_arg`
@ -259,7 +260,7 @@ other presets:
- gain\_max (dB): -20..40 - gain\_max (dB): -20..40
- rms (signal level, dB): -80..10 - rms (signal level, dB): -80..10
## `thruzero split index ## `thruzero split index rate mix feedback depth_mod`
> Tape flanger and ADT > Tape flanger and ADT
@ -269,3 +270,21 @@ other presets:
- mix (wet/dry mix, set to 50% for complete cancelling): 0..1, default 0.47 - mix (wet/dry mix, set to 50% for complete cancelling): 0..1, default 0.47
- feedback (add positive or negative feedback for harsher or "ringing" sound): 0..1, default 0.3 - feedback (add positive or negative feedback for harsher or "ringing" sound): 0..1, default 0.3
- depth_mod (modulation depth, set to less than 100% to limit build up of low frequencies with feedback): 0..1, default 1 - depth_mod (modulation depth, set to less than 100% to limit build up of low frequencies with feedback): 0..1, default 1
## `foverdrive split index drive`
Fast Overdrive from SWH plugins.
- drive: 1..3, default 1
## `gverb split index roomsize revtime damping drylevel earlylevel taillevel`
GVerb algorithm from SWH plugins.
- roomsize (meters): 1..300, default 75.75
- revtime (reverb time, seconds): 0.1..30, default 7.575
- damping: 0..1, default 0.5
- inputbandwidth: 0..1, default 0.75
- drylevel (dB): -70..0, default 0
- earlylevel (dB): -70..0, default 0
- taillevel (dB): -70..0, default -17.5

3
examples/foverdrive.scri Normal file
View file

@ -0,0 +1,3 @@
load :0;
foverdrive 3 1 100;
quicksave;

3
examples/gverb.scri Normal file
View file

@ -0,0 +1,3 @@
load :0;
gverb 3 1 75.75 7.575 0.5 0.75 0 0 -17.5;
quicksave;

View file

@ -34,6 +34,8 @@ pub const CommandType = enum {
TalkBox, TalkBox,
DynComp, DynComp,
ThruZero, ThruZero,
Foverdrive,
Gverb,
Noise, Noise,
WildNoise, WildNoise,
@ -197,6 +199,8 @@ pub const Lang = struct {
_ = try self.keywords.put("overdrive", .Overdrive); _ = try self.keywords.put("overdrive", .Overdrive);
_ = try self.keywords.put("talkbox", .TalkBox); _ = try self.keywords.put("talkbox", .TalkBox);
_ = try self.keywords.put("thruzero", .ThruZero); _ = try self.keywords.put("thruzero", .ThruZero);
_ = try self.keywords.put("foverdrive", .Foverdrive);
_ = try self.keywords.put("gverb", .Gverb);
// custom implementations (not lv2) // custom implementations (not lv2)
_ = try self.keywords.put("noise", .Noise); _ = try self.keywords.put("noise", .Noise);
@ -221,69 +225,6 @@ pub const Lang = struct {
} }
} }
// NOTE this is fallback since std.AutoHashMap does not follow
// pointers anymore (in master).
fn oldGetCommand(self: *Lang, stmt: []const u8) ?CommandType {
const commands = [_][]const u8{
"noop",
"load",
"quicksave",
"runqs",
"amp",
"rflanger",
"eq",
"phaser",
"mbeq",
"chorus",
"pitchscaler",
"reverb",
"highpass",
"delay",
"vinyl",
"revdelay",
"noise",
"wildnoise",
"write",
"embed",
"rotate",
};
const command_types = [_]CommandType{
.Noop,
.Load,
.Quicksave,
.RunQS,
.Amp,
.RFlanger,
.Eq,
.Phaser,
.Mbeq,
.Chorus,
.PitchScaler,
.Reverb,
.Highpass,
.Delay,
.Vinyl,
.RevDelay,
.Noise,
.WildNoise,
.Write,
.Embed,
.Rotate,
};
std.debug.assert(commands.len == command_types.len);
for (commands) |command, idx| {
if (std.mem.eql(u8, stmt, command)) return command_types[idx];
}
return null;
}
fn expectAny(self: *Lang, count: usize, args: ArgList) !void { fn expectAny(self: *Lang, count: usize, args: ArgList) !void {
if (args.len != count) { if (args.len != count) {
self.doError("expected {} arguments, found {}", .{ count, args.len }); self.doError("expected {} arguments, found {}", .{ count, args.len });

View file

@ -28,6 +28,8 @@ pub fn printList(list: langs.CommandList, stream: var) !void {
.TalkBox => "talkbox", .TalkBox => "talkbox",
.DynComp => "dyncomp", .DynComp => "dyncomp",
.ThruZero => "thruzero", .ThruZero => "thruzero",
.Foverdrive => "foverdrive",
.Gverb => "gverb",
.Noise => "noise", .Noise => "noise",
.WildNoise => "wildnoise", .WildNoise => "wildnoise",

View file

@ -329,11 +329,21 @@ pub const Runner = struct {
try image.runPlugin("http://gareus.org/oss/lv2/darc#mono", pos, params); try image.runPlugin("http://gareus.org/oss/lv2/darc#mono", pos, params);
} }
fn foverdriveCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/foverdrive", pos, params);
}
fn thruZeroCmd(self: *Runner, pos: Position, params: ParamList) !void { fn thruZeroCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage(); var image = try self.getImage();
try image.runPlugin("http://drobilla.net/plugins/mda/ThruZero", pos, params); try image.runPlugin("http://drobilla.net/plugins/mda/ThruZero", pos, params);
} }
fn gverbCmd(self: *Runner, pos: Position, params: ParamList) !void {
var image = try self.getImage();
try image.runPlugin("http://plugin.org.uk/swh-plugins/gverb", pos, params);
}
fn runCommand(self: *Runner, cmd: *lang.Command) !void { fn runCommand(self: *Runner, cmd: *lang.Command) !void {
var params = ParamList.init(self.allocator); var params = ParamList.init(self.allocator);
defer params.deinit(); defer params.deinit();
@ -601,6 +611,24 @@ pub const Runner = struct {
try self.thruZeroCmd(pos, params); try self.thruZeroCmd(pos, params);
}, },
.Foverdrive => {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "drive");
try self.foverdriveCmd(pos, params);
},
.Gverb => {
const pos = try cmd.consumePosition();
try cmd.appendParam(&params, "roomsize");
try cmd.appendParam(&params, "revtime");
try cmd.appendParam(&params, "damping");
try cmd.appendParam(&params, "inputbandwidth");
try cmd.appendParam(&params, "drylevel");
try cmd.appendParam(&params, "earlylevel");
try cmd.appendParam(&params, "taillevel");
try self.gverbCmd(pos, params);
},
else => blk: { else => blk: {
std.debug.warn("Unsupported command: {}\n", .{cmd.command}); std.debug.warn("Unsupported command: {}\n", .{cmd.command});
break :blk RunError.UnknownCommand; break :blk RunError.UnknownCommand;