From 7c5a4bd34e286608d61735bd77f5635dc6bc227e Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Sun, 21 Dec 2025 06:50:16 +0100 Subject: Major restructuring, GUI, icons, MacOS compatibility, fixes --- src/wav/wav.odin | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/wav/wav.odin') diff --git a/src/wav/wav.odin b/src/wav/wav.odin index bfa11b1..89dd5eb 100644 --- a/src/wav/wav.odin +++ b/src/wav/wav.odin @@ -110,7 +110,7 @@ main :: proc() { /* Reads in the wav file metadata, without loading the sound data into ram. */ -read :: proc(path : string, allocator:=context.allocator) -> (Wav, bool) #optional_ok { +read :: proc(path : string, allocator := context.allocator) -> (Wav, bool) #optional_ok { file : Wav file.path = path file.take = -1 @@ -126,11 +126,10 @@ read :: proc(path : string, allocator:=context.allocator) -> (Wav, bool) #option return {}, false } - - temp_buf := new([BUFFER_SIZE]u8)[:] + temp_buf := make([]u8, BUFFER_SIZE) + defer delete(temp_buf) temp_bext : []u8 temp_ixml : string - defer delete(temp_buf) os.read(file.handle, temp_buf) @@ -318,7 +317,7 @@ read :: proc(path : string, allocator:=context.allocator) -> (Wav, bool) #option */ interleave_set := false - xml_recurse :: proc(doc: ^xml.Document, element_id: xml.Element_ID, file: ^Wav, naming_channel: ^int, interleave_set: ^bool, allocator:=context.allocator, indent := 0) { + xml_recurse :: proc(doc: ^xml.Document, element_id: xml.Element_ID, file: ^Wav, naming_channel: ^int, interleave_set: ^bool, allocator:type_of(context.allocator), indent := 0) { naming_channel := naming_channel interleave_set := interleave_set @@ -448,6 +447,9 @@ read :: proc(path : string, allocator:=context.allocator) -> (Wav, bool) #option parsed_ixml : ^xml.Document + prev_alloc := context.allocator + defer context.allocator = prev_alloc + context.allocator = context.temp_allocator parsed_ixml, _ = xml.parse(temp_ixml, xml.Options{ flags={.Ignore_Unsupported}, expected_doctype = "", @@ -469,7 +471,7 @@ read :: proc(path : string, allocator:=context.allocator) -> (Wav, bool) #option description := string(temp_bext[:256]) for line in strings.split_lines(description) { - + if len(line)<1 do continue if file.channel_names[naming_channel] == "" && (strings.starts_with(line, "sTRK") || strings.starts_with(line, "zTRK")) { eq_index := strings.index(line, "=") @@ -545,7 +547,6 @@ read :: proc(path : string, allocator:=context.allocator) -> (Wav, bool) #option // just here to make some printing prettier temp_bext = nil - temp_buf = nil return file, true } -- cgit v1.2.1