X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/782614dbb55addcae8c9d4d9e1ce3dec81287282..77a9df36a77d2523dd2bc24fa17f9f04c6c175c5:/Projects/MIDIToneGenerator/MIDIToneGenerator.c diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/MIDIToneGenerator/MIDIToneGenerator.c index a4e2764c0..e1008a7d3 100644 --- a/Projects/MIDIToneGenerator/MIDIToneGenerator.c +++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.c @@ -166,7 +166,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) if (NoteData[i].Pitch) { /* Use the top 8 bits of the table position as the sample table index */ - uint8_t TableIndex = ((uint8_t*)&NoteData[i].TablePosition)[3]; + uint8_t TableIndex = (NoteData[i].TablePosition >> 24); /* Add the new tone sample to the accumulator and increment the table position */ MixedSample += SineTable[TableIndex];