forked from external-repos/noisedash
Compare commits
115 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd73809ad9 | ||
|
|
3d7c3545ea | ||
|
|
02c5fd9660 | ||
|
|
d98b23ed40 | ||
|
|
d57ea01750 | ||
|
|
3cc060fdae | ||
|
|
2f21025d20 | ||
|
|
bdbbdee48d | ||
|
|
f442d486a3 | ||
|
|
ef3eb1a70a | ||
|
|
2bb67a9a22 | ||
|
|
af2384b790 | ||
|
|
d83639b5c6 | ||
|
|
5d3a6fb912 | ||
|
|
722e0600f1 | ||
|
|
cd65c0b714 | ||
|
|
d73afdb68c | ||
|
|
e72503e91e | ||
|
|
294a4e4dec | ||
|
|
21fda5ce04 | ||
|
|
17301b5b31 | ||
|
|
923f5bb52e | ||
|
|
0cac4f2d5a | ||
|
|
5b99b8cfc2 | ||
|
|
1ae403171e | ||
|
|
c329f4f70a | ||
|
|
f1654d39ca | ||
|
|
a698934823 | ||
|
|
0ec92bad85 | ||
|
|
0bb814e763 | ||
|
|
621576db14 | ||
|
|
80969ca029 | ||
|
|
26fc54054f | ||
|
|
8a1fc99fb5 | ||
|
|
e6cc5b36c5 | ||
|
|
6c4c24c166 | ||
|
|
9466ed692b | ||
|
|
5ace3d9996 | ||
|
|
c4642df353 | ||
|
|
aca7fbd1e0 | ||
|
|
90f4d50b7f | ||
|
|
66b23f39a6 | ||
|
|
4d22dab887 | ||
|
|
bc93b05c4e | ||
|
|
60a01908c2 | ||
|
|
5879e6d327 | ||
|
|
88cbfe0bf1 | ||
|
|
74c7d543c0 | ||
|
|
dc81a65c7a | ||
|
|
3358efce1d | ||
|
|
2d71af03d0 | ||
|
|
aae33a6121 | ||
|
|
cc3fe4608d | ||
|
|
38de3595c4 | ||
|
|
4330b04c1f | ||
|
|
70aa906110 | ||
|
|
55851a4cd0 | ||
|
|
3c738925bc | ||
|
|
3dbbf4c85d | ||
|
|
a3f7709adf | ||
|
|
496b71ee7b | ||
|
|
c2aad26e3f | ||
|
|
b84522847a | ||
|
|
231dea143a | ||
|
|
659d48548d | ||
|
|
7dc4524fa0 | ||
|
|
9b2bdaf159 | ||
|
|
d3cc1db2f9 | ||
|
|
34215b4126 | ||
|
|
5fc23030d4 | ||
|
|
4fc23521c1 | ||
|
|
cb3e39729a | ||
|
|
5219f53655 | ||
|
|
a2b6f1245c | ||
|
|
9400959852 | ||
|
|
72a7f99850 | ||
|
|
f40e6d47f4 | ||
|
|
4ab595f3a1 | ||
|
|
625ce328dd | ||
|
|
411270b850 | ||
|
|
2cc5051ab4 | ||
|
|
ff902fac16 | ||
|
|
8e1a8aeb05 | ||
|
|
fa59f8ebfe | ||
|
|
f8289ad4d1 | ||
|
|
5fb7066e59 | ||
|
|
6cc6493ee6 | ||
|
|
c97c87f58c | ||
|
|
4bc985d36e | ||
|
|
c6ff0b6def | ||
|
|
319be778b0 | ||
|
|
86141a124c | ||
|
|
8ad174b0af | ||
|
|
c485b0a786 | ||
|
|
e13a056706 | ||
|
|
232163064e | ||
|
|
5a5660c361 | ||
|
|
f1db1883f7 | ||
|
|
85e0ff36dd | ||
|
|
da40516e10 | ||
|
|
022412473f | ||
|
|
06d4f10208 | ||
|
|
0a6bf8b44d | ||
|
|
bfb0891844 | ||
|
|
3628dc456a | ||
|
|
0916ff314e | ||
|
|
37dc916dcc | ||
|
|
d59bb03b13 | ||
|
|
2569227beb | ||
|
|
6be2169cb3 | ||
|
|
7a59000a41 | ||
|
|
7127e473b8 | ||
|
|
c1bcc69ee3 | ||
|
|
64e5c63d2a | ||
|
|
7a361f9c34 |
@@ -8,7 +8,7 @@ module.exports = {
|
|||||||
'@vue/standard'
|
'@vue/standard'
|
||||||
],
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: 'babel-eslint'
|
parser: '@babel/eslint-parser'
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
|
|||||||
4
.github/FUNDING.yml
vendored
Normal file
4
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: kaythomas0
|
||||||
|
custom: "https://kaythomas.dev/cryptocurrency.html"
|
||||||
8
.github/dependabot.yml
vendored
Normal file
8
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
# Disable version updates for npm dependencies
|
||||||
|
open-pull-requests-limit: 0
|
||||||
BIN
.github/noisedash-screenshot-1.jpg
vendored
BIN
.github/noisedash-screenshot-1.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 78 KiB |
BIN
.github/noisedash-screenshot-4.png
vendored
Normal file
BIN
.github/noisedash-screenshot-4.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
38
.github/workflows/docker-image.yml
vendored
Normal file
38
.github/workflows/docker-image.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Docker Image CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- labeled
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buildx:
|
||||||
|
if: ${{ github.event.label.name == 'run-workflow' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: noisedash/noisedash:latest,noisedash/noisedash:${{ github.head_ref }}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
## Project setup
|
## Project setup
|
||||||
|
Requires [Node](https://nodejs.org/en/download/) and [Vue CLI](https://cli.vuejs.org/guide/installation.html)
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
@@ -23,5 +25,22 @@ npm run build
|
|||||||
npm run lint
|
npm run lint
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Directory Summary
|
||||||
|
|
||||||
|
Here are some of the more important files and directories:
|
||||||
|
|
||||||
|
* `config/default.json`: Contains the default configuration file
|
||||||
|
* `server/*`: Where all of the node server related code is
|
||||||
|
* `server/app.js`: The main server file where server settings are set
|
||||||
|
* `server/db.js`: Where the database is created
|
||||||
|
* `server/logger.js`: Where the logger is created and configured
|
||||||
|
* `server/bin/www.js`: The entry point of the server application (what you run to start the server)
|
||||||
|
* `server/boot/*`: These are run on server startup
|
||||||
|
* `server/routes/*`: Where all of the server routes and logic are defined
|
||||||
|
* `src/*`: Contains all the frontend code
|
||||||
|
* `src/components/*`: Where all of the Vue components are defined, split into vue and js files for each component
|
||||||
|
* `src/router/index.js`: Where all the routing and route-protection logic is defined
|
||||||
|
* `src/views/*`: Contains all the views
|
||||||
|
|
||||||
### Customize configuration
|
### Customize configuration
|
||||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
FROM node:14
|
FROM node:16
|
||||||
LABEL maintainer="me@kevinthomas.dev"
|
LABEL maintainer="kaythomas@pm.me"
|
||||||
WORKDIR /var/noisedash
|
WORKDIR /var/noisedash
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm install --force
|
||||||
COPY . .
|
COPY . .
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
Self-hostable web tool for generating ambient noises
|
Self-hostable web tool for generating ambient noises
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
(More screenshots on the [wiki](https://github.com/KevinThomas0/noisedash/wiki/Screenshots))
|
(More screenshots on the [wiki](https://github.com/kaythomas0/noisedash/wiki/Screenshots))
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
* Generate and customize ambient noises and user-uploadable samples (leveraging [Tone.js](https://github.com/Tonejs/Tone.js/))
|
* Generate and customize ambient noises and user-uploadable samples (leveraging [Tone.js](https://github.com/Tonejs/Tone.js/))
|
||||||
* Save "noise profiles" so you can easily switch between your created soundscapes
|
* Save "noise profiles" so you can easily switch between your created soundscapes. Import and export them for easy sharing, record them for use elsewhere
|
||||||
* Fine-tune your noises with audio processing tools like filters, LFOs, and effects
|
* Fine-tune your noises with audio processing tools like filters, LFOs, and effects
|
||||||
* Upload audio samples (e.g rain, wind, thunder) to combine with your generated noises
|
* Upload and edit audio samples (e.g rain, wind, thunder) to combine with your generated noises. Add effects to them and set playback modes
|
||||||
* Use admin tools to manage multiple users
|
* Use admin tools to manage multiple users
|
||||||
* Mobile friendly
|
* Mobile friendly
|
||||||
|
|
||||||
@@ -21,8 +21,8 @@ Self-hostable web tool for generating ambient noises
|
|||||||
|
|
||||||
Requires docker and docker-compose
|
Requires docker and docker-compose
|
||||||
|
|
||||||
* Download the provided [docker-compose.yml file](https://github.com/KevinThomas0/noisedash/blob/main/docker-compose.yml)
|
* Download the provided [docker-compose.yml file](https://github.com/kaythomas0/noisedash/blob/main/docker-compose.yml)
|
||||||
* In the same directory as the docker-compose file, created a folder called `config`, and inside it, put the provided [config file](https://github.com/KevinThomas0/noisedash/blob/main/config/default.json)
|
* In the same directory as the docker-compose file, created a folder called `config`, and inside it, put the provided [config file](https://github.com/kaythomas0/noisedash/blob/main/config/default.json)
|
||||||
* Edit the config file to your preference
|
* Edit the config file to your preference
|
||||||
* Bring the container up:
|
* Bring the container up:
|
||||||
|
|
||||||
@@ -32,14 +32,16 @@ docker-compose up -d
|
|||||||
|
|
||||||
* Proceed to the URL where it's deployed and register your first user
|
* Proceed to the URL where it's deployed and register your first user
|
||||||
|
|
||||||
|
(Raspberry Pi compatible images are available, see armv7 images on [Docker Hub](https://hub.docker.com/repository/docker/noisedash/noisedash))
|
||||||
|
|
||||||
## From Source
|
## From Source
|
||||||
|
|
||||||
Requires node 14 and npm
|
Requires node 16 and npm
|
||||||
|
|
||||||
* Clone the repo:
|
* Clone the repo:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
git clone https://github.com/KevinThomas0/noisedash.git
|
git clone https://github.com/kaythomas0/noisedash.git
|
||||||
cd noisedash
|
cd noisedash
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -62,4 +64,22 @@ npm run server-prod
|
|||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
See [CONTRIBUTING.md](https://github.com/KevinThomas0/noisedash/blob/main/CONTRIBUTING.md)
|
See [CONTRIBUTING.md](https://github.com/kaythomas0/noisedash/blob/main/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
Noisedash, a self-hostable web tool for generating ambient noises
|
||||||
|
Copyright (C) 2021 Kay Thomas <kaythomas@pm.me>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
"sessionFileStorePath": "sessions",
|
"sessionFileStorePath": "sessions",
|
||||||
"sampleUploadPath": "samples",
|
"sampleUploadPath": "samples",
|
||||||
"maxSampleSize": 10737418240, // In bytes, 10GB by default
|
"maxSampleSize": 10737418240, // In bytes, 10GB by default
|
||||||
"sessionSecret": "CHANGE_THIS",
|
|
||||||
"logFile": "log/noisedash.log",
|
"logFile": "log/noisedash.log",
|
||||||
"tls": false, // Keep this as false if using an external web server like nginx
|
"tls": false, // Keep this as false if using an external web server like nginx
|
||||||
"tlsKey": "certs/key.pem",
|
"tlsKey": "certs/key.pem",
|
||||||
|
|||||||
1
config/production.json
Normal file
1
config/production.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{} // Left empty intentionally: https://github.com/node-config/node-config/wiki/Strict-Mode#node_env-value-of-node_env-did-not-match-any-deployment-config-file-names=
|
||||||
@@ -2,14 +2,14 @@ version: "3"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
noisedash:
|
noisedash:
|
||||||
image: kevinthomas0/noisedash:latest
|
image: noisedash/noisedash:latest
|
||||||
container_name: noisedash
|
container_name: noisedash
|
||||||
ports:
|
ports:
|
||||||
- "1432:1432"
|
- "1432:1432"
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/noisedash/db
|
- db:/var/noisedash/db
|
||||||
- samples:/var/noisedash/samples
|
- samples:/var/noisedash/samples
|
||||||
- ./config:/var/noisedash/config
|
- ./config/default.json:/var/noisedash/config/default.json
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db:
|
db:
|
||||||
|
|||||||
30704
package-lock.json
generated
30704
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
57
package.json
57
package.json
@@ -1,18 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "noisedash",
|
"name": "noisedash",
|
||||||
"descriptions": "Self-hostable web tool for generating ambient noises",
|
"version": "0.6.12",
|
||||||
"homepage": "https://github.com/KevinThomas0/noisedash",
|
|
||||||
"bugs": "https://github.com/KevinThomas0/noisedash/issues",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"author": "Kevin Thomas <me@kevinthomas.dev> (https://kevinthomas.dev)",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"author": "Kay Thomas <kaythomas@pm.me> (https://kaythomas.dev)",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"server": "node server/bin/www.js",
|
|
||||||
"server-prod": "NODE_ENV=production node server/bin/www.js",
|
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint",
|
||||||
|
"server": "node server/bin/www.js",
|
||||||
|
"server-prod": "NODE_ENV=production node server/bin/www.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vscode/sqlite3": "^5.0.8",
|
"@vscode/sqlite3": "^5.0.8",
|
||||||
@@ -20,38 +16,43 @@
|
|||||||
"config": "^3.3.6",
|
"config": "^3.3.6",
|
||||||
"connect-history-api-fallback": "^1.6.0",
|
"connect-history-api-fallback": "^1.6.0",
|
||||||
"cookie-parser": "^1.4.5",
|
"cookie-parser": "^1.4.5",
|
||||||
"core-js": "^3.19.1",
|
"core-js": "^3.23.5",
|
||||||
"express": "^4.17.1",
|
"express": "^4.18.1",
|
||||||
"express-session": "^1.17.2",
|
"express-session": "^1.17.3",
|
||||||
"multer": "^1.4.3",
|
"multer": "^1.4.5-lts.1",
|
||||||
"passport": "^0.4.1",
|
"passport": "^0.6.0",
|
||||||
"passport-local": "^1.0.0",
|
"passport-local": "^1.0.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"session-file-store": "^1.5.0",
|
"session-file-store": "^1.5.0",
|
||||||
"tone": "^14.7.77",
|
"tone": "^14.7.77",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-router": "^3.5.3",
|
"vue-router": "^3.5.4",
|
||||||
"vuetify": "^2.5.12",
|
"vuetify": "^2.6.10",
|
||||||
"winston": "^3.3.3"
|
"winston": "^3.3.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "^4.5.15",
|
"@babel/core": "^7.12.16",
|
||||||
"@vue/cli-plugin-eslint": "^4.5.15",
|
"@babel/eslint-parser": "^7.12.16",
|
||||||
"@vue/cli-plugin-router": "^4.5.15",
|
"@vue/cli-plugin-babel": "^5.0.8",
|
||||||
"@vue/cli-service": "^4.5.15",
|
"@vue/cli-plugin-eslint": "^5.0.8",
|
||||||
"@vue/eslint-config-standard": "^5.1.2",
|
"@vue/cli-plugin-router": "^5.0.8",
|
||||||
"babel-eslint": "^10.1.0",
|
"@vue/cli-service": "^5.0.8",
|
||||||
"eslint": "^6.7.2",
|
"@vue/eslint-config-standard": "^6.1.0",
|
||||||
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-html": "^6.2.0",
|
"eslint-plugin-html": "^6.2.0",
|
||||||
"eslint-plugin-import": "^2.25.2",
|
"eslint-plugin-import": "^2.25.3",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^5.1.0",
|
||||||
"eslint-plugin-standard": "^4.0.0",
|
"eslint-plugin-standard": "^4.0.0",
|
||||||
"eslint-plugin-vue": "^6.2.2",
|
"eslint-plugin-vue": "^8.0.3",
|
||||||
"sass": "~1.32.0",
|
"sass": "~1.32.0",
|
||||||
"sass-loader": "^10.0.0",
|
"sass-loader": "^10.0.0",
|
||||||
"vue-cli-plugin-vuetify": "^2.4.3",
|
"vue-cli-plugin-vuetify": "^2.5.8",
|
||||||
"vue-template-compiler": "^2.6.11",
|
"vue-template-compiler": "^2.6.11",
|
||||||
"vuetify-loader": "^1.7.3"
|
"vuetify-loader": "^1.7.3"
|
||||||
}
|
},
|
||||||
|
"bugs": "https://github.com/kaythomas0/noisedash/issues",
|
||||||
|
"descriptions": "Self-hostable web tool for generating ambient noises",
|
||||||
|
"homepage": "https://github.com/kaythomas0/noisedash",
|
||||||
|
"license": "AGPL-3.0-or-later"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const path = require('path')
|
|||||||
const cookieParser = require('cookie-parser')
|
const cookieParser = require('cookie-parser')
|
||||||
const config = require('config')
|
const config = require('config')
|
||||||
const history = require('connect-history-api-fallback')
|
const history = require('connect-history-api-fallback')
|
||||||
|
const crypto = require('crypto')
|
||||||
const authRouter = require('./routes/auth')
|
const authRouter = require('./routes/auth')
|
||||||
const usersRouter = require('./routes/users')
|
const usersRouter = require('./routes/users')
|
||||||
const profilesRouter = require('./routes/profiles')
|
const profilesRouter = require('./routes/profiles')
|
||||||
@@ -30,11 +31,13 @@ app.use('/samples', express.static(path.join(__dirname, '../', config.get('Serve
|
|||||||
app.use(history())
|
app.use(history())
|
||||||
app.use('/samples', express.static(path.join(__dirname, '../', config.get('Server.sampleUploadPath'))))
|
app.use('/samples', express.static(path.join(__dirname, '../', config.get('Server.sampleUploadPath'))))
|
||||||
|
|
||||||
|
const sessionSecret = crypto.randomBytes(64).toString('hex')
|
||||||
app.use(session({
|
app.use(session({
|
||||||
store: new FileStore(fileStoreOptions),
|
store: new FileStore(fileStoreOptions),
|
||||||
secret: config.get('Server.sessionSecret'),
|
secret: sessionSecret,
|
||||||
resave: true,
|
resave: true,
|
||||||
saveUninitialized: true
|
saveUninitialized: true,
|
||||||
|
cookie: { sameSite: 'strict' }
|
||||||
}))
|
}))
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
const msgs = req.session.messages || []
|
const msgs = req.session.messages || []
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const db = require('../db')
|
const db = require('../db')
|
||||||
|
const logger = require('../logger')
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
db.serialize(() => {
|
db.serialize(() => {
|
||||||
@@ -51,5 +52,54 @@ module.exports = function () {
|
|||||||
FOREIGN KEY(profile) REFERENCES profiles(id),
|
FOREIGN KEY(profile) REFERENCES profiles(id),
|
||||||
FOREIGN KEY(sample) REFERENCES samples(id))`
|
FOREIGN KEY(sample) REFERENCES samples(id))`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
db.get('PRAGMA user_version', (err, row) => {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
} else {
|
||||||
|
const userVersion = row.user_version
|
||||||
|
|
||||||
|
db.serialize(() => {
|
||||||
|
if (userVersion < 1) {
|
||||||
|
db.run('ALTER TABLE samples ADD COLUMN fade_in REAL DEFAULT 0')
|
||||||
|
db.run('ALTER TABLE samples ADD COLUMN loop_points_enabled INTEGER DEFAULT 0')
|
||||||
|
db.run('ALTER TABLE samples ADD COLUMN loop_start REAL DEFAULT 0')
|
||||||
|
db.run('ALTER TABLE samples ADD COLUMN loop_end REAL DEFAULT 0')
|
||||||
|
|
||||||
|
db.run('PRAGMA user_version = 1')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userVersion < 2) {
|
||||||
|
db.run('ALTER TABLE users ADD COLUMN preferences TEXT DEFAULT "{}"')
|
||||||
|
|
||||||
|
db.run('PRAGMA user_version = 2')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userVersion < 3) {
|
||||||
|
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_enabled INTEGER DEFAULT 0')
|
||||||
|
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_pre_delay REAL DEFAULT 0')
|
||||||
|
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_decay REAL DEFAULT 0')
|
||||||
|
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_wet INTEGER DEFAULT 0')
|
||||||
|
db.run('ALTER TABLE profiles_samples ADD COLUMN playback_mode TEXT DEFAULT "continuous"')
|
||||||
|
db.run('ALTER TABLE profiles_samples ADD COLUMN sporadic_min INTEGER DEFAULT 30')
|
||||||
|
db.run('ALTER TABLE profiles_samples ADD COLUMN sporadic_max INTEGER DEFAULT 300')
|
||||||
|
|
||||||
|
db.run('PRAGMA user_version = 3')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userVersion < 4) {
|
||||||
|
db.run('UPDATE users SET preferences = ? WHERE preferences = ?',
|
||||||
|
['{"accentColor":{"alpha":1,"hex":"#607D8B","hexa":"#607D8BFF","hsla":{"h":200,"s":18,"l":46,"a":1},"hsva":{"h":200,"s":31,"v":55,"a":1},"hue":200,"rgba":{"r":96,"g":125,"b":139,"a":1}}}', '{}'],
|
||||||
|
(err) => {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
} else {
|
||||||
|
db.run('PRAGMA user_version = 4')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,14 @@ router.get('/admin', (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
router.get('/logout', (req, res) => {
|
router.get('/logout', (req, res) => {
|
||||||
req.logout()
|
req.logout((err) => {
|
||||||
res.sendStatus(200)
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
res.sendStatus(500)
|
||||||
|
} else {
|
||||||
|
res.sendStatus(200)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
router.get('/setup', (req, res) => {
|
router.get('/setup', (req, res) => {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ router.post('/profiles', (req, res) => {
|
|||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -59,10 +59,28 @@ router.post('/profiles', (req, res) => {
|
|||||||
profileID = this.lastID
|
profileID = this.lastID
|
||||||
|
|
||||||
req.body.samples.forEach(s => {
|
req.body.samples.forEach(s => {
|
||||||
db.run('INSERT INTO profiles_samples (profile, sample, volume) VALUES (?, ?, ?)', [
|
db.run(`INSERT INTO profiles_samples(
|
||||||
|
profile,
|
||||||
|
sample,
|
||||||
|
volume,
|
||||||
|
reverb_enabled,
|
||||||
|
reverb_pre_delay,
|
||||||
|
reverb_decay,
|
||||||
|
reverb_wet,
|
||||||
|
playback_mode,
|
||||||
|
sporadic_min,
|
||||||
|
sporadic_max)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
||||||
profileID,
|
profileID,
|
||||||
s.id,
|
s.id,
|
||||||
s.volume
|
s.volume,
|
||||||
|
s.reverbEnabled,
|
||||||
|
s.reverbPreDelay,
|
||||||
|
s.reverbDecay,
|
||||||
|
s.reverbWet,
|
||||||
|
s.playbackMode,
|
||||||
|
s.sporadicMin,
|
||||||
|
s.sporadicMax
|
||||||
],
|
],
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -77,6 +95,66 @@ router.post('/profiles', (req, res) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.post('/profiles/import', (req, res) => {
|
||||||
|
if (!req.user) {
|
||||||
|
return res.sendStatus(401)
|
||||||
|
}
|
||||||
|
|
||||||
|
let profileID = 0
|
||||||
|
|
||||||
|
db.serialize(() => {
|
||||||
|
db.run(`INSERT INTO profiles (
|
||||||
|
name,
|
||||||
|
user,
|
||||||
|
timer_enabled,
|
||||||
|
duration,
|
||||||
|
volume,
|
||||||
|
noise_color,
|
||||||
|
filter_enabled,
|
||||||
|
filter_type,
|
||||||
|
filter_cutoff,
|
||||||
|
lfo_filter_cutoff_enabled,
|
||||||
|
lfo_filter_cutoff_frequency,
|
||||||
|
lfo_filter_cutoff_low,
|
||||||
|
lfo_filter_cutoff_high,
|
||||||
|
tremolo_enabled,
|
||||||
|
tremolo_frequency,
|
||||||
|
tremolo_depth)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
||||||
|
req.body.name,
|
||||||
|
req.user.id,
|
||||||
|
req.body.isTimerEnabled ? 1 : 0,
|
||||||
|
req.body.duration,
|
||||||
|
req.body.volume,
|
||||||
|
req.body.noiseColor,
|
||||||
|
req.body.isFilterEnabled ? 1 : 0,
|
||||||
|
req.body.filterType,
|
||||||
|
req.body.filterCutoff,
|
||||||
|
req.body.isLFOFilterCutoffEnabled ? 1 : 0,
|
||||||
|
req.body.lfoFilterCutoffFrequency,
|
||||||
|
req.body.lfoFilterCutoffLow,
|
||||||
|
req.body.lfoFilterCutoffHigh,
|
||||||
|
req.body.isTremoloEnabled ? 1 : 0,
|
||||||
|
req.body.tremoloFrequency,
|
||||||
|
req.body.tremoloDepth
|
||||||
|
],
|
||||||
|
function (err) {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
|
return res.sendStatus(409)
|
||||||
|
} else {
|
||||||
|
return res.sendStatus(500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
profileID = this.lastID
|
||||||
|
|
||||||
|
return res.json({ id: profileID })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
router.put('/profiles/:profileId', (req, res) => {
|
router.put('/profiles/:profileId', (req, res) => {
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.sendStatus(401)
|
return res.sendStatus(401)
|
||||||
@@ -144,10 +222,28 @@ router.put('/profiles/:profileId', (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
req.body.samples.forEach(s => {
|
req.body.samples.forEach(s => {
|
||||||
db.run('INSERT INTO profiles_samples (profile, sample, volume) VALUES (?, ?, ?)', [
|
db.run(`INSERT INTO profiles_samples(
|
||||||
|
profile,
|
||||||
|
sample,
|
||||||
|
volume,
|
||||||
|
reverb_enabled,
|
||||||
|
reverb_pre_delay,
|
||||||
|
reverb_decay,
|
||||||
|
reverb_wet,
|
||||||
|
playback_mode,
|
||||||
|
sporadic_min,
|
||||||
|
sporadic_max)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
||||||
req.params.profileId,
|
req.params.profileId,
|
||||||
s.id,
|
s.id,
|
||||||
s.volume
|
s.volume,
|
||||||
|
s.reverbEnabled,
|
||||||
|
s.reverbPreDelay,
|
||||||
|
s.reverbDecay,
|
||||||
|
s.reverbWet,
|
||||||
|
s.playbackMode,
|
||||||
|
s.sporadicMin,
|
||||||
|
s.sporadicMax
|
||||||
],
|
],
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -291,7 +387,21 @@ router.get('/profiles/:profileId', (req, res) => {
|
|||||||
sampleQueryArgs.push(row.sample)
|
sampleQueryArgs.push(row.sample)
|
||||||
})
|
})
|
||||||
|
|
||||||
db.all(`SELECT samples.id, name, profiles_samples.volume
|
db.all(`SELECT
|
||||||
|
samples.id,
|
||||||
|
name,
|
||||||
|
profiles_samples.volume,
|
||||||
|
profiles_samples.reverb_enabled as reverbEnabled,
|
||||||
|
profiles_samples.reverb_pre_delay as reverbPreDelay,
|
||||||
|
profiles_samples.reverb_decay as reverbDecay,
|
||||||
|
profiles_samples.reverb_wet as reverbWet,
|
||||||
|
profiles_samples.playback_mode as playbackMode,
|
||||||
|
profiles_samples.sporadic_min as sporadicMin,
|
||||||
|
profiles_samples.sporadic_max as sporadicMax,
|
||||||
|
fade_in as fadeIn,
|
||||||
|
loop_points_enabled as loopPointsEnabled,
|
||||||
|
loop_start as loopStart,
|
||||||
|
loop_end as loopEnd
|
||||||
FROM samples
|
FROM samples
|
||||||
INNER JOIN profiles_samples
|
INNER JOIN profiles_samples
|
||||||
ON profiles_samples.sample = samples.id
|
ON profiles_samples.sample = samples.id
|
||||||
@@ -311,6 +421,17 @@ router.get('/profiles/:profileId', (req, res) => {
|
|||||||
sample.id = row.id
|
sample.id = row.id
|
||||||
sample.name = row.name
|
sample.name = row.name
|
||||||
sample.volume = row.volume
|
sample.volume = row.volume
|
||||||
|
sample.fadeIn = row.fadeIn
|
||||||
|
sample.loopPointsEnabled = row.loopPointsEnabled === 1
|
||||||
|
sample.loopStart = row.loopStart
|
||||||
|
sample.loopEnd = row.loopEnd
|
||||||
|
sample.reverbEnabled = row.reverbEnabled === 1
|
||||||
|
sample.reverbPreDelay = row.reverbPreDelay
|
||||||
|
sample.reverbDecay = row.reverbDecay
|
||||||
|
sample.reverbWet = row.reverbWet
|
||||||
|
sample.playbackMode = row.playbackMode
|
||||||
|
sample.sporadicMin = row.sporadicMin
|
||||||
|
sample.sporadicMax = row.sporadicMax
|
||||||
|
|
||||||
samples.push(sample)
|
samples.push(sample)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ router.post('/samples', upload.single('sample'), (req, res, next) => {
|
|||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
deleteSample(req.user.id + '_' + req.body.name)
|
deleteSample(req.user.id + '_' + req.body.name)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -77,7 +77,14 @@ router.get('/samples', (req, res) => {
|
|||||||
|
|
||||||
const samples = []
|
const samples = []
|
||||||
|
|
||||||
db.all('SELECT id, name FROM samples WHERE user = ?', [req.user.id], (err, rows) => {
|
db.all(`SELECT
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
fade_in as fadeIn,
|
||||||
|
loop_points_enabled as loopPointsEnabled,
|
||||||
|
loop_start as loopStart,
|
||||||
|
loop_end as loopEnd
|
||||||
|
FROM samples WHERE user = ?`, [req.user.id], (err, rows) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -88,6 +95,10 @@ router.get('/samples', (req, res) => {
|
|||||||
|
|
||||||
sample.id = row.id
|
sample.id = row.id
|
||||||
sample.name = row.name
|
sample.name = row.name
|
||||||
|
sample.fadeIn = row.fadeIn
|
||||||
|
sample.loopPointsEnabled = row.loopPointsEnabled === 1
|
||||||
|
sample.loopStart = row.loopStart
|
||||||
|
sample.loopEnd = row.loopEnd
|
||||||
sample.user = req.user.id
|
sample.user = req.user.id
|
||||||
|
|
||||||
samples.push(sample)
|
samples.push(sample)
|
||||||
@@ -97,4 +108,76 @@ router.get('/samples', (req, res) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.get('/samples/:sampleId', (req, res) => {
|
||||||
|
if (!req.user) {
|
||||||
|
return res.sendStatus(401)
|
||||||
|
}
|
||||||
|
|
||||||
|
db.get(`SELECT
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
fade_in as fadeIn,
|
||||||
|
loop_points_enabled as loopPointsEnabled,
|
||||||
|
loop_start as loopStart,
|
||||||
|
loop_end as loopEnd
|
||||||
|
FROM samples WHERE user = ? AND id = ?`, [req.user.id, req.params.sampleId], (err, row) => {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
return res.sendStatus(500)
|
||||||
|
}
|
||||||
|
|
||||||
|
const sample = {}
|
||||||
|
|
||||||
|
sample.id = row.id
|
||||||
|
sample.name = row.name
|
||||||
|
sample.fadeIn = row.fadeIn
|
||||||
|
sample.loopPointsEnabled = row.loopPointsEnabled === 1
|
||||||
|
sample.loopStart = row.loopStart
|
||||||
|
sample.loopEnd = row.loopEnd
|
||||||
|
sample.user = req.user.id
|
||||||
|
|
||||||
|
res.json({ sample: sample })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.put('/samples/:sampleId', (req, res) => {
|
||||||
|
if (!req.user) {
|
||||||
|
return res.sendStatus(401)
|
||||||
|
}
|
||||||
|
|
||||||
|
db.serialize(() => {
|
||||||
|
db.get('SELECT user FROM samples WHERE id = ?', [req.params.sampleId], (err, row) => {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
return res.sendStatus(500)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.user.toString() !== req.user.id) {
|
||||||
|
return res.sendStatus(401)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
db.run(`UPDATE samples SET
|
||||||
|
fade_in = ?,
|
||||||
|
loop_points_enabled = ?,
|
||||||
|
loop_start = ?,
|
||||||
|
loop_end = ?
|
||||||
|
WHERE id = ?`, [
|
||||||
|
req.body.fadeIn,
|
||||||
|
req.body.loopPointsEnabled ? 1 : 0,
|
||||||
|
req.body.loopStart,
|
||||||
|
req.body.loopEnd,
|
||||||
|
req.params.sampleId
|
||||||
|
],
|
||||||
|
(err) => {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
return res.sendStatus(500)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.sendStatus(200)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ router.get('/users/current', (req, res) => {
|
|||||||
return res.sendStatus(401)
|
return res.sendStatus(401)
|
||||||
}
|
}
|
||||||
|
|
||||||
db.get('SELECT is_admin as isAdmin, dark_mode as darkMode, can_upload as canUpload, * FROM users WHERE id = ?', [req.user.id], (err, row) => {
|
db.get(`SELECT
|
||||||
|
is_admin as isAdmin,
|
||||||
|
dark_mode as darkMode,
|
||||||
|
can_upload as canUpload,
|
||||||
|
* FROM users WHERE id = ?`, [req.user.id], (err, row) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -24,6 +28,7 @@ router.get('/users/current', (req, res) => {
|
|||||||
user.isAdmin = row.isAdmin === 1
|
user.isAdmin = row.isAdmin === 1
|
||||||
user.darkMode = row.darkMode === 1
|
user.darkMode = row.darkMode === 1
|
||||||
user.canUpload = row.canUpload === 1
|
user.canUpload = row.canUpload === 1
|
||||||
|
user.preferences = JSON.parse(row.preferences)
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json({ user: user })
|
res.json({ user: user })
|
||||||
@@ -67,6 +72,8 @@ router.post('/users', (req, res) => {
|
|||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultPreferences = '{"accentColor":{"alpha":1,"hex":"#607D8B","hexa":"#607D8BFF","hsla":{"h":200,"s":18,"l":46,"a":1},"hsva":{"h":200,"s":31,"v":55,"a":1},"hue":200,"rgba":{"r":96,"g":125,"b":139,"a":1}}}'
|
||||||
|
|
||||||
if (row.count !== 0) {
|
if (row.count !== 0) {
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.sendStatus(401)
|
return res.sendStatus(401)
|
||||||
@@ -89,19 +96,20 @@ router.post('/users', (req, res) => {
|
|||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
}
|
}
|
||||||
|
|
||||||
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload)
|
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload, preferences)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?)`, [
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
|
||||||
req.body.username,
|
req.body.username,
|
||||||
hashedPassword,
|
hashedPassword,
|
||||||
salt,
|
salt,
|
||||||
req.body.name,
|
req.body.name,
|
||||||
req.body.isAdmin,
|
req.body.isAdmin,
|
||||||
req.body.darkMode,
|
req.body.darkMode,
|
||||||
req.body.canUpload
|
req.body.canUpload,
|
||||||
|
defaultPreferences
|
||||||
], (err) => {
|
], (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -120,19 +128,20 @@ router.post('/users', (req, res) => {
|
|||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
}
|
}
|
||||||
|
|
||||||
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload)
|
db.run(`INSERT INTO users (username, hashed_password, salt, name, is_admin, dark_mode, can_upload, preferences)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?)`, [
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
|
||||||
req.body.username,
|
req.body.username,
|
||||||
hashedPassword,
|
hashedPassword,
|
||||||
salt,
|
salt,
|
||||||
req.body.name,
|
req.body.name,
|
||||||
req.body.isAdmin,
|
req.body.isAdmin,
|
||||||
req.body.darkMode,
|
req.body.darkMode,
|
||||||
req.body.canUpload
|
req.body.canUpload,
|
||||||
|
defaultPreferences
|
||||||
], function (err) {
|
], function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
if (err.code === 'SQLITE_CONSTRAINT') {
|
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
||||||
return res.sendStatus(409)
|
return res.sendStatus(409)
|
||||||
} else {
|
} else {
|
||||||
return res.sendStatus(500)
|
return res.sendStatus(500)
|
||||||
@@ -287,4 +296,23 @@ router.delete('/users/:userId', (req, res) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.patch('/users/preferences', (req, res) => {
|
||||||
|
if (!req.user) {
|
||||||
|
return res.sendStatus(401)
|
||||||
|
}
|
||||||
|
|
||||||
|
const preferences = JSON.stringify(req.body.preferences)
|
||||||
|
|
||||||
|
db.serialize(() => {
|
||||||
|
db.run('UPDATE users SET preferences = ? WHERE id = ?', [preferences, req.user.id], (err) => {
|
||||||
|
if (err) {
|
||||||
|
logger.error(err)
|
||||||
|
return res.sendStatus(500)
|
||||||
|
} else {
|
||||||
|
return res.sendStatus(200)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
|
<h2 class="headline font-weight-bold mb-3">
|
||||||
|
User Management
|
||||||
|
</h2>
|
||||||
|
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<v-row>
|
<v-row>
|
||||||
ID: {{ currentUser.id }}
|
ID: {{ currentUser.id }}
|
||||||
@@ -24,9 +28,9 @@
|
|||||||
v-model="changePasswordDialog"
|
v-model="changePasswordDialog"
|
||||||
max-width="600px"
|
max-width="600px"
|
||||||
>
|
>
|
||||||
<template v-slot:activator="{ on, attrs }">
|
<template #activator="{ on, attrs }">
|
||||||
<v-btn
|
<v-btn
|
||||||
class="my-3"
|
class="mt-5 mb-10"
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
v-on="on"
|
v-on="on"
|
||||||
@click="resetChangePasswordForm"
|
@click="resetChangePasswordForm"
|
||||||
@@ -77,13 +81,42 @@
|
|||||||
</v-form>
|
</v-form>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
|
|
||||||
|
<h2 class="headline font-weight-bold mb-3">
|
||||||
|
Preferences
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<h3 class="font-weight-bold">
|
||||||
|
Dark Mode
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<v-switch
|
||||||
|
v-model="$vuetify.theme.dark"
|
||||||
|
:label="`${$vuetify.theme.dark ? 'On' : 'Off'}`"
|
||||||
|
@change="toggleDarkMode"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h3 class="mb-5 font-weight-bold">
|
||||||
|
Accent Color
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<v-color-picker
|
||||||
|
v-model="accentColor"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<v-btn
|
||||||
|
class="mt-5"
|
||||||
|
@click="updateAccentColor"
|
||||||
|
>
|
||||||
|
Apply
|
||||||
|
</v-btn>
|
||||||
|
|
||||||
<v-snackbar
|
<v-snackbar
|
||||||
v-model="snackbar"
|
v-model="snackbar"
|
||||||
timeout="3000"
|
timeout="3000"
|
||||||
>
|
>
|
||||||
{{ snackbarText }}
|
{{ snackbarText }}
|
||||||
|
|
||||||
<template v-slot:action="{ attrs }">
|
<template #action="{ attrs }">
|
||||||
<v-btn
|
<v-btn
|
||||||
text
|
text
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
v-model="registerUserDialog"
|
v-model="registerUserDialog"
|
||||||
max-width="600px"
|
max-width="600px"
|
||||||
>
|
>
|
||||||
<template v-slot:activator="{ on, attrs }">
|
<template #activator="{ on, attrs }">
|
||||||
<v-btn
|
<v-btn
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
v-on="on"
|
v-on="on"
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
>
|
>
|
||||||
{{ snackbarText }}
|
{{ snackbarText }}
|
||||||
|
|
||||||
<template v-slot:action="{ attrs }">
|
<template #action="{ attrs }">
|
||||||
<v-btn
|
<v-btn
|
||||||
text
|
text
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
dense
|
dense
|
||||||
>
|
>
|
||||||
<v-app-bar-nav-icon
|
<v-app-bar-nav-icon
|
||||||
@click="getCurrentUser"
|
@click="checkForAdmin"
|
||||||
/>
|
/>
|
||||||
</v-app-bar>
|
</v-app-bar>
|
||||||
<v-navigation-drawer
|
<v-navigation-drawer
|
||||||
@@ -61,20 +61,12 @@
|
|||||||
Logout
|
Logout
|
||||||
</v-list-item-title>
|
</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-item>
|
|
||||||
<v-switch
|
|
||||||
v-model="$vuetify.theme.dark"
|
|
||||||
label="Dark Mode"
|
|
||||||
:disabled="!loggedIn"
|
|
||||||
@change="toggleDarkMode"
|
|
||||||
/>
|
|
||||||
</v-list-item>
|
|
||||||
</v-list-item-group>
|
</v-list-item-group>
|
||||||
</v-list>
|
</v-list>
|
||||||
<template v-slot:append>
|
<template #append>
|
||||||
<v-btn
|
<v-btn
|
||||||
block
|
block
|
||||||
href="https://github.com/KevinThomas0/noisedash"
|
href="https://github.com/kaythomas0/noisedash"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
Source Code
|
Source Code
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
>
|
>
|
||||||
{{ snackbarText }}
|
{{ snackbarText }}
|
||||||
|
|
||||||
<template v-slot:action="{ attrs }">
|
<template #action="{ attrs }">
|
||||||
<v-btn
|
<v-btn
|
||||||
text
|
text
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
@@ -1,582 +0,0 @@
|
|||||||
<template>
|
|
||||||
<v-container>
|
|
||||||
<v-row class="text-center">
|
|
||||||
<v-col>
|
|
||||||
<h1 class="display-2 font-weight-bold mb-5">
|
|
||||||
Noisedash
|
|
||||||
</h1>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<h2 class="display-1 font-weight-bold mb-10">
|
|
||||||
Playback
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-btn
|
|
||||||
:disabled="playDisabled || !isTimerValid"
|
|
||||||
class="mx-3 mb-5"
|
|
||||||
fab
|
|
||||||
large
|
|
||||||
color="primary"
|
|
||||||
@click="play"
|
|
||||||
>
|
|
||||||
<v-icon>mdi-play</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
|
|
||||||
<v-btn
|
|
||||||
class="mx-3 mb-5"
|
|
||||||
fab
|
|
||||||
large
|
|
||||||
color="primary"
|
|
||||||
@click="stop"
|
|
||||||
>
|
|
||||||
<v-icon>mdi-stop</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-row>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<h2 class="headline font-weight-bold mb-5">
|
|
||||||
Profiles
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-select
|
|
||||||
v-model="selectedProfile"
|
|
||||||
:items="profileItems"
|
|
||||||
return-object
|
|
||||||
label="Profiles"
|
|
||||||
class="mx-3 mb-5"
|
|
||||||
:disabled="playDisabled"
|
|
||||||
@change="loadProfile"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-btn
|
|
||||||
class="mx-3 my-3"
|
|
||||||
:disabled="profileItems.length < 2 || playDisabled"
|
|
||||||
@click="deleteProfile"
|
|
||||||
>
|
|
||||||
Delete Profile
|
|
||||||
</v-btn>
|
|
||||||
|
|
||||||
<v-btn
|
|
||||||
class="mx-3 my-3"
|
|
||||||
@click="updateProfile"
|
|
||||||
>
|
|
||||||
Save Profile
|
|
||||||
</v-btn>
|
|
||||||
|
|
||||||
<v-dialog
|
|
||||||
v-model="profileDialog"
|
|
||||||
max-width="600px"
|
|
||||||
>
|
|
||||||
<template v-slot:activator="{ on, attrs }">
|
|
||||||
<v-btn
|
|
||||||
v-bind="attrs"
|
|
||||||
class="mx-3 my-3"
|
|
||||||
:disabled="playDisabled"
|
|
||||||
v-on="on"
|
|
||||||
@click="resetProfileForm"
|
|
||||||
>
|
|
||||||
Save Profile As...
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
<v-form
|
|
||||||
ref="profileForm"
|
|
||||||
v-model="isProfileValid"
|
|
||||||
>
|
|
||||||
<v-card>
|
|
||||||
<v-card-title>
|
|
||||||
<span class="text-h5">Profile Name</span>
|
|
||||||
</v-card-title>
|
|
||||||
<v-card-text>
|
|
||||||
<v-container>
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12">
|
|
||||||
<v-text-field
|
|
||||||
v-model="profileName"
|
|
||||||
label="Profile Name"
|
|
||||||
:rules="[rules.required()]"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-container>
|
|
||||||
</v-card-text>
|
|
||||||
<v-card-actions>
|
|
||||||
<v-spacer />
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
@click="profileDialog = false"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
:disabled="!isProfileValid"
|
|
||||||
@click="saveProfile"
|
|
||||||
>
|
|
||||||
Save
|
|
||||||
</v-btn>
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</v-form>
|
|
||||||
</v-dialog>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<h2 class="headline font-weight-bold mb-5">
|
|
||||||
Timer
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-checkbox
|
|
||||||
v-model="isTimerEnabled"
|
|
||||||
:disabled="playDisabled"
|
|
||||||
label="Timer"
|
|
||||||
class="mx-3"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-form
|
|
||||||
v-model="isTimerValid"
|
|
||||||
>
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-text-field
|
|
||||||
v-model="hours"
|
|
||||||
type="number"
|
|
||||||
label="Hours"
|
|
||||||
class="mx-3"
|
|
||||||
:disabled="playDisabled || !isTimerEnabled"
|
|
||||||
:rules="[rules.gt(-1)]"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-text-field
|
|
||||||
v-model="minutes"
|
|
||||||
type="number"
|
|
||||||
label="Minutes"
|
|
||||||
class="mx-3"
|
|
||||||
:disabled="playDisabled || !isTimerEnabled"
|
|
||||||
:rules="[rules.lt(60), rules.gt(-1)]"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-text-field
|
|
||||||
v-model="seconds"
|
|
||||||
type="number"
|
|
||||||
label="Seconds"
|
|
||||||
class="mx-3"
|
|
||||||
:disabled="playDisabled || !isTimerEnabled"
|
|
||||||
:rules="[rules.lt(60), rules.gt(-1)]"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-text-field
|
|
||||||
v-model="timeRemaining"
|
|
||||||
class="mx-3"
|
|
||||||
:value="timeRemaining"
|
|
||||||
label="Seconds Remaining"
|
|
||||||
filled
|
|
||||||
readonly
|
|
||||||
:disabled="!isTimerEnabled"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
</v-form>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<h2 class="display-1 font-weight-bold mb-5">
|
|
||||||
Noise Settings
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-slider
|
|
||||||
v-model="volume"
|
|
||||||
label="Volume"
|
|
||||||
thumb-label
|
|
||||||
max="0"
|
|
||||||
min="-30"
|
|
||||||
class="mx-3"
|
|
||||||
@input="updateVolume"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="mx-3"
|
|
||||||
>
|
|
||||||
<p>{{ volume }}</p>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-select
|
|
||||||
v-model="noiseColor"
|
|
||||||
:items="noiseColorItems"
|
|
||||||
label="Noise Color"
|
|
||||||
class="mx-3"
|
|
||||||
@change="updateNoiseColor"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<h2 class="headline font-weight-bold mb-5">
|
|
||||||
Filter
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-checkbox
|
|
||||||
v-model="isFilterEnabled"
|
|
||||||
label="Filter"
|
|
||||||
class="mx-3"
|
|
||||||
@change="updateAudioChain"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-slider
|
|
||||||
v-model="filterCutoff"
|
|
||||||
:disabled="!isFilterEnabled || isLFOFilterCutoffEnabled"
|
|
||||||
label="Cutoff"
|
|
||||||
thumb-label
|
|
||||||
max="20000"
|
|
||||||
min="0"
|
|
||||||
class="mx-3"
|
|
||||||
@input="updateFilterCutoff"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="mx-3"
|
|
||||||
>
|
|
||||||
<p>{{ filterCutoff }}</p>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-select
|
|
||||||
v-model="filterType"
|
|
||||||
:disabled="!isFilterEnabled"
|
|
||||||
:items="filterTypeItems"
|
|
||||||
label="Filter Type"
|
|
||||||
class="mx-3"
|
|
||||||
@change="updateFilterType"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-checkbox
|
|
||||||
v-model="isLFOFilterCutoffEnabled"
|
|
||||||
:disabled="!isFilterEnabled"
|
|
||||||
label="Filter Cutoff LFO"
|
|
||||||
class="mx-3"
|
|
||||||
@change="updateAudioChain"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-slider
|
|
||||||
v-model="lfoFilterCutoffFrequency"
|
|
||||||
:disabled="!isLFOFilterCutoffEnabled || !isFilterEnabled"
|
|
||||||
thumb-label
|
|
||||||
label="Rate"
|
|
||||||
max="10"
|
|
||||||
min="0.01"
|
|
||||||
step="0.01"
|
|
||||||
class="mx-3"
|
|
||||||
@input="updateLFOFilterCutoffFrequency"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="mx-3"
|
|
||||||
>
|
|
||||||
<p>{{ lfoFilterCutoffFrequency }}</p>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-range-slider
|
|
||||||
v-model="lfoFilterCutoffRange"
|
|
||||||
:disabled="!isLFOFilterCutoffEnabled || !isFilterEnabled"
|
|
||||||
label="Range"
|
|
||||||
thumb-label
|
|
||||||
:min="lfoFilterCutoffMin"
|
|
||||||
:max="lfoFilterCutoffMax"
|
|
||||||
class="mx-3"
|
|
||||||
@input="updateLFOFilterCutoffRange"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="mx-3"
|
|
||||||
>
|
|
||||||
<p>{{ lfoFilterCutoffRange }}</p>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12">
|
|
||||||
<h2 class="headline font-weight-bold mb-5">
|
|
||||||
Tremolo
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-checkbox
|
|
||||||
v-model="isTremoloEnabled"
|
|
||||||
label="Enabled"
|
|
||||||
class="mx-3"
|
|
||||||
@change="updateAudioChain"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-slider
|
|
||||||
v-model="tremoloFrequency"
|
|
||||||
:disabled="!isTremoloEnabled"
|
|
||||||
label="Rate"
|
|
||||||
thumb-label
|
|
||||||
max="1"
|
|
||||||
min="0"
|
|
||||||
step="0.1"
|
|
||||||
ticks
|
|
||||||
tick-size="4"
|
|
||||||
class="mx-3"
|
|
||||||
@input="updateTremoloFrequency"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="mx-3"
|
|
||||||
>
|
|
||||||
<p>{{ tremoloFrequency }}</p>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row justify="center">
|
|
||||||
<v-slider
|
|
||||||
v-model="tremoloDepth"
|
|
||||||
:disabled="!isTremoloEnabled"
|
|
||||||
label="Depth"
|
|
||||||
thumb-label
|
|
||||||
max="1"
|
|
||||||
min="0"
|
|
||||||
step="0.1"
|
|
||||||
ticks
|
|
||||||
tick-size="4"
|
|
||||||
class="mx-3"
|
|
||||||
@input="updateTremoloDepth"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="mx-3"
|
|
||||||
>
|
|
||||||
<p>{{ tremoloDepth }}</p>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col
|
|
||||||
v-if="canUpload"
|
|
||||||
cols="12"
|
|
||||||
>
|
|
||||||
<h2 class="display-1 font-weight-bold mb-5">
|
|
||||||
Samples
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<v-row
|
|
||||||
v-for="(sample, index) in loadedSamples"
|
|
||||||
:key="sample.name"
|
|
||||||
>
|
|
||||||
<v-container>
|
|
||||||
<v-row
|
|
||||||
justify="center"
|
|
||||||
>
|
|
||||||
{{ sample.name }}
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-row>
|
|
||||||
<v-btn
|
|
||||||
icon
|
|
||||||
:disabled="playDisabled"
|
|
||||||
@click="removeSample(index)"
|
|
||||||
>
|
|
||||||
<v-icon>mdi-delete</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
|
|
||||||
<v-slider
|
|
||||||
v-model="sample.volume"
|
|
||||||
label="Volume"
|
|
||||||
thumb-label
|
|
||||||
max="0"
|
|
||||||
min="-30"
|
|
||||||
class="mx-3"
|
|
||||||
@input="updateSampleVolume(sample.id, index)"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="mx-3"
|
|
||||||
>
|
|
||||||
<p>{{ loadedSamples[index].volume }}</p>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
</v-container>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<v-dialog
|
|
||||||
v-model="addSampleDialog"
|
|
||||||
max-width="600px"
|
|
||||||
>
|
|
||||||
<template v-slot:activator="{ on, attrs }">
|
|
||||||
<v-btn
|
|
||||||
v-bind="attrs"
|
|
||||||
class="mx-3 my-3 mb-5"
|
|
||||||
:disabled="playDisabled"
|
|
||||||
v-on="on"
|
|
||||||
>
|
|
||||||
Add Sample
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
<v-card>
|
|
||||||
<v-card-title>
|
|
||||||
<span class="text-h5">Add Sample</span>
|
|
||||||
</v-card-title>
|
|
||||||
<v-card-text>
|
|
||||||
<v-container>
|
|
||||||
<v-row v-if="unloadedSamples.length != 0">
|
|
||||||
<v-list-item
|
|
||||||
v-for="(sample) in unloadedSamples"
|
|
||||||
:key="sample.name"
|
|
||||||
>
|
|
||||||
<v-list-item-action>
|
|
||||||
<v-checkbox
|
|
||||||
v-model="checkedSamples"
|
|
||||||
:value="sample.id"
|
|
||||||
/>
|
|
||||||
</v-list-item-action>
|
|
||||||
<v-list-item-content>
|
|
||||||
<v-list-item-title>{{ sample.name }}</v-list-item-title>
|
|
||||||
</v-list-item-content>
|
|
||||||
</v-list-item>
|
|
||||||
</v-row>
|
|
||||||
<v-row v-else>
|
|
||||||
No samples to add
|
|
||||||
</v-row>
|
|
||||||
</v-container>
|
|
||||||
</v-card-text>
|
|
||||||
<v-card-actions>
|
|
||||||
<v-spacer />
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
@click="addSampleDialog = false"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
:disabled="unloadedSamples.length === 0"
|
|
||||||
@click="addSample"
|
|
||||||
>
|
|
||||||
Add
|
|
||||||
</v-btn>
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</v-dialog>
|
|
||||||
|
|
||||||
<v-dialog
|
|
||||||
v-model="uploadSampleDialog"
|
|
||||||
max-width="600px"
|
|
||||||
>
|
|
||||||
<template v-slot:activator="{ on, attrs }">
|
|
||||||
<v-btn
|
|
||||||
v-bind="attrs"
|
|
||||||
class="mx-3 my-3 mb-5"
|
|
||||||
v-on="on"
|
|
||||||
@click="resetUploadSampleForm"
|
|
||||||
>
|
|
||||||
Upload Sample
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
<v-form
|
|
||||||
ref="uploadSampleForm"
|
|
||||||
v-model="isSampleUploadValid"
|
|
||||||
>
|
|
||||||
<v-card>
|
|
||||||
<v-card-title>
|
|
||||||
<span class="text-h5">Upload Sample</span>
|
|
||||||
</v-card-title>
|
|
||||||
<v-card-text>
|
|
||||||
<v-container>
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12">
|
|
||||||
<p><strong>WARNING:</strong> Uploaded samples are publicly accessible.</p>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-row>
|
|
||||||
<v-file-input
|
|
||||||
v-model="selectedSample"
|
|
||||||
accept="audio/*"
|
|
||||||
label="Upload a sample!"
|
|
||||||
:rules="[rules.required()]"
|
|
||||||
/>
|
|
||||||
</v-row>
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12">
|
|
||||||
<v-text-field
|
|
||||||
v-model="sampleName"
|
|
||||||
label="Sample Name"
|
|
||||||
:rules="[rules.required()]"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-container>
|
|
||||||
</v-card-text>
|
|
||||||
<v-card-actions>
|
|
||||||
<v-spacer />
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
@click="uploadSampleDialog = false"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
:disabled="!isSampleUploadValid"
|
|
||||||
@click="uploadSample"
|
|
||||||
>
|
|
||||||
Upload
|
|
||||||
</v-btn>
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</v-form>
|
|
||||||
</v-dialog>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-snackbar
|
|
||||||
v-model="infoSnackbar"
|
|
||||||
timeout="3000"
|
|
||||||
>
|
|
||||||
{{ infoSnackbarText }}
|
|
||||||
|
|
||||||
<template v-slot:action="{ attrs }">
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
v-bind="attrs"
|
|
||||||
@click="infoSnackbar = false"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
</v-snackbar>
|
|
||||||
|
|
||||||
<v-snackbar
|
|
||||||
v-model="errorSnackbar"
|
|
||||||
color="error"
|
|
||||||
timeout="3000"
|
|
||||||
>
|
|
||||||
{{ errorSnackbarText }}
|
|
||||||
|
|
||||||
<template v-slot:action="{ attrs }">
|
|
||||||
<v-btn
|
|
||||||
text
|
|
||||||
v-bind="attrs"
|
|
||||||
@click="errorSnackbar = false"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
</v-snackbar>
|
|
||||||
</v-row>
|
|
||||||
</v-container>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script src="./noise.js"></script>
|
|
||||||
1106
src/components/NoisePage.vue
Normal file
1106
src/components/NoisePage.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
|||||||
export default {
|
export default {
|
||||||
name: 'Admin',
|
name: 'Account',
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
currentUser: {},
|
currentUser: {},
|
||||||
changePasswordDialog: false,
|
changePasswordDialog: false,
|
||||||
isPasswordValid: false,
|
isPasswordValid: false,
|
||||||
password: '',
|
password: '',
|
||||||
|
accentColor: {},
|
||||||
snackbar: false,
|
snackbar: false,
|
||||||
snackbarText: '',
|
snackbarText: '',
|
||||||
rules: {
|
rules: {
|
||||||
@@ -21,6 +22,7 @@ export default {
|
|||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this.currentUser = response.data.user
|
this.currentUser = response.data.user
|
||||||
|
this.accentColor = this.currentUser.preferences.accentColor
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -40,6 +42,19 @@ export default {
|
|||||||
if (this.$refs.changePasswordForm) {
|
if (this.$refs.changePasswordForm) {
|
||||||
this.$refs.changePasswordForm.reset()
|
this.$refs.changePasswordForm.reset()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
toggleDarkMode () {
|
||||||
|
this.$http.patch('/users/dark-mode', {
|
||||||
|
darkMode: this.$vuetify.theme.dark
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateAccentColor () {
|
||||||
|
const preferences = { accentColor: this.accentColor }
|
||||||
|
this.$http.patch('/users/preferences', {
|
||||||
|
preferences: preferences
|
||||||
|
})
|
||||||
|
this.$vuetify.theme.themes.dark.primary = this.accentColor.hex
|
||||||
|
this.$vuetify.theme.themes.light.primary = this.accentColor.hex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ export default {
|
|||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
loggedIn: false
|
loggedIn: false
|
||||||
}),
|
}),
|
||||||
|
created () {
|
||||||
|
this.getUserPreferences()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
home () {
|
home () {
|
||||||
this.$router.push('/')
|
this.$router.push('/')
|
||||||
@@ -24,7 +27,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCurrentUser () {
|
checkForAdmin () {
|
||||||
this.loggedIn = false
|
this.loggedIn = false
|
||||||
this.drawyer = true
|
this.drawyer = true
|
||||||
this.$http.get('/users/current')
|
this.$http.get('/users/current')
|
||||||
@@ -32,17 +35,21 @@ export default {
|
|||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this.loggedIn = true
|
this.loggedIn = true
|
||||||
this.isAdmin = response.data.user.isAdmin
|
this.isAdmin = response.data.user.isAdmin
|
||||||
this.$vuetify.theme.dark = response.data.user.darkMode
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.isAdmin = false
|
this.isAdmin = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toggleDarkMode () {
|
getUserPreferences () {
|
||||||
this.$http.patch('/users/dark-mode', {
|
this.$http.get('/users/current')
|
||||||
darkMode: this.$vuetify.theme.dark
|
.then(response => {
|
||||||
})
|
if (response.status === 200) {
|
||||||
|
const preferences = response.data.user.preferences
|
||||||
|
this.$vuetify.theme.themes.dark.primary = preferences.accentColor.hex
|
||||||
|
this.$vuetify.theme.themes.light.primary = preferences.accentColor.hex
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
name: 'Login',
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
valid: false,
|
valid: false,
|
||||||
username: '',
|
username: '',
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
import { Filter, LFO, Noise, Players, Transport, Tremolo } from 'tone'
|
import * as Tone from 'tone'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Noise',
|
name: 'Noise',
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
mainPlayLoading: true,
|
||||||
isTimerValid: false,
|
isTimerValid: false,
|
||||||
selectedProfile: {},
|
selectedProfile: {},
|
||||||
profileItems: [],
|
profileItems: [],
|
||||||
profileDialog: false,
|
profileDialog: false,
|
||||||
profileName: '',
|
profileName: '',
|
||||||
isProfileValid: false,
|
isProfileValid: false,
|
||||||
|
profileMoreDialog: false,
|
||||||
|
importDialog: false,
|
||||||
|
isImportValid: false,
|
||||||
|
exportDialog: false,
|
||||||
|
importedProfile: null,
|
||||||
|
importedProfileName: '',
|
||||||
|
exportedProfile: {},
|
||||||
infoSnackbar: false,
|
infoSnackbar: false,
|
||||||
infoSnackbarText: '',
|
infoSnackbarText: '',
|
||||||
playDisabled: false,
|
playDisabled: false,
|
||||||
@@ -44,6 +52,30 @@ export default {
|
|||||||
sampleName: '',
|
sampleName: '',
|
||||||
isSampleUploadValid: false,
|
isSampleUploadValid: false,
|
||||||
canUpload: false,
|
canUpload: false,
|
||||||
|
editSampleDialog: false,
|
||||||
|
previewSampleLoopPointsEnabled: false,
|
||||||
|
previewSampleLoopStart: 0,
|
||||||
|
previewSampleLoopEnd: 0,
|
||||||
|
previewSampleFadeIn: 0,
|
||||||
|
previewSamplePlaying: false,
|
||||||
|
selectedPreviewSample: {},
|
||||||
|
previewSampleItems: [],
|
||||||
|
isEditSampleValid: false,
|
||||||
|
previewSampleButtonText: 'Preview Sample',
|
||||||
|
previewSampleLoading: true,
|
||||||
|
previewSampleLength: 0,
|
||||||
|
startRecordingDialog: false,
|
||||||
|
recordingDialog: false,
|
||||||
|
recordingTimeElapsed: 0,
|
||||||
|
recordedProfile: {},
|
||||||
|
recordingFileName: '',
|
||||||
|
isRecordingValid: false,
|
||||||
|
unsavedWork: false,
|
||||||
|
saveProfileText: 'Save Profile',
|
||||||
|
unwatch: null,
|
||||||
|
confirmSwitchProfileDialog: false,
|
||||||
|
activeProfile: {},
|
||||||
|
isSporadicValid: false,
|
||||||
errorSnackbar: false,
|
errorSnackbar: false,
|
||||||
errorSnackbarText: '',
|
errorSnackbarText: '',
|
||||||
rules: {
|
rules: {
|
||||||
@@ -68,15 +100,54 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return samples
|
return samples
|
||||||
|
},
|
||||||
|
changeableSettings: function () {
|
||||||
|
const settings = [
|
||||||
|
this.isTimerEnabled,
|
||||||
|
this.hours,
|
||||||
|
this.minutes,
|
||||||
|
this.seconds,
|
||||||
|
this.volume,
|
||||||
|
this.noiseColor,
|
||||||
|
this.isFilterEnabled,
|
||||||
|
this.filterType,
|
||||||
|
this.filterCutoff,
|
||||||
|
this.isLFOFilterCutoffEnabled,
|
||||||
|
this.lfoFilterCutoffFrequency,
|
||||||
|
this.lfoFilterCutoffRange,
|
||||||
|
this.isTremoloEnabled,
|
||||||
|
this.tremoloDepth,
|
||||||
|
this.tremoloFrequency,
|
||||||
|
this.isTimerEnabled,
|
||||||
|
this.loadedSamples
|
||||||
|
]
|
||||||
|
|
||||||
|
this.loadedSamples.forEach(s => {
|
||||||
|
settings.push(s.volume)
|
||||||
|
settings.push(s.reverbEnabled)
|
||||||
|
settings.push(s.reverbPreDelay)
|
||||||
|
settings.push(s.reverbDecay)
|
||||||
|
settings.push(s.reverbWet)
|
||||||
|
settings.push(s.playbackMode)
|
||||||
|
settings.push(s.sporadicMin)
|
||||||
|
settings.push(s.sporadicMax)
|
||||||
|
})
|
||||||
|
|
||||||
|
return settings
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.noise = new Noise()
|
this.noise = new Tone.Noise()
|
||||||
this.filter = new Filter()
|
this.filter = new Tone.Filter()
|
||||||
this.tremolo = new Tremolo()
|
this.tremolo = new Tone.Tremolo()
|
||||||
this.lfo = new LFO()
|
this.lfo = new Tone.LFO()
|
||||||
this.players = new Players()
|
this.players = new Tone.Players()
|
||||||
|
this.samplePreviewPlayer = new Tone.Player().toDestination()
|
||||||
|
this.samplePreviewPlayer.loop = true
|
||||||
|
this.recorder = new Tone.Recorder()
|
||||||
|
|
||||||
this.populateProfileItems(0)
|
this.populateProfileItems(0)
|
||||||
|
this.populatePreviewSampleItems()
|
||||||
this.getSamples()
|
this.getSamples()
|
||||||
this.getCurrentUser()
|
this.getCurrentUser()
|
||||||
},
|
},
|
||||||
@@ -84,64 +155,122 @@ export default {
|
|||||||
this.stop()
|
this.stop()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
play () {
|
async play () {
|
||||||
|
if (!this.players.loaded) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await Tone.start()
|
||||||
|
|
||||||
this.playDisabled = true
|
this.playDisabled = true
|
||||||
Transport.cancel()
|
Tone.Transport.cancel()
|
||||||
|
|
||||||
if (!this.isFilterEnabled && !this.isTremoloEnabled) {
|
if (!this.isFilterEnabled && !this.isTremoloEnabled) {
|
||||||
this.noise = new Noise({ volume: this.volume, type: this.noiseColor }).toDestination()
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).toDestination()
|
||||||
} else if (!this.isFilterEnabled && this.isTremoloEnabled) {
|
} else if (!this.isFilterEnabled && this.isTremoloEnabled) {
|
||||||
this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
||||||
this.noise = new Noise({ volume: this.volume, type: this.noiseColor }).connect(this.tremolo)
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.tremolo)
|
||||||
} else if (this.isFilterEnabled && !this.isTremoloEnabled) {
|
} else if (this.isFilterEnabled && !this.isTremoloEnabled) {
|
||||||
this.filter = new Filter(this.filterCutoff, this.filterType).toDestination()
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).toDestination()
|
||||||
this.noise = new Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
||||||
} else if (this.isFilterEnabled && this.isTremoloEnabled) {
|
} else if (this.isFilterEnabled && this.isTremoloEnabled) {
|
||||||
this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
||||||
this.filter = new Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
||||||
this.noise = new Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
||||||
} else {
|
} else {
|
||||||
this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
||||||
this.filter = new Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
||||||
this.noise = new Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isLFOFilterCutoffEnabled) {
|
if (this.isLFOFilterCutoffEnabled) {
|
||||||
this.lfo = new LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
|
this.lfo = new Tone.LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
|
||||||
this.lfo.connect(this.filter.frequency).start()
|
this.lfo.connect(this.filter.frequency).start()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isTimerEnabled) {
|
if (this.isTimerEnabled) {
|
||||||
this.duration = parseInt((this.hours * 3600)) + parseInt((this.minutes * 60)) + parseInt(this.seconds)
|
this.duration = parseInt((this.hours * 3600)) + parseInt((this.minutes * 60)) + parseInt(this.seconds)
|
||||||
this.noise.sync().start(0).stop(this.duration)
|
|
||||||
Transport.loopEnd = this.duration
|
|
||||||
this.timeRemaining = this.duration
|
this.timeRemaining = this.duration
|
||||||
this.transportInterval = setInterval(() => this.stop(), this.duration * 1000 + 100)
|
this.transportInterval = setInterval(() => this.stop(), this.duration * 1000 + 100)
|
||||||
this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
|
this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
|
||||||
|
Tone.Transport.loopEnd = this.duration
|
||||||
|
|
||||||
this.loadedSamples.forEach(s => {
|
this.noise.sync().start(0).stop(this.duration)
|
||||||
this.players.player(s.id).loop = true
|
|
||||||
this.players.player(s.id).unsync().sync().start(0).stop(this.duration)
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
this.noise.sync().start(0)
|
this.noise.sync().start(0)
|
||||||
|
|
||||||
this.loadedSamples.forEach(s => {
|
|
||||||
this.players.player(s.id).loop = true
|
|
||||||
this.players.player(s.id).unsync().sync().start(0)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Transport.start()
|
this.loadedSamples.forEach(s => {
|
||||||
|
this.players.player(s.id).loop = true
|
||||||
|
this.players.player(s.id).fadeIn = s.fadeIn
|
||||||
|
if (s.loopPointsEnabled) {
|
||||||
|
this.players.player(s.id).setLoopPoints(s.loopStart, s.loopEnd)
|
||||||
|
} else {
|
||||||
|
this.players.player(s.id).setLoopPoints(0, this.players.player(s.id).buffer.duration)
|
||||||
|
}
|
||||||
|
this.players.player(s.id).volume.value = s.volume
|
||||||
|
|
||||||
|
this.players.player(s.id).disconnect()
|
||||||
|
if (s.reverbEnabled) {
|
||||||
|
const reverb = new Tone.Reverb(s.reverbDecay).toDestination()
|
||||||
|
reverb.set({ preDelay: s.reverbPreDelay, wet: s.reverbWet })
|
||||||
|
this.players.player(s.id).connect(reverb)
|
||||||
|
} else {
|
||||||
|
this.players.player(s.id).toDestination()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.playbackMode === 'sporadic') {
|
||||||
|
this.players.player(s.id).loop = false
|
||||||
|
|
||||||
|
const maxInt = parseInt(s.sporadicMax, 10)
|
||||||
|
const minInt = parseInt(s.sporadicMin, 10)
|
||||||
|
|
||||||
|
if (minInt <= maxInt) {
|
||||||
|
const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
|
||||||
|
s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.players.player(s.id).loop = true
|
||||||
|
|
||||||
|
if (this.isTimerEnabled) {
|
||||||
|
this.players.player(s.id).unsync().sync().start(0).stop(this.duration)
|
||||||
|
} else {
|
||||||
|
this.players.player(s.id).unsync().sync().start(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Tone.Transport.start('+0.1')
|
||||||
|
},
|
||||||
|
playSporadicSample (id) {
|
||||||
|
const sample = this.loadedSamples.find(s => s.id === id)
|
||||||
|
|
||||||
|
clearInterval(sample.initialSporadicPlayInterval)
|
||||||
|
clearInterval(sample.sporadicInterval)
|
||||||
|
|
||||||
|
this.players.player(id).unsync().sync().start()
|
||||||
|
|
||||||
|
const maxInt = parseInt(sample.sporadicMax, 10)
|
||||||
|
const minInt = parseInt(sample.sporadicMin, 10)
|
||||||
|
sample.playNextTime = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
|
||||||
|
|
||||||
|
sample.sporadicInterval = setInterval(() => this.playSporadicSample(id), sample.playNextTime * 1000)
|
||||||
},
|
},
|
||||||
stop () {
|
stop () {
|
||||||
clearInterval(this.transportInterval)
|
clearInterval(this.transportInterval)
|
||||||
Transport.stop()
|
Tone.Transport.stop()
|
||||||
this.playDisabled = false
|
this.playDisabled = false
|
||||||
|
|
||||||
clearInterval(this.timeRemainingInterval)
|
clearInterval(this.timeRemainingInterval)
|
||||||
this.timeRemaining = 0
|
this.timeRemaining = 0
|
||||||
this.duration = 0
|
this.duration = 0
|
||||||
|
|
||||||
|
this.loadedSamples.forEach(s => {
|
||||||
|
if (s.playbackMode === 'sporadic') {
|
||||||
|
clearInterval(s.initialSporadicPlayInterval)
|
||||||
|
clearInterval(s.sporadicInterval)
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
startTimer () {
|
startTimer () {
|
||||||
this.timeRemaining -= 1
|
this.timeRemaining -= 1
|
||||||
@@ -176,27 +305,27 @@ export default {
|
|||||||
if (!this.isFilterEnabled && !this.isTremoloEnabled) {
|
if (!this.isFilterEnabled && !this.isTremoloEnabled) {
|
||||||
this.noise.toDestination()
|
this.noise.toDestination()
|
||||||
} else if (!this.isFilterEnabled && this.isTremoloEnabled) {
|
} else if (!this.isFilterEnabled && this.isTremoloEnabled) {
|
||||||
this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
||||||
this.noise.connect(this.tremolo)
|
this.noise.connect(this.tremolo)
|
||||||
} else if (this.isFilterEnabled && !this.isLFOFilterCutoffEnabled && !this.isTremoloEnabled) {
|
} else if (this.isFilterEnabled && !this.isLFOFilterCutoffEnabled && !this.isTremoloEnabled) {
|
||||||
this.filter = new Filter(this.filterCutoff, this.filterType).toDestination()
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).toDestination()
|
||||||
this.noise.connect(this.filter)
|
this.noise.connect(this.filter)
|
||||||
this.lfo.disconnect()
|
this.lfo.disconnect()
|
||||||
this.lfo.stop()
|
this.lfo.stop()
|
||||||
} else if (this.isFilterEnabled && this.isLFOFilterCutoffEnabled && !this.isTremoloEnabled) {
|
} else if (this.isFilterEnabled && this.isLFOFilterCutoffEnabled && !this.isTremoloEnabled) {
|
||||||
this.filter = new Filter(this.filterCutoff, this.filterType).toDestination()
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).toDestination()
|
||||||
this.noise.connect(this.filter)
|
this.noise.connect(this.filter)
|
||||||
this.lfo = new LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
|
this.lfo = new Tone.LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
|
||||||
this.lfo.connect(this.filter.frequency).start()
|
this.lfo.connect(this.filter.frequency).start()
|
||||||
} else if (this.isFilterEnabled && this.isLFOFilterCutoffEnabled && this.isTremoloEnabled) {
|
} else if (this.isFilterEnabled && this.isLFOFilterCutoffEnabled && this.isTremoloEnabled) {
|
||||||
this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
||||||
this.filter = new Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
||||||
this.noise.connect(this.filter)
|
this.noise.connect(this.filter)
|
||||||
this.lfo = new LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
|
this.lfo = new Tone.LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
|
||||||
this.lfo.connect(this.filter.frequency).start()
|
this.lfo.connect(this.filter.frequency).start()
|
||||||
} else {
|
} else {
|
||||||
this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
|
||||||
this.filter = new Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
||||||
this.noise.connect(this.filter)
|
this.noise.connect(this.filter)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -213,7 +342,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.selectedProfile = this.profileItems.find(p => p.id === profileId)
|
this.selectedProfile = this.profileItems.find(p => p.id === profileId)
|
||||||
}
|
}
|
||||||
this.loadProfile()
|
this.exportedProfile = this.profileItems[0]
|
||||||
|
this.recordedProfile = this.profileItems[0]
|
||||||
|
this.loadProfile(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -250,6 +381,7 @@ export default {
|
|||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this.profileDialog = false
|
this.profileDialog = false
|
||||||
this.populateProfileItems(response.data.id)
|
this.populateProfileItems(response.data.id)
|
||||||
|
this.unsavedWork = false
|
||||||
this.infoSnackbarText = 'Profile Saved'
|
this.infoSnackbarText = 'Profile Saved'
|
||||||
this.infoSnackbar = true
|
this.infoSnackbar = true
|
||||||
}
|
}
|
||||||
@@ -278,6 +410,7 @@ export default {
|
|||||||
samples: this.loadedSamples
|
samples: this.loadedSamples
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
|
this.unsavedWork = false
|
||||||
this.infoSnackbarText = 'Profile Saved'
|
this.infoSnackbarText = 'Profile Saved'
|
||||||
this.infoSnackbar = true
|
this.infoSnackbar = true
|
||||||
}
|
}
|
||||||
@@ -287,30 +420,48 @@ export default {
|
|||||||
this.errorSnackbar = true
|
this.errorSnackbar = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadProfile () {
|
loadProfile (checkForUnsavedWork) {
|
||||||
this.$http.get('/profiles/'.concat(this.selectedProfile.id))
|
if (checkForUnsavedWork && this.unsavedWork) {
|
||||||
.then(response => {
|
this.confirmSwitchProfileDialog = true
|
||||||
if (response.status === 200) {
|
} else {
|
||||||
const profile = response.data.profile
|
this.$http.get('/profiles/'.concat(this.selectedProfile.id))
|
||||||
|
.then(response => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
const profile = response.data.profile
|
||||||
|
|
||||||
this.isTimerEnabled = profile.isTimerEnabled
|
this.isTimerEnabled = profile.isTimerEnabled
|
||||||
this.duration = profile.duration
|
this.duration = profile.duration
|
||||||
this.volume = profile.volume
|
this.volume = profile.volume
|
||||||
this.noiseColor = profile.noiseColor
|
this.noiseColor = profile.noiseColor
|
||||||
this.isFilterEnabled = profile.isFilterEnabled
|
this.isFilterEnabled = profile.isFilterEnabled
|
||||||
this.filterType = profile.filterType
|
this.filterType = profile.filterType
|
||||||
this.filterCutoff = profile.filterCutoff
|
this.filterCutoff = profile.filterCutoff
|
||||||
this.isLFOFilterCutoffEnabled = profile.isLFOFilterCutoffEnabled
|
this.isLFOFilterCutoffEnabled = profile.isLFOFilterCutoffEnabled
|
||||||
this.lfoFilterCutoffFrequency = profile.lfoFilterCutoffFrequency
|
this.lfoFilterCutoffFrequency = profile.lfoFilterCutoffFrequency
|
||||||
this.lfoFilterCutoffRange[0] = profile.lfoFilterCutoffLow
|
this.lfoFilterCutoffRange[0] = profile.lfoFilterCutoffLow
|
||||||
this.lfoFilterCutoffRange[1] = profile.lfoFilterCutoffHigh
|
this.lfoFilterCutoffRange[1] = profile.lfoFilterCutoffHigh
|
||||||
this.isTremoloEnabled = profile.isTremoloEnabled
|
this.isTremoloEnabled = profile.isTremoloEnabled
|
||||||
this.tremoloFrequency = profile.tremoloFrequency
|
this.tremoloFrequency = profile.tremoloFrequency
|
||||||
this.tremoloDepth = profile.tremoloDepth
|
this.tremoloDepth = profile.tremoloDepth
|
||||||
|
|
||||||
this.loadedSamples = profile.samples
|
this.loadedSamples = profile.samples
|
||||||
}
|
|
||||||
})
|
this.activeProfile = profile
|
||||||
|
|
||||||
|
if (this.unwatch) {
|
||||||
|
this.unwatch()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.unwatch = this.$watch('changeableSettings', function () {
|
||||||
|
this.unsavedWork = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.errorSnackbarText = 'Error Loading Profile'
|
||||||
|
this.errorSnackbar = true
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
deleteProfile () {
|
deleteProfile () {
|
||||||
this.$http.delete('/profiles/'.concat(this.selectedProfile.id))
|
this.$http.delete('/profiles/'.concat(this.selectedProfile.id))
|
||||||
@@ -336,6 +487,7 @@ export default {
|
|||||||
this.players.add(s.id, '/samples/' + s.user + '_' + s.name).toDestination()
|
this.players.add(s.id, '/samples/' + s.user + '_' + s.name).toDestination()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.mainPlayLoading = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -353,6 +505,7 @@ export default {
|
|||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this.getSamples()
|
this.getSamples()
|
||||||
|
this.populatePreviewSampleItems()
|
||||||
this.infoSnackbarText = 'Sample Uploaded'
|
this.infoSnackbarText = 'Sample Uploaded'
|
||||||
this.infoSnackbar = true
|
this.infoSnackbar = true
|
||||||
}
|
}
|
||||||
@@ -372,6 +525,8 @@ export default {
|
|||||||
this.checkedSamples.forEach(i => {
|
this.checkedSamples.forEach(i => {
|
||||||
const load = this.allSamples.find(e => e.id === i)
|
const load = this.allSamples.find(e => e.id === i)
|
||||||
load.volume = -10
|
load.volume = -10
|
||||||
|
load.sporadicMin = 30
|
||||||
|
load.sporadicMax = 300
|
||||||
this.loadedSamples.push(load)
|
this.loadedSamples.push(load)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -391,6 +546,9 @@ export default {
|
|||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this.canUpload = response.data.user.canUpload
|
this.canUpload = response.data.user.canUpload
|
||||||
this.$vuetify.theme.dark = response.data.user.darkMode
|
this.$vuetify.theme.dark = response.data.user.darkMode
|
||||||
|
const preferences = response.data.user.preferences
|
||||||
|
this.$vuetify.theme.themes.dark.primary = preferences.accentColor.hex
|
||||||
|
this.$vuetify.theme.themes.light.primary = preferences.accentColor.hex
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -403,6 +561,363 @@ export default {
|
|||||||
if (this.$refs.uploadSampleForm) {
|
if (this.$refs.uploadSampleForm) {
|
||||||
this.$refs.uploadSampleForm.reset()
|
this.$refs.uploadSampleForm.reset()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
openImportDialog () {
|
||||||
|
this.profileMoreDialog = false
|
||||||
|
this.importDialog = true
|
||||||
|
},
|
||||||
|
openExportDialog () {
|
||||||
|
this.profileMoreDialog = false
|
||||||
|
this.exportDialog = true
|
||||||
|
},
|
||||||
|
async importProfile () {
|
||||||
|
const fileContents = await this.readFile(this.importedProfile)
|
||||||
|
const profileJSON = JSON.parse(fileContents)
|
||||||
|
|
||||||
|
this.$http.post('/profiles/import', {
|
||||||
|
name: this.importedProfileName,
|
||||||
|
isTimerEnabled: profileJSON.isTimerEnabled,
|
||||||
|
duration: profileJSON.duration,
|
||||||
|
volume: profileJSON.volume,
|
||||||
|
noiseColor: profileJSON.noiseColor,
|
||||||
|
isFilterEnabled: profileJSON.isFilterEnabled,
|
||||||
|
filterType: profileJSON.filterType,
|
||||||
|
filterCutoff: profileJSON.filterCutoff,
|
||||||
|
isLFOFilterCutoffEnabled: profileJSON.isLFOFilterCutoffEnabled,
|
||||||
|
lfoFilterCutoffFrequency: profileJSON.lfoFilterCutoffFrequency,
|
||||||
|
lfoFilterCutoffLow: profileJSON.lfoFilterCutoffLow,
|
||||||
|
lfoFilterCutoffHigh: profileJSON.lfoFilterCutoffHigh,
|
||||||
|
isTremoloEnabled: profileJSON.isTremoloEnabled,
|
||||||
|
tremoloFrequency: profileJSON.tremoloFrequency,
|
||||||
|
tremoloDepth: profileJSON.tremoloDepth
|
||||||
|
}).then(response => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
this.importDialog = false
|
||||||
|
this.populateProfileItems(response.data.id)
|
||||||
|
this.infoSnackbarText = 'Profile Imported and Saved'
|
||||||
|
this.infoSnackbar = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.errorSnackbarText = 'Error Importing Profile'
|
||||||
|
this.errorSnackbar = true
|
||||||
|
})
|
||||||
|
|
||||||
|
if (this.$refs.importForm) {
|
||||||
|
this.$refs.importForm.reset()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
readFile (file) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const reader = new FileReader()
|
||||||
|
|
||||||
|
reader.onload = res => {
|
||||||
|
resolve(res.target.result)
|
||||||
|
}
|
||||||
|
reader.onerror = err => reject(err)
|
||||||
|
|
||||||
|
reader.readAsText(file)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
exportProfile () {
|
||||||
|
this.$http.get('/profiles/'.concat(this.exportedProfile.id))
|
||||||
|
.then(response => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
const profile = response.data.profile
|
||||||
|
|
||||||
|
const profileJSON = {}
|
||||||
|
profileJSON.name = this.exportedProfile.text
|
||||||
|
profileJSON.isTimerEnabled = profile.isTimerEnabled
|
||||||
|
profileJSON.duration = profile.duration
|
||||||
|
profileJSON.volume = profile.volume
|
||||||
|
profileJSON.noiseColor = profile.noiseColor
|
||||||
|
profileJSON.isFilterEnabled = profile.isFilterEnabled
|
||||||
|
profileJSON.filterType = profile.filterType
|
||||||
|
profileJSON.filterCutoff = profile.filterCutoff
|
||||||
|
profileJSON.isLFOFilterCutoffEnabled = profile.isLFOFilterCutoffEnabled
|
||||||
|
profileJSON.lfoFilterCutoffFrequency = profile.lfoFilterCutoffFrequency
|
||||||
|
profileJSON.lfoFilterCutoffLow = profile.lfoFilterCutoffLow
|
||||||
|
profileJSON.lfoFilterCutoffHigh = profile.lfoFilterCutoffHigh
|
||||||
|
profileJSON.isTremoloEnabled = profile.isTremoloEnabled
|
||||||
|
profileJSON.tremoloFrequency = profile.tremoloFrequency
|
||||||
|
profileJSON.tremoloDepth = profile.tremoloDepth
|
||||||
|
|
||||||
|
const dataStr = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(profileJSON))
|
||||||
|
const downloadAnchorNode = document.createElement('a')
|
||||||
|
downloadAnchorNode.setAttribute('href', dataStr)
|
||||||
|
downloadAnchorNode.setAttribute('download', profileJSON.name + '.json')
|
||||||
|
document.body.appendChild(downloadAnchorNode) // required for firefox
|
||||||
|
downloadAnchorNode.click()
|
||||||
|
downloadAnchorNode.remove()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.errorSnackbarText = 'Error Exporting Profile'
|
||||||
|
this.errorSnackbar = true
|
||||||
|
})
|
||||||
|
|
||||||
|
this.exportDialog = false
|
||||||
|
},
|
||||||
|
populatePreviewSampleItems () {
|
||||||
|
this.$http.get('/samples')
|
||||||
|
.then(response => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
this.previewSampleItems = response.data.samples
|
||||||
|
if (this.previewSampleItems.length > 0) {
|
||||||
|
this.selectedPreviewSample = this.previewSampleItems[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
openEditSampleForm () {
|
||||||
|
if (this.previewSampleItems.length > 0) {
|
||||||
|
this.selectedPreviewSample = this.previewSampleItems[0]
|
||||||
|
}
|
||||||
|
this.loadPreviewSample()
|
||||||
|
},
|
||||||
|
closeEditSampleForm () {
|
||||||
|
this.editSampleDialog = false
|
||||||
|
this.previewSampleLoading = true
|
||||||
|
if (this.previewSamplePlaying) {
|
||||||
|
this.previewSamplePlaying = false
|
||||||
|
this.previewSampleButtonText = 'Preview Sample'
|
||||||
|
this.samplePreviewPlayer.stop()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadPreviewSample () {
|
||||||
|
this.previewSampleLoading = true
|
||||||
|
this.$http.get('/samples/'.concat(this.selectedPreviewSample.id))
|
||||||
|
.then(async response => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
const sample = response.data.sample
|
||||||
|
|
||||||
|
await this.samplePreviewPlayer.load('/samples/' + sample.user + '_' + sample.name)
|
||||||
|
|
||||||
|
this.previewSampleFadeIn = sample.fadeIn
|
||||||
|
this.previewSampleLoopPointsEnabled = sample.loopPointsEnabled
|
||||||
|
if (sample.loopPointsEnabled) {
|
||||||
|
this.previewSampleLoopStart = sample.loopStart
|
||||||
|
this.previewSampleLoopEnd = sample.loopEnd
|
||||||
|
this.samplePreviewPlayer.setLoopPoints(this.previewSampleLoopStart, this.previewSampleLoopEnd)
|
||||||
|
} else {
|
||||||
|
this.previewSampleLoopStart = 0
|
||||||
|
this.previewSampleLoopEnd = 0
|
||||||
|
}
|
||||||
|
this.samplePreviewPlayer.fadeIn = this.previewSampleFadeIn
|
||||||
|
this.previewSampleLength = this.samplePreviewPlayer.buffer.duration
|
||||||
|
this.previewSampleLoading = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updatePreviewSampleLoopPoints () {
|
||||||
|
if (this.previewSampleLoopPointsEnabled) {
|
||||||
|
this.samplePreviewPlayer.setLoopPoints(this.previewSampleLoopStart, this.previewSampleLoopEnd)
|
||||||
|
} else {
|
||||||
|
this.samplePreviewPlayer.setLoopPoints(0, this.samplePreviewPlayer.buffer.duration)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
previewSample () {
|
||||||
|
if (this.previewSamplePlaying) {
|
||||||
|
this.previewSamplePlaying = false
|
||||||
|
this.previewSampleButtonText = 'Preview Sample'
|
||||||
|
this.samplePreviewPlayer.stop()
|
||||||
|
} else {
|
||||||
|
this.previewSamplePlaying = true
|
||||||
|
this.previewSampleButtonText = 'Stop'
|
||||||
|
this.samplePreviewPlayer.start()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
editSample () {
|
||||||
|
this.$http.put('/samples/'.concat(this.selectedPreviewSample.id), {
|
||||||
|
fadeIn: this.previewSampleFadeIn,
|
||||||
|
loopPointsEnabled: this.previewSampleLoopPointsEnabled,
|
||||||
|
loopStart: this.previewSampleLoopStart,
|
||||||
|
loopEnd: this.previewSampleLoopEnd
|
||||||
|
}).then(response => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
this.getSamples()
|
||||||
|
|
||||||
|
// Update sample if it's already loaded in current profile
|
||||||
|
const sample = this.loadedSamples.find(s => s.id === this.selectedPreviewSample.id)
|
||||||
|
if (sample) {
|
||||||
|
sample.fadeIn = this.previewSampleFadeIn
|
||||||
|
sample.loopPointsEnabled = this.previewSampleLoopPointsEnabled
|
||||||
|
sample.loopStart = this.previewSampleLoopStart
|
||||||
|
sample.loopEnd = this.previewSampleLoopEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
this.closeEditSampleForm()
|
||||||
|
this.infoSnackbarText = 'Sample Saved'
|
||||||
|
this.infoSnackbar = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.errorSnackbarText = 'Error Saving Sample'
|
||||||
|
this.errorSnackbar = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updatePreviewSamplePlayerFadeIn () {
|
||||||
|
this.samplePreviewPlayer.fadeIn = this.previewSampleFadeIn
|
||||||
|
},
|
||||||
|
updatePreviewSamplePlayerLoopPoints () {
|
||||||
|
if (this.previewSampleLoopStart >= 0 && this.previewSampleLoopEnd <= this.previewSampleLength) {
|
||||||
|
this.samplePreviewPlayer.setLoopPoints(this.previewSampleLoopStart, this.previewSampleLoopEnd)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openStartRecordingDialog () {
|
||||||
|
this.startRecordingDialog = true
|
||||||
|
this.profileMoreDialog = false
|
||||||
|
},
|
||||||
|
startRecording () {
|
||||||
|
// Save current profile before recording
|
||||||
|
this.updateProfile()
|
||||||
|
|
||||||
|
this.$http.get('/profiles/'.concat(this.recordedProfile.id))
|
||||||
|
.then(async response => {
|
||||||
|
if (response.status === 200) {
|
||||||
|
const profile = response.data.profile
|
||||||
|
|
||||||
|
this.isTimerEnabled = profile.isTimerEnabled
|
||||||
|
this.duration = profile.duration
|
||||||
|
this.volume = profile.volume
|
||||||
|
this.noiseColor = profile.noiseColor
|
||||||
|
this.isFilterEnabled = profile.isFilterEnabled
|
||||||
|
this.filterType = profile.filterType
|
||||||
|
this.filterCutoff = profile.filterCutoff
|
||||||
|
this.isLFOFilterCutoffEnabled = profile.isLFOFilterCutoffEnabled
|
||||||
|
this.lfoFilterCutoffFrequency = profile.lfoFilterCutoffFrequency
|
||||||
|
this.lfoFilterCutoffRange[0] = profile.lfoFilterCutoffLow
|
||||||
|
this.lfoFilterCutoffRange[1] = profile.lfoFilterCutoffHigh
|
||||||
|
this.isTremoloEnabled = profile.isTremoloEnabled
|
||||||
|
this.tremoloFrequency = profile.tremoloFrequency
|
||||||
|
this.tremoloDepth = profile.tremoloDepth
|
||||||
|
|
||||||
|
this.loadedSamples = profile.samples
|
||||||
|
|
||||||
|
this.startRecordingDialog = false
|
||||||
|
this.recordingDialog = true
|
||||||
|
this.recordingTimeElapsed = 0
|
||||||
|
|
||||||
|
await this.recorder.start()
|
||||||
|
this.recordingInterval = setInterval(() => this.recordingTimeElapsed++, 1000)
|
||||||
|
this.playProfileForRecording()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.errorSnackbarText = 'Error Recording Profile'
|
||||||
|
this.errorSnackbar = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
playProfileForRecording () {
|
||||||
|
this.playDisabled = true
|
||||||
|
Tone.Transport.cancel()
|
||||||
|
|
||||||
|
if (!this.isFilterEnabled && !this.isTremoloEnabled) {
|
||||||
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.recorder).toDestination()
|
||||||
|
} else if (!this.isFilterEnabled && this.isTremoloEnabled) {
|
||||||
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).connect(this.recorder).toDestination().start()
|
||||||
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.tremolo)
|
||||||
|
} else if (this.isFilterEnabled && !this.isTremoloEnabled) {
|
||||||
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).connect(this.recorder).toDestination()
|
||||||
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
||||||
|
} else if (this.isFilterEnabled && this.isTremoloEnabled) {
|
||||||
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).connect(this.recorder).toDestination().start()
|
||||||
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
||||||
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
||||||
|
} else {
|
||||||
|
this.tremolo = new Tone.Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).connect(this.recorder).toDestination().start()
|
||||||
|
this.filter = new Tone.Filter(this.filterCutoff, this.filterType).connect(this.tremolo)
|
||||||
|
this.noise = new Tone.Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isLFOFilterCutoffEnabled) {
|
||||||
|
this.lfo = new Tone.LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
|
||||||
|
this.lfo.connect(this.filter.frequency).start()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadedSamples.forEach(s => {
|
||||||
|
this.players.player(s.id).loop = true
|
||||||
|
this.players.player(s.id).fadeIn = s.fadeIn
|
||||||
|
if (s.loopPointsEnabled) {
|
||||||
|
this.players.player(s.id).setLoopPoints(s.loopStart, s.loopEnd)
|
||||||
|
} else {
|
||||||
|
this.players.player(s.id).setLoopPoints(0, this.players.player(s.id).buffer.duration)
|
||||||
|
}
|
||||||
|
this.players.player(s.id).volume.value = s.volume
|
||||||
|
|
||||||
|
this.players.player(s.id).disconnect()
|
||||||
|
if (s.reverbEnabled) {
|
||||||
|
const reverb = new Tone.Reverb(s.reverbDecay).connect(this.recorder).toDestination()
|
||||||
|
reverb.set({ preDelay: s.reverbPreDelay, wet: s.reverbWet })
|
||||||
|
this.players.player(s.id).connect(reverb)
|
||||||
|
} else {
|
||||||
|
this.players.player(s.id).connect(this.recorder).toDestination()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.noise.sync().start(0)
|
||||||
|
|
||||||
|
this.loadedSamples.forEach(s => {
|
||||||
|
if (s.playbackMode === 'sporadic') {
|
||||||
|
this.players.player(s.id).loop = false
|
||||||
|
|
||||||
|
const maxInt = parseInt(s.sporadicMax, 10)
|
||||||
|
const minInt = parseInt(s.sporadicMin, 10)
|
||||||
|
const rand = Math.floor(Math.random() * (maxInt - minInt + 1) + minInt)
|
||||||
|
|
||||||
|
s.initialSporadicPlayInterval = setInterval(() => this.playSporadicSample(s.id), rand * 1000)
|
||||||
|
} else {
|
||||||
|
this.players.player(s.id).loop = true
|
||||||
|
this.players.player(s.id).unsync().sync().start(0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Tone.Transport.start('+0.1')
|
||||||
|
},
|
||||||
|
async stopRecording () {
|
||||||
|
const recording = await this.recorder.stop()
|
||||||
|
|
||||||
|
// Set active profile back to the selected one
|
||||||
|
this.loadProfile(false)
|
||||||
|
|
||||||
|
const url = URL.createObjectURL(recording)
|
||||||
|
const anchor = document.createElement('a')
|
||||||
|
anchor.download = this.recordingFileName + '.webm'
|
||||||
|
anchor.href = url
|
||||||
|
anchor.click()
|
||||||
|
|
||||||
|
clearInterval(this.recordingInterval)
|
||||||
|
|
||||||
|
this.loadedSamples.forEach(s => {
|
||||||
|
if (s.playbackMode === 'sporadic') {
|
||||||
|
clearInterval(s.initialSporadicPlayInterval)
|
||||||
|
clearInterval(s.sporadicInterval)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.recordingDialog = false
|
||||||
|
this.stop()
|
||||||
|
},
|
||||||
|
async cancelRecording () {
|
||||||
|
await this.recorder.stop()
|
||||||
|
|
||||||
|
// Set active profile back to the selected one
|
||||||
|
this.loadProfile(false)
|
||||||
|
|
||||||
|
clearInterval(this.recordingInterval)
|
||||||
|
this.recordingDialog = false
|
||||||
|
this.stop()
|
||||||
|
},
|
||||||
|
discardChanges () {
|
||||||
|
this.unsavedWork = false
|
||||||
|
this.loadProfile(true)
|
||||||
|
this.confirmSwitchProfileDialog = false
|
||||||
|
},
|
||||||
|
saveChanges () {
|
||||||
|
// Set active profile back to previously selected one before saving
|
||||||
|
this.selectedProfile = this.profileItems.find(p => p.text === this.activeProfile.name)
|
||||||
|
this.updateProfile()
|
||||||
|
this.confirmSwitchProfileDialog = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
|
name: 'Register',
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
valid: false,
|
valid: false,
|
||||||
name: '',
|
name: '',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuetify from 'vuetify/lib/framework'
|
import Vuetify from 'vuetify/lib'
|
||||||
|
|
||||||
import colors from 'vuetify/lib/util/colors'
|
import colors from 'vuetify/lib/util/colors'
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<Account />
|
<AccountPage />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Account from '../components/Account'
|
import AccountPage from '../components/AccountPage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AccountView',
|
name: 'AccountView',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Account
|
AccountPage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<Admin />
|
<AdminPage />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Admin from '../components/Admin'
|
import AdminPage from '../components/AdminPage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AdminView',
|
name: 'AdminView',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Admin
|
AdminPage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<Noise />
|
<NoisePage />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Noise from '../components/Noise'
|
import NoisePage from '../components/NoisePage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HomeView',
|
name: 'HomeView',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Noise
|
NoisePage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<Login />
|
<LoginPage />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Login from '../components/Login'
|
import LoginPage from '../components/LoginPage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LoginView',
|
name: 'LoginView',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Login
|
LoginPage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<Register />
|
<RegisterPage />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Register from '../components/Register'
|
import RegisterPage from '../components/RegisterPage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RegisterView',
|
name: 'RegisterView',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Register
|
RegisterPage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user