Skip to content

Commit

Permalink
Added CI/CD and Dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
dmotte committed Jan 5, 2024
1 parent 82d15b0 commit 424cba2
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 242 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: main

on:
push: # All branches and tags

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
job:
uses: dmotte/misc/.github/workflows/cicd-with-script.yml@main
232 changes: 118 additions & 114 deletions bnplay-audio-api.html
Original file line number Diff line number Diff line change
@@ -1,131 +1,135 @@
<!DOCTYPE html>
<html>

<head>
<head>
<title>BNPlay - Audio API version</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />

<style type="text/css">
body,
td,
th {
font-family: sans-serif;
}
body {
background-color: #222;
color: #ccc;
}
.text-center {
text-align: center;
}
.btn-ctrl {
background-color: #000;
color: #ccc;
border: 1px solid #888;
padding: 20px 30px;
font-weight: bold;
}
.btn-ctrl:disabled {
color: #c60;
border: 1px solid #f80;
}
body,
td,
th {
font-family: sans-serif;
}

body {
background-color: #222;
color: #ccc;
}

.text-center {
text-align: center;
}

.btn-ctrl {
background-color: #000;
color: #ccc;
border: 1px solid #888;
padding: 20px 30px;
font-weight: bold;
}

.btn-ctrl:disabled {
color: #c60;
border: 1px solid #f80;
}
</style>

<script type="text/javascript">
var bnp_audioCtx = new AudioContext();
var bnp_audioData;
var bnp_source = null;

function bnp_load() {
// This URL has CORS enabled
return fetch("https://dmotte.github.io/bnplay/bn-sample.flac")
.then((response) => {
if (!response.ok)
throw new Error("HTTP error " + response.status);
return response.arrayBuffer();
})
.then(buffer => bnp_audioCtx.decodeAudioData(buffer))
.then(audioData => {
bnp_audioData = audioData;
});
}

function bnp_isPlaying() {
return bnp_source !== null;
}

function bnp_play() {
if (bnp_isPlaying())
return;

bnp_source = new AudioBufferSourceNode(bnp_audioCtx);
bnp_source.buffer = bnp_audioData;
bnp_source.connect(bnp_audioCtx.destination);
bnp_source.loop = true;
bnp_source.start(0);
}

function bnp_stop() {
if (!bnp_isPlaying())
return;

bnp_source.stop();
bnp_source = null;
}

function bnp_toggle() {
if (bnp_isPlaying())
bnp_stop();
else
bnp_play();
}
var bnp_audioCtx = new AudioContext();
var bnp_audioData;
var bnp_source = null;

function bnp_load() {
// This URL has CORS enabled
return fetch("https://dmotte.github.io/bnplay/bn-sample.flac")
.then((response) => {
if (!response.ok) throw new Error("HTTP error " + response.status);
return response.arrayBuffer();
})
.then((buffer) => bnp_audioCtx.decodeAudioData(buffer))
.then((audioData) => {
bnp_audioData = audioData;
});
}

function bnp_isPlaying() {
return bnp_source !== null;
}

function bnp_play() {
if (bnp_isPlaying()) return;

bnp_source = new AudioBufferSourceNode(bnp_audioCtx);
bnp_source.buffer = bnp_audioData;
bnp_source.connect(bnp_audioCtx.destination);
bnp_source.loop = true;
bnp_source.start(0);
}

function bnp_stop() {
if (!bnp_isPlaying()) return;

bnp_source.stop();
bnp_source = null;
}

function bnp_toggle() {
if (bnp_isPlaying()) bnp_stop();
else bnp_play();
}
</script>

<script type="text/javascript">
function ui_load() {
btnToggle = document.getElementById("btnToggle");

return bnp_load().then(() => {
btnToggle.removeAttribute("disabled");
ui_update();
});
function ui_load() {
btnToggle = document.getElementById("btnToggle");

return bnp_load().then(() => {
btnToggle.removeAttribute("disabled");
ui_update();
});
}

function ui_update() {
btnToggle = document.getElementById("btnToggle");
divStatus = document.getElementById("divStatus");

if (bnp_isPlaying()) {
divStatus.innerHTML = "Playing...";
btnToggle.value = "STOP";
} else {
divStatus.innerHTML = "Stopped.";
btnToggle.value = "PLAY";
}
}

function ui_update() {
btnToggle = document.getElementById("btnToggle");
divStatus = document.getElementById("divStatus");

if (bnp_isPlaying()) {
divStatus.innerHTML = "Playing...";
btnToggle.value = "STOP";
} else {
divStatus.innerHTML = "Stopped.";
btnToggle.value = "PLAY";
}
}

function ui_toggle() {
bnp_toggle();
ui_update();
}
function ui_toggle() {
bnp_toggle();
ui_update();
}
</script>
</head>
</head>

<body onload="ui_load()" onkeypress="if (event.key == ' ') btnToggle.click();">
<body
onload="ui_load()"
onkeypress="if (event.key == ' ') btnToggle.click();"
>
<div class="text-center">
<h1>Brown noise</h1>

<p><i>Audio API version</i></p>
<br/>
<div id="divStatus">Please wait...</div>
<br/>
<input type="button" id="btnToggle" value="Loading..." class="btn-ctrl" onfocus="this.blur()" onclick="ui_toggle()" disabled="disabled" />
<h1>Brown noise</h1>

<p><i>Audio API version</i></p>
<br />
<div id="divStatus">Please wait...</div>
<br />
<input
type="button"
id="btnToggle"
value="Loading..."
class="btn-ctrl"
onfocus="this.blur()"
onclick="ui_toggle()"
disabled="disabled"
/>
</div>
</body>

</html>
</body>
</html>
Loading

0 comments on commit 424cba2

Please sign in to comment.