use sf_open_fd
This commit is contained in:
parent
2d64eaa3ef
commit
6e66850d90
2 changed files with 6 additions and 3 deletions
|
@ -1,3 +1,3 @@
|
|||
load :0;
|
||||
embed 3 1 ./file.mp3
|
||||
embed 3 1 file.mp3
|
||||
quicksave;
|
||||
|
|
|
@ -31,14 +31,17 @@ pub fn sopen(
|
|||
var cstr_path = try std.cstr.addNullByte(allocator, path);
|
||||
defer allocator.free(cstr_path);
|
||||
|
||||
var file = c.sf_open(cstr_path.ptr, mode, fmt);
|
||||
var fs_file = try std.fs.File.openRead(path);
|
||||
|
||||
var file = c.sf_open_fd(fs_file.handle, mode, fmt, 1);
|
||||
const st: i32 = c.sf_error(file);
|
||||
|
||||
if (st != 0) {
|
||||
var msg = c.sf_error_number(st);
|
||||
std.debug.warn(
|
||||
"Failed to open {} ({})\n",
|
||||
path,
|
||||
c.sf_error_number(st),
|
||||
msg[0..std.mem.len(u8, msg)],
|
||||
);
|
||||
|
||||
return ImageError.OpenFail;
|
||||
|
|
Loading…
Reference in a new issue