Commit graph jsxm/xm.js
Author SHA1 Message Date
Andy Sloane
f6113fc6c4 simple optimization to filter
just basic algebra, but I should have noticed this sooner!
2016-05-31 18:52:33 -07:00
Andy Sloane
ea423577f0 [#4] Re-enable iOS hack
Before it was running a 1Hz oscillator for 10ms which caused a huge DC
offset when it was done.. Turns out it works if you just immediately
stop and disconnect it, without causing DC offsets or other problems.
2016-04-22 12:12:50 -07:00
Andy Sloane
27d9435d83 [#24] Implement M0 volume effect (portamento)
Written so Mx is equivalent to 3x0; I think if both are present, it
might not do exactly what FT2 does.
2016-04-19 16:34:20 -07:00
Johan Hillerström
413bc4b538 Retrigger waveforms 0-3 2015-11-21 15:50:35 +01:00
Johan Hillerström
fb103e61bc Read vibrato waveform type 2015-11-21 14:58:32 +01:00
Andy Sloane
65a2ea2863 [#5] implement volume effect vibrato 2015-11-20 17:43:48 -08:00
Andy Sloane
8b3f318f60 [#19] handle loops of length 0
also more robust way to find sample offsets to load in the file
2015-11-20 17:42:41 -08:00
Andy Sloane
e347807abf Change cur_row to actually mean current row
It used to really mean "next row", and resulted in showing the wrong row
in the pattern view (row -1 instead of the last row).

Fixes #14.
2015-11-16 18:59:46 -08:00
Andy Sloane
215f72c19d Fix samples for instruments with >1 sample
The sample offset was incorrectly computed, and was including the sample
headers for all samples after the first one into the first sample's
data, causing various glitches at the beginning of the sample.

Fixes #10.
2015-11-16 18:47:41 -08:00
Andy Sloane
05216f5ce0 implement E5x finetune override
nf_chill.xm just needs EDx now
2015-11-14 09:29:08 -08:00
Andy Sloane
9a410aa535 Merge remote-tracking branch 'hillerstorm/implement_Gxx_effect' 2015-11-14 08:39:27 -08:00
Johan Hillerström
b04e6c00b0 Introduce a global volume variable 2015-11-14 13:04:16 +01:00
Johan Hillerström
1f2b0ba419 Add safeguards when setting cur_pat 2015-11-14 12:35:18 +01:00
Andy Sloane
570aa33a20 added test for vibrato... and fixed vibrato
naturally when i actually tested it, it turned out to be subtly broken

also reorg'd the tests a bit, sorry @hillerstorm.
2015-11-13 22:06:50 -08:00
Andy Sloane
be463856db Add round 1 of tests 2015-11-12 10:57:02 -08:00
Andy Sloane
6a5fe5e024 Remove XM suffix from XMPlayer calls 2015-11-12 08:56:33 -08:00
Andy Sloane
7ca90f9b98 really basic test runner
npm test now does... something somewhat useful.

now to write a bunch of tests.
2015-11-11 22:28:49 -08:00
Andy Sloane
8c37c8d96b Separate html "shell" javascript; player now standalone
Closes #3.

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:

 - `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 now 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
2015-11-11 21:19:41 -08:00
Andy Sloane
8e114a16da Split viewer code into trackview.js
Also disabled iOS hack, as it seems to be causing issues, and fixed a
minor drag-n-drop bug (wouldn't load if track was already playing past
length of newly loaded track).

To play without a viewer, you still have to stub it out. Not sure the
best way to handle that case yet.
2015-11-11 18:01:15 -08:00
Johan Hillerström
1667ab502b Add window fallback 2015-11-12 01:09:20 +01:00
Johan Hillerström
664686f199 Add newlines 2015-11-12 01:05:59 +01:00
Johan Hillerström
7aa67803ed Use postfix increment operator 2015-11-12 01:04:59 +01:00
Johan Hillerström
ea36dceb55 Wrap in IIFE and namespace any shared info 2015-11-12 00:08:32 +01:00
Andy Sloane
2cf8840665 Contact with the real world
Many, many fixes found after posting this on my website.

 - drag n drop supported
 - plays on OSX and iOS safari now
 - random other hiccups fixed

there seems to be some remaining issues cleaning up when loading a new
song.
2015-11-10 20:30:41 -08:00
Andy Sloane
7d6481ad73 file picker! 2015-11-04 10:21:04 -08:00
Andy Sloane
a547732063 render a nice big title and center stuff 2015-11-04 07:19:44 -08:00
Andy Sloane
f092f847f7 instrument list rendering with FT2 font. 2015-11-04 06:22:49 -08:00
Andy Sloane
54809c2b81 bugfix for 9xx offset effect 2015-11-04 05:50:29 -08:00
Andy Sloane
b859f27109 disable looping if looplen = 0...
so much pathological crap in XM files...
2015-11-03 18:16:00 -08:00
Andy Sloane
fd52b21e3f only instruments with samplemaps can play
by refactoring the xm loader i inadvertently broke this
2015-11-03 09:50:19 -08:00
Andy Sloane
ea6edaf2e4 add play/pause function 2015-11-03 09:36:00 -08:00
Andy Sloane
5967da7353 only reset pan/vol on instrument, not note 2015-11-03 07:18:30 -08:00
Andy Sloane
07cd6e8111 another corner case, another broken .xm 2015-11-02 22:51:04 -08:00
Andy Sloane
06ad3ed8a5 fix instrument trigger glitch 2015-11-02 22:29:59 -08:00
Andy Sloane
27d0a0b1c3 render volume effect column with the icons 2015-11-02 16:51:02 -08:00
Andy Sloane
c4370f447c implemented multiple samples / instrument 2015-11-02 13:46:23 -08:00
Andy Sloane
22dd555228 zoom scopes out 4x; looks way better 2015-11-02 13:46:22 -08:00
Andy Sloane
d68e8e8225 show all instrument names 2015-11-01 21:26:03 -08:00
Andy Sloane
114240ca9f oscilloscopes.
couldn't really think of a better way to do it, but it looks pretty
awesome. you can really see the filter effect too.
2015-11-01 09:26:03 -08:00
Andy Sloane
3daeeee96b implement retrigger, move effects into separate js 2015-11-01 07:42:52 -08:00
Andy Sloane
6dee1787f3 show the instruments 2015-10-31 11:39:49 -07:00
Andy Sloane
a3b94c51b9 oh man, DUH 2015-10-31 11:17:22 -07:00
Andy Sloane
49005f0ae0 so many weird uses of effects 2015-10-31 10:52:46 -07:00
Andy Sloane
5e141535ab fix some filter weirdness 2015-10-31 09:33:59 -07:00
Andy Sloane
32b09bdf63 various envelope/effect fixes
Dubmood's .xms seem to expose a lot of bugs...
2015-10-31 09:27:38 -07:00
Andy Sloane
837e302796 workaround pattern rendering breakage
synchronized screen updates need to be a bit more robust...
2015-10-31 07:56:36 -07:00
Andy Sloane
9f014f35c8 how did i mess up arpeggio!? 2015-10-30 23:39:50 -07:00
Andy Sloane
acffa056a5 *really* fix instrument triggers
last commit was completely wrong. also i read somewhere that the
instrument alone doesn't reset volume, which is apparently a lie.
2015-10-30 22:54:19 -07:00
Andy Sloane
c12f2b8068 fix triggering without note
you can retrigger a note just by using the instrument column.
2015-10-30 22:35:48 -07:00
Andy Sloane
ee005ef668 implement volume column slides 2015-10-30 22:28:03 -07:00