Skip to content

Commit

Permalink
reset_osc > 9999 resets time clock
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhitman committed Sep 29, 2024
1 parent 81f5af0 commit cde0b8c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion amy.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def reset(osc=None, **kwargs):
if(osc is not None):
send(reset=osc, **kwargs)
else:
send(reset=10000, **kwargs) # reset > AMY_OSCS resets all oscs
send(reset=1000, **kwargs) # reset > AMY_OSCS resets all oscs

def volume(volume, client = None):
send(client=client, volume=volume)
Expand Down
15 changes: 14 additions & 1 deletion src/amy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,20 @@ void play_event(struct delta d) {
AMY_UNSET(synth[d.osc].chained_osc);
}
if(d.param == CLONE_OSC) { clone_osc(d.osc, *(int16_t *)&d.data); }
if(d.param == RESET_OSC) { if(*(int16_t *)&d.data>(AMY_OSCS+1)) { amy_reset_oscs(); } else { reset_osc(*(int16_t *)&d.data); } }
if(d.param == RESET_OSC) {
// If reset_osc > 9999, also reset time base
// In the future, we want to use this as a "hard reset" that e.g. resets the chip this is running on, or resets the audio driver.
if(*(int16_t *)&d.data>9999) {
amy_reset_sysclock();
amy_reset_oscs();
// If reset_osc > AMY_OSCS but < 10000, then just reset oscs
} else if(*(int16_t *)&d.data>(AMY_OSCS+1)) {
amy_reset_oscs();
// Else, just reset the given osc.
} else {
reset_osc(*(int16_t *)&d.data);
}
}
if(d.param == MOD_SOURCE) {
uint16_t mod_osc = *(uint16_t *)&d.data;
synth[d.osc].mod_source = mod_osc;
Expand Down
1 change: 0 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class AmyTest:

def __init__(self):
amy.restart()
amy.send(time=0) # Defeat "computed_delta" offset.

def test(self):

Expand Down

0 comments on commit cde0b8c

Please sign in to comment.