mirror of
https://github.com/bvanroll/rpiRadio.git
synced 2025-08-30 04:22:50 +00:00
Initial Commit
This commit is contained in:
1912
ProjectNow/NodeServer/public/css/bootstrap-grid.css
vendored
Normal file
1912
ProjectNow/NodeServer/public/css/bootstrap-grid.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
ProjectNow/NodeServer/public/css/bootstrap-grid.css.map
Normal file
1
ProjectNow/NodeServer/public/css/bootstrap-grid.css.map
Normal file
File diff suppressed because one or more lines are too long
7
ProjectNow/NodeServer/public/css/bootstrap-grid.min.css
vendored
Normal file
7
ProjectNow/NodeServer/public/css/bootstrap-grid.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
330
ProjectNow/NodeServer/public/css/bootstrap-reboot.css
vendored
Normal file
330
ProjectNow/NodeServer/public/css/bootstrap-reboot.css
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v4.1.0 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2018 The Bootstrap Authors
|
||||
* Copyright 2011-2018 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
line-height: 1.15;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
-ms-overflow-style: scrollbar;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
@-ms-viewport {
|
||||
width: device-width;
|
||||
}
|
||||
|
||||
article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: #212529;
|
||||
text-align: left;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
[tabindex="-1"]:focus {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
hr {
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
abbr[title],
|
||||
abbr[data-original-title] {
|
||||
text-decoration: underline;
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 1rem;
|
||||
font-style: normal;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
ol ol,
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: .5rem;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
position: relative;
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
background-color: transparent;
|
||||
-webkit-text-decoration-skip: objects;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #0056b3;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:not([href]):not([tabindex]) {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:not([href]):not([tabindex]):focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
overflow: auto;
|
||||
-ms-overflow-style: scrollbar;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
img {
|
||||
vertical-align: middle;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
caption {
|
||||
padding-top: 0.75rem;
|
||||
padding-bottom: 0.75rem;
|
||||
color: #6c757d;
|
||||
text-align: left;
|
||||
caption-side: bottom;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: inherit;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button:focus {
|
||||
outline: 1px dotted;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
optgroup,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
button,
|
||||
input {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
button,
|
||||
html [type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
input[type="radio"],
|
||||
input[type="checkbox"] {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
input[type="date"],
|
||||
input[type="time"],
|
||||
input[type="datetime-local"],
|
||||
input[type="month"] {
|
||||
-webkit-appearance: listbox;
|
||||
}
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
margin-bottom: .5rem;
|
||||
font-size: 1.5rem;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
[type="search"] {
|
||||
outline-offset: -2px;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
[type="search"]::-webkit-search-cancel-button,
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap-reboot.css.map */
|
File diff suppressed because one or more lines are too long
8
ProjectNow/NodeServer/public/css/bootstrap-reboot.min.css
vendored
Normal file
8
ProjectNow/NodeServer/public/css/bootstrap-reboot.min.css
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v4.1.0 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2018 The Bootstrap Authors
|
||||
* Copyright 2011-2018 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg:not(:root){overflow:hidden}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
|
||||
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
|
File diff suppressed because one or more lines are too long
8950
ProjectNow/NodeServer/public/css/bootstrap.css
vendored
Normal file
8950
ProjectNow/NodeServer/public/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
ProjectNow/NodeServer/public/css/bootstrap.css.map
Normal file
1
ProjectNow/NodeServer/public/css/bootstrap.css.map
Normal file
File diff suppressed because one or more lines are too long
7
ProjectNow/NodeServer/public/css/bootstrap.min.css
vendored
Normal file
7
ProjectNow/NodeServer/public/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ProjectNow/NodeServer/public/css/bootstrap.min.css.map
Normal file
1
ProjectNow/NodeServer/public/css/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
94
ProjectNow/NodeServer/public/css/styles.css
Normal file
94
ProjectNow/NodeServer/public/css/styles.css
Normal file
@@ -0,0 +1,94 @@
|
||||
/*color*/
|
||||
/*
|
||||
html {
|
||||
background-color: #e1f5fe;
|
||||
}
|
||||
|
||||
.nav-wrapper {
|
||||
background-color: #80deea;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: #e8f5e9;
|
||||
}
|
||||
|
||||
#boxx a, a {
|
||||
color: #00e676;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.card-content p, li {
|
||||
color: grey;
|
||||
}
|
||||
|
||||
/*other*/
|
||||
/*
|
||||
#navbar {
|
||||
position: fixed;
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
.brand-logo {
|
||||
max-height: 4.06rem;
|
||||
margin-left: 0.07rem;
|
||||
}
|
||||
|
||||
#boxx {
|
||||
z-index: 5;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#maps {
|
||||
height: 25rem;
|
||||
}
|
||||
|
||||
iframe {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
#avout {
|
||||
width: 30rem;
|
||||
}
|
||||
|
||||
#imgtext {
|
||||
width: 14.5rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#odisee {
|
||||
max-width: 71rem;
|
||||
min-width: 71rem;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#odiseetext {
|
||||
margin-top:-0.7rem;
|
||||
}
|
||||
|
||||
.container{
|
||||
margin:50px;
|
||||
}
|
||||
|
||||
#contentdiv {
|
||||
padding-top: 4.5rem;
|
||||
}
|
||||
|
||||
select {
|
||||
visibility: visible;
|
||||
}
|
||||
*/
|
||||
.col-centered{
|
||||
float: none;
|
||||
margin: 0 auto;
|
||||
width: 70%;
|
||||
}
|
||||
.extraMargin{
|
||||
margin: 2rem;
|
||||
}
|
||||
.extraBorder{
|
||||
border:2rem;
|
||||
}
|
BIN
ProjectNow/NodeServer/public/img/midi.png
Normal file
BIN
ProjectNow/NodeServer/public/img/midi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
ProjectNow/NodeServer/public/img/odisee.jpg
Normal file
BIN
ProjectNow/NodeServer/public/img/odisee.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
6433
ProjectNow/NodeServer/public/scripts/bootstrap.bundle.js
vendored
Normal file
6433
ProjectNow/NodeServer/public/scripts/bootstrap.bundle.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
7
ProjectNow/NodeServer/public/scripts/bootstrap.bundle.min.js
vendored
Normal file
7
ProjectNow/NodeServer/public/scripts/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3925
ProjectNow/NodeServer/public/scripts/bootstrap.js
vendored
Normal file
3925
ProjectNow/NodeServer/public/scripts/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
ProjectNow/NodeServer/public/scripts/bootstrap.js.map
Normal file
1
ProjectNow/NodeServer/public/scripts/bootstrap.js.map
Normal file
File diff suppressed because one or more lines are too long
7
ProjectNow/NodeServer/public/scripts/bootstrap.min.js
vendored
Normal file
7
ProjectNow/NodeServer/public/scripts/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5
ProjectNow/NodeServer/public/scripts/client.js
Normal file
5
ProjectNow/NodeServer/public/scripts/client.js
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
const button = document.getElementById('mainbtn');
|
||||
button.addEventListener('click', function(e) {
|
||||
console.log('button was clicked');
|
||||
});
|
1
ProjectNow/NodeServer/public/scripts/example-song.js
Normal file
1
ProjectNow/NodeServer/public/scripts/example-song.js
Normal file
File diff suppressed because one or more lines are too long
433
ProjectNow/NodeServer/public/scripts/midiplayer.js
Normal file
433
ProjectNow/NodeServer/public/scripts/midiplayer.js
Normal file
@@ -0,0 +1,433 @@
|
||||
/************************************************************************
|
||||
* Circular Web Audio Buffer Queue
|
||||
*/
|
||||
function CircularAudioBuffer(slots) {
|
||||
slots = slots || 24;
|
||||
// number of buffers
|
||||
this.slots = slots;
|
||||
this.buffers = new Array(slots);
|
||||
|
||||
this.reset();
|
||||
|
||||
for (var i = 0; i < this.slots; i++) {
|
||||
var buffer = audioCtx.createBuffer(channels, BUFFER, SAMPLE_RATE);
|
||||
this.buffers[i] = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
// pseudo empty all buffers
|
||||
CircularAudioBuffer.prototype.reset = function () {
|
||||
this.used = 0;
|
||||
this.filled = 0;
|
||||
};
|
||||
|
||||
// returns number of buffers that are filled
|
||||
CircularAudioBuffer.prototype.filledBuffers = function () {
|
||||
var fills = this.filled - this.used;
|
||||
if (fills < 0) fills += this.slots;
|
||||
return fills;
|
||||
}
|
||||
|
||||
// returns whether buffers are all filled
|
||||
CircularAudioBuffer.prototype.full = function () {
|
||||
//console.debug(this.filledBuffers());
|
||||
return this.filledBuffers() >= this.slots - 1;
|
||||
}
|
||||
|
||||
// returns a reference to next available buffer to be filled
|
||||
CircularAudioBuffer.prototype.prepare = function () {
|
||||
if (this.full()) {
|
||||
//console.log('buffers full!!')
|
||||
return
|
||||
}
|
||||
var buffer = this.buffers[ this.filled++];
|
||||
this.filled %= this.slots;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// returns the next buffer in the queue
|
||||
CircularAudioBuffer.prototype.use = function () {
|
||||
if (! this.filledBuffers()) return;
|
||||
var buffer = this.buffers[ this.used++];
|
||||
this.used %= this.slots;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Web Audio Stuff
|
||||
*/
|
||||
|
||||
var SAMPLE_RATE = 44100;
|
||||
var BUFFER = 4096;
|
||||
var channels = 2;
|
||||
|
||||
var audioCtx;
|
||||
var source;
|
||||
var scriptNode;
|
||||
var circularBuffer;
|
||||
var emptyBuffer;
|
||||
|
||||
function initAudio() {
|
||||
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
||||
scriptNode = audioCtx.createScriptProcessor(BUFFER, 0, channels);
|
||||
scriptNode.onaudioprocess = onAudioProcess;
|
||||
|
||||
source = audioCtx.createBufferSource();
|
||||
circularBuffer = new CircularAudioBuffer(8);
|
||||
emptyBuffer = audioCtx.createBuffer(channels, BUFFER, SAMPLE_RATE);
|
||||
|
||||
source.connect(scriptNode);
|
||||
source.start(0);
|
||||
console.debug("initAudio");
|
||||
}
|
||||
|
||||
function startAudio() {
|
||||
scriptNode.connect(audioCtx.destination);
|
||||
console.debug("startAudio");
|
||||
}
|
||||
|
||||
function pauseAudio() {
|
||||
circularBuffer.reset();
|
||||
scriptNode.disconnect();
|
||||
console.debug("pauseAudio");
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Emscripten variables and callback - cannot be renamed
|
||||
*/
|
||||
|
||||
var ULONG_MAX = 4294967295;
|
||||
var _EM_signalStop = 0;
|
||||
var _EM_seekSamples = ULONG_MAX;
|
||||
|
||||
function processAudio(buffer_loc, size) {
|
||||
var buffer = circularBuffer.prepare();
|
||||
var left_buffer_f32 = buffer.getChannelData(0);
|
||||
var right_buffer_f32 = buffer.getChannelData(1);
|
||||
|
||||
// Copy emscripten memory (OpenAL stereo16 format) to JS
|
||||
for (var i = 0; i < size; i++) {
|
||||
left_buffer_f32[i] = MidiPlayer.HEAP16[(buffer_loc >> 1) + 2 * i + 0] / 32768;
|
||||
right_buffer_f32[i] = MidiPlayer.HEAP16[(buffer_loc >> 1) + 2 * i + 1] / 32768;
|
||||
}
|
||||
}
|
||||
|
||||
function updateProgress(current, total) {
|
||||
midiPlayer_currentSamples = current;
|
||||
midiPlayer_totalSamples = total;
|
||||
midiPlayer_progress.style.width = (current / total * 100) + '%';
|
||||
midiPlayer_playingTime.innerHTML = samplesToTime(current);
|
||||
midiPlayer_totalTime.innerHTML = samplesToTime(total);
|
||||
|
||||
var millisec = Math.floor(current * 1000 / SAMPLE_RATE / midiPlayer_updateRate);
|
||||
if (midiPlayer_lastMillisec > millisec) {
|
||||
midiPlayer_lastMillisec = 0;
|
||||
}
|
||||
if (millisec > midiPlayer_lastMillisec) {
|
||||
if (midiPlayer_onUpdate != null) midiPlayer_onUpdate(millisec * midiPlayer_updateRate);
|
||||
//console.log(millisec * UPDATE_RATE);
|
||||
}
|
||||
midiPlayer_lastMillisec = millisec;
|
||||
}
|
||||
|
||||
function completeConversion(status) {
|
||||
midiPlayer_drainBuffer = true;
|
||||
console.debug('completeConversion');
|
||||
midiPlayer_convertionJob = null;
|
||||
// Not a pause
|
||||
if (_EM_signalStop != 2) {
|
||||
setTimeout(stop, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Global player variables and functions
|
||||
*/
|
||||
|
||||
// html elements
|
||||
var midiPlayer_width;
|
||||
var midiPlayer_bar;
|
||||
var midiPlayer_progress;
|
||||
var midiPlayer_playingTime;
|
||||
var midiPlayer_play;
|
||||
var midiPlayer_pause;
|
||||
var midiPlayer_stop;
|
||||
var midiPlayer_totalTime;
|
||||
|
||||
// variables
|
||||
var midiPlayer_isLoaded = false;
|
||||
var midiPlayer_isAudioInit = false;
|
||||
var midiPlayer_input = null;
|
||||
var midiPlayer_lastMillisec = 0;
|
||||
var midiPlayer_midiName = ''
|
||||
var midiPlayer_convertionJob = null;
|
||||
var midiPlayer_currentSamples = ULONG_MAX;
|
||||
var midiPlayer_totalSamples = 0;
|
||||
var midiPlayer_updateRate = 50;
|
||||
var midiPlayer_drainBuffer = false;
|
||||
var BASE64_MARKER = ';base64,';
|
||||
|
||||
// callbacks
|
||||
var midiPlayer_onStop = null;
|
||||
var midiPlayer_onUpdate = null;
|
||||
|
||||
var MidiPlayer = {
|
||||
noInitialRun: true,
|
||||
totalDependencies: 1,
|
||||
monitorRunDependencies: function(left) {
|
||||
//console.log(this.totalDependencies);
|
||||
//console.log(left);
|
||||
if ((left == 0) && !midiPlayer_isLoaded) {
|
||||
console.log("MidiPlayer is loaded");
|
||||
midiPlayer_isLoaded = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
MidiModule(MidiPlayer);
|
||||
|
||||
|
||||
function onAudioProcess(audioProcessingEvent) {
|
||||
var generated = circularBuffer.use();
|
||||
|
||||
if (!generated && midiPlayer_drainBuffer) {
|
||||
// wait for remaining buffer to drain before disconnect audio
|
||||
pauseAudio();
|
||||
midiPlayer_drainBuffer = false;
|
||||
return;
|
||||
}
|
||||
if (!generated) {
|
||||
//console.log('buffer under run!!')
|
||||
generated = emptyBuffer;
|
||||
}
|
||||
|
||||
var outputBuffer = audioProcessingEvent.outputBuffer;
|
||||
var offset = 0;
|
||||
if (outputBuffer.copyToChannel !== undefined) {
|
||||
// Firefox -> about 50% faster than decoding
|
||||
outputBuffer.copyToChannel(generated.getChannelData(0), 0, offset);
|
||||
outputBuffer.copyToChannel(generated.getChannelData(1), 1, offset);
|
||||
} else {
|
||||
// Other browsers -> about 20 - 70% slower than decoding
|
||||
var leftChannel = outputBuffer.getChannelData(0);
|
||||
var rightChannel = outputBuffer.getChannelData(1);
|
||||
var generatedLeftChannel = generated.getChannelData(0);
|
||||
var generatedRightChannel = generated.getChannelData(1);
|
||||
var i;
|
||||
for (i = 0; i < BUFFER; i++) {
|
||||
leftChannel[i] = generatedLeftChannel[i];
|
||||
rightChannel[i] = generatedRightChannel[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function samplesToTime(at) {
|
||||
var in_s = Math.floor(at / SAMPLE_RATE);
|
||||
var s = in_s % 60;
|
||||
var min = in_s / 60 | 0;
|
||||
return min + ':' + (s === 0 ? '00': s < 10 ? '0' + s: s);
|
||||
}
|
||||
|
||||
function convertDataURIToBinary(dataURI) {
|
||||
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
|
||||
var base64 = dataURI.substring(base64Index);
|
||||
var raw = window.atob(base64);
|
||||
var rawLength = raw.length;
|
||||
var array = new Uint8Array(new ArrayBuffer(rawLength));
|
||||
|
||||
for (var i = 0; i < rawLength; i++) {
|
||||
array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
function convertFile(file, data) {
|
||||
midiPlayer_midiName = file;
|
||||
midiPlayer_input = null;
|
||||
console.log('open ', midiPlayer_midiName);
|
||||
MidiPlayer['FS'].writeFile(midiPlayer_midiName, data, {
|
||||
encoding: 'binary'
|
||||
});
|
||||
play();
|
||||
}
|
||||
|
||||
function pause() {
|
||||
_EM_signalStop = 2;
|
||||
circularBuffer.reset();
|
||||
midiPlayer_play.style.display = 'inline-block';
|
||||
midiPlayer_pause.style.display = 'none';
|
||||
}
|
||||
|
||||
function play() {
|
||||
if (!midiPlayer_isLoaded) {
|
||||
console.error("MidiPlayer is not loaded yet");
|
||||
return;
|
||||
}
|
||||
if (!midiPlayer_isAudioInit) {
|
||||
initAudio();
|
||||
midiPlayer_isAudioInit = true;
|
||||
}
|
||||
|
||||
_EM_seekSamples = midiPlayer_currentSamples;
|
||||
if (midiPlayer_convertionJob) {
|
||||
return;
|
||||
}
|
||||
|
||||
_EM_signalStop = 0;
|
||||
midiPlayer_play.style.display = 'none';
|
||||
midiPlayer_pause.style.display = 'inline-block';
|
||||
midiPlayer_stop.style.display = 'inline-block';
|
||||
// add small delay so UI can update.
|
||||
setTimeout(runConversion, 100);
|
||||
}
|
||||
|
||||
function stop() {
|
||||
_EM_signalStop = 1;
|
||||
_EM_seekSamples = 0;
|
||||
circularBuffer.reset();
|
||||
|
||||
midiPlayer_totalSamples = 0;
|
||||
midiPlayer_currentSamples = ULONG_MAX;
|
||||
midiPlayer_progress.style.width = '0%';
|
||||
midiPlayer_playingTime.innerHTML = "00.00";
|
||||
midiPlayer_totalTime.innerHTML = "00.00";
|
||||
|
||||
midiPlayer_play.style.display = 'none';
|
||||
midiPlayer_pause.style.display = 'none';
|
||||
midiPlayer_stop.style.display = 'none';
|
||||
|
||||
if (midiPlayer_onStop != null) midiPlayer_onStop();
|
||||
}
|
||||
|
||||
function runConversion() {
|
||||
midiPlayer_convertionJob = {
|
||||
sourceMidi: midiPlayer_midiName,
|
||||
targetWav: midiPlayer_midiName.replace(/\.midi?$/i, '.wav'),
|
||||
targetPath: '',
|
||||
conversion_start: Date.now()
|
||||
};
|
||||
|
||||
var sleep = 10;
|
||||
circularBuffer.reset();
|
||||
startAudio();
|
||||
|
||||
console.log(midiPlayer_convertionJob);
|
||||
|
||||
MidiPlayer.ccall('wildwebmidi',
|
||||
null,[ 'string', 'string', 'number'],[midiPlayer_convertionJob.sourceMidi, midiPlayer_convertionJob.targetPath, sleep], {
|
||||
async: true
|
||||
});
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* jQuery player plugin
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
$.fn.midiPlayer = function (options) {
|
||||
|
||||
var options = $.extend({
|
||||
// These are the defaults.
|
||||
color: "#556b2f",
|
||||
backgroundColor: "white",
|
||||
width: 500,
|
||||
onStop: null,
|
||||
onUpdate: null,
|
||||
updateRate: 50,
|
||||
},
|
||||
options);
|
||||
// width should not be less than 150
|
||||
options.width = Math.max(options.width, 150);
|
||||
// update rate should not be less than 10 milliseconds
|
||||
options.updateRate = Math.max(options.updateRate, 10);
|
||||
|
||||
$.fn.midiPlayer.play = function (song) {
|
||||
if (midiPlayer_isLoaded == false) {
|
||||
midiPlayer_input = song;
|
||||
}
|
||||
else {
|
||||
var byteArray = convertDataURIToBinary(song);
|
||||
if (midiPlayer_totalSamples > 0) {
|
||||
stop();
|
||||
// a timeout is necessary because otherwise writing to the disk is not done
|
||||
setTimeout(function() {convertFile("player.midi", byteArray);}, 200);
|
||||
}
|
||||
else {
|
||||
convertFile("player.midi", byteArray);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.midiPlayer.seek = function (millisec) {
|
||||
if (midiPlayer_totalSamples == 0) return;
|
||||
var samples = millisec * SAMPLE_RATE / 1000;
|
||||
midiPlayer_currentSamples = Math.min(midiPlayer_totalSamples, samples);
|
||||
play();
|
||||
};
|
||||
|
||||
$.fn.midiPlayer.stop = function () {
|
||||
stop();
|
||||
};
|
||||
|
||||
// Create the player
|
||||
this.append("<div id=\"midiPlayer_div\"></div>");
|
||||
$("#midiPlayer_div").append("<div id=\"midiPlayer_playingTime\">0:00</div>")
|
||||
.append("<div id=\"midiPlayer_bar\"><div id=\"midiPlayer_progress\"></div></div>")
|
||||
.append("<div id=\"midiPlayer_totalTime\">0:00</div>")
|
||||
.append("<a class=\"icon play\" id=\"midiPlayer_play\" onclick=\"play()\"></a>")
|
||||
.append("<a class=\"icon pause\" id=\"midiPlayer_pause\" onclick=\"pause()\"></a>")
|
||||
.append("<a class=\"icon stop\" id=\"midiPlayer_stop\" onclick=\"stop()\"></a>");
|
||||
|
||||
$("#midiPlayer_div").css("width", options.width + 200);
|
||||
$("#midiPlayer_bar").css("width", options.width);
|
||||
$("#midiPlayer_progress").css("background", options.color);
|
||||
|
||||
// Assign the global variables
|
||||
midiPlayer_onStop = options.onStop;
|
||||
midiPlayer_onUpdate = options.onUpdate;
|
||||
midiPlayer_updateRate = options.updateRate;
|
||||
midiPlayer_bar = document.getElementById('midiPlayer_bar');
|
||||
midiPlayer_progress = document.getElementById('midiPlayer_progress');
|
||||
midiPlayer_playingTime = document.getElementById('midiPlayer_playingTime');
|
||||
midiPlayer_play = document.getElementById('midiPlayer_play');
|
||||
midiPlayer_pause = document.getElementById('midiPlayer_pause');
|
||||
midiPlayer_stop = document.getElementById('midiPlayer_stop');
|
||||
midiPlayer_totalTime = document.getElementById('midiPlayer_totalTime');
|
||||
|
||||
|
||||
var pageDragStart = 0;
|
||||
var barDragStart = 0;
|
||||
midiPlayer_bar.addEventListener('mousedown', function (e) {
|
||||
if (midiPlayer_totalSamples == 0) return;
|
||||
pageDragStart = e.pageX;
|
||||
barDragStart = e.offsetX;
|
||||
updateDragging(e.pageX);
|
||||
});
|
||||
window.addEventListener('mousemove', function (e) {
|
||||
if (pageDragStart != 0) {
|
||||
pause();
|
||||
updateDragging(e.pageX);
|
||||
}
|
||||
|
||||
});
|
||||
window.addEventListener('mouseup', function (e) {
|
||||
if (pageDragStart == 0) return;
|
||||
if (midiPlayer_totalSamples == 0) return;
|
||||
pageDragStart = 0;
|
||||
play();
|
||||
});
|
||||
|
||||
function updateDragging(pageX) {
|
||||
var posX = barDragStart + (pageX - pageDragStart);
|
||||
if (posX >= 0 && posX <= options.width) {
|
||||
var percent = posX / options.width;
|
||||
midiPlayer_currentSamples = percent * midiPlayer_totalSamples | 0;
|
||||
updateProgress(midiPlayer_currentSamples, midiPlayer_totalSamples);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
}
|
||||
(jQuery));
|
53
ProjectNow/NodeServer/public/scripts/script.js
Normal file
53
ProjectNow/NodeServer/public/scripts/script.js
Normal file
@@ -0,0 +1,53 @@
|
||||
function test(Arg){
|
||||
console.log("tEST");
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
console.log('iets');
|
||||
}
|
||||
};
|
||||
var audio;
|
||||
var reader = new FileReader();
|
||||
var test1 = httpGet(Arg);
|
||||
var enc = new TextEncoder("base64");
|
||||
var file = new File(enc.encode(test, true), "Kweetnie", {type : "audio/mid"});
|
||||
/*
|
||||
console.log(file);
|
||||
var midName = file.name;
|
||||
var wavName = midName.replace(/\..+?$/, '.wav');
|
||||
var wav = synth.midiToWav(file);
|
||||
var src = URL.createObjectURL(wav);
|
||||
audio = new Audio(src);
|
||||
audio.play();
|
||||
console.log(file)
|
||||
reader.readAsArrayBuffer(file);
|
||||
anchor.setAttribute('download', wavName);*/
|
||||
$("#player").midiPlayer({
|
||||
color: "red",
|
||||
onUnpdate: midiUpdate,
|
||||
onStop: midiStop,
|
||||
width: 250
|
||||
});
|
||||
var tempString = "data:audio/midi;base64,"+btoa(test);
|
||||
console.log(tempString);
|
||||
$("#player").midiPlayer.play(tempString);
|
||||
}
|
||||
|
||||
|
||||
function httpGet(theUrl)
|
||||
{
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
|
||||
xmlHttp.send( null );
|
||||
return xmlHttp.responseText;
|
||||
}
|
||||
var midiUpdate = function(time) {
|
||||
console.log(time);
|
||||
}
|
||||
var midiStop = function() {
|
||||
console.log("Stop");
|
||||
}
|
||||
|
||||
function startPlaying() {
|
||||
$("#player").midiPlayer.play(song);
|
||||
}
|
3
ProjectNow/NodeServer/public/scripts/synth.min.js
vendored
Normal file
3
ProjectNow/NodeServer/public/scripts/synth.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ProjectNow/NodeServer/public/scripts/synth.min.js.map
Normal file
1
ProjectNow/NodeServer/public/scripts/synth.min.js.map
Normal file
File diff suppressed because one or more lines are too long
BIN
ProjectNow/NodeServer/public/scripts/wildwebmidi.data
Normal file
BIN
ProjectNow/NodeServer/public/scripts/wildwebmidi.data
Normal file
Binary file not shown.
29
ProjectNow/NodeServer/public/scripts/wildwebmidi.js
Normal file
29
ProjectNow/NodeServer/public/scripts/wildwebmidi.js
Normal file
File diff suppressed because one or more lines are too long
BIN
ProjectNow/NodeServer/public/scripts/wildwebmidi.js.gz
Normal file
BIN
ProjectNow/NodeServer/public/scripts/wildwebmidi.js.gz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ProjectNow/NodeServer/public/wildwebmidi.data
Normal file
BIN
ProjectNow/NodeServer/public/wildwebmidi.data
Normal file
Binary file not shown.
Reference in New Issue
Block a user