-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from lazzarello/include-nexus-tutorial
[Nexus UI Tutorial](https://nexus-js.github.io/ui/api/#intro), but for Vue.js with [async components](https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components) loading to enable the web audio context. The async stuff might not be needed when the [relevant PR is merged](nexus-js/ui#190).
- Loading branch information
Showing
5 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<div class="mixer"> | ||
<button v-on:click="pan1()">Load Mixer Controls</button> | ||
<h1>I'm a ScarlettMixer!</h1> | ||
<div id="channel"> | ||
<div id="pan"></div> | ||
<div id="volume"></div> | ||
<div id="outbus"></div> | ||
</div> | ||
<div id="debug"> | ||
<hr /> | ||
<h3>Debugging</h3> | ||
<tt>{{ controls.data }}</tt> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import axios from 'axios' | ||
var apiURL = 'http://localhost:1234/jsonapi?request='; | ||
// https://nexus-js.github.io/ui/api/#intro | ||
import Nexus from 'nexusui' | ||
//we gotta seperate the actual rendering of NexusUI elements before the context is started | ||
function loadAudio() { | ||
Nexus.context.resume(); | ||
var pan = new Nexus.Pan('#pan'); | ||
var volume = new Nexus.Slider("#volume", { | ||
'size': [20,200] | ||
}); | ||
var outbus = new Nexus.Toggle('#outbus'); | ||
var channel = [pan, volume, outbus]; | ||
pan.on('change', function(v) { | ||
console.log('Pan ' + v.value); | ||
}) | ||
volume.on('change', function(v) { | ||
console.log('Volume ' + v); | ||
}) | ||
outbus.on('change', function(v) { | ||
console.log('Channel ' + v); | ||
}) | ||
return channel; | ||
} | ||
export default { | ||
data () { | ||
return { | ||
controls: null, | ||
loading: true, | ||
errored: false, | ||
pan1: loadAudio, | ||
context: Nexus.context | ||
} | ||
}, | ||
mounted () { | ||
// There can be more than one device named hw:USB | ||
// I'll have to pass in cardid from a value from the Scarlett component | ||
axios | ||
.get(apiURL + 'ctrl-get-all' + '&cardid=hw:USB') | ||
.then(response => (this.controls = response.data)) | ||
.catch(error => { | ||
console.log(error) | ||
this.errored = true | ||
}) | ||
.finally(() => this.loading = false) | ||
}, | ||
name: 'ScarlettMixer' | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters