add build status and API docs to README
This commit is contained in:
parent
9bf35716f3
commit
ce5fd027a3
1 changed files with 31 additions and 6 deletions
37
README.md
37
README.md
|
|
@ -1,15 +1,40 @@
|
||||||
# xm.js
|
# xm.js
|
||||||
|
|
||||||
|
[](https://travis-ci.org/a1k0n/jsxm)
|
||||||
|
|
||||||
FastTracker 2 .XM player, written for fun.
|
FastTracker 2 .XM player, written for fun.
|
||||||
|
|
||||||
[Demo](http://www.a1k0n.net/code/jsxm/)
|
[Demo](http://www.a1k0n.net/code/jsxm/)
|
||||||
|
|
||||||
By default it plays "my dirty old kamel" by Alexander Bulér aka
|
There is an XM player and a visualizer which are separate components. The
|
||||||
[Zalza](http://zalza.bandcamp.com/). I love this tune, and wrote this code just
|
player API looks like this:
|
||||||
to play it. It can also load some other tunes hosted on my website with a file
|
|
||||||
picker, and it should play just about any .XM file now if checked out and run
|
|
||||||
locally.
|
|
||||||
|
|
||||||
It is fairly feature-complete, but is missing a bunch of effects.
|
- `XMPlayer.initAudio` -> starts up audio context; it's available as
|
||||||
|
`XMPlayer.audioctx`
|
||||||
|
- `XMPlayer.loadXM(ArrayBuffer)` -> returns `true` if loaded, otherwise
|
||||||
|
barfs randomly
|
||||||
|
- `XMPlayer.playXM()` -> starts playing
|
||||||
|
- `XMPlayer.pauseXM()` -> obvious
|
||||||
|
- `XMPlayer.stopXM()` -> obvious; call this before loading a new one
|
||||||
|
|
||||||
|
Loading trackview.js is optional; without it, the player won't do any
|
||||||
|
visualizations. Or, you can override the following to get callbacks:
|
||||||
|
|
||||||
|
- `XMView.pushEvent(e)` -> push an audio event onto the queue. Called
|
||||||
|
once per tick (about 50Hz, controlled by song). `e` contains fields:
|
||||||
|
- `t` - audio timestamp
|
||||||
|
- `vu` - Float32Array of RMS power (volume) for each channel
|
||||||
|
- `scopes` - [Float32Array] of oscilloscope data, one array per
|
||||||
|
channel; `XMView.scope_width` contains # of samples to produce here
|
||||||
|
- `songpos` - position in the song (# patterns played)
|
||||||
|
- `pat` - pattern number currently playing
|
||||||
|
- `row` - row within pattern
|
||||||
|
- `XMView.pause()` - pause visualization
|
||||||
|
- `XMView.stop()` - stop/reset visualization
|
||||||
|
|
||||||
|
The code which defines what the buttons do and downloads songs and so
|
||||||
|
forth is in `shell.js`.
|
||||||
|
|
||||||
|
The player is fairly feature-complete, but is missing a bunch of effects.
|
||||||
|
|
||||||
MIT license.
|
MIT license.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue