- [FIX] [Chirping] Silence crashes app

This commit is contained in:
2023-01-09 17:35:33 +01:00
parent c7dcf8bb8e
commit 4205bdfe90

View File

@@ -117,7 +117,7 @@ void chirp_init() {
for (uint8_t i=0;i<MAX_CHANNELS;++i) channels[i].song=NULL;
}
uint32_t interpret_note(const int c, const char note, const char param ) {
uint32_t interpret_note(const int c, const uint8_t note, const char param ) {
const uint32_t length = ( param == -1 ? channels[c].length : ((float)lengths[uint8_t(param)])/10000.0f ) * channels[c].tempo;
if( note == SILENCE ) { memset( channels[c].play_buffer, 0, length ); return length; }
if( note == NOISE ) { for( uint32_t i = 0; i < length; i++ ) channels[c].play_buffer[i] = rand()%2==0 ? channels[c].volume : -channels[c].volume; return length; }