/***************************************************************************
                          wavutil.h - description
                             -------------------
    begin                : Wed Mar 09 2005
    copyright            : (C) 2005 by Carsten Siebholz
    email                : c.siebholz@t-online.de

 ***************************************************************************/

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


#define ID_RIFF 0x46464952 /* RIFF */
#define ID_FMT  0x20746d66 /* fmt  */
#define ID_DATA 0x61746164 /* data */
#define ID_LIST 0x5453494C /* LIST */


typedef unsigned int   DWORD;
typedef signed int     SDWORD;
typedef unsigned short WORD;
typedef signed short   SWORD;
typedef unsigned char  BYTE;
typedef enum {FALSE, TRUE} BOOL;
typedef enum {SILENT, LOUD} SAMPLETYPE;




typedef struct {
  DWORD id;
  DWORD chunkSize;
} chunkHeader;


typedef struct {
  chunkHeader header;

  DWORD type;
} RIFFChunk;

typedef struct {
  chunkHeader header;

  WORD  formatTag;
  WORD  channels;
  DWORD samplesPerSec;
  DWORD avgBytesPerSec;
  WORD  blockAlign;
  WORD  bitsPerSample;
} FMTChunk;



typedef struct {
  char* filename;
  FILE* f;

  /* FMT values */
  WORD  f_formatTag;
  WORD  f_channels;
  DWORD f_samplesPerSec;
  DWORD f_avgBytesPerSec;
  WORD  f_blockAlign;
  WORD  f_bitsPerSample;

  /* DATA values */
  DWORD d_start;
  DWORD d_end;

  /* own values */
  DWORD o_curFrame;
  DWORD o_anzFrames;

/*DWORD minTrackSamples; / * in frames */

} WAVFile;

#if 0
typedef struct {
  chunkHeader header;
  DWORD id2;
} LISTChunk;

typedef struct {
  FILE *f;
  DWORD dataStart; /* in bytes */
  DWORD dataEnd; /* in bytes */
  DWORD frameEnd; /* in Frames */
  DWORD curFrame;

  WORD  frameSize; /* in bytes */
  WORD  sampleSize; /* in bits */
  WORD  channels;

  DWORD samplesPerSec;
  DWORD minTrackSamples; /* in frames */
  DWORD gapLengthSamples; /* in frames */
  DWORD avgBytesPerSec;
} InputDesc;
#endif
