#ifndef _NoteHandler_H
#define _NoteHandler_H

#include "TimTypes.h"
#include "Note.h"

#define hnotes_max_notes 128

typedef struct
{
	Note*    pfirst;
	Note*    plast;
} NoteList;

struct NoteHandler
{
	uint32_t     Polyphony;
	uint32_t     MaxNotesPerChannel;
	uint32_t     Flags;
	int32_t      Volume; // [0, 256]
	int32_t      MinPitch; // in 1/256 semitone
	int32_t      MaxPitch; // in 1/256 semitone
	uint32_t     MixFrequency; // in Hz
	uint32_t     ActiveNotes;
	NoteList     PrimaryNotesPool;
	NoteList     VirtualNotesPool;
	NoteList     UnusedNotesPool;
	Note*        ActiveNotesArray[hnotes_max_notes];
	Note         NotesArray[hnotes_max_notes];
};

#define hnotes_flag_ITenvelopes      0x00000001
#define hnotes_flag_nocutonhighpitch 0x00000002
#define hnotes_flag_XMFadeout        0x00000004

#endif
