#include <fishtalk.h>

FT_HANDLE FishTalkInit(FT_SAMPLE_PROC sample, int rate) {
	FT_HANDLE h;

	assert(rate == 11025 || rate == 44100);

	h = malloc(sizeof(*h));
	memset(h, 0, sizeof(*h));

	h->sample = sample;
	h->rate	  = rate;

	h->in_cmd = 0;

	h->buffer_size	   = 0;
	h->cmd_buffer_size = 0;

	return h;
}

void FishTalkBuffer(FT_HANDLE handle, const char* buffer) {
	ft_cmd_queue(handle, buffer);
}

void FishTalkSync(FT_HANDLE handle) {
	FishTalkBuffer(handle, "\n");
}

void FishTalkFree(FT_HANDLE handle) {
	free(handle);
}
