Arduboy-homemade-package/board-package-source/libraries/ATMlib/src/ATMlib.h

56 lines
982 B
C
Raw Normal View History

2018-09-18 16:19:10 +00:00
#ifndef _ATMLIB_H_
#define _ATMLIB_H_
#include <stddef.h>
#include <inttypes.h>
#include <Arduino.h>
#define CH_ZERO 0
#define CH_ONE 1
#define CH_TWO 2
#define CH_THREE 3
extern byte trackCount;
extern const word *trackList;
extern const byte *trackBase;
extern uint8_t pcm;
extern bool half;
class ATMsynth {
public:
ATMsynth() {};
// Load and play specified song
2020-06-26 23:14:04 +00:00
static void play(const byte *song);
2018-09-18 16:19:10 +00:00
// Play or Pause playback
2020-06-26 23:14:04 +00:00
static void playPause();
2018-09-18 16:19:10 +00:00
// Stop playback (unloads song)
2020-06-26 23:14:04 +00:00
static void stop();
2018-09-18 16:19:10 +00:00
2020-06-26 23:14:04 +00:00
static void muteChannel(byte ch);
2018-09-18 16:19:10 +00:00
2020-06-26 23:14:04 +00:00
static void unMuteChannel(byte ch);
2018-09-18 16:19:10 +00:00
};
// oscillator structure
typedef struct {
uint8_t vol;
uint16_t freq;
uint16_t phase;
} osc_t;
typedef osc_t Oscillator;
extern osc_t osc[4];
uint16_t read_vle(const byte **pp);
static inline const byte *getTrackPointer(byte track);
extern void ATM_playroutine() asm("ATM_playroutine");
2020-06-26 23:14:04 +00:00
#endif