From 94b4c84ee2b8f2c6b25ecbb15906140b16f58c2c Mon Sep 17 00:00:00 2001 From: Rauri Rochford Date: Mon, 19 Sep 2022 19:10:52 +1000 Subject: [PATCH] Add methods to enable displaying progress (#44) * current time * add getTotalOrder and getTotalPatterns --- chiptune2.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chiptune2.js b/chiptune2.js index e54bbef..7a5647f 100644 --- a/chiptune2.js +++ b/chiptune2.js @@ -68,6 +68,18 @@ ChiptuneJsPlayer.prototype.getCurrentOrder = function() { return libopenmpt._openmpt_module_get_current_order(this.currentPlayingNode.modulePtr); } +ChiptuneJsPlayer.prototype.getCurrentTime = function () { + return libopenmpt._openmpt_module_get_position_seconds(this.currentPlayingNode.modulePtr); +}; + +ChiptuneJsPlayer.prototype.getTotalOrder = function () { + return libopenmpt._openmpt_module_get_num_orders(this.currentPlayingNode.modulePtr); +}; + +ChiptuneJsPlayer.prototype.getTotalPatterns = function () { + return libopenmpt._openmpt_module_get_num_patterns(this.currentPlayingNode.modulePtr); +}; + ChiptuneJsPlayer.prototype.metadata = function() { var data = {}; var keys = UTF8ToString(libopenmpt._openmpt_module_get_metadata_keys(this.currentPlayingNode.modulePtr)).split(';');