Skip to content
This repository has been archived by the owner on Jul 17, 2018. It is now read-only.
François edited this page May 1, 2017 · 6 revisions

ImoSPC

ImoSPC provides an API for playing SPC files and Zip archives, as well as reading SPC metadata, using JavaScript.

(This page is under construction.)

Basic usage

You need to grab imospc.js, imo-w-spc.js, imo-w-unzip.js, and imo-fl.swf from the repository. Or, you can compile it yourself.

These files need those exact names, and they need to be stored in the same directory.

<script type="text/javascript" src="url/to/imospc.js"></script>

You need to initialize ImoSPC using ImoSPC.init in order to use it. The initialization process is asynchrous, so you need to add event listeners for the init and initerror events, using ImoSPC.addEventListener.

ImoSPC.addEventListener("init", myInitProc);
ImoSPC.addEventListener("initerror", myInitFailProc);
ImoSPC.init();
function myInitFailproc(e) {
    // This isn't a good way to handle initerror, but it demonstrates the idea.
    alert("Failed to initialize!");
}

Once ImoSPC is initialized, you can now load metadata using ImoSPC.open.

function myInitproc() {
    // Passing autostart: true here will cause the opened file to play immediately.
    // You can also pass autostart: true to ImoSPC.init to use this behaviour by default.
    // You can also listen for the 'load' event instead of using autostart.
    ImoSPC.open("url/to/file.spc", { autostart: true });
}

Links

API reference

Compiling

To compile ImoSPC, you need Emscripten, [FlasCC], and [Flex].

(under construction)

Under Windows: compile imo-w-spc.js and imo-w-unzip.js by running make-workers.bat.

Under Linux: compile imospc.js with make main.

Clone this wiki locally