本文整理汇总了C++中AFfilehandle类的典型用法代码示例。如果您正苦于以下问题:C++ AFfilehandle类的具体用法?C++ AFfilehandle怎么用?C++ AFfilehandle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AFfilehandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: afSetMarkPosition
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;
}
示例2: _af_instparam_set
/*
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;
}
}
}
示例3: afSetChannelMatrix
void afSetChannelMatrix (AFfilehandle file, int trackid, double* matrix)
{
if (!_af_filehandle_ok(file))
return;
Track *track = file->getTrack(trackid);
if (!track)
return;
if (track->channelMatrix != NULL)
free(track->channelMatrix);
track->channelMatrix = NULL;
if (matrix != NULL)
{
int i, size;
size = track->v.channelCount * track->f.channelCount;
track->channelMatrix = (double *) malloc(size * sizeof (double));
for (i = 0; i < size; i++)
track->channelMatrix[i] = matrix[i];
}
}
示例4: afSeekFrame
AFframecount afSeekFrame (AFfilehandle file, int trackid, AFframecount frame)
{
if (!_af_filehandle_ok(file))
return -1;
if (!file->checkCanRead())
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
if (track->ms->isDirty() && track->ms->setup(file, track) == AF_FAIL)
return -1;
if (frame < 0)
return track->nextvframe;
/* Optimize the case of seeking to the current position. */
if (frame == track->nextvframe)
return track->nextvframe;
/* Limit request to the number of frames in the file. */
if (track->totalvframes != -1)
if (frame > track->totalvframes)
frame = track->totalvframes - 1;
/*
Now that the modules are not dirty and frame
represents a valid virtual frame, we call
_AFsetupmodules again after setting track->nextvframe.
_AFsetupmodules will look at track->nextvframe and
compute track->nextfframe in clever and mysterious
ways.
*/
track->nextvframe = frame;
if (track->ms->setup(file, track) == AF_FAIL)
return -1;
return track->nextvframe;
}
示例5: afGetFileFormat
/* XXXmpruett fix the version */
int afGetFileFormat (AFfilehandle file, int *version)
{
if (!_af_filehandle_ok(file))
return -1;
if (version != NULL)
*version = file->getVersion();
return file->m_fileFormat;
}
示例6: _af_instparam_get
/*
This routine gets instrument parameters.
npv is number of valid AUpvlist pairs
*/
void _af_instparam_get (AFfilehandle file, int instid, AUpvlist pvlist, int npv,
bool forceLong)
{
if (!_af_filehandle_ok(file))
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;
int type = _af_units[file->m_fileFormat].instrumentParameters[j].type;
/*
forceLong is true when this routine called by
afGetInstParamLong().
*/
if (forceLong && type != AU_PVTYPE_LONG)
{
_af_error(AF_BAD_INSTPTYPE, "type of instrument parameter %d is not AU_PVTYPE_LONG", param);
continue;
}
AUpvsetvaltype(pvlist, i, type);
switch (type)
{
case AU_PVTYPE_LONG:
AUpvsetval(pvlist, i, &instrument->values[j].l);
break;
case AU_PVTYPE_DOUBLE:
AUpvsetval(pvlist, i, &instrument->values[j].d);
break;
case AU_PVTYPE_PTR:
AUpvsetval(pvlist, i, &instrument->values[j].v);
break;
default:
_af_error(AF_BAD_INSTPTYPE, "invalid instrument parameter type %d", type);
return;
}
}
}
示例7: afGetVirtualByteOrder
int afGetVirtualByteOrder (AFfilehandle file, int trackid)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
return track->v.byteOrder;
}
示例8: afGetVirtualFrameSize
float afGetVirtualFrameSize (AFfilehandle file, int trackid, int stretch3to4)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
return _af_format_frame_size(&track->v, stretch3to4);
}
示例9: afGetTrackBytes
AFfileoffset afGetTrackBytes (AFfilehandle file, int trackid)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
return track->data_size;
}
示例10: afGetDataOffset
AFfileoffset afGetDataOffset (AFfilehandle file, int trackid)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
return track->fpos_first_frame;
}
示例11: afGetVirtualChannels
int afGetVirtualChannels (AFfilehandle file, int trackid)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
return track->v.channelCount;
}
示例12: afGetVirtualRate
double afGetVirtualRate (AFfilehandle file, int trackid)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
return track->v.sampleRate;
}
示例13: afGetFrameCount
AFframecount afGetFrameCount (AFfilehandle file, int trackid)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
if (track->ms->isDirty() && track->ms->setup(file, track) == AF_FAIL)
return -1;
return track->totalvframes;
}
示例14: afGetVirtualSampleFormat
void afGetVirtualSampleFormat (AFfilehandle file, int trackid, int *sampleFormat, int *sampleWidth)
{
if (!_af_filehandle_ok(file))
return;
Track *track = file->getTrack(trackid);
if (!track)
return;
if (sampleFormat)
*sampleFormat = track->v.sampleFormat;
if (sampleWidth)
*sampleWidth = track->v.sampleWidth;
}
示例15: afSetVirtualSampleFormat
int afSetVirtualSampleFormat (AFfilehandle file, int trackid,
int sampleFormat, int sampleWidth)
{
if (!_af_filehandle_ok(file))
return -1;
Track *track = file->getTrack(trackid);
if (!track)
return -1;
if (_af_set_sample_format(&track->v, sampleFormat, sampleWidth) == AF_FAIL)
return -1;
track->ms->setDirty();
return 0;
}