/* WaveTableStorage.h */

#ifndef Included_WaveTableStorage_h
#define Included_WaveTableStorage_h

/* WaveTableStorage module depends on */
/* MiscInfo.h */
/* Audit */
/* Debug */
/* Definitions */
/* SampleConsts */
/* Array */
/* Memory */
/* FixedPoint */
/* DataMunging */

#include "SampleConsts.h"
#include "FixedPoint.h"

struct WaveTableStorageRec;
typedef struct WaveTableStorageRec WaveTableStorageRec;

/* create a new, empty wave table storage object */
WaveTableStorageRec*		NewWaveTableStorage(NumBitsType NumBits, long NumFrames);

/* dispose of the wave table storage object */
void										DisposeWaveTableStorage(WaveTableStorageRec* Storage);

/* get the number of frames per table */
long										WaveTableStorageNumFramesPerTable(WaveTableStorageRec* Storage);

/* get the number of tables */
long										WaveTableStorageNumTables(WaveTableStorageRec* Storage);

/* get the number of bits for the wave table */
NumBitsType							WaveTableStorageNumBits(WaveTableStorageRec* Storage);

/* get a reference to a table.  this is NOT copied, and there is no type information. */
/* it is formatted as an array of characters for 8 bit data or array of shorts for */
/* 16 bit data.  it contains (WaveTableStorageNumFramesPerTable + 1) elements for */
/* each table.  The last element is a repeat of the first, and is provided for */
/* making anti-aliasing more efficient. */
void*										WaveTableStorageGetTable(WaveTableStorageRec* Storage,
													long Index);

/* append a new (zeroed out) table to the end of the array */
MyBoolean								WaveTableStorageAppendEntry(WaveTableStorageRec* Storage);

/* put a value into a frame in a table */
void										WaveTableStorageSetFrame(WaveTableStorageRec* Storage,
													long TableIndex, long FrameIndex, largefixedsigned Value);

/* get a value from a frame in a table */
largefixedsigned				WaveTableStorageGetFrame(WaveTableStorageRec* Storage,
													long TableIndex, long FrameIndex);

/* make a duplicate of the wave table */
WaveTableStorageRec*		WaveTableDuplicate(WaveTableStorageRec* Original);

#endif
