#ifndef AUDIOTOWAV
#define AUDIOTOWAV

/*
 * @(#)AudioToWAV.h
 *
 * This file is part of webCDwriter - Network CD Writing.
 *
 * Copyright (C) 2000-2003 Jörg P. M. Haeger
 *
 * webCDwriter is free software. See CDWserver.cpp for details.
 */

#include <stdio.h>

class Process;

class AudioToWAV {
	FILE *inStream;
	protected: Process *converter;
	private: int leftInStream,
		writeBuf0, writeBuf1, readBufN,
		waveLength;
	char writeBuf[4 * 1024], readBuf[4 * 1024];
	enum { NORMAL, CLOSEOUT, OUTCLOSED, INCLOSED } mode;
public:
	AudioToWAV(FILE *inStream = NULL);
	virtual ~AudioToWAV();
	void end();
	int get(const char **buf);
	void put(int n);
	void setInStream(FILE *inStream);
	void updateHeader(FILE *outStream);
private:
	void fillReadBuf();
	void fillWriteBuf();
};

#endif
