ATMlib minor optimisation
This commit is contained in:
parent
315c3c45e9
commit
7b4faf6a85
|
@ -292,11 +292,8 @@ static inline const byte *getTrackPointer(byte track) {
|
|||
|
||||
|
||||
void ATMsynth::play(const byte *song) {
|
||||
TIMSK4 = 0b00000000;// ensure interrupt is disabled
|
||||
stop();
|
||||
cia_count = 1;
|
||||
// cleanUp stuff first
|
||||
memset(channel, 0, sizeof(channel));
|
||||
ChannelActiveMute = 0b11110000;
|
||||
|
||||
// Initializes ATMsynth
|
||||
// Sets sample rate and tick rate
|
||||
|
@ -324,7 +321,7 @@ void ATMsynth::play(const byte *song) {
|
|||
// Store track pointer
|
||||
trackBase = (song += (trackCount << 1)) + 4;
|
||||
// Fetch starting points for each track
|
||||
for (unsigned n = 0; n < 4; n++) {
|
||||
for (byte n = 0; n < 4; n++) {
|
||||
channel[n].ptr = getTrackPointer(pgm_read_byte(song++));
|
||||
}
|
||||
TIMSK4 = 0b00000100;// enable interrupt as last
|
||||
|
@ -603,8 +600,7 @@ void ATM_playroutine() {
|
|||
}
|
||||
else
|
||||
{
|
||||
memset(channel, 0, sizeof(channel));
|
||||
TIMSK4 = 0; // Disable interrupt
|
||||
ATMsynth::stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,17 +22,17 @@ class ATMsynth {
|
|||
ATMsynth() {};
|
||||
|
||||
// Load and play specified song
|
||||
void play(const byte *song);
|
||||
static void play(const byte *song);
|
||||
|
||||
// Play or Pause playback
|
||||
void playPause();
|
||||
static void playPause();
|
||||
|
||||
// Stop playback (unloads song)
|
||||
void stop();
|
||||
static void stop();
|
||||
|
||||
void muteChannel(byte ch);
|
||||
static void muteChannel(byte ch);
|
||||
|
||||
void unMuteChannel(byte ch);
|
||||
static void unMuteChannel(byte ch);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue