refactor: remove 'new' prefix from functions

This commit is contained in:
Luna 2020-06-01 21:54:10 -03:00
parent 76b353e593
commit 54919110a5

View file

@ -224,7 +224,7 @@ pub const Runner = struct {
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{
.split = command.split,
.index = command.index,
@ -234,7 +234,7 @@ pub const Runner = struct {
try image.runCustomPlugin(@TypeOf(command).plugin_type, pos, command.parameters);
}
fn newRunCommandSingle(
fn runSingleCommand(
self: *@This(),
cmd: lang.Command,
comptime tag: lang.Command.Tag,
@ -251,13 +251,13 @@ pub const Runner = struct {
const ctype = typ.command_type;
switch (ctype) {
.lv2_command => try self.executeLV2Command(command.*),
.custom_command => try self.executePlugin(command.*),
.custom_command => try self.executeCustomCommand(command.*),
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) {
.load => {
const command = cmd.cast(lang.Command.Load).?;
@ -266,40 +266,40 @@ pub const Runner = struct {
.quicksave => {
try self.quicksaveCmd();
},
.amp => try self.newRunCommandSingle(cmd, .amp),
.amp => try self.runSingleCommand(cmd, .amp),
.rflanger => try self.newRunCommandSingle(cmd, .rflanger),
.eq => try self.newRunCommandSingle(cmd, .eq),
.phaser => try self.newRunCommandSingle(cmd, .phaser),
.mbeq => try self.newRunCommandSingle(cmd, .mbeq),
.chorus => try self.newRunCommandSingle(cmd, .chorus),
.pitchscaler => try self.newRunCommandSingle(cmd, .pitchscaler),
.reverb => try self.newRunCommandSingle(cmd, .reverb),
.highpass => try self.newRunCommandSingle(cmd, .highpass),
.delay => try self.newRunCommandSingle(cmd, .delay),
.vinyl => try self.newRunCommandSingle(cmd, .vinyl),
.revdelay => try self.newRunCommandSingle(cmd, .revdelay),
.gate => try self.newRunCommandSingle(cmd, .gate),
.detune => try self.newRunCommandSingle(cmd, .detune),
.overdrive => try self.newRunCommandSingle(cmd, .overdrive),
.degrade => try self.newRunCommandSingle(cmd, .degrade),
.repsycho => try self.newRunCommandSingle(cmd, .repsycho),
.talkbox => try self.newRunCommandSingle(cmd, .talkbox),
.dyncomp => try self.newRunCommandSingle(cmd, .dyncomp),
.thruzero => try self.newRunCommandSingle(cmd, .thruzero),
.foverdrive => try self.newRunCommandSingle(cmd, .foverdrive),
.gverb => try self.newRunCommandSingle(cmd, .gverb),
.invert => try self.newRunCommandSingle(cmd, .invert),
.tapedelay => try self.newRunCommandSingle(cmd, .tapedelay),
.moddelay => try self.newRunCommandSingle(cmd, .moddelay),
.multichorus => try self.newRunCommandSingle(cmd, .multichorus),
.saturator => try self.newRunCommandSingle(cmd, .saturator),
.vintagedelay => try self.newRunCommandSingle(cmd, .vintagedelay),
.rflanger => try self.runSingleCommand(cmd, .rflanger),
.eq => try self.runSingleCommand(cmd, .eq),
.phaser => try self.runSingleCommand(cmd, .phaser),
.mbeq => try self.runSingleCommand(cmd, .mbeq),
.chorus => try self.runSingleCommand(cmd, .chorus),
.pitchscaler => try self.runSingleCommand(cmd, .pitchscaler),
.reverb => try self.runSingleCommand(cmd, .reverb),
.highpass => try self.runSingleCommand(cmd, .highpass),
.delay => try self.runSingleCommand(cmd, .delay),
.vinyl => try self.runSingleCommand(cmd, .vinyl),
.revdelay => try self.runSingleCommand(cmd, .revdelay),
.gate => try self.runSingleCommand(cmd, .gate),
.detune => try self.runSingleCommand(cmd, .detune),
.overdrive => try self.runSingleCommand(cmd, .overdrive),
.degrade => try self.runSingleCommand(cmd, .degrade),
.repsycho => try self.runSingleCommand(cmd, .repsycho),
.talkbox => try self.runSingleCommand(cmd, .talkbox),
.dyncomp => try self.runSingleCommand(cmd, .dyncomp),
.thruzero => try self.runSingleCommand(cmd, .thruzero),
.foverdrive => try self.runSingleCommand(cmd, .foverdrive),
.gverb => try self.runSingleCommand(cmd, .gverb),
.invert => try self.runSingleCommand(cmd, .invert),
.tapedelay => try self.runSingleCommand(cmd, .tapedelay),
.moddelay => try self.runSingleCommand(cmd, .moddelay),
.multichorus => try self.runSingleCommand(cmd, .multichorus),
.saturator => try self.runSingleCommand(cmd, .saturator),
.vintagedelay => try self.runSingleCommand(cmd, .vintagedelay),
.noise => try self.newRunCommandSingle(cmd, .noise),
.wildnoise => try self.newRunCommandSingle(cmd, .wildnoise),
.write => try self.newRunCommandSingle(cmd, .write),
.embed => try self.newRunCommandSingle(cmd, .embed),
.noise => try self.runSingleCommand(cmd, .noise),
.wildnoise => try self.runSingleCommand(cmd, .wildnoise),
.write => try self.runSingleCommand(cmd, .write),
.embed => try self.runSingleCommand(cmd, .embed),
else => {
std.debug.warn("TODO support {}\n", .{@tagName(cmd.tag)});
@ -315,7 +315,7 @@ pub const Runner = struct {
) !void {
for (cmds.items) |cmd| {
cmd.print();
try self.newRunCommand(cmd.*);
try self.runCommand(cmd.*);
}
}
};