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

Could gibberwocky live and max be packaged as npm packages ? #16

Open
JTriggerFish opened this issue Oct 9, 2018 · 13 comments
Open

Could gibberwocky live and max be packaged as npm packages ? #16

JTriggerFish opened this issue Oct 9, 2018 · 13 comments

Comments

@JTriggerFish
Copy link

I'd like to write a vscode extension to write gibberwocky in there rather than in the browser.
Rather than copy the code it would be cleaner if I could require an npm package ( like the atom gibber package does ).

@charlieroberts
Copy link
Collaborator

Cool. Are you OK with the code annotations going away? I've thought about trying to abstract them so that they could be re-implemented for other editors besides CodeMirror but it would be a ton of work...

There might be a few other editor-dependent issues to look at. Did you see this project? https://www.youtube.com/watch?v=SEvG3dqVk18

@JTriggerFish
Copy link
Author

Great thanks. Yes I saw that, should provide a good starting point.

That's fine for the annotations, I expected that.
I'm hopeful that most of them can be done without too much effort using this:
https://github.com/Microsoft/vscode-extension-samples/tree/master/decorator-sample
or taking inspiration from this:
https://github.com/hoovercj/vscode-power-mode

Waveform display will probably be trickier though but that will be a second step.

@charlieroberts
Copy link
Collaborator

Cool, I hadn’t seen that decorator example before. Looks promising!

CodeMirror is also getting a dramatic rewrite (which will include support for mobile devices), so I might need to refactor the annotations soon anyways; if so I could try and do a vscode implementation at the same time.

@JTriggerFish
Copy link
Author

I’m struggling a bit with the window.foo global variables as these don’t work outside the browser, wouls you have a suggestion for a quick workaround ?

@charlieroberts
Copy link
Collaborator

I don't know how the global object works in vscode, but I just changed the export method in gibber.js so that it doesn't explicitly call window:

https://github.com/gibber-cc/gibberwocky.live/blob/6b8d42e736dfc3a74d53dfa376fa6c2d389d5c0f/js/gibber.js#L22

If you change the line in init that calls export and pass in whatever the global object is, maybe that will fix your problem?

@JTriggerFish
Copy link
Author

Thanks ! As far as I can tell so far there isn't a global object that can be freely written to but I'm still digging.

@charlieroberts
Copy link
Collaborator

Hmmm... interesting. I guess you could declare an object (maybe even name it window, or global) and then execute all code within a with block? I know it's deprecated but it still seems to work in Chrome at least... might be good enough for now.

You'd need to add the with blocks in a couple of places:

https://github.com/gibber-cc/gibberwocky.live/blob/6b8d42e736dfc3a74d53dfa376fa6c2d389d5c0f/js/environment.js#L222

https://github.com/gibber-cc/gibberwocky.live/blob/6b8d42e736dfc3a74d53dfa376fa6c2d389d5c0f/js/clock.js#L94

@JTriggerFish
Copy link
Author

Thank you! not 100% sure whether this will work yet but I've done this for now to keep moving forward with other issues.
I'm getting an error on:
genish.gen.memory = genish.gen.createMemory( 88200, Float64Array )

I'm guessing that the genish.js that is on npm is out of date ?

@charlieroberts
Copy link
Collaborator

Yep, exactly. I just bumped up the version on npm to fix this. Thanks!

@JTriggerFish
Copy link
Author

I believe there's an issue with the package's code,
it reads:
createMemory( amount, type ) {
const mem = MemoryHelper.create( mem, type )
},

but it should be:
createMemory( amount, type ) {
const mem = MemoryHelper.create( amount, type )
return mem
},

?

@charlieroberts
Copy link
Collaborator

Ugh, I don't know how that even happened. Fixed.

@JTriggerFish
Copy link
Author

No worries, thank you !
I also resolved the window issue by writing a dummy global module and importing it everywhere:
https://github.com/JTriggerFish/vscode-gibberwocky/blob/master/gibber/global.js

hopefully should have at least the communication working soon.

@JTriggerFish
Copy link
Author

Hi Charlie,
Bit of a long shot but would you by any chance have a test websocket server that sends back what ableton is supposed to send back in order to test gibberwocky's communication without running ableton ?
Also see my pull request on genish.js
Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants