/****************************<--OGI-->*************************************/
/*                                                                        */
/*             Center for Spoken Language Understanding                   */
/*        Oregon Graduate Institute of Science & Technology               */
/*                         Portland, OR USA                               */
/*                        Copyright (c) 2000                              */
/*                                                                        */
/*      This module is not part of the CSTR/University of Edinburgh       */
/*               release of the Festival TTS system.                      */
/*                                                                        */
/*  In addition to any conditions disclaimers below, please see the file  */
/*  "license_ogi_tts.txt" distributed with this software for information  */
/*  on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES.  */
/*                                                                        */
/****************************<--OGI-->*************************************/
#ifndef __OGIDBASE_H__
#define __OGIDBASE_H__

#include "EST.h"
#include "OGIdbUnits.h"



enum OGIaccess_t {a_direct, a_dynamic, a_ondemand};
enum OGIdata_t {d_unset, d_resLPC, d_LPC, d_sine};


class OGIdbase {
  // 
private:

public:
  // global things
  OGIdbase();  
  ~OGIdbase(); 

  EST_String name; // name of the dbase
	
  enum OGIaccess_t access_mode; // ondemand, dynamic, direct
  OGIbool swap;  // byte order flag
  OGIbool isGrouped;       /* grouped or ungrouped */
  OGIbool isCompressed;
  float Fs;    // sampling freq
  EST_Option dbglobal; // container for misc signal processing constants
  /* includes: lpc_order; preemph; def_f0; phoneset */

  // specific to grouped case
  FILE *gfd;                /* the group file */
  
  // specific to ungrouped case
  EST_Option fileinfo;  // KVL of info...  might change to EST_Features
    /* includes.... unitdic_file, signal_dir; signal_ext; signal_type; pitch_dir;
     pitch_ext; lpc_dir; lpc_ext; lpc_res_dir; lpc_res_ext; */

  // index into this to get each unit in dbase
  OGIdbUnits unitdic; // from unitdic file

  EST_TStringHash<int> unamehash;


  // pointer to the speech data object
  void *udata;
  enum OGIdata_t udata_type;

  // functions
  void load_grouped(EST_String &groupfile, LISP usr_params);
  void save_grouped(EST_String &groupfile);
  void load_ungrouped(LISP params);
  LISP lispify_unit_info(int indx);
  LISP lispify_data_type(void);
  int name_lookup(const EST_String &name);

 int name_lookup_hash(const EST_String &name);
 void build_hash(void);

  void parse_lisp_parameters(LISP params, OGIbool isGrp);
  void load_grp_header(void);
  void save_grp_header(void);
  void load_grp_params(void);
  void save_grp_params(void);
  void load_grp_unitdic(void);
  void save_grp_unitdic(void);
  void load_ungrp_udata(void);

};


#endif 




