hundredrabbits / Orca-c

Live Programming Environment(C Port)
http://wiki.xxiivv.com/orca
MIT License
482 stars 48 forks source link

Proposal: Commander (`$`) operator and utils. #77

Open royeden opened 3 years ago

royeden commented 3 years ago

Preface:

The other day I was watching this tutorial featured in the OrcaJS repo, and I found out that adjusting the BPM programmatically (as seen here) wasn't an option, so I decided to try and implement that, along with some of the other features from the commander interface.

I haven't programmed anything in C beyond some "hello world" stuff (I come from a JS background) and this PR is the result of reverse engineering the really comprehensible code written in this repo + some web search :smile: .


Changes:

Menu

Implemented Orca commander interface:

State (state.h):

* This abstraction was necessary to change is_playing via reference pointer (without abstracting the whole Ged struct). It could still be implemented without struct nesting, changing the type of is_playing to int and leaving everything inside of the Ged struct intact (this could maybe favor performance, but I don't know how much the performance is affected currently by passing a struct vs passing each value individually by reference).

Commander (commander.h, commander.c, sim.h, sim.c, cli_main.c, symisc.c):

tool:

Caveats and considerations: