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

typedef struct _GdamRawFile GdamRawFile;
#include <stdio.h>

#include "gdasresample.h"

typedef GdasResampleClass   GdamRawFileClass;

#define GDAM_RAW_FILE_SIGNED			1
#define GDAM_RAW_FILE_UNSIGNED			2
#define GDAM_RAW_FILE_SIGN_MASK			3

#define GDAM_RAW_FILE_8BIT			4
#define GDAM_RAW_FILE_16BIT			8
#define GDAM_RAW_FILE_SIZE_MASK			12

#define GDAM_RAW_FILE_MONO			16
#define GDAM_RAW_FILE_STEREO			32
#define GDAM_RAW_FILE_CHANNEL_MASK		48

GtkType gdam_raw_file_get_type();
#define GDAM_TYPE_RAW_FILE              (gdam_raw_file_get_type ())
#define GDAM_RAW_FILE(obj)              (GTK_CHECK_CAST ((obj), GDAM_TYPE_RAW_FILE, GdamRawFile))

struct _GdamRawFile {
	GdasResample			resample;
	gint64				bytes_remaining;

	/* These two variables are used to store start/length during creation */
	gint64				samples_remaining;
	int				to_seek;
};

void gdam_raw_file_configure          (GdamRawFile  *raw_file,
                                       FILE         *fp,
			               void        (*close_func)(FILE*),
			               int           input_hertz,
			               int           bits_per_sample,
                                       int           is_big_endian,
			               int           is_signed,
			               int           num_channels);

void gdam_raw_file_set_bytes_remaining(GdamRawFile    *raw_file,
                                       gint64          bytes_remaining);
void gdam_raw_file_seek_relative      (GdamRawFile    *raw_file,
                                       int             n);
void gdam_raw_file_set_samples_remaining (GdamRawFile    *raw_file,
                                          gint64          samples_remaining);

#endif
