jtothebell / fake-08

A Pico-8 player/emulator for console homebrew
Other
559 stars 49 forks source link

custom instruments #188

Closed fringd closed 1 year ago

fringd commented 1 year ago

This PR adds support for custom instruments or sfx instruments. basically when you play a note on a custom instrument it recurses and plays an sfx sample for that note, but frequency shifted relative to C2.

this pr accomplishes this by:

  1. extracting the logic for an sfx sample
  2. adding a child channel to each main sfx channel to store sfx instrument channel state
  3. adding a prev child channel for use when crossfading from one note to the next.

I added some tests to catch an important nuance: the instrument will start over at every note played, unless the note is the same note, in which case it will continue playing the sfx without restarting.

jtothebell commented 1 year ago

After doing some more testing, it looks like this introduces crashes in several carts. I'm going to revert this PR. Examples of carts that seem to work before this change, but crash after it:

fringd commented 1 year ago

ah bummer. i'll dig through and try to find the issue.

fringd commented 1 year ago

taking a look at this tonight... having a hard time reproducing. I played the songs from those carts in a test, and i loaded those carts on my miyoo mini and tried to boot/go offroad (both things that use custom instruments so makes sense).

Now that i think about it... i did have some segfaults while developing that went away if i cleared out the build/ directory (in test/ or platform/miyoomini/). I don't pretend to remember any of what i learned about c++ and make in the 90s though, so not really sure why that might be? maybe the .o files don't check if included .h files change or something.

Were the errors you saw with builds from github's agents (which seem to always clean the build dir) or from a local build? if it's from a local build does nuking build/ from orbit fix your issue?

jtothebell commented 1 year ago

It was just a local build. I tried cleaning before, but maybe it didn't clean everything. I will try again and make sure all previous build artifacts are cleared. Hopefully that was all it was.

jtothebell commented 1 year ago

It looks like you're right. It looks like I need to take a look at make clean calls because once I ran a git clean -dfx it built and worked perfectly. Sorry for the false alarm, and thanks for looking at it so quickly. Time to force push to main to hide my shame ;)

fringd commented 1 year ago

hehe ^_^

On Thu, Mar 2, 2023 at 8:43 AM Jon Bell @.***> wrote:

It looks like you're right. It looks like I need to take a look at make clean calls because once I ran a git clean -dfx it built and worked perfectly. Sorry for the false alarm, and thanks for looking at it so quickly. Time to force push to main to hide my shame ;)

— Reply to this email directly, view it on GitHub https://github.com/jtothebell/fake-08/pull/188#issuecomment-1451885920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACCSRNWED4C776XUX7RO33W2CPXZANCNFSM6AAAAAAVBF756U . You are receiving this because you authored the thread.Message ID: @.***>