/* TrackEffectGenerator.h */

#ifndef Included_TrackEffectGenerator_h
#define Included_TrackEffectGenerator_h

/* TrackEffectGenerator module depends on */
/* MiscInfo.h */
/* Audit */
/* Debug */
/* Definitions */
/* EffectSpecList */
/* FixedPoint */
/* Memory */
/* BinaryCodedDecimal */
/* LinearTransition */
/* NoteObject */
/* IncrementalParameterUpdator */
/* NLProc */
/* FilterArray */
/* Analyzer */

#include "FixedPoint.h"

struct TrackEffectGenRec;
typedef struct TrackEffectGenRec TrackEffectGenRec;

/* forwards */
struct EffectSpecListRec;
struct NoteObjectRec;
struct MainWindowRec;

/* dispose of cached effect generator structures */
void									FlushTrackEffectGeneratorInfo(void);

/* create a new track effect generator */
TrackEffectGenRec*		NewTrackEffectGenerator(struct EffectSpecListRec* SpecList,
												long FramesPerSecond, MyBoolean DoingStereo,
												float InverseVolume, struct MainWindowRec* MainWindow,
												long ScanningGapWidthInEnvelopeTicks);

/* dispose of a track effect generator */
void									DisposeTrackEffectGenerator(TrackEffectGenRec* Generator);

/* generate effect cycle.  this is called once per envelope tick to apply */
/* effects to data generated during this envelope clock cycle. */
void									ApplyTrackEffectGenerator(TrackEffectGenRec* Generator,
												largefixedsigned* Data, long NumFrames);

/* hand off command to be handled by effect generator.  the command will be scheduled */
/* to occur at the time ScanningGapFrontInEnvelopeTicks (which will be */
/* ScanningGapWidthInEnvelopeTicks in the future from now). */
MyBoolean							TrackEffectHandleCommand(TrackEffectGenRec* Generator,
												struct NoteObjectRec* Command,
												long ScanningGapFrontInEnvelopeTicks);

/* increment duration timer.  this is called once per envelope tick to adjust */
/* all of the parameter transition tracking devices.  this should be called at */
/* the end of an envelope cycle to prepare the initial values for the next cycle. */
void									TrackEffectIncrementDurationTimer(TrackEffectGenRec* Generator,
												long NumDurationTicks);

/* process commands in the queue that occur now.  this should be called after */
/* queueing commands, but before incrementing the execution index, and before */
/* processing the data, so that commands are handled at the beginning of a transition. */
void									TrackEffectProcessQueuedCommands(TrackEffectGenRec* Generator);

#endif
