strummachine / sm-audiokit

0 stars 0 forks source link

Luke went a bit nuts... #3

Closed banjerluke closed 2 years ago

banjerluke commented 2 years ago

Once I started pulling on threads, I just kind of kept going. To my great surprise, I was able to get it compiling after all the changes! πŸŽ‰

So, quick summary of what's changed:

Your mission, should you choose to accept it:

Then I suppose we can look at getting this all into Cordova, although I feel like that might be better to do live, as a team...

Really appreciate your help with all this!

banjerluke commented 2 years ago

Updated initial comment.

banjerluke commented 2 years ago

Did a little more hacking on it today, though not nearly as much as yesterday.

I did some testing to ensure that the audio files would be available in the Bundle, and, well, πŸ’©. Turns out they're not updated with hot code pushes, and I think that's going to be a problem (long story). So I think the way to go is for WebCode to pass an ArrayBuffer (which pops out as a Data object in Swift) with each MP3 file to the plugin. I was going to just stub out a function for that, but your code was very clearly written so I was able to pretty easily move the non-audio-package parts into SampleStorage and add a function to AudioManager to store any samples provided as Data objects. Looks good to me but the real test will be when we hook it up to a real Cordova project.

Beyond that, I did a little more refactoring:

I also started running into a very strange bug, which I didn't have before. Basically, I can play any sample in the "test" channel and it works just fine, but if I play it in "guitar" or "drums" it fails with a 'player started when in a disconnected state' error. All the channels should be identical so I'm quite perplexed as to what's going on, but hopefully you can figure it out. Maybe I'm initing the channels wrong somehow...