RISC-V/V003/midi/midiplayer.h
2024-05-07 11:46:49 +02:00

32 lines
799 B
C++

#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;
void stop ();
void pass ();
protected:
// Chráněné metody
/// Obsluha tónu
void ToneChange (void);
/// Obsluha vzorku
short nextSample (void);
private:
GpioClass led, but;
unsigned passcnt;
volatile bool running;
unsigned char const * melody;
unsigned index;
volatile int pause;
};
extern "C" const unsigned char * const scores[];
#endif // DACPLAYER_H