magspoof
magspoof copied to clipboard
Plays Track1+2, then ONLY Track 2 every other "press"
With the current implementation of the code, the first time you press the button, it will call playTrack(1), then next time you press the button, it will call playTrack(2) (because of how it keeps track and increments curTrack)
This doesn't make a lot of sense, because when calling playTrack(1), it will actually play BOTH tracks because of this if statement within the method:
if (track == 0)
{
// if track 1, also play track 2 in reverse
// zeros in between
for (int i = 0; i < BETWEEN_ZERO; i++)
playBit(0);
// send second track in reverse
reverseTrack(2);
}
Then after playing both tracks, next time you press the button it will call playTrack(2) which will ONLY play the 2nd track because that if statement isn't satisfied.
Essentially this means that every other time you press the button, the magspoof will ONLY play track 2. All other times it will play both tracks.
This doesn't make a lot of sense, and it should probably be changed by either:
- Getting rid of curTrack entirely, and simply replace the line
playTrack(1 + (curTrack++ % 2));
withplayTrack(1)
OR
- Remove the reverse track implementation entirely, then simply call playTrack(1) and playTrack(2) sequentially.