refactor: remove 'new' prefix from functions
This commit is contained in:
parent
76b353e593
commit
54919110a5
1 changed files with 37 additions and 37 deletions
|
@ -224,7 +224,7 @@ pub const Runner = struct {
|
||||||
try image.runPlugin(typ.lv2_url, pos, params);
|
try image.runPlugin(typ.lv2_url, pos, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn executePlugin(self: *@This(), command: var) !void {
|
fn executeCustomCommand(self: *@This(), command: var) !void {
|
||||||
const pos = plugin.Position{
|
const pos = plugin.Position{
|
||||||
.split = command.split,
|
.split = command.split,
|
||||||
.index = command.index,
|
.index = command.index,
|
||||||
|
@ -234,7 +234,7 @@ pub const Runner = struct {
|
||||||
try image.runCustomPlugin(@TypeOf(command).plugin_type, pos, command.parameters);
|
try image.runCustomPlugin(@TypeOf(command).plugin_type, pos, command.parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn newRunCommandSingle(
|
fn runSingleCommand(
|
||||||
self: *@This(),
|
self: *@This(),
|
||||||
cmd: lang.Command,
|
cmd: lang.Command,
|
||||||
comptime tag: lang.Command.Tag,
|
comptime tag: lang.Command.Tag,
|
||||||
|
@ -251,13 +251,13 @@ pub const Runner = struct {
|
||||||
const ctype = typ.command_type;
|
const ctype = typ.command_type;
|
||||||
switch (ctype) {
|
switch (ctype) {
|
||||||
.lv2_command => try self.executeLV2Command(command.*),
|
.lv2_command => try self.executeLV2Command(command.*),
|
||||||
.custom_command => try self.executePlugin(command.*),
|
.custom_command => try self.executeCustomCommand(command.*),
|
||||||
else => @panic("TODO support command type"),
|
else => @panic("TODO support command type"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn newRunCommand(self: *@This(), cmd: lang.Command) !void {
|
fn runCommand(self: *@This(), cmd: lang.Command) !void {
|
||||||
switch (cmd.tag) {
|
switch (cmd.tag) {
|
||||||
.load => {
|
.load => {
|
||||||
const command = cmd.cast(lang.Command.Load).?;
|
const command = cmd.cast(lang.Command.Load).?;
|
||||||
|
@ -266,40 +266,40 @@ pub const Runner = struct {
|
||||||
.quicksave => {
|
.quicksave => {
|
||||||
try self.quicksaveCmd();
|
try self.quicksaveCmd();
|
||||||
},
|
},
|
||||||
.amp => try self.newRunCommandSingle(cmd, .amp),
|
.amp => try self.runSingleCommand(cmd, .amp),
|
||||||
|
|
||||||
.rflanger => try self.newRunCommandSingle(cmd, .rflanger),
|
.rflanger => try self.runSingleCommand(cmd, .rflanger),
|
||||||
.eq => try self.newRunCommandSingle(cmd, .eq),
|
.eq => try self.runSingleCommand(cmd, .eq),
|
||||||
.phaser => try self.newRunCommandSingle(cmd, .phaser),
|
.phaser => try self.runSingleCommand(cmd, .phaser),
|
||||||
.mbeq => try self.newRunCommandSingle(cmd, .mbeq),
|
.mbeq => try self.runSingleCommand(cmd, .mbeq),
|
||||||
.chorus => try self.newRunCommandSingle(cmd, .chorus),
|
.chorus => try self.runSingleCommand(cmd, .chorus),
|
||||||
.pitchscaler => try self.newRunCommandSingle(cmd, .pitchscaler),
|
.pitchscaler => try self.runSingleCommand(cmd, .pitchscaler),
|
||||||
.reverb => try self.newRunCommandSingle(cmd, .reverb),
|
.reverb => try self.runSingleCommand(cmd, .reverb),
|
||||||
.highpass => try self.newRunCommandSingle(cmd, .highpass),
|
.highpass => try self.runSingleCommand(cmd, .highpass),
|
||||||
.delay => try self.newRunCommandSingle(cmd, .delay),
|
.delay => try self.runSingleCommand(cmd, .delay),
|
||||||
.vinyl => try self.newRunCommandSingle(cmd, .vinyl),
|
.vinyl => try self.runSingleCommand(cmd, .vinyl),
|
||||||
.revdelay => try self.newRunCommandSingle(cmd, .revdelay),
|
.revdelay => try self.runSingleCommand(cmd, .revdelay),
|
||||||
.gate => try self.newRunCommandSingle(cmd, .gate),
|
.gate => try self.runSingleCommand(cmd, .gate),
|
||||||
.detune => try self.newRunCommandSingle(cmd, .detune),
|
.detune => try self.runSingleCommand(cmd, .detune),
|
||||||
.overdrive => try self.newRunCommandSingle(cmd, .overdrive),
|
.overdrive => try self.runSingleCommand(cmd, .overdrive),
|
||||||
.degrade => try self.newRunCommandSingle(cmd, .degrade),
|
.degrade => try self.runSingleCommand(cmd, .degrade),
|
||||||
.repsycho => try self.newRunCommandSingle(cmd, .repsycho),
|
.repsycho => try self.runSingleCommand(cmd, .repsycho),
|
||||||
.talkbox => try self.newRunCommandSingle(cmd, .talkbox),
|
.talkbox => try self.runSingleCommand(cmd, .talkbox),
|
||||||
.dyncomp => try self.newRunCommandSingle(cmd, .dyncomp),
|
.dyncomp => try self.runSingleCommand(cmd, .dyncomp),
|
||||||
.thruzero => try self.newRunCommandSingle(cmd, .thruzero),
|
.thruzero => try self.runSingleCommand(cmd, .thruzero),
|
||||||
.foverdrive => try self.newRunCommandSingle(cmd, .foverdrive),
|
.foverdrive => try self.runSingleCommand(cmd, .foverdrive),
|
||||||
.gverb => try self.newRunCommandSingle(cmd, .gverb),
|
.gverb => try self.runSingleCommand(cmd, .gverb),
|
||||||
.invert => try self.newRunCommandSingle(cmd, .invert),
|
.invert => try self.runSingleCommand(cmd, .invert),
|
||||||
.tapedelay => try self.newRunCommandSingle(cmd, .tapedelay),
|
.tapedelay => try self.runSingleCommand(cmd, .tapedelay),
|
||||||
.moddelay => try self.newRunCommandSingle(cmd, .moddelay),
|
.moddelay => try self.runSingleCommand(cmd, .moddelay),
|
||||||
.multichorus => try self.newRunCommandSingle(cmd, .multichorus),
|
.multichorus => try self.runSingleCommand(cmd, .multichorus),
|
||||||
.saturator => try self.newRunCommandSingle(cmd, .saturator),
|
.saturator => try self.runSingleCommand(cmd, .saturator),
|
||||||
.vintagedelay => try self.newRunCommandSingle(cmd, .vintagedelay),
|
.vintagedelay => try self.runSingleCommand(cmd, .vintagedelay),
|
||||||
|
|
||||||
.noise => try self.newRunCommandSingle(cmd, .noise),
|
.noise => try self.runSingleCommand(cmd, .noise),
|
||||||
.wildnoise => try self.newRunCommandSingle(cmd, .wildnoise),
|
.wildnoise => try self.runSingleCommand(cmd, .wildnoise),
|
||||||
.write => try self.newRunCommandSingle(cmd, .write),
|
.write => try self.runSingleCommand(cmd, .write),
|
||||||
.embed => try self.newRunCommandSingle(cmd, .embed),
|
.embed => try self.runSingleCommand(cmd, .embed),
|
||||||
|
|
||||||
else => {
|
else => {
|
||||||
std.debug.warn("TODO support {}\n", .{@tagName(cmd.tag)});
|
std.debug.warn("TODO support {}\n", .{@tagName(cmd.tag)});
|
||||||
|
@ -315,7 +315,7 @@ pub const Runner = struct {
|
||||||
) !void {
|
) !void {
|
||||||
for (cmds.items) |cmd| {
|
for (cmds.items) |cmd| {
|
||||||
cmd.print();
|
cmd.print();
|
||||||
try self.newRunCommand(cmd.*);
|
try self.runCommand(cmd.*);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue