RISC-V/V003/midi/midiplayer.h

33 lines
799 B
C
Raw Normal View History

2024-03-09 11:10:52 +01:00
#ifndef DACPLAYER_H
#define DACPLAYER_H
#include "oneway.h"
#include "gpio.h"
/// Třída, která hraje čistě na pozadí.
class MidiPlayer : public OneWay {
// Veřejné metody
public:
/// Konstruktor
explicit MidiPlayer () noexcept;
unsigned Send (uint16_t * const ptr, const unsigned len) override;
2024-03-10 17:40:00 +01:00
void stop ();
void pass ();
2024-03-09 11:10:52 +01:00
protected:
// Chráněné metody
/// Obsluha tónu
void ToneChange (void);
/// Obsluha vzorku
short nextSample (void);
private:
2024-03-12 13:24:01 +01:00
GpioClass led, but;
2024-03-10 17:40:00 +01:00
unsigned passcnt;
2024-03-09 11:10:52 +01:00
volatile bool running;
unsigned char const * melody;
unsigned index;
volatile int pause;
};
extern "C" const unsigned char * const scores[];
#endif // DACPLAYER_H