Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

full sc development method in maiden #462

Closed
mhetrick opened this issue Jul 7, 2018 · 10 comments
Closed

full sc development method in maiden #462

mhetrick opened this issue Jul 7, 2018 · 10 comments

Comments

@mhetrick
Copy link

@mhetrick mhetrick commented Jul 7, 2018

@catfact posted the following on lines. I don't see an open issue here. Feel free to close this if I missed a duplicate:

-put new engines in dust/lib/sc.
-use a text editor, not maiden.
-restart the norns when you make changes (we’re working on better tooling for this, slowly)

Right now, the SC development process is slow and fragile. It requires the use of a separate editor along with frequent restarts when testing out ideas.

Additionally, many users who are pulling dust changes early are experiencing "error: AUDIO ENGINE" due to instances of bad copies and duplicate files with the same engine name.

@tehn
Copy link
Member

@tehn tehn commented Jul 7, 2018

sc development has been a secondary focus and we'll get to it.

right now my suggested method is to ssh into the machine with a few terminals. use vim/emacs/whatever to edit your .sc files and then use the scripts to reboot the software. i'd suggest manually running crone.sh (for text output) and matron.sh.

@tehn tehn changed the title Better SC Development Experience full sc development method in maiden Jul 7, 2018
@catfact
Copy link
Collaborator

@catfact catfact commented Jul 7, 2018

FYI, the sclang REPL in maiden does work, and you can recompile the SC class library from there or from lua.

the only thing missing is editor support for the SC files themselves.

@TheTechnobear
Copy link

@TheTechnobear TheTechnobear commented Jul 9, 2018

you can recompile the SC class library from there or from lua.

how does this work?

I found if I did s.reboot, matron did not reconnect properly (should this work?)

if i did restart_audio() , this caused my (push2) display to not work correctly.
(this could be a bug of mine, but perhaps someone can test on a proper norns, to verify this is working)


so i ended up restarting matron in each occasion above....

this led me to wonder, perhaps a 'shell console' / REPL might be useful for maiden.
(could be useful for all sorts of quick tasks...)

also perhaps maiden, could have a SC/matron status, and reboot option, a bit like scide has for the scsynth (in the toolbar). this might help users who are not confident with command line, if norns appears to 'get stuck', they could attempt a quick sc/matron reboot - rather than a hardware shutdown.

(similarly like scide, it could be extended to have a status info like cpu load)

@catfact
Copy link
Collaborator

@catfact catfact commented Jul 9, 2018

you can recompile the SC class library from there or from lua.
how does this work?

in SC: thisProcess.recompile. the Crone class has startup methods that perform the correct server configuration, handshake with matron, other things.

audio_restart() does the same thing.

test on a proper norns, to verify this is working

it works for me.

I found if I did s.reboot, matron did not reconnect properly (should this work?)

no, it will skip the handshake and will not work.

@TheTechnobear
Copy link

@TheTechnobear TheTechnobear commented Jul 9, 2018

test on a proper norns, to verify this is working
it works for me.

ok, so did a bit more testing...

and i can say it does work 'sometimes' for me too ;)

but sometimes cairo will throw an assertion.

matron: ../../../../src/cairo-pattern.c:1125: cairo_pattern_destroy: Assertion `CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&pattern->ref_count)' failed.

(note/hint : its not always the same cairo assertion )

Ive not traced the exact error, but I think its an issue cause by two things updating the screen (in different threads)
(my assumption is cairo is not thread safe, hence you get into an invalid state)

what i think happens is:

not only is restart_audio() asking crone to recompile, but it also is going thru the startup procedure and so doing hello_start.

the issue is:
while hello is doing the animation, the current lua script is actually still running,
so if the script does screen updates, you are getting updates being done by hello (in a separate thread, rather than the event thread) , whilst the script is also updating the screen in the event thread.

(it wont always crash, as it depends on 'unlucky' timing, but depending on how much updating the scripts doing, will depend on the likelihood)

I think the solution is, that restart_audio should be stopping any active script, and then restart it after 'hello' is completed...

it might as well do this, as the audio/metros dont appear to be running after restart_audio anyway - even when it doesn't crash, you still have to restart the script yourself.

@catfact
Copy link
Collaborator

@catfact catfact commented Jul 9, 2018

ok good point - yes, restart_audio() also runs the startup animation and waits for handshake from crone. yes, its a mistake to do this with a script running; use script.clear() to stop first.

restart_audio() is a C function, not the place to do script lifecycle management. audio.restart() is lua module wrapper where more lua stuff could go.

the use case isn't totally clear to me. a full soft-restart of the system should perhaps also reset the LVM state or maybe just relaunch the matron process. audio_restart() is mostly for convenience while working on engines. it might not be really necessary.

@TheTechnobear
Copy link

@TheTechnobear TheTechnobear commented Jul 9, 2018

also, it might be an idea to run the hello animation/sync thru the event loop, rather than in a separate thread -that way we know also know all screen access is thru the event loop/thread.

@catfact
Copy link
Collaborator

@catfact catfact commented Jul 9, 2018

ok, this is getting way off topic. new issue to address cairo's thread safety.
#466

@antonhornquist
Copy link
Collaborator

@antonhornquist antonhornquist commented Jul 13, 2018

i believe install.sh in ~/norns/sc also needs to be invoked to after new .sc files containing engine classes are added.

@tehn
Copy link
Member

@tehn tehn commented Apr 7, 2019

this is now possible with ;restart within maiden

@tehn tehn closed this Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants