#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