From 81663d40615953e53dadd7ad53abae2a5a23afdc Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Sun, 18 Jun 2017 21:40:28 -0400 Subject: [PATCH] port from Pd Vanilla: fix bug in aiff soundfile header writing commit 4ec6b6437261342b979f5f818d33f5141cb91386 --- pd/src/d_soundfile.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c index 8908627ab..eb52c5091 100644 --- a/pd/src/d_soundfile.c +++ b/pd/src/d_soundfile.c @@ -799,8 +799,6 @@ static int create_soundfile(t_canvas *canvas, const char *filename, { long datasize = nframes * nchannels * bytespersamp; long longtmp; - static unsigned char dogdoo[] = - {0x40, 0x0e, 0xac, 0x44, 0, 0, 0, 0, 0, 0, 'S', 'S', 'N', 'D'}; if (strcmp(filenamebuf + strlen(filenamebuf)-4, ".aif") && strcmp(filenamebuf + strlen(filenamebuf)-5, ".aiff")) strcat(filenamebuf, ".aif"); @@ -814,9 +812,10 @@ static int create_soundfile(t_canvas *canvas, const char *filename, memcpy(&aiffhdr->a_nframeshi, &longtmp, 4); aiffhdr->a_bitspersamp = swap2(8 * bytespersamp, swap); makeaiffsamprate(samplerate, aiffhdr->a_samprate); + strncpy(((char *)(&aiffhdr->a_samprate))+10, "SSND", 4); longtmp = swap4(datasize + 8, swap); - memcpy(aiffhdr->a_samprate + sizeof(dogdoo), &longtmp, 4); - memset(aiffhdr->a_samprate + sizeof(dogdoo) + 4, 0, 8); + memcpy(((char *)(&aiffhdr->a_samprate))+14, &longtmp, 4); + memset(((char *)(&aiffhdr->a_samprate))+18, 0, 8); headersize = AIFFPLUS; } else /* WAVE format */ -- GitLab