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

Get pattern #42

Open
Lakelimbo opened this issue Jul 9, 2021 · 2 comments
Open

Get pattern #42

Lakelimbo opened this issue Jul 9, 2021 · 2 comments

Comments

@Lakelimbo
Copy link

Hello! So I'm not an expert on JS, and I'm trying to figure out how to get a visualization in pattern, just like the trackers, if possible.
(Preferentially with a code snippet, I usually understand those better D: )

@gs11
Copy link
Contributor

gs11 commented Dec 14, 2021

This library is for playback only. I'm not personally familiar with other libraries providing such functionality.

@deskjet
Copy link
Owner

deskjet commented Dec 15, 2021

Sorry for the late response. The library behind chiptunejs libopenmpt can do everything you'd expect from a tracker. It's the same code that OpenMPT is built upon. Exposing the functionality to JS is not always straight forward unfortunately. The first step is always to check libopenmpt C-API which we can call from JS.

You can find functions like openmpt_module_get_current_pattern and openmpt_module_format_pattern_row_channel that sound like they're be related to what you're trying to do.

A call from JS would look something like that:

libopenmpt._openmpt_module_get_current_pattern(this.currentPlayingNode.modulePtr);  

It should return the index of the currently playing pattern. You can use that to go further.

By default only a limited number of functions are exposed via Emscripten to JS. So you might have to look into building a custom version of libopenmpt.js from the libopenmpt source. Make sure to use the Makefile based build system.

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

3 participants