/*
    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_WAVETABLE_H_
#define __GDAS_WAVETABLE_H_

typedef struct _GdasWavetable GdasWavetable;

#include "gdassource.h"
#include "gdamcachebuffer.h"

GtkType gdas_wavetable_get_type ();
#define GDAS_TYPE_WAVETABLE              (gdas_wavetable_get_type ())
#define GDAS_WAVETABLE(obj)              (GTK_CHECK_CAST ((obj), GDAS_TYPE_WAVETABLE, GdasWavetable))

struct _GdasWavetable {
	GdasSource		source;
        GdamCacheBuffer        *cache;
	gint64			index_32;	/* 32-bits of fraction */
	gint64			velocity_32;

	gint64			position;

	unsigned		interpolating : 1,
				terminates : 1,
				use_overall_position : 1;
};

GdasWavetable     *gdas_wavetable_new           (guint            buffer_id,
                                                 gint64           hertz_32);
void               gdas_wavetable_set_hertz     (GdasWavetable*   wavetable,
                                                 gint64           hertz_32);
void               gdas_wavetable_set_velocity  (GdasWavetable*   wavetable,
                                                 gint64           velocity_32);

void               gdas_wavetable_init_common();
GdamCacheBuffer   *gdas_wavetable_get_common_by_name();

/* The caller must free the returned NULL-terminated array
 * (but not the strings themselves). */
char             **gdas_wavetable_get_list_of_common();

#endif
