briandorsey / wavrw

wavrw is a command line tool to read and write WAV files with a focus on visualizing the structure of files and parsing metadata.
Apache License 2.0
2 stars 1 forks source link

Could iter_chunks() use inner chunk structs instead of KnownChunk wrapper? #101

Open briandorsey opened 2 months ago

briandorsey commented 2 months ago

Since it's already manually parsing the ChunkID and size... what if we just parsed the chunk data directly using the inner structs instead of seeking back and using the KnownChunk wrapper?

Could we eliminate the need for KnownChunk entirely? (at the cost of needing chunk parsing/writing code... but I think we're already going to need code to convert back and forth between inner and KnownChunk wrapped variants... maybe it's cleaner to just manually handle the ID and size? (especially since there isn't a good way to know the size of the inner data when creating or modifying a new chunk before it's written.

briandorsey commented 2 months ago

Maybe add a WAV method which returns id, size, offset for each chunk? Use that as base for parsing and writing chunks later?