moved patch and add patch fetch function to minimize load
parent
d28e7a34a8
commit
15b0140cd0
File diff suppressed because one or more lines are too long
|
@ -1,55 +0,0 @@
|
|||
Copyright (c) 2023 Cycling '74
|
||||
|
||||
The code that Max generates automatically and that end users are capable of
|
||||
exporting and using, and any associated documentation files (the “Software”)
|
||||
is a work of authorship for which Cycling '74 is the author and owner for
|
||||
copyright purposes.
|
||||
|
||||
This Software is dual-licensed either under the terms of the Cycling '74
|
||||
License for Max-Generated Code for Export, or alternatively under the terms
|
||||
of the General Public License (GPL) Version 3. You may use the Software
|
||||
according to either of these licenses as it is most appropriate for your
|
||||
project on a case-by-case basis (proprietary or not).
|
||||
|
||||
A) Cycling '74 License for Max-Generated Code for Export
|
||||
|
||||
A license is hereby granted, free of charge, to any person obtaining a copy
|
||||
of the Software (“Licensee”) to use, copy, modify, merge, publish, and
|
||||
distribute copies of the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following conditions:
|
||||
|
||||
The Software is licensed to Licensee for all uses that do not include the sale,
|
||||
sublicensing, or commercial distribution of software that incorporates this
|
||||
source code. This means that the Licensee is free to use this software for
|
||||
educational, research, and prototyping purposes, to create musical or other
|
||||
creative works with software that incorporates this source code, or any other
|
||||
use that does not constitute selling software that makes use of this source
|
||||
code. Commercial distribution also includes the packaging of free software with
|
||||
other paid software, hardware, or software-provided commercial services.
|
||||
|
||||
For entities with UNDER $200k in annual revenue or funding, a license is hereby
|
||||
granted, free of charge, for the sale, sublicensing, or commercial distribution
|
||||
of software that incorporates this source code, for as long as the entity's
|
||||
annual revenue remains below $200k annual revenue or funding.
|
||||
|
||||
For entities with OVER $200k in annual revenue or funding interested in the
|
||||
sale, sublicensing, or commercial distribution of software that incorporates
|
||||
this source code, please send inquiries to licensing@cycling74.com.
|
||||
|
||||
The above copyright notice and this license shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Please see
|
||||
https://support.cycling74.com/hc/en-us/articles/10730637742483-RNBO-Export-Licensing-FAQ
|
||||
for additional information
|
||||
|
||||
B) General Public License Version 3 (GPLv3)
|
||||
Details of the GPLv3 license can be found at: https://www.gnu.org/licenses/gpl-3.0.html
|
|
@ -1 +0,0 @@
|
|||
[]
|
21
src/main.ts
21
src/main.ts
|
@ -1,9 +1,9 @@
|
|||
import { createDevice, type Device } from '@rnbo/js'
|
||||
import { attachDBValueListener } from './dbValueListener'
|
||||
import controlValuesPatcher from './assets/patch/LAF-Controll-Values_Simple_Band1000.rnbopat.export.json'
|
||||
import { fetchOrLoadBuffer, createBufferSource } from './composables/BufferStore'
|
||||
import { setupPlayButton } from './composables/Player';
|
||||
import { getPreferredDevice } from './lib/microphone';
|
||||
import patcherUrl from '../public/patches/controlvalue/LAF-Controll-Values_Simple_Band1000.rnbopat.export.json?url'
|
||||
|
||||
interface DeviceInfo {
|
||||
id: number;
|
||||
|
@ -12,9 +12,14 @@ interface DeviceInfo {
|
|||
audioNode: AudioNode;
|
||||
}
|
||||
|
||||
// RNBO
|
||||
// RNBO
|
||||
let patcherPromise: Promise<any>
|
||||
|
||||
// create context & master gain
|
||||
const ctx = new AudioContext() // match your assets
|
||||
const mobile = /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
let WAContext = window.AudioContext || window.webkitAudioContext
|
||||
const ctx = new WAContext() // match your assets
|
||||
const mobile = /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
console.log("AudioContext created")
|
||||
|
||||
//
|
||||
|
@ -45,8 +50,13 @@ const urlsWebM = mobile ? [
|
|||
{ name: bands[8], url: 'audio/masking/9bands/Quellrauschen16000.webm' },
|
||||
]
|
||||
|
||||
async function init() {
|
||||
async function getPatcher() {
|
||||
if (!patcherPromise) patcherPromise = fetch(patcherUrl).then(r => r.json())
|
||||
return patcherPromise
|
||||
}
|
||||
|
||||
async function init() {
|
||||
await getPatcher()
|
||||
const newDevices = await Promise.all(
|
||||
bands.map(async (freq, index) => {
|
||||
const device = await createBandDevice(freq, ctx) as DeviceInfo
|
||||
|
@ -133,7 +143,6 @@ async function initMicrophone() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function creates a RNBODevice with a given frequency. If the microphone is connected
|
||||
* this devices sends out control Values as messages.
|
||||
|
@ -142,7 +151,7 @@ async function initMicrophone() {
|
|||
* @returns RNBO Device
|
||||
*/
|
||||
async function createBandDevice(freq: number, ctx: AudioContext): Promise<DeviceInfo> {
|
||||
const patcher = await controlValuesPatcher as any
|
||||
const patcher = await getPatcher()
|
||||
const rnboDevice = await createDevice({
|
||||
context: ctx,
|
||||
patcher
|
||||
|
|
Loading…
Reference in New Issue