/* SampleStorageDisplay.h */

#ifndef Included_SampleStorageDisplay_h
#define Included_SampleStorageDisplay_h

/* SampleStorageDisplay module depends on */
/* MiscInfo.h */
/* Audit */
/* Debug */
/* Definitions */
/* SampleConsts */
/* FixedPoint */
/* Memory */
/* DataMunging */
/* Scrap */
/* Files */

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

struct SampleStorageDisplayRec;
typedef struct SampleStorageDisplayRec SampleStorageDisplayRec;

/* create a zero-length sample storage object */
SampleStorageDisplayRec*	NewSampleStorageDisplayEmpty(NumBitsType NumBits,
														NumChannelsType NumChannels);

/* create a zero-length sample storage object */
SampleStorageDisplayRec*	NewSampleStorageDisplayData(NumBitsType NumBits,
														NumChannelsType NumChannels, largefixedsigned* DataBlock);

/* dispose of a sample storage object */
void											DisposeSampleStorageDisplay(SampleStorageDisplayRec* Storage);

/* get the number of bits being represented in this sample */
NumBitsType								GetSampleStorageDisplayNumBits(
														SampleStorageDisplayRec* Storage);

/* get the number of channels being represented in this sample */
NumChannelsType						GetSampleStorageDisplayNumChannels(
														SampleStorageDisplayRec* Storage);

/* get the number of frames stored in this object */
long											GetSampleStorageDisplayNumFrames(
														SampleStorageDisplayRec* Storage);

/* get a value from in the array */
largefixedsigned					GetSampleStorageDisplayValue(SampleStorageDisplayRec* Storage,
														long Index, ChannelType WhichChannel);

/* find out if the array has been changed since last being saved */
MyBoolean									DoesSampleStorageDisplayNeedToBeSaved(
														SampleStorageDisplayRec* Storage);

/* change the number of bits being used to store the data */
void											SetSampleStorageDisplayNumBits(
														SampleStorageDisplayRec* Storage, NumBitsType NewNumBits);

/* change the number of channels being stored in the array */
MyBoolean									SetSampleStorageDisplayNumChannels(
														SampleStorageDisplayRec* Storage,
														NumChannelsType NewNumChannels);

/* change the value of one of the sample points */
void											SetSampleStorageDisplayValue(SampleStorageDisplayRec* Storage,
														long Index, ChannelType WhichChannel,
														largefixedsigned NewValue);

/* indicate that the object has been saved */
void											SampleStorageDisplayHasBeenSaved(
														SampleStorageDisplayRec* Storage);

/* insert a bunch of zeros into the array */
MyBoolean									InsertSampleStorageDisplayArea(
														SampleStorageDisplayRec* Storage, long Index,
														long NumFramesToInsert);

/* delete a range of values from the array */
MyBoolean									DeleteSampleStorageDisplayArea(
														SampleStorageDisplayRec* Storage, long Index,
														long NumFramesToDelete);

/* extract part of the sample & create another sample record containing it */
SampleStorageDisplayRec*	ExtractSampleStorageDisplaySection(
														SampleStorageDisplayRec* Storage, long Index,
														long NumFramesToExtract);

/* insert one sample into another at a certain point */
MyBoolean									InsertSampleStorageDisplaySection(
														SampleStorageDisplayRec* Storage, long Index,
														SampleStorageDisplayRec* DataToInsert);

/* dump the contents of the object and install a copy of the contents of another */
MyBoolean									SampleStorageDisplaySetContents(
														SampleStorageDisplayRec* Storage,
														SampleStorageDisplayRec* NewData);

/* put the raw data for the sample onto the clipboard */
void											PutSampleStorageDisplayOnClipboard(
														SampleStorageDisplayRec* Storage);

/* get a sample off the clipboard.  returns NIL if the scrap isn't a sample */
SampleStorageDisplayRec*	GetSampleStorageDisplayFromClipboard(void);

/* get a copy of a particular channel of data from the sample */
largefixedsigned*					SampleStorageDisplayGetChannelFixed(
														SampleStorageDisplayRec* Storage, ChannelType WhichChannel);

/* put a new block of data into the sample object.  a copy of the block is made */
MyBoolean									SampleStorageDisplayPutMonoFixed(
														SampleStorageDisplayRec* Storage, largefixedsigned* Data);

/* put two new blocks of data into a stereo sample object.  copies are made */
MyBoolean									SampleStorageDisplayPutStereoFixed(
														SampleStorageDisplayRec* Storage, largefixedsigned* Left,
														largefixedsigned* Right);

/* flush any undo information */
void											SampleStorageDisplayFlushUndo(SampleStorageDisplayRec* Storage);

/* save the object to a temporary file so that we can undo any changes. */
/* if it couldn't be done, then it returns False */
MyBoolean									SampleStorageDisplaySetupForUndo(SampleStorageDisplayRec* Storage);

/* find out if we can undo something */
MyBoolean									SampleStorageDisplayUndoAvailable(SampleStorageDisplayRec* Storage);

/* try to undo something.  returns True if the undo data was successfully recovered. */
/* the current state is swapped with the recovered state */
MyBoolean									SampleStorageDisplayUndo(SampleStorageDisplayRec* Storage);

/* get the actual raw data in the channel */
largefixedsigned*					SampleStorageDisplayGetActualData(SampleStorageDisplayRec* Storage);

#endif
