Decoding with my own translation of libmad, loading and playback progress, next and prev songs

This commit is contained in:
Blue 2019-01-24 22:54:16 +03:00 committed by Gitea
parent baa6f4ef23
commit d6e22f6111
21 changed files with 290 additions and 11796 deletions

View file

@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 2.8.12)
add_subdirectory(requirejs)
add_subdirectory(wSocket)
add_subdirectory(bintrees)
add_subdirectory(mp3)
add_subdirectory(aurora)
add_subdirectory(wContainer)
add_subdirectory(utils)
add_subdirectory(wType)
@ -12,3 +10,4 @@ add_subdirectory(wDispatcher)
add_subdirectory(wTest)
add_subdirectory(wController)
add_subdirectory(fonts)
add_subdirectory(em)

View file

@ -1,3 +0,0 @@
cmake_minimum_required(VERSION 2.8.12)
configure_file(aurora.js aurora.js)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
configure_file(wrapper.js wrapper.js)
configure_file(wrapper.wasm wrapper.wasm COPYONLY)

4
lorgar/lib/em/wrapper.js Normal file

File diff suppressed because one or more lines are too long

BIN
lorgar/lib/em/wrapper.wasm Normal file

Binary file not shown.

View file

@ -1,3 +0,0 @@
cmake_minimum_required(VERSION 2.8.12)
configure_file(mp3.js mp3.js)

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,7 @@
"use strict";
(function main_js() {
requirejs.config({
"baseUrl": "/",
"shim": {
"lib/mp3/mp3": ["lib/aurora/aurora"]
}
"baseUrl": "/"
});
requirejs.onError = function(e) {
throw e;
@ -14,7 +11,8 @@
defineArray.push("test/test");
defineArray.push("core/lorgar");
defineArray.push("lib/utils/globalMethods");
defineArray.push("lib/mp3/mp3");
defineArray.push("lib/em/wrapper");
require(defineArray, function main_module() {
require("lib/utils/globalMethods");
@ -24,6 +22,8 @@
var Controller = require("lib/wController/controller");
var View = require("views/view");
window.Mp3Decoder = Module.Decoder;
var waiter = {
views: false,
controllers: false,

View file

@ -14,5 +14,6 @@ configure_file(image.js image.js)
configure_file(button.js button.js)
configure_file(enumeration.js enumeration.js)
configure_file(player.js player.js)
configure_file(songProgress.js songProgress.js)
add_subdirectory(helpers)

View file

@ -8,6 +8,7 @@
deps.push("views/label");
deps.push("views/view");
deps.push("views/image");
deps.push("views/songProgress");
deps.push("lib/wController/localModel");
@ -19,6 +20,7 @@
var Label = require("views/label");
var View = require("views/view");
var Image = require("views/image");
var SongProgress = require("views/songProgress");
var Model = require("lib/wController/localModel");
@ -34,6 +36,7 @@
this._next = null;
this._picture = null;
this._cpbCtrl = null;
this._infoModels = {
artist: new Model(null, "artist: unknown"),
album: new Model(null, "album: unknown"),
@ -46,12 +49,14 @@
var artist = new Label(this._infoModels.artist);
var album = new Label(this._infoModels.album);
var song = new Label(this._infoModels.song);
var spacer = new View(helper);
var spacer = new View(helper, {maxWidth: 50});
var progress = new SongProgress(ctrl.progress);
this.append(artist, 0, 4, 1, 1, GridLayout.Aligment.LeftCenter);
this.append(song, 1, 4, 1, 1, GridLayout.Aligment.LeftCenter);
this.append(album, 2, 4, 1, 1, GridLayout.Aligment.LeftCenter);
this.append(spacer, 0, 5, 3, 1, GridLayout.Aligment.LeftCenter);
this.append(spacer, 0, 6, 3, 1, GridLayout.Aligment.LeftCenter);
this.append(progress, 1, 5, 1, 1, GridLayout.Aligment.CenterCenter);
this._uncyclic.push(this._infoModels.artist.destructor.bind(this._infoModels.artist));
this._uncyclic.push(this._infoModels.song.destructor.bind(this._infoModels.song));

View file

@ -0,0 +1,76 @@
"use strict";
(function() {
var moduleName = "views/songProgress";
var deps = [];
deps.push("views/view");
define(moduleName, deps, function() {
var View = require("views/view");
var SongProgress = View.inherit({
className: "SongProgress",
constructor: function(controller, options) {
var base = {
minHeight: 10,
maxHeight: 10
};
W.extend(base, options)
var el = document.createElement("div");
this._createBars();
View.fn.constructor.call(this, controller, base, el);
this._f.on("load", this._onLoad, this);
this._f.on("playback", this._onPlayback, this);
this._e.style.backgroundColor = "#eeeeee";
this._e.appendChild(this._loadProgress);
this._e.appendChild(this._playbackProgress);
},
destructor: function() {
this._f.off("load", this._onLoad, this);
this._f.off("playback", this._onPlayback, this);
View.fn.destructor.call(this);
},
_createBars: function() {
this._loadProgress = document.createElement("div");
this._playbackProgress = document.createElement("div");
this._loadProgress.style.backgroundColor = View.theme.secondaryColor || "#ffff00";
this._loadProgress.style.height = "100%";
this._loadProgress.style.width = "0";
this._loadProgress.style.position = "absolute";
this._loadProgress.style.top = "0";
this._loadProgress.style.left = "0";
this._playbackProgress.style.backgroundColor = View.theme.primaryColor || "#ff0000";
this._playbackProgress.style.height = "100%";
this._playbackProgress.style.width = "0";
this._playbackProgress.style.position = "absolute";
this._playbackProgress.style.top = "0";
this._playbackProgress.style.left = "0";
},
_onData: function() {
this._onLoad(this._f.load);
this._onPlayback(this._f.playback);
},
_onLoad: function(load) {
this._loadProgress.style.width = load * 100 + "%";
},
_onPlayback: function(pb) {
this._playbackProgress.style.width = pb * 100 + "%";
},
_resetTheme: function() {
View.fn._resetTheme.call(this);
this._loadProgress.style.backgroundColor = View.theme.secondaryColor || "#ffff00"
this._playbackProgress.style.backgroundColor = View.theme.primaryColor || "#ff0000";
}
});
return SongProgress;
})
})();