diff options
-rw-r--r-- | apps/plugins/pdbox/PDa/src/d_soundfile.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/plugins/pdbox/PDa/src/d_soundfile.c b/apps/plugins/pdbox/PDa/src/d_soundfile.c index 9aea9ca8f4..81e2d4008e 100644 --- a/apps/plugins/pdbox/PDa/src/d_soundfile.c +++ b/apps/plugins/pdbox/PDa/src/d_soundfile.c | |||
@@ -682,25 +682,27 @@ static int create_soundfile(t_canvas *canvas, const char *filename, | |||
682 | else if (filetype == FORMAT_AIFF) | 682 | else if (filetype == FORMAT_AIFF) |
683 | { | 683 | { |
684 | long datasize = nframes * nchannels * bytespersamp; | 684 | long datasize = nframes * nchannels * bytespersamp; |
685 | long longtmp; | 685 | long longtmp; |
686 | static unsigned char dogdoo[] = | 686 | t_datachunk *aiffdc = (t_datachunk *)headerbuf + sizeof(t_aiff); |
687 | {0x40, 0x0e, 0xac, 0x44, 0, 0, 0, 0, 0, 0, 'S', 'S', 'N', 'D'}; | 687 | static unsigned char AIFF_splrate[] = {0x40, 0x0e, 0xac, 0x44, 0, 0, 0, 0, 0, 0}; |
688 | static unsigned char datachunk_ID[] = {'S', 'S', 'N', 'D'}; | ||
688 | if (strcmp(filenamebuf + strlen(filenamebuf)-4, ".aif") && | 689 | if (strcmp(filenamebuf + strlen(filenamebuf)-4, ".aif") && |
689 | strcmp(filenamebuf + strlen(filenamebuf)-5, ".aiff")) | 690 | strcmp(filenamebuf + strlen(filenamebuf)-5, ".aiff")) |
690 | strcat(filenamebuf, ".aif"); | 691 | strcat(filenamebuf, ".aif"); |
691 | strncpy(aiffhdr->a_fileid, "FORM", 4); | 692 | strncpy(aiffhdr->a_fileid, "FORM", 4); |
692 | aiffhdr->a_chunksize = swap4(datasize + sizeof(*aiffhdr) + 4, swap); | 693 | aiffhdr->a_chunksize = swap4(datasize + sizeof(*aiffhdr) + 4, swap); |
693 | strncpy(aiffhdr->a_aiffid, "AIFF", 4); | 694 | strncpy(aiffhdr->a_aiffid, "AIFF", 4); |
694 | strncpy(aiffhdr->a_fmtid, "COMM", 4); | 695 | strncpy(aiffhdr->a_fmtid, "COMM", 4); |
695 | aiffhdr->a_fmtchunksize = swap4(18, swap); | 696 | aiffhdr->a_fmtchunksize = swap4(18, swap); |
696 | aiffhdr->a_nchannels = swap2(nchannels, swap); | 697 | aiffhdr->a_nchannels = swap2(nchannels, swap); |
697 | longtmp = swap4(nframes, swap); | 698 | longtmp = swap4(nframes, swap); |
698 | memcpy(&aiffhdr->a_nframeshi, &longtmp, 4); | 699 | memcpy(&aiffhdr->a_nframeshi, &longtmp, 4); |
699 | aiffhdr->a_bitspersamp = swap2(8 * bytespersamp, swap); | 700 | aiffhdr->a_bitspersamp = swap2(8 * bytespersamp, swap); |
700 | memcpy(aiffhdr->a_samprate, dogdoo, sizeof(dogdoo)); | 701 | memcpy(aiffhdr->a_samprate, AIFF_splrate, sizeof(AIFF_splrate)); |
701 | longtmp = swap4(datasize, swap); | 702 | memcpy(aiffdc->dc_id, datachunk_ID, sizeof(datachunk_ID)); |
702 | memcpy(aiffhdr->a_samprate + sizeof(dogdoo), &longtmp, 4); | 703 | longtmp = swap4(datasize, swap); |
703 | headersize = AIFFPLUS; | 704 | memcpy(&aiffdc->dc_size, &longtmp, 4); |
705 | headersize = AIFFPLUS; | ||
704 | } | 706 | } |
705 | else /* WAVE format */ | 707 | else /* WAVE format */ |
706 | { | 708 | { |