Files
chirping/song.cpp

46 lines
911 B
C++

#include "song.h"
Song::Song() {
this->playing = false;
this->current_pattern = 0;
this->current_row = 0;
}
void Song::SetCurrentPatternNum(const int pattern_num) {
this->current_pattern = pattern_num;
}
void Song::SetCurrentNote(const int channel, const int row, const uint16_t note) {
this->pattern[channel][row] = note;
}
const int Song::GetCurrentPatternNum() {
return this->current_pattern;
}
const int Song::GetCurrentRow() {
return this->current_row;
}
uint16_t Song::GetCurrentNote(const int channel, int row) {
return this->pattern[channel][row<0?this->current_row:row];
}
void Song::Play() {
this->current_row = 0;
this->playing = true;
}
void Song::Stop() {
this->playing = false;
}
const bool Song::IsPlaying() {
return this->playing;
}
void Song::Next() {
this->current_row++;
if (this->current_row == 64) this->current_row = 0;
}