#ifndef _NPLAYER_H__
# define _NPLAYER_H__   1

# ifndef _NMODULE_H__
#  error "include <naudio\nmodule.h> first"
# endif

typedef struct
{
   n_module    *song;
   n_voice     *p,
               *mod_p;
   n_pattern   *c_pat;
   lword       entries;
   sword       seqno,               /* index in pattern sequence  */
               pc,                  /* PC in pattern              */
               eseqno,              /* effective seqno            */
               epc;                 /* effective PC               */
   word        no,
               index;
   sbyte       mode,                /* 1 wrap around, 2 brk loop  */
               cia;
   byte        speed,
               on_voices;           /* bit pattern,turn ON/OFF    */
                                    /* unofficial stuff */
   lword       c_entries;
   sword       loop_start,
               do_loop,
               delay;
   word        c_n_entries,
               c_n_voices;
   byte        c_speed,             /* safety */
               c_voices,
               stopper,
               no_probugs;          /* bug compatibility off switch*/
} ntrack_control;


typedef struct
{
   channel     *voice[ N_MAX_VOICES];
   word        incr1_tab[ P_HIGHEST + 1],
               incr2_tab[ P_HIGHEST + 1];
} ntrack_tables;


#define PAL    0x0020            /* same value as Falcon video needs... har */
#define NTSC   0

void  ntrack_calc_incr  _C_PROTO(( long frq, int pal));
void  ntrack_calc_cia   _C_PROTO(( long frq));
long  ntrack_engine     _C_PROTO(( long frq, unsigned type, int pal));
void  ntrack_set_tempo  _C_PROTO(( word cia));
void  ntrack_do_it      _C_PROTO(( void));
void  ntrack_reset      _C_PROTO(( void));
void  nmodule_stop      _C_PROTO(( void));
void  nmodule_play      _C_PROTO(( n_module *p, int no, int index,
                                   lword entries, int loop));

#define ntrack_play     nmodule_play
#define ntrack_stop     nmodule_stop
#endif

