forked from external-repos/noisedash
Add sample edit feature
This commit is contained in:
@@ -61,7 +61,6 @@ module.exports = function () {
|
||||
|
||||
if (userVersion === 0) {
|
||||
db.run('ALTER TABLE samples ADD COLUMN fade_in REAL DEFAULT 0')
|
||||
db.run('ALTER TABLE samples ADD COLUMN fade_out 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')
|
||||
|
||||
@@ -351,7 +351,9 @@ router.get('/profiles/:profileId', (req, res) => {
|
||||
sampleQueryArgs.push(row.sample)
|
||||
})
|
||||
|
||||
db.all(`SELECT samples.id, name, profiles_samples.volume
|
||||
db.all(`SELECT samples.id, name, profiles_samples.volume,
|
||||
fade_in as fadeIn, loop_points_enabled as loopPointsEnabled,
|
||||
loop_start as loopStart, loop_end as loopEnd
|
||||
FROM samples
|
||||
INNER JOIN profiles_samples
|
||||
ON profiles_samples.sample = samples.id
|
||||
@@ -371,6 +373,10 @@ router.get('/profiles/:profileId', (req, res) => {
|
||||
sample.id = row.id
|
||||
sample.name = row.name
|
||||
sample.volume = row.volume
|
||||
sample.fadeIn = row.fadeIn
|
||||
sample.loopPointsEnabled = row.loopPointsEnabled === 1
|
||||
sample.loopStart = row.loopStart
|
||||
sample.loopEnd = row.loopEnd
|
||||
|
||||
samples.push(sample)
|
||||
})
|
||||
|
||||
@@ -158,16 +158,13 @@ router.put('/samples/:sampleId', (req, res) => {
|
||||
})
|
||||
|
||||
db.run(`UPDATE samples SET
|
||||
name = ?,
|
||||
fade_in = ?,
|
||||
fade_out = ?,
|
||||
loop_points_enabled = ?,
|
||||
loop_start = ?,
|
||||
loop_end = ?,
|
||||
loop_end = ?
|
||||
WHERE id = ?`, [
|
||||
req.body.name,
|
||||
req.body.fadeIn,
|
||||
req.body.loopPointsEnabled,
|
||||
req.body.loopPointsEnabled ? 1 : 0,
|
||||
req.body.loopStart,
|
||||
req.body.loopEnd,
|
||||
req.params.sampleId
|
||||
|
||||
Reference in New Issue
Block a user