2020-03-14 22:30:05 +01:00
|
|
|
/* Copyright © 2020 tyrolyean
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SOUND_H
|
|
|
|
#define _SOUND_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-03-15 01:28:01 +01:00
|
|
|
#include <avr/pgmspace.h>
|
2020-03-14 22:30:05 +01:00
|
|
|
|
|
|
|
struct tone_t {
|
|
|
|
uint8_t waveform;
|
2020-03-15 22:14:50 +01:00
|
|
|
int16_t frequency_deviation; /* */
|
|
|
|
uint16_t length; /* The tone length in milliseconds */
|
2020-03-14 22:30:05 +01:00
|
|
|
};
|
|
|
|
|
2020-03-15 22:14:50 +01:00
|
|
|
/* The end marker tells the sound routines where the end of a track is. It
|
|
|
|
* is required to be present at the end of EVERY track, otherwise the
|
|
|
|
* routine runs into undefined behaviour */
|
|
|
|
#define TRACK_END_MARKER {DAC_MODE_SILENT, 0, 0}
|
|
|
|
|
2020-03-17 16:25:58 +01:00
|
|
|
extern const struct tone_t computer_room_track[] PROGMEM;
|
|
|
|
extern const struct tone_t lonely_road_track[] PROGMEM;
|
|
|
|
|
|
|
|
#define INTRO_LEN 10350
|
|
|
|
extern const struct tone_t intro_track[] PROGMEM;
|
2020-03-15 01:28:01 +01:00
|
|
|
|
2020-03-15 22:14:50 +01:00
|
|
|
extern const struct tone_t * current_track;
|
2020-03-26 23:53:14 +01:00
|
|
|
extern int16_t global_frequency_offset; /* Added to every playing song */
|
2020-03-15 01:28:01 +01:00
|
|
|
|
2020-03-14 22:30:05 +01:00
|
|
|
void update_sound();
|
2020-03-15 22:14:50 +01:00
|
|
|
void init_sound();
|
2020-03-14 22:30:05 +01:00
|
|
|
|
2020-03-26 23:53:14 +01:00
|
|
|
|
2020-03-14 22:30:05 +01:00
|
|
|
#endif
|