/*
    GDAM - Geoff & Dave's Audio Mixer
    Copyright (C) 1999    Dave Benson, Geoff Matters.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

    Contact:
        daveb@ffem.org <Dave Benson>
        geoff@ugcs.caltech.edu <Geoff Matters>
*/
#ifndef __GDAS_RESAMPLE_H_
#define __GDAS_RESAMPLE_H_

typedef struct _GdasResample GdasResample;

#include "gdasfilter.h"

typedef GdasFilterClass GdasResampleClass;


GtkType gdas_resample_get_type();
#define GDAS_TYPE_RESAMPLE   gdas_resample_get_type()
#define GDAS_RESAMPLE(ptr) ((GdasResample*) gtk_type_check_object_cast ((GtkTypeObject*) (ptr), GDAS_TYPE_RESAMPLE))

struct _GdasResample {
	GdasFilter           filter;

	/* This is the rate with 32bits of fraction. */
	guint64			rate;


	/* Specifies what the last sample read was,
	 * and how much is carrying over... */
	GdamSample		last_sample;

	/* In interpolating mode, this is used in conjunction
	 * w/ last_sample... */
	GdamSample		cur_sample;
	/*
	   this value is the fractional
	   number of samples we have output
           with last_sample.
	 */
	guint32			accum;

	gboolean		hi_quality;

	/* Last time, the number of whole samples that were skipped. */
	int			last_skipped;

	/* Used during _read(), allocated once. */
	GdamSample*		read_tmp_buffer;
	guint			read_tmp_buffer_size;
};

#if 0
void        gdas_resample_set_rate     (GdasResample*   resample,
                                        GdamFixed       fixed);
#endif

#endif
