Minimal sound implementation take 2 #17
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I investigated various implementations of sound in other emulators, which tended to be a bit tricky. After brainstorming with @ladyada we hit upon the idea of simply assuming samples are written as bytes in order and trapping on the write to the RAM address of the final sample to collect a full 370 sample buffer.
This is good enough to play the system beep. It also works with some games (dark castle) but not others (glider) and still does not successfully play samples in hypercard. This may have to do with the incomplete implementation of the VIA timer2, because debug messages about timer2 are printed when trying to play sounds in hypercard.
Unlike the previous pull request #14 I have rebased this one to not include all the other hacks going into the Adafruit Fruit Jam edition of umac, and tried to more closely follow the ambient coding style.