void afInitMarkComment(AFfilesetup setup, int trackid, int markid, const char *commstr) { int markno; int length; if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; for (markno=0; markno<track->markerCount; markno++) { if (track->markers[markno].id == markid) break; } if (markno == track->markerCount) { _af_error(AF_BAD_MARKID, "no marker id %d for file setup", markid); return; } length = strlen(commstr); if (track->markers[markno].comment) free(track->markers[markno].comment); if ((track->markers[markno].comment = (char *) _af_malloc(length+1)) == NULL) return; strcpy(track->markers[markno].comment, commstr); }
void afInitMarkIDs(AFfilesetup setup, int trackid, const int *markids, int nmarks) { if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; if (track->markers != NULL) { for (int i=0; i<track->markerCount; i++) { if (track->markers[i].name != NULL) free(track->markers[i].name); if (track->markers[i].comment != NULL) free(track->markers[i].comment); } free(track->markers); } track->markers = (MarkerSetup *) _af_calloc(nmarks, sizeof (struct MarkerSetup)); track->markerCount = nmarks; for (int i=0; i<nmarks; i++) { track->markers[i].id = markids[i]; track->markers[i].name = _af_strdup(""); track->markers[i].comment = _af_strdup(""); } track->markersSet = true; }
AFfilesetup RawFile::completeSetup(AFfilesetup setup) { AFfilesetup newSetup; if (setup->trackSet && setup->trackCount != 1) { _af_error(AF_BAD_FILESETUP, "raw file must have exactly one track"); return AF_NULL_FILESETUP; } TrackSetup *track = setup->getTrack(); if (!track) { _af_error(AF_BAD_FILESETUP, "could not access track in file setup"); return AF_NULL_FILESETUP; } if (track->aesDataSet) { _af_error(AF_BAD_FILESETUP, "raw file cannot have AES data"); return AF_NULL_FILESETUP; } if (track->markersSet && track->markerCount != 0) { _af_error(AF_BAD_NUMMARKS, "raw file cannot have markers"); return AF_NULL_FILESETUP; } if (setup->instrumentSet && setup->instrumentCount != 0) { _af_error(AF_BAD_NUMINSTS, "raw file cannot have instruments"); return AF_NULL_FILESETUP; } if (setup->miscellaneousSet && setup->miscellaneousCount != 0) { _af_error(AF_BAD_NUMMISC, "raw file cannot have miscellaneous data"); return AF_NULL_FILESETUP; } newSetup = (_AFfilesetup *) _af_malloc(sizeof (_AFfilesetup)); *newSetup = rawDefaultFileSetup; newSetup->tracks = (TrackSetup *) _af_malloc(sizeof (TrackSetup)); newSetup->tracks[0] = setup->tracks[0]; newSetup->tracks[0].f.compressionParams = NULL; newSetup->tracks[0].markerCount = 0; newSetup->tracks[0].markers = NULL; return newSetup; }
status RawFile::readInit(AFfilesetup fileSetup) { if (!fileSetup) { _af_error(AF_BAD_FILESETUP, "a valid AFfilesetup is required for reading raw data"); return AF_FAIL; } if (initFromSetup(fileSetup) == AF_FAIL) return AF_FAIL; TrackSetup *trackSetup = fileSetup->getTrack(); if (!trackSetup) return AF_FAIL; Track *track = getTrack(); /* Set the track's data offset. */ if (trackSetup->dataOffsetSet) track->fpos_first_frame = trackSetup->dataOffset; else track->fpos_first_frame = 0; /* Set the track's frame count. */ if (trackSetup->frameCountSet) { track->totalfframes = trackSetup->frameCount; } else { AFfileoffset filesize = m_fh->length(); if (filesize == -1) track->totalfframes = -1; else { /* Ensure that the data offset is valid. */ if (track->fpos_first_frame > filesize) { _af_error(AF_BAD_FILESETUP, "data offset is larger than file size"); return AF_FAIL; } filesize -= track->fpos_first_frame; track->totalfframes = filesize / (int) _af_format_frame_size(&track->f, false); } track->data_size = filesize; } return AF_SUCCEED; }
void afInitSampleFormat (AFfilesetup setup, int trackid, int sampfmt, int sampwidth) { if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; _af_set_sample_format(&track->f, sampfmt, sampwidth); track->sampleFormatSet = true; track->sampleWidthSet = true; }
status RawFile::writeInit(AFfilesetup setup) { if (initFromSetup(setup) == AF_FAIL) return AF_FAIL; TrackSetup *trackSetup = setup->getTrack(); if (!trackSetup) return AF_FAIL; Track *track = getTrack(); if (trackSetup->dataOffsetSet) track->fpos_first_frame = trackSetup->dataOffset; else track->fpos_first_frame = 0; return AF_SUCCEED; }
void afInitRate (AFfilesetup setup, int trackid, double rate) { if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; if (rate <= 0.0) { _af_error(AF_BAD_RATE, "invalid sample rate %.30g", rate); return; } track->f.sampleRate = rate; track->rateSet = true; }
void afInitMarkName(AFfilesetup setup, int trackid, int markid, const char *namestr) { int markno; int length; if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; for (markno=0; markno<track->markerCount; markno++) { if (track->markers[markno].id == markid) break; } if (markno == track->markerCount) { _af_error(AF_BAD_MARKID, "no marker id %d for file setup", markid); return; } length = strlen(namestr); if (length > 255) { _af_error(AF_BAD_STRLEN, "warning: marker name truncated to 255 characters"); length = 255; } if (track->markers[markno].name) free(track->markers[markno].name); if ((track->markers[markno].name = (char *) _af_malloc(length+1)) == NULL) return; strncpy(track->markers[markno].name, namestr, length); /* The null terminator is not set by strncpy if strlen(namestr) > length. Set it here. */ track->markers[markno].name[length] = '\0'; }
void afInitByteOrder (AFfilesetup setup, int trackid, int byteorder) { if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; if (byteorder != AF_BYTEORDER_BIGENDIAN && byteorder != AF_BYTEORDER_LITTLEENDIAN) { _af_error(AF_BAD_BYTEORDER, "invalid byte order %d", byteorder); return; } track->f.byteOrder = byteorder; track->byteOrderSet = true; }
void afInitChannels (AFfilesetup setup, int trackid, int channels) { if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; if (channels < 1) { _af_error(AF_BAD_CHANNELS, "invalid number of channels %d", channels); return; } track->f.channelCount = channels; track->channelCountSet = true; }
/* track data: data offset within the file (initialized for raw reading only) */ void afInitDataOffset (AFfilesetup setup, int trackid, AFfileoffset offset) { if (!_af_filesetup_ok(setup)) return; TrackSetup *track = setup->getTrack(trackid); if (!track) return; if (offset < 0) { #ifdef __WXOSX__ _af_error(AF_BAD_DATAOFFSET, "invalid data offset %jd", #else _af_error(AF_BAD_DATAOFFSET, "invalid data offset %"PRId64, #endif static_cast<intmax_t>(offset)); return; }
AFfilesetup NISTFile::completeSetup(AFfilesetup setup) { if (setup->trackSet && setup->trackCount != 1) { _af_error(AF_BAD_NUMTRACKS, "NIST SPHERE file must have 1 track"); return AF_NULL_FILESETUP; } TrackSetup *track = setup->getTrack(); if (!track) return AF_NULL_FILESETUP; if (track->sampleFormatSet) { /* XXXmpruett: Currently we allow only 1-16 bit sample width. */ if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP && (track->f.sampleWidth < 1 || track->f.sampleWidth > 16)) { _af_error(AF_BAD_WIDTH, "invalid sample width %d bits for NIST SPHERE format", track->f.sampleWidth); return AF_NULL_FILESETUP; } else if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) { _af_error(AF_BAD_SAMPFMT, "NIST SPHERE format does not support unsigned data"); return AF_NULL_FILESETUP; } else if (track->f.sampleFormat == AF_SAMPFMT_FLOAT || track->f.sampleFormat == AF_SAMPFMT_DOUBLE) { _af_error(AF_BAD_SAMPFMT, "NIST SPHERE format does not support floating-point data"); return AF_NULL_FILESETUP; } } if (track->rateSet && track->f.sampleRate <= 0.0) { _af_error(AF_BAD_RATE, "invalid sample rate %.30g for NIST SPHERE file", track->f.sampleRate); return AF_NULL_FILESETUP; } if (track->compressionSet && track->f.compressionType != AF_COMPRESSION_NONE && track->f.compressionType != AF_COMPRESSION_G711_ULAW && track->f.compressionType != AF_COMPRESSION_G711_ALAW) { _af_error(AF_BAD_NOT_IMPLEMENTED, "NIST SPHERE format supports only G.711 u-law or A-law compression"); return AF_NULL_FILESETUP; } if (track->aesDataSet) { _af_error(AF_BAD_FILESETUP, "NIST SPHERE file cannot have AES data"); return AF_NULL_FILESETUP; } if (track->markersSet && track->markerCount != 0) { _af_error(AF_BAD_NUMMARKS, "NIST SPHERE format does not support markers"); return AF_NULL_FILESETUP; } if (setup->instrumentSet && setup->instrumentCount != 0) { _af_error(AF_BAD_NUMINSTS, "NIST SPHERE format does not support instruments"); return AF_NULL_FILESETUP; } /* XXXmpruett: We don't support miscellaneous chunks for now. */ if (setup->miscellaneousSet && setup->miscellaneousCount != 0) { _af_error(AF_BAD_NOT_IMPLEMENTED, "NIST SPHERE format does not currently support miscellaneous chunks"); return AF_NULL_FILESETUP; } return _af_filesetup_copy(setup, &nistDefaultFileSetup, true); }
AFfilesetup NeXTFile::completeSetup(AFfilesetup setup) { if (setup->trackSet && setup->trackCount != 1) { _af_error(AF_BAD_NUMTRACKS, "NeXT files must have exactly 1 track"); return AF_NULL_FILESETUP; } TrackSetup *track = setup->getTrack(); if (!track) return AF_NULL_FILESETUP; if (track->f.sampleFormat == AF_SAMPFMT_UNSIGNED) { _af_error(AF_BAD_FILEFMT, "NeXT format does not support unsigned data"); _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, track->f.sampleWidth); } if (track->f.sampleFormat == AF_SAMPFMT_TWOSCOMP) { if (track->f.sampleWidth != 8 && track->f.sampleWidth != 16 && track->f.sampleWidth != 24 && track->f.sampleWidth != 32) { _af_error(AF_BAD_WIDTH, "invalid sample width %d for NeXT file (only 8-, 16-, 24-, and 32-bit data are allowed)"); return AF_NULL_FILESETUP; } } if (track->f.compressionType != AF_COMPRESSION_NONE && track->f.compressionType != AF_COMPRESSION_G711_ULAW && track->f.compressionType != AF_COMPRESSION_G711_ALAW) { _af_error(AF_BAD_NOT_IMPLEMENTED, "compression format not implemented for NeXT files"); return AF_NULL_FILESETUP; } if (track->f.byteOrder != AF_BYTEORDER_BIGENDIAN && track->byteOrderSet) { _af_error(AF_BAD_BYTEORDER, "NeXT format supports only big-endian data"); track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; } if (track->aesDataSet) { _af_error(AF_BAD_FILESETUP, "NeXT files cannot have AES data"); return AF_NULL_FILESETUP; } if (track->markersSet && track->markerCount != 0) { _af_error(AF_BAD_FILESETUP, "NeXT format does not support markers"); return AF_NULL_FILESETUP; } if (setup->instrumentSet && setup->instrumentCount != 0) { _af_error(AF_BAD_FILESETUP, "NeXT format does not support instruments"); return AF_NULL_FILESETUP; } if (setup->miscellaneousSet && setup->miscellaneousCount != 0) { _af_error(AF_BAD_FILESETUP, "NeXT format does not support miscellaneous data"); return AF_NULL_FILESETUP; } return _af_filesetup_copy(setup, &next_default_filesetup, false); }
AFfilesetup AVRFile::completeSetup(AFfilesetup setup) { if (setup->trackSet && setup->trackCount != 1) { _af_error(AF_BAD_NUMTRACKS, "AVR files must have exactly 1 track"); return AF_NULL_FILESETUP; } TrackSetup *track = setup->getTrack(); if (!track) return AF_NULL_FILESETUP; /* AVR allows only unsigned and two's complement integer data. */ if (track->f.sampleFormat != AF_SAMPFMT_UNSIGNED && track->f.sampleFormat != AF_SAMPFMT_TWOSCOMP) { _af_error(AF_BAD_FILEFMT, "AVR format does supports only unsigned and two's complement integer data"); return AF_NULL_FILESETUP; } /* For now we support only 8- and 16-bit samples. */ if (track->f.sampleWidth != 8 && track->f.sampleWidth != 16) { _af_error(AF_BAD_WIDTH, "invalid sample width %d for AVR file (only 8- and 16-bit sample widths are allowed)", track->f.sampleWidth); return AF_NULL_FILESETUP; } /* AVR does not support compression. */ if (track->f.compressionType != AF_COMPRESSION_NONE) { _af_error(AF_BAD_NOT_IMPLEMENTED, "compression not supported for AVR files"); return AF_NULL_FILESETUP; } /* AVR audio data is big-endian. */ if (track->f.byteOrder != AF_BYTEORDER_BIGENDIAN) { if (track->byteOrderSet) { _af_error(AF_BAD_BYTEORDER, "AVR format supports only big-endian data"); return AF_NULL_FILESETUP; } else track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; } if (track->aesDataSet) { _af_error(AF_BAD_FILESETUP, "AVR files do not support AES data"); return AF_NULL_FILESETUP; } if (track->markersSet && track->markerCount != 0) { _af_error(AF_BAD_FILESETUP, "AVR format does not support markers"); return AF_NULL_FILESETUP; } if (setup->instrumentSet && setup->instrumentCount != 0) { _af_error(AF_BAD_FILESETUP, "AVR format does not support instruments"); return AF_NULL_FILESETUP; } if (setup->miscellaneousSet && setup->miscellaneousCount != 0) { _af_error(AF_BAD_FILESETUP, "AVR format does not support miscellaneous data"); return AF_NULL_FILESETUP; } return _af_filesetup_copy(setup, &avrDefaultFileSetup, false); }
AFfilesetup IFFFile::completeSetup(AFfilesetup setup) { if (setup->trackSet && setup->trackCount != 1) { _af_error(AF_BAD_NUMTRACKS, "IFF/8SVX file must have 1 track"); return AF_NULL_FILESETUP; } TrackSetup *track = setup->getTrack(); if (!track) return AF_NULL_FILESETUP; if (track->sampleFormatSet && track->f.sampleFormat != AF_SAMPFMT_TWOSCOMP) { _af_error(AF_BAD_SAMPFMT, "IFF/8SVX format supports only two's complement integer data"); return AF_NULL_FILESETUP; } if (track->sampleFormatSet && track->f.sampleWidth != 8) { _af_error(AF_BAD_WIDTH, "IFF/8SVX file allows only 8 bits per sample " "(%d bits requested)", track->f.sampleWidth); return AF_NULL_FILESETUP; } if (track->channelCountSet && track->f.channelCount != 1) { _af_error(AF_BAD_CHANNELS, "invalid channel count (%d) for IFF/8SVX format " "(only 1 channel supported)", track->f.channelCount); return AF_NULL_FILESETUP; } if (track->f.compressionType != AF_COMPRESSION_NONE) { _af_error(AF_BAD_COMPRESSION, "IFF/8SVX does not support compression"); return AF_NULL_FILESETUP; } /* Ignore requested byte order since samples are only one byte. */ track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; /* Either one channel was requested or no request was made. */ track->f.channelCount = 1; _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, 8); if (track->markersSet && track->markerCount != 0) { _af_error(AF_BAD_NUMMARKS, "IFF/8SVX format does not support markers"); return AF_NULL_FILESETUP; } if (track->aesDataSet) { _af_error(AF_BAD_FILESETUP, "IFF/8SVX format does not support AES data"); return AF_NULL_FILESETUP; } if (setup->instrumentSet && setup->instrumentCount != 0) { _af_error(AF_BAD_NUMINSTS, "IFF/8SVX format does not support instruments"); return AF_NULL_FILESETUP; } return _af_filesetup_copy(setup, &iffDefaultFileSetup, true); }
AFfilesetup WAVEFile::completeSetup(AFfilesetup setup) { if (setup->trackSet && setup->trackCount != 1) { _af_error(AF_BAD_NUMTRACKS, "WAVE file must have 1 track"); return AF_NULL_FILESETUP; } TrackSetup *track = setup->getTrack(); if (track->sampleFormatSet) { switch (track->f.sampleFormat) { case AF_SAMPFMT_FLOAT: if (track->sampleWidthSet && track->f.sampleWidth != 32) { _af_error(AF_BAD_WIDTH, "Warning: invalid sample width for floating-point WAVE file: %d (must be 32 bits)\n", track->f.sampleWidth); _af_set_sample_format(&track->f, AF_SAMPFMT_FLOAT, 32); } break; case AF_SAMPFMT_DOUBLE: if (track->sampleWidthSet && track->f.sampleWidth != 64) { _af_error(AF_BAD_WIDTH, "Warning: invalid sample width for double-precision floating-point WAVE file: %d (must be 64 bits)\n", track->f.sampleWidth); _af_set_sample_format(&track->f, AF_SAMPFMT_DOUBLE, 64); } break; case AF_SAMPFMT_UNSIGNED: if (track->sampleWidthSet) { if (track->f.sampleWidth < 1 || track->f.sampleWidth > 32) { _af_error(AF_BAD_WIDTH, "invalid sample width for WAVE file: %d (must be 1-32 bits)\n", track->f.sampleWidth); return AF_NULL_FILESETUP; } if (track->f.sampleWidth > 8) { _af_error(AF_BAD_SAMPFMT, "WAVE integer data of more than 8 bits must be two's complement signed"); _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, track->f.sampleWidth); } } else /* If the sample width is not set but the user requests unsigned data, set the width to 8 bits. */ _af_set_sample_format(&track->f, track->f.sampleFormat, 8); break; case AF_SAMPFMT_TWOSCOMP: if (track->sampleWidthSet) { if (track->f.sampleWidth < 1 || track->f.sampleWidth > 32) { _af_error(AF_BAD_WIDTH, "invalid sample width %d for WAVE file (must be 1-32)", track->f.sampleWidth); return AF_NULL_FILESETUP; } else if (track->f.sampleWidth <= 8) { _af_error(AF_BAD_SAMPFMT, "Warning: WAVE format integer data of 1-8 bits must be unsigned; setting sample format to unsigned"); _af_set_sample_format(&track->f, AF_SAMPFMT_UNSIGNED, track->f.sampleWidth); } } else /* If no sample width was specified, we default to 16 bits for signed integer data. */ _af_set_sample_format(&track->f, track->f.sampleFormat, 16); break; } } /* Otherwise set the sample format depending on the sample width or set completely to default. */ else { if (!track->sampleWidthSet) { track->f.sampleWidth = 16; track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; } else { if (track->f.sampleWidth < 1 || track->f.sampleWidth > 32) { _af_error(AF_BAD_WIDTH, "invalid sample width %d for WAVE file (must be 1-32)", track->f.sampleWidth); return AF_NULL_FILESETUP; } else if (track->f.sampleWidth > 8) /* Here track->f.sampleWidth is in {1..32}. */ track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP; else /* Here track->f.sampleWidth is in {1..8}. */ track->f.sampleFormat = AF_SAMPFMT_UNSIGNED; } } if (track->f.compressionType != AF_COMPRESSION_NONE && track->f.compressionType != AF_COMPRESSION_G711_ULAW && track->f.compressionType != AF_COMPRESSION_G711_ALAW) { _af_error(AF_BAD_NOT_IMPLEMENTED, "compression format not supported in WAVE format"); return AF_NULL_FILESETUP; } if (track->byteOrderSet && track->f.byteOrder != AF_BYTEORDER_LITTLEENDIAN && track->f.compressionType == AF_COMPRESSION_NONE) { _af_error(AF_BAD_BYTEORDER, "WAVE format only supports little-endian data"); return AF_NULL_FILESETUP; } if (track->f.compressionType == AF_COMPRESSION_NONE) track->f.byteOrder = AF_BYTEORDER_LITTLEENDIAN; else track->f.byteOrder = AF_BYTEORDER_BIGENDIAN; if (track->aesDataSet) { _af_error(AF_BAD_FILESETUP, "WAVE files cannot have AES data"); return AF_NULL_FILESETUP; } if (setup->instrumentSet) { if (setup->instrumentCount > 1) { _af_error(AF_BAD_NUMINSTS, "WAVE files can have 0 or 1 instrument"); return AF_NULL_FILESETUP; } else if (setup->instrumentCount == 1) { if (setup->instruments[0].loopSet && setup->instruments[0].loopCount > 0 && (!track->markersSet || track->markerCount == 0)) { _af_error(AF_BAD_NUMMARKS, "WAVE files with loops must contain at least 1 marker"); return AF_NULL_FILESETUP; } } } /* Make sure the miscellaneous data is of an acceptable type. */ if (setup->miscellaneousSet) { for (int i=0; i<setup->miscellaneousCount; i++) { switch (setup->miscellaneous[i].type) { case AF_MISC_COPY: case AF_MISC_AUTH: case AF_MISC_NAME: case AF_MISC_ICRD: case AF_MISC_ISFT: case AF_MISC_ICMT: break; default: _af_error(AF_BAD_MISCTYPE, "illegal miscellaneous type [%d] for WAVE file", setup->miscellaneous[i].type); return AF_NULL_FILESETUP; } } } /* Allocate an AFfilesetup and make all the unset fields correct. */ AFfilesetup newsetup = _af_filesetup_copy(setup, &wave_default_filesetup, false); /* Make sure we do not copy loops if they are not specified in setup. */ if (setup->instrumentSet && setup->instrumentCount > 0 && setup->instruments[0].loopSet) { free(newsetup->instruments[0].loops); newsetup->instruments[0].loopCount = 0; } return newsetup; }
AFfilesetup VOCFile::completeSetup(AFfilesetup setup) { if (setup->trackSet && setup->trackCount != 1) { _af_error(AF_BAD_NUMTRACKS, "VOC file must have 1 track"); return AF_NULL_FILESETUP; } TrackSetup *track = setup->getTrack(); if (!track) return AF_NULL_FILESETUP; if (track->sampleFormatSet) { if (!track->f.isInteger()) { _af_error(AF_BAD_SAMPFMT, "VOC format supports only integer audio data"); return AF_NULL_FILESETUP; } if ((track->f.isSigned() && track->f.sampleWidth != 16) || (track->f.isUnsigned() && track->f.sampleWidth != 8)) { _af_error(AF_BAD_SAMPFMT, "VOC format supports only 16-bit signed or 8-bit unsigned data"); return AF_NULL_FILESETUP; } } else _af_set_sample_format(&track->f, AF_SAMPFMT_TWOSCOMP, track->f.sampleWidth); if (track->f.isUncompressed() && track->byteOrderSet && track->f.byteOrder != AF_BYTEORDER_LITTLEENDIAN && track->f.isByteOrderSignificant()) { _af_error(AF_BAD_BYTEORDER, "VOC supports only little-endian data"); return AF_NULL_FILESETUP; } if (track->f.isUncompressed()) track->f.byteOrder = AF_BYTEORDER_LITTLEENDIAN; if (track->f.compressionType != AF_COMPRESSION_NONE && track->f.compressionType != AF_COMPRESSION_G711_ULAW && track->f.compressionType != AF_COMPRESSION_G711_ALAW) { _af_error(AF_BAD_COMPTYPE, "compression format %d not supported in VOC file", track->f.compressionType); return AF_NULL_FILESETUP; } if (track->markersSet && track->markerCount) { _af_error(AF_BAD_NUMMARKS, "VOC does not support markers"); return AF_NULL_FILESETUP; } if (track->aesDataSet) { _af_error(AF_BAD_FILESETUP, "VOC does not support AES data"); return AF_NULL_FILESETUP; } if (setup->instrumentSet && setup->instrumentCount) { _af_error(AF_BAD_FILESETUP, "VOC does not support instruments"); return AF_NULL_FILESETUP; } if (setup->miscellaneousSet && setup->miscellaneousCount) { _af_error(AF_BAD_FILESETUP, "VOC does not support miscellaneous data"); return AF_NULL_FILESETUP; } return _af_filesetup_copy(setup, &vocDefaultFileSetup, true); }