add foverdrive cmd
- lang: remove oldGetCommand
This commit is contained in:
		
							parent
							
								
									fa8740e0db
								
							
						
					
					
						commit
						c73b7440a6
					
				
					 5 changed files with 26 additions and 65 deletions
				
			
		|  | @ -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 | ||||
| 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` | ||||
| 
 | ||||
|  | @ -259,7 +260,7 @@ other presets: | |||
|  - gain\_max (dB): -20..40 | ||||
|  - rms (signal level, dB): -80..10 | ||||
|   | ||||
| ## `thruzero split index  | ||||
| ## `thruzero split index rate mix feedback depth_mod` | ||||
| 
 | ||||
| > Tape flanger and ADT | ||||
| 
 | ||||
|  | @ -269,3 +270,9 @@ other presets: | |||
|  - 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 | ||||
|  - 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 | ||||
|  |  | |||
							
								
								
									
										3
									
								
								examples/foverdrive.scri
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								examples/foverdrive.scri
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| load :0; | ||||
| foverdrive 3 1 100; | ||||
| quicksave; | ||||
							
								
								
									
										65
									
								
								src/lang.zig
									
										
									
									
									
								
							
							
						
						
									
										65
									
								
								src/lang.zig
									
										
									
									
									
								
							|  | @ -34,6 +34,7 @@ pub const CommandType = enum { | |||
|     TalkBox, | ||||
|     DynComp, | ||||
|     ThruZero, | ||||
|     Foverdrive, | ||||
| 
 | ||||
|     Noise, | ||||
|     WildNoise, | ||||
|  | @ -197,6 +198,7 @@ pub const Lang = struct { | |||
|         _ = try self.keywords.put("overdrive", .Overdrive); | ||||
|         _ = try self.keywords.put("talkbox", .TalkBox); | ||||
|         _ = try self.keywords.put("thruzero", .ThruZero); | ||||
|         _ = try self.keywords.put("foverdrive", .Foverdrive); | ||||
| 
 | ||||
|         // custom implementations (not lv2) | ||||
|         _ = try self.keywords.put("noise", .Noise); | ||||
|  | @ -221,69 +223,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 { | ||||
|         if (args.len != count) { | ||||
|             self.doError("expected {} arguments, found {}", .{ count, args.len }); | ||||
|  |  | |||
|  | @ -28,6 +28,7 @@ pub fn printList(list: langs.CommandList, stream: var) !void { | |||
|             .TalkBox => "talkbox", | ||||
|             .DynComp => "dyncomp", | ||||
|             .ThruZero => "thruzero", | ||||
|             .Foverdrive => "foverdrive", | ||||
| 
 | ||||
|             .Noise => "noise", | ||||
|             .WildNoise => "wildnoise", | ||||
|  |  | |||
|  | @ -329,6 +329,11 @@ pub const Runner = struct { | |||
|         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 { | ||||
|         var image = try self.getImage(); | ||||
|         try image.runPlugin("http://drobilla.net/plugins/mda/ThruZero", pos, params); | ||||
|  | @ -601,6 +606,12 @@ pub const Runner = struct { | |||
|                 try self.thruZeroCmd(pos, params); | ||||
|             }, | ||||
| 
 | ||||
|             .Foverdrive => { | ||||
|                 const pos = try cmd.consumePosition(); | ||||
|                 try cmd.appendParam(¶ms, "drive"); | ||||
|                 try self.foverdriveCmd(pos, params); | ||||
|             }, | ||||
| 
 | ||||
|             else => blk: { | ||||
|                 std.debug.warn("Unsupported command: {}\n", .{cmd.command}); | ||||
|                 break :blk RunError.UnknownCommand; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue