void afSetMarkPosition (AFfilehandle file, int trackid, int markid, AFframecount position) { if (!_af_filehandle_ok(file)) return; if (!file->checkCanWrite()) return; Track *track = file->getTrack(trackid); if (!track) return; Marker *marker = track->getMarker(markid); if (!marker) return; if (position < 0) { #ifdef __WXOSX__ _af_error(AF_BAD_MARKPOS, "invalid marker position %jd", #else _af_error(AF_BAD_MARKPOS, "invalid marker position %"PRId64, #endif static_cast<intmax_t>(position)); position = 0; }
/* This routine checks and sets instrument parameters. npv is number of valid AUpvlist pairs. */ void _af_instparam_set (AFfilehandle file, int instid, AUpvlist pvlist, int npv) { if (!_af_filehandle_ok(file)) return; if (!file->checkCanWrite()) return; Instrument *instrument = file->getInstrument(instid); if (!instrument) return; if (AUpvgetmaxitems(pvlist) < npv) npv = AUpvgetmaxitems(pvlist); for (int i=0; i < npv; i++) { int param; AUpvgetparam(pvlist, i, ¶m); int j; if ((j = _af_instparam_index_from_id(file->m_fileFormat, param)) == -1) /* no parameter with that id; ignore */ continue; if (!file->isInstrumentParameterValid(pvlist, i)) /* bad parameter value; ignore */ continue; int type = _af_units[file->m_fileFormat].instrumentParameters[j].type; switch (type) { case AU_PVTYPE_LONG: AUpvgetval(pvlist, i, &instrument->values[j].l); break; case AU_PVTYPE_DOUBLE: AUpvgetval(pvlist, i, &instrument->values[j].d); break; case AU_PVTYPE_PTR: AUpvgetval(pvlist, i, &instrument->values[j].v); break; default: return; } } }