📄 hparm.h
字号:
*/PBStatus BufferStatus(ParmBuf pbuf);/* Return current status of buffer. PB_INIT - buffer ready for StartBuffer call. No observations available. PB_FILLING - buffer is currently reading from source. PB_STOPPED - source has closed and buffer can be used as a table. PB_CLEARED - same as PB_STOPPED but ReadAsBuffer has read final frame. Does not block.*/int ObsInBuffer(ParmBuf pbuf);/* Return number of observations available to ReadAsBuffer without blocking. This will be zero once the buffer is COMPLETE although ReadAsTable can still be used to access whole buffer (use GetBufferInfo to find range of allowable indexes). Note that final frame may not be read and the source closed until a ReadAsBuffer call has to read the final frame (this is only a problem for HParm/HWave file descriptors which normally get read immediately in full). This is non-ideal but cannot otherwise guarantee ObsInBuffer is non-blocking.*/void StartBuffer(ParmBuf pbuf);/* Start and filling the buffer. If signals have been enabled then effect is delayed until first signal is sent. If silence/speech detection is enabled then frames will accumulate when speech starts and buffer will stop filling when silence is detected. If silence/speech detection is not enabled but signals are, then a second signal will stop the filling. This operation will fail if pbuf status is not PB_INIT. This operation should now be non-blocking.*/ void StopBuffer(ParmBuf pbuf);/* Filling the buffer is stopped regardless of whether signals and/or silence/speech detection is enabled. After making this call, the pbuf status will change to PB_STOPPED. Only when the buffer has been emptied will the status change to PB_CLEARED.*/void CloseBuffer(ParmBuf pbuf);/* Close the given buffer, close the associated audio stream if any and release any associated memory.*/Boolean ReadAsBuffer(ParmBuf pbuf, Observation *o);/* Get next observation from buffer. Buffer status must be PB_FILLING or PB_STOPPED. If no observation is available the function will block until one is available or the input is closed. Will returns FALSE if blocked but could not read new Observation.*/void ReadAsTable (ParmBuf pbuf, int index, Observation *o);/* Get the index'th observation from buffer. Buffer status must be PB_STOPPED. Index runs 0,1,2,.... By definition this operation is non-blocking.*/void GetBufferInfo(ParmBuf pbuf, BufferInfo *info);/* Get info associated with pbuf. Does not block.*//* ---------------- External Data Source Handling---------------- */HParmSrcDef CreateSrcExt(Ptr xInfo, ParmKind pk, int size, HTime sampPeriod, Ptr (*fOpen)(Ptr xInfo,char *fn,BufferInfo *info), void (*fClose)(Ptr xInfo,Ptr bInfo), void (*fStart)(Ptr xInfo,Ptr bInfo), void (*fStop)(Ptr xInfo,Ptr bInfo), int (*fNumSamp)(Ptr xInfo,Ptr bInfo), int (*fGetData)(Ptr xInfo,Ptr bInfo,int n,Ptr data));/* Create and return a HParmSrcDef object handling an external data source. size: 1 for 8 bit u-law, 0x101 for 8 bit a-law or 2 for 16 bit linear Semantics of functions fClose() etc. described in HParm.c.*/ParmBuf OpenExtBuffer(MemHeap *x, char *fn, int maxObs, FileFormat ff, HParmSrcDef ext, TriState enSpeechDet, TriState silMeasure);/* Open and return input buffer using an external source*//* ----------------- New Buffer Creation Routines -------------- */ParmBuf EmptyBuffer(MemHeap *x, int size, Observation o, BufferInfo info);/* Create and return an empty ParmBuf object set-up as a table with initially size free observation slots. Observation o is used for sizing and info supplies associated configuration parameters. The latter will typically be copied from a buffer created by an OpenBuffer call.*/ReturnStatus SaveBuffer(ParmBuf pbuf, char *fname, FileFormat ff);/* Write contents of given buffer to fname. If SAVEWITHCRC is set in config then a cyclic redundancy check code is added. If SAVECOMPRESSED is set then the data in the table is compressed before writing out. If ff is not UNDEFF then ff overrides target file format set in buffer.*/void AddToBuffer(ParmBuf pbuf, Observation o);/* Append the given observation to the table.*//* ----------------- Observation Handling Routines -------------- */Observation MakeObservation(MemHeap *x, short *swidth, ParmKind pkind, Boolean forceDisc, Boolean eSep);/* Create observation using info in swidth, eSep and pkind If forceDisc is true the observation will be DISCRETE but can read from a continuous parameter parmbuffer.*/void ExplainObservation(Observation *o, int itemsPerLine);/* Explain the structure of given observation by printing a template showing component structure*/void PrintObservation(int i, Observation *o, int itemsPerLine);/* Print the given observation. If i>0 then print with an index.*/void ZeroStreamWidths(int numS, short *swidth);/* Stores numS in swidth[0] and sets remaining components of swidth to zero*/void SetStreamWidths(ParmKind pk, int size, short *swidth, Boolean *eSep);/* If swidth has been 'zeroed' by ZeroStreamWidths, then this function sets up stream widths in swidth[1] to swidth[S] for number of streams S specified in swidth[0]. If eSep then energy is extracted as a separate stream. If swidth[n] is non-zero, then it only eSep is set.*//* EXPORT->SyncBuffers: if matrix transformations are used this syncs the two buffers */Boolean SyncBuffers(ParmBuf pbuf,ParmBuf pbuf2);void SetParmHMMSet(Ptr hset);/* The prototype for this should really be void SetParmHMMSet(HMMSet *hset); However the .h files have an issue with this. A cast is performed in the first line of the function.*//* ------------------- Parameter Kind Conversions --------------- */char *ParmKind2Str(ParmKind kind, char *buf);ParmKind Str2ParmKind(char *str);/* Convert between ParmKind type & string form.*/ParmKind BaseParmKind(ParmKind kind);Boolean HasEnergy(ParmKind kind);Boolean HasDelta(ParmKind kind);Boolean HasNulle(ParmKind kind);Boolean HasAccs(ParmKind kind);Boolean HasThird(ParmKind kind);Boolean HasCompx(ParmKind kind);Boolean HasCrcc(ParmKind kind);Boolean HasZerom(ParmKind kind);Boolean HasZeroc(ParmKind kind);Boolean HasVQ(ParmKind kind);/* Functions to separate base param kind from qualifiers */Boolean ValidConversion(ParmKind src, ParmKind tgt);/* Checks that src -> tgt conversion is possible */#ifdef __cplusplus}#endif#endif /* _HPARM_H_ *//* ------------------------ End of HParm.h ------------------------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -