Skip to content
Snippets Groups Projects
Commit 0997de6c authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

port from Pd Vanilla: aiff (and maybe wav) file reading bugfix: odd-sized...

port from Pd Vanilla: aiff (and maybe wav) file reading bugfix: odd-sized chunks are padded up to even number of bytes
commit a567e4398d14901840f24ac82ecfc79306e22903
parent a582602a
No related branches found
No related tags found
No related merge requests found
...@@ -113,7 +113,7 @@ typedef struct _wavechunk /* ... and the last two items */ ...@@ -113,7 +113,7 @@ typedef struct _wavechunk /* ... and the last two items */
#define WAV_INT 1 #define WAV_INT 1
#define WAV_FLOAT 3 #define WAV_FLOAT 3
/* the AIFF header. I'm assuming AIFC is compatible but don't really know /* the cd lib header. I'm assuming AIFC is compatible but don't really know
that. */ that. */
typedef struct _datachunk typedef struct _datachunk
...@@ -292,7 +292,8 @@ int open_soundfile_via_fd(int fd, int headersize, ...@@ -292,7 +292,8 @@ int open_soundfile_via_fd(int fd, int headersize,
{ {
long chunksize = swap4(((t_wavechunk *)buf)->wc_size, long chunksize = swap4(((t_wavechunk *)buf)->wc_size,
swap), seekto = headersize + chunksize + 8, seekout; swap), seekto = headersize + chunksize + 8, seekout;
if (seekto & 1) /* pad up to even number of bytes */
seekto++;
if (!strncmp(((t_wavechunk *)buf)->wc_id, "fmt ", 4)) if (!strncmp(((t_wavechunk *)buf)->wc_id, "fmt ", 4))
{ {
long commblockonset = headersize + 8; long commblockonset = headersize + 8;
...@@ -344,6 +345,8 @@ int open_soundfile_via_fd(int fd, int headersize, ...@@ -344,6 +345,8 @@ int open_soundfile_via_fd(int fd, int headersize,
{ {
long chunksize = swap4(((t_datachunk *)buf)->dc_size, long chunksize = swap4(((t_datachunk *)buf)->dc_size,
swap), seekto = headersize + chunksize + 8, seekout; swap), seekto = headersize + chunksize + 8, seekout;
if (seekto & 1) /* pad up to even number of bytes */
seekto++;
/* post("chunk %c %c %c %c seek %d", /* post("chunk %c %c %c %c seek %d",
((t_datachunk *)buf)->dc_id[0], ((t_datachunk *)buf)->dc_id[0],
((t_datachunk *)buf)->dc_id[1], ((t_datachunk *)buf)->dc_id[1],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment