SPRAAK
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Namespaces | Macros | Enumerations | Functions | Variables
keyset.c File Reference

Key-sets. More...

Data Structures

struct  SprStdKeys
 

Namespaces

 xref_spr_file_hdr
 File formats and headers
 

Macros

#define SPR_DEFAULT_FSHIFT
 The default frame shift (10 msec). More...
 
#define SPR_DEFAULT_SAMPLEFREQ
 The default sample frequency (8kHz). More...
 
#define SPR_DEFAULT_FORMAT
 
#define SPR_DEFAULT_FORMAT_STR
 

Enumerations

enum  SPR_KEY_FORMAT { SPR_KEY_FORMAT_BIN01, SPR_KEY_FORMAT_BIN10, SPR_KEY_FORMAT_ASCII, SPR_KEY_FORMAT_NR }
 
enum  SPR_KEY_LAYOUT { SPR_KEY_LAYOUT_LIST, SPR_KEY_LAYOUT_MATRIX, SPR_KEY_LAYOUT_CUSTOM, SPR_KEY_LAYOUT_NR }
 
enum  SPR_KEY_DATA {
  SPR_KEY_DATA_SAMPLE, SPR_KEY_DATA_TRACK, SPR_KEY_DATA_CORPUS, SPR_KEY_DATA_SEG,
  SPR_KEY_DATA_DICTIONARY, SPR_KEY_DATA_PARAM, SPR_KEY_DATA_MATRIX, SPR_KEY_DATA_DES,
  SPR_KEY_DATA_NR
}
 

Functions

SprKeySetspr_kset_alloc (void)
 
SprKeySetspr_kset_reset (SprKeySet *keys)
 
SprKeySetspr_kset_free (SprKeySet *keys)
 Free a previously allocated keyset. More...
 
int spr_kset_set (SprKeySet *keys, const char *key, const char *value)
 
int spr_kset_cset (SprKeySet *keys, const char *key, const char *value)
 
int spr_kset_set_value (SprKeySet *keys, const char *key, const SprDT *dt, const void *value)
 
int spr_kset_set_value_size (SprKeySet *keys, const char *key, ssize_t value)
 
int spr_kset_set_value_double (SprKeySet *keys, const char *key, double value)
 
int spr_kset_set_value_float (SprKeySet *keys, const char *key, float value)
 
const char * spr_kset_get (const SprKeySet *keys, const char *key)
 
const char * spr_kset_get_err (const SprKeySet *keys, const char *key)
 
int spr_kset_get_value (const SprKeySet *keys, const char *key, const SprDT *dt, void *dst, const void *def_val)
 
ssize_t spr_kset_get_value_size (const SprKeySet *keys, const char *key, ssize_t nf_val)
 
double spr_kset_get_value_double (const SprKeySet *keys, const char *key, double nf_val)
 
float spr_kset_get_value_float (const SprKeySet *keys, const char *key, float nf_val)
 
int spr_kset_rm (SprKeySet *keys, const char *key)
 
int spr_kset_get_value_format (const SprKeySet *keys)
 
int spr_kset_get_value_format_alt (const SprKeySet *keys, int alt_val)
 
int spr_kset_get_value_layout (const SprKeySet *keys)
 
const SprDTspr_kset_get_value_type (const SprKeySet *keys)
 
const SprDTspr_kset_get_value_type_alt (const SprKeySet *keys, const SprDT *alt_val)
 
ssize_t spr_kset_get_value_dim1 (const SprKeySet *keys)
 
ssize_t spr_kset_get_value_dim1_alt (const SprKeySet *keys, ssize_t alt_val)
 
ssize_t spr_kset_get_value_dim2 (const SprKeySet *keys)
 
ssize_t spr_kset_get_value_dim2_alt (const SprKeySet *keys, ssize_t alt_val)
 
ssize_t spr_kset_get_value_nchan (const SprKeySet *keys)
 
ssize_t spr_kset_get_value_nchan_alt (const SprKeySet *keys, ssize_t alt_val)
 
ssize_t spr_kset_get_value_chanlen (const SprKeySet *keys)
 
ssize_t spr_kset_get_value_chanlen_alt (const SprKeySet *keys, ssize_t alt_val)
 
double spr_kset_get_value_fshift (const SprKeySet *keys)
 
