Skip to content

Commit

Permalink
APU: fix regression in envelope speed and add comments about envelope…
Browse files Browse the repository at this point in the history
… and sweep edge-cases
  • Loading branch information
fleroviux committed Nov 16, 2023
1 parent ba587e4 commit f94692a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/nba/src/hw/apu/channel/envelope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

namespace nba::core {

/**
* TODO:
* - Figure out how the envelope timer behaves when the envelope speed (divider) changes mid-note.
* - Is the new value loaded into the counter right away or on the next reload?
* - Is the timer ticked when the envelope is deactivated (divider == 0)?
* - If so, what value is loaded into the timer on channel restart?
*/

class Envelope {
public:
void Reset() {
Expand All @@ -25,7 +33,7 @@ class Envelope {
}

void Tick() {
if(step == 0) {
if(step == 1) {
step = divider;

if(active && divider != 0) {
Expand All @@ -44,7 +52,7 @@ class Envelope {
}
}
} else {
step--;
step = (step - 1) & 7;
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/nba/src/hw/apu/channel/sweep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

namespace nba::core {

/**
* TODO: figure out specifics of how the sweep timer works when the sweep speed (divider) is set to zero
* or changed in the middle of a note.
*/

class Sweep {
public:
void Reset() {
Expand Down

0 comments on commit f94692a

Please sign in to comment.