App-MHFS

 view release on metacpan or  search on metacpan

share/public_html/static/music_worklet_inprogress/music_inc_module.js  view on Meta::CPAN

import {default as MHFSPlayer} from './player/mhfsplayer.js'

// times in seconds
const AQMaxDecodedTime = 20;    // maximum time decoded, but not queued
const DesiredChannels = 2;
const DesiredSampleRate = 44100;

let SBAR_UPDATING = 0;

(async function () {

Number.prototype.toHHMMSS = function () {
    var sec_num = Math.floor(this); //parseInt(this, 10); // don't forget the second param
    var hours = Math.floor(sec_num / 3600);
    var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
    var seconds = sec_num - (hours * 3600) - (minutes * 60);
    var str;
    if (hours > 0) {
        if (hours < 10) { hours = "0" + hours; }
        str = hours + ':'
    }
    else {
        str = '';
    }
    //if (minutes < 10) {minutes = "0"+minutes;}
    if (seconds < 10) { seconds = "0" + seconds; }
    return str + minutes + ':' + seconds;
}

const SetCurtimeText = function(seconds) {   
    curtimetxt.value = seconds.toHHMMSS();
}

const SetEndtimeText = function(seconds) {   
    endtimetxt.value = seconds.toHHMMSS();
}

const clamp = (num, min, max) => Math.min(Math.max(num, min), max);

const WindowManager = function() {
    const that = {};

    // adds a window to the window stack and updates Z
    const AddWindow = function(awindow) {
        let zindexToUse = 2;
        if(that.windowstack) {
            that.windowstack.domwindow.getElementsByClassName("movableWindowTitleBar")[0].style.backgroundColor = "#0095FF";
            zindexToUse = parseInt(that.windowstack.domwindow.style.zIndex)+1;
            awindow.prev = that.windowstack;
            that.windowstack.next = awindow;
        }
        that.windowstack = awindow;
        awindow.domwindow.getElementsByClassName("movableWindowTitleBar")[0].style.backgroundColor = "#0000FF";
        awindow.domwindow.style.zIndex = zindexToUse;
    };

     // removes a window to the window stack and updates Z
    const RemoveWindow = function(awindow) {
        let nextwindow = awindow.next;
        const prevwindow = awindow.prev;
        // remove awindow from the list
        if(prevwindow) {
            awindow.prev = undefined;
            prevwindow.next = nextwindow;



( run in 1.570 second using v1.01-cache-2.11-cpan-d7f47b0818f )