electronoora / webaudio-mod-player

MOD/S3M/XM module player for Web Audio
https://mod.haxor.fi/
MIT License
364 stars 54 forks source link

Standalone player #5

Closed pistacchio closed 7 years ago

pistacchio commented 8 years ago

Hi, I'm trying to use the library as a standalone player, without the UI part. Since it's not documented, all I'm trying to do is:

var player = new Modplayer();
player.load('chiptune.mod');
player.onReady = function () {
    player.play();
}

It starts playing but after a short while (a couple of seconds) the song gets stuck in a loop (like repeating the same bar) and in the console I see this error:

Uncaught TypeError: Cannot read property 'player' of undefined

being thrown over and over.

electronoora commented 8 years ago

Hi,

Are you trying to play XM format modules? Support for them is not yet complete and there are several bugs - some of which downright crash the player.

I tried your code with a 4-channel Protracker module and this small test seems to work fine for me, at least;

<html><head>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/player.js"></script>
<script type="text/javascript" src="js/st3.js"></script>
<script type="text/javascript" src="js/pt.js"></script>
<script type="text/javascript" src="js/ft2.js"></script>
<script type="text/javascript">
  var player = new Modplayer();
  player.load('mods/mod.tf');
  player.onReady = function () {
    player.play();
  }
</script>
</head><body></body>
</html>