/*
    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_PROXY_SOURCE_H__
#define __GDAS_PROXY_SOURCE_H__

typedef struct _GdasProxySource GdasProxySource;

#include <gtk/gtkobject.h>
#include "gdassource.h"
typedef GdasSourceClass GdasProxySourceClass;

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


GtkType gdas_proxy_source_get_type();
#define GDAS_TYPE_PROXY_SOURCE              (gdas_proxy_source_get_type ())
#define GDAS_PROXY_SOURCE(obj)              (GTK_CHECK_CAST ((obj), GDAS_TYPE_PROXY_SOURCE, GdasProxySource))
#define GDAS_PROXY_SOURCE_CLASS(klass)      (GTK_CHECK_CLASS_CAST ((klass), GDAS_TYPE_PROXY_SOURCE, GdasProxySourceClass))
#define GDAM_IS_PROXY_SOURCE(obj)           (GTK_CHECK_TYPE ((obj), GDAS_TYPE_PROXY_SOURCE))
#define GDAM_IS_PROXY_SOURCE_CLASS(klass)   (GTK_CHECK_CLASS_TYPE ((klass), GDAS_TYPE_PROXY_SOURCE))

struct _GdasProxySource {
	GdasSource		source;
        GdasSource             *delegate;

	/* To confuse the purpose of this class, and for featuritis,
	 * here is a hack!  This member is a source which becomes
	 * the delegate as soon as it is ready-to-read.  Not pretty,
	 * but pretty useful.  (SeekableMp3 uses it) */
        GdasSource             *cueing;

	int			max_envelope;
        GdamSample             *fading_out;
	int			fading_out_index;
};

void   gdas_proxy_source_set    (GdasProxySource *proxy_source,
                                 GdasSource      *delegate);
void   gdas_proxy_source_set_cue(GdasProxySource *proxy_source,
                                 GdasSource      *to_cue_up_and_replace);

void   gdas_proxy_source_set_envelope(GdasProxySource*, int max_envelope);

#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif
