Compare commits
No commits in common. "adf89eb3600305d9b5ba5c679721eb8dab511e02" and "fe8ef6b25c54bc71a92837f630e4dff5358e1b77" have entirely different histories.
adf89eb360
...
fe8ef6b25c
4 changed files with 9 additions and 28 deletions
|
@ -36,10 +36,14 @@ Run the eg-amp plugin over the given slice of the file.
|
||||||
|
|
||||||
Run an echo filter on the given loaded file.
|
Run an echo filter on the given loaded file.
|
||||||
|
|
||||||
## `quicksave`
|
## TODO `quicksave`
|
||||||
|
|
||||||
Save the file on the same directory of the file specified by `load`, but
|
Save the file on the same directory of the file specified by `load`, but
|
||||||
with a suffix on the filename (before extension).
|
with a suffix on the filename (before extension).
|
||||||
|
|
||||||
Doing consecutive `quicksave`s will not overwrite any files, the suffixes will
|
Doing consecutive `quicksave`s will not overwrite any files, the suffixes will
|
||||||
just be different.
|
just be different.
|
||||||
|
|
||||||
|
## TODO `showpath`
|
||||||
|
|
||||||
|
Print the current loaded path on the screen.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
load :0;
|
load :0;
|
||||||
amp 3 1 20;
|
amp 3 1 10;
|
||||||
# echo 3 0 1 0.2;
|
# echo 3 0 1 0.2;
|
||||||
quicksave;
|
quicksave;
|
||||||
|
|
|
@ -109,16 +109,9 @@ fn mkSfInfo() c.SF_INFO {
|
||||||
|
|
||||||
pub const Image = struct {
|
pub const Image = struct {
|
||||||
allocator: *std.mem.Allocator,
|
allocator: *std.mem.Allocator,
|
||||||
|
|
||||||
/// Pointer to the underlying libsndfile's SNDFILE struct.
|
|
||||||
sndfile: *c.SNDFILE,
|
sndfile: *c.SNDFILE,
|
||||||
|
|
||||||
/// The original image file path.
|
|
||||||
path: []const u8,
|
path: []const u8,
|
||||||
|
|
||||||
/// Represents the current path being worked on.
|
|
||||||
curpath: []const u8,
|
|
||||||
|
|
||||||
/// Open a BMP file.
|
/// Open a BMP file.
|
||||||
pub fn open(allocator: *std.mem.Allocator, path: []const u8) !*Image {
|
pub fn open(allocator: *std.mem.Allocator, path: []const u8) !*Image {
|
||||||
var in_fmt = mkSfInfo();
|
var in_fmt = mkSfInfo();
|
||||||
|
@ -130,7 +123,6 @@ pub const Image = struct {
|
||||||
.allocator = allocator,
|
.allocator = allocator,
|
||||||
.sndfile = sndfile,
|
.sndfile = sndfile,
|
||||||
.path = path,
|
.path = path,
|
||||||
.curpath = path,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
@ -259,13 +251,6 @@ pub const Image = struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = c.sf_close(self.sndfile);
|
_ = c.sf_close(out_file);
|
||||||
self.sndfile = out_file;
|
|
||||||
self.curpath = tmpnam;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn saveTo(self: *Image, out_path: []const u8) !void {
|
|
||||||
std.debug.warn("saved to '{}'\n", out_path);
|
|
||||||
try std.fs.copyFile(self.curpath, out_path);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -136,16 +136,8 @@ pub const Runner = struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const out_path = try std.fmt.allocPrint(
|
const out_path = try std.fmt.allocPrint(self.allocator, "{}_g{}{}", starts_with, max + 1, extension);
|
||||||
self.allocator,
|
std.debug.warn("out path: {}\n", out_path);
|
||||||
"{}/{}{}{}",
|
|
||||||
dirname,
|
|
||||||
starts_with,
|
|
||||||
max + 1,
|
|
||||||
extension,
|
|
||||||
);
|
|
||||||
|
|
||||||
try image.saveTo(out_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run the http://lv2plug.in/plugins/eg-amp plugin over the file.
|
/// Run the http://lv2plug.in/plugins/eg-amp plugin over the file.
|
||||||
|
|
Loading…
Reference in a new issue