dipl/code/textadv/include/sound.h

48 lines
1.5 KiB
C
Raw Permalink Normal View History

/* 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>
#include <avr/pgmspace.h>
struct tone_t {
uint8_t waveform;
int16_t frequency_deviation; /* */
uint16_t length; /* The tone length in milliseconds */
};
/* 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}
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;
extern const struct tone_t * current_track;
extern int16_t global_frequency_offset; /* Added to every playing song */
void update_sound();
void init_sound();
#endif