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
parent 0e31c5fdf2
commit e690d67b80
21 changed files with 290 additions and 11796 deletions

View file

@ -17,6 +17,36 @@ var Blob = Object.inherit({
return this.size() == other.size(); //TODO let's pretend one shall never wish to compare blobs)
},
"+=": function(other) {
if (this.getType() !== other.getType()) {
throw new Error("An attempt to add and assign an " + other.className + " to " + this.className);
}
var newData = new ArrayBuffer(this._data.byteLength + other._data.byteLength);
var newView = new Uint8Array(newData);
var thisView = new Uint8Array(this._data);
var otherView = new Uint8Array(other._data);
newView.set(thisView, 0);
newView.set(otherView, this._data.byteLength);
this._data = newData;
},
"+": function(other) {
if (this.getType() !== other.getType()) {
throw new Error("An attempt to add an " + other.className + " to " + this.className);
}
var newData = new ArrayBuffer(this._data.byteLength + other._data.byteLength);
var newView = new Uint8Array(newData);
var thisView = new Uint8Array(this._data);
var otherView = new Uint8Array(other._data);
newView.set(thisView, 0);
newView.set(otherView, this._data.byteLength);
return new Blob(newData);
},
"base64": function() {
var arr = new Uint8Array(this._data);
var bin = "";