/*
	TODO:

	- support multiple bit widths and sample rates for data
*/

#ifndef __SPEECHY_H__
#define __SPEECHY_H__

#define END_SEQ			0x7FFF
#define ERR_SEQ_FLAG	0x8000


typedef struct SPEECHY_SIGNAL
{
	int length;
	int copy;
	unsigned char *data;
}SPEECHY_SIGNAL;


typedef struct SPEECHY_VOICE
{
	unsigned int freq;			// Sample rate
	unsigned int max;			// max number of allophones
	unsigned int count;			// next allophone to allocate
	SPEECHY_SIGNAL *table;		// table of allophones

	short *sequence;			// allophones to be played
	int pos;					// current sample position in current signal
}SPEECHY_VOICE;


// API
SPEECHY_VOICE *speechy_init(unsigned int count, unsigned int freq);

int speechy_add(SPEECHY_VOICE *voice, unsigned char *buffer, 
	unsigned int length, int copy);
int speechy_add_silence(SPEECHY_VOICE *voice, unsigned int length);
int speechy_sequence(SPEECHY_VOICE *voice, short *sequence);
int speechy_read(SPEECHY_VOICE *voice, unsigned char *buffer, 
	unsigned int length);
void speechy_reset(SPEECHY_VOICE *voice);

void speechy_exit(SPEECHY_VOICE *voice);

#endif
