a1k0n / jsxm

FastTracker 2 .xm module player in Javascript
http://www.a1k0n.net/code/jsxm/
MIT License
485 stars 36 forks source link

Standalone player #3

Closed mrdoob closed 8 years ago

mrdoob commented 8 years ago

What do you think about taking the viewer code out of xm.js into viewer.js so xm.js can be used as standalone player? (You know, for demos and stuff 😉)

a1k0n commented 8 years ago

Definitely a good idea, though I'd need to introduce some sort of viewer callback mechanism from the player. Hmm.

luckcolors commented 8 years ago

You could use https://github.com/nwjs or https://github.com/atom/electron for the standalone client.

mrdoob commented 8 years ago

@luckcolors I meant a library that only cares about reproducing the file, without the visualisation part.

a1k0n commented 8 years ago

Yeah. I'll work on splitting it out. The code needs a bunch of cleanup first, and a unit test suite before that, because it's sort of fragile, since so many mods rely on various corner cases. Trackers didn't have linters back then :/

luckcolors commented 8 years ago

@mrdoob Ah ok. I will make a separate issue for the native app.

a1k0n commented 8 years ago

oops, bumped the button. A native app sort of defeats the purpose...

luckcolors commented 8 years ago

Well it will be just packaged in a differen way. The app will be the same as the one inside the browser.

a1k0n commented 8 years ago

With 8e114a16da95a5fea14e75a32180d32dcb7d79a3 it's now possible to play without a viewer, though you still need to create a few XMView stubs to do it. I'll have to add a few checks so that isn't necessary.

a1k0n commented 8 years ago

The code which defines what the buttons do and downloads songs and so forth are now completely separated from the player, which has the following API:

Loading trackview.js is now optional; without it, the player won't do any visualizations. Or, you can override the following to get callbacks:

mrdoob commented 8 years ago

May I suggest... XMPlayer.init(), XMPlayer.load(ArrayBuffer), XMPlayer.play(), XMPlayer.pause() and XMPlayer.stop()?

a1k0n commented 8 years ago

Heh, yeah, now that those functions moved into the namespace, that makes more sense...