double spr_kset_get_value_fshift_alt (const SprKeySet *keys, double alt_val)
 
double spr_kset_get_value_foffset (const SprKeySet *keys)
 
double spr_kset_get_value_foffset_alt (const SprKeySet *keys, double alt_val)
 
int spr_kset_get_values_dim_and_type (const SprKeySet *keys, int *dim1, int *dim2, const SprDT **dt, const char *fname, SprMsgId *routine)
 
int spr_kset_set_value_dim1 (SprKeySet *keys, ssize_t value)
 
int spr_kset_set_value_dim2 (SprKeySet *keys, ssize_t value)
 
SprKeySetspr_kset_cpy (const SprKeySet *keys)
 
const char * spr_kset_iter (const SprKeySet *restrict keys, int *restrict iter, const char **restrict value)
 
int spr_kset_print (SprStream *restrict fd, const SprKeySet *restrict keys)
 
void spr_kset_get_stdset (SprStdKeys *restrict res, const SprKeySet *restrict keys)
 Retrieve the 'standard' keys from keys. More...
 
int spr_kset_enohdr_adjust (SprStream *restrict fd)
 
SprKeySetspr_kset_set_defaults (SprKeySet *restrict keys, SprStream *restrict fd, const char *restrict fname)
 
SprKeySetspr_kset_check (const SprKeySet *keys, const char *fname)
 
ssize_t spr_kset_sample_adjust (SprKeySet *restrict keys, const double *restrict fshift_ptr, const double *restrict flength_ptr, int htk_convention)
 
SprKeySetspr_kset_read_spraak (SprStream *restrict fd, SprKeySet *restrict keys)
 
int spr_kset_write_spraak (SprStream *restrict fd, SprKeySet *restrict keys, int mode)
 
SprKeySetspr_kset_read_key (SprStream *restrict fd, SprKeySet *restrict keys)
 
int spr_kset_write_key (SprStream *restrict fd, SprKeySet *restrict keys, int mode)
 
int spr_kset_stream_modif (SprStream *restrict fd)
 
int spr_kset_stream_adjust_close (SprStream *restrict fd, ssize_t dim1)
 

Variables

const char spr_kset_key_data []
 the string "DATA" More...
 
const char spr_kset_key_layout []
 the string "LAYOUT" More...
 
const char spr_kset_key_format []
 the string "FORMAT" More...
 
const char spr_kset_key_type []
 the string "TYPE" More...
 
const char spr_kset_key_dim1 []
 the string "DIM1" More...
 
const char spr_kset_key_dim2 []
 the string "DIM2" More...
 
const char spr_kset_key_fshift []
 the string "FSHIFT" More...
 
const char spr_kset_key_foffset []
 the string "FOFFSET" More...
 
const char spr_kset_key_flength []
 the string "FLENGTH" More...
 
const char spr_kset_key_nchan []
 the string "NCHAN" More...
 
const char spr_kset_key_chanlen []
 the string "CHANLEN" More...
 
const char spr_kset_key_vlen []
 the string "VLEN" More...
 
const char spr_kset_key_vnum []
 the string "VNUM" More...
 
const char spr_kset_key_compress []
 the string "COMPRESS" More...
 
const char spr_kset_key_samplefreq []
 the string "SAMPLEFREQ" More...
 
const char spr_kset_val_minus1 []
 
const char *const spr_kset_format_str []
 
const char *const spr_kset_layout_str []
 
const char *const spr_kset_data_str [SPR_KEY_DATA_NR+1]
 

Detailed Description

Key-sets.

Key-sets are used to represent the header info from files (audio, preprocessed audio, models, ...). The key-set is basically a set of (key,value) pairs where both key and value are strings. The keys in the key-set must be unique, i.e. only one key with a given name can be stored in the key-set, adding a new key with the same name will replace the old (key,value) pair.

Key-sets are closely linked to streams (each stream handler has a key-set associated to it), but they can also be used as an entity by themselves (e.g. for passing along information to other routines).

See Also
File formats and headers
The standard keys
Author
Kris Demuynck
Date
22/04/2008
Revision History:
22/02/2008 - KD
re-implementation + cleanup
20/01/1995 - FS
re-implementation; no change in functionality
09/07/1991 - DVC
first implementation