Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
jhammen
handrumr.lv2
Commits
fd217cef
Commit
fd217cef
authored
May 12, 2022
by
jhammen
Browse files
allow per instrument sample base path
parent
a868ee82
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugin.cpp
View file @
fd217cef
...
...
@@ -279,6 +279,7 @@ Instrument *Plugin::loadInstrument(Json::Value &jsonInstr, uint16_t channel, flo
Instrument
*
instrument
=
new
handrumr
::
Instrument
();
instrument
->
name
(
jsonInstr
[
"iname"
].
asString
());
float
instgain
=
jsonInstr
.
isMember
(
"gain"
)
?
jsonInstr
[
"gain"
].
asFloat
()
:
0.0
;
string
instbase
=
jsonInstr
.
isMember
(
"folder"
)
?
jsonInstr
[
"folder"
].
asString
()
:
sampleBase
;
// layers
Json
::
Value
jsonLayers
=
jsonInstr
[
"layers"
];
uint16_t
layerCount
=
jsonLayers
.
size
();
...
...
@@ -309,7 +310,7 @@ Instrument *Plugin::loadInstrument(Json::Value &jsonInstr, uint16_t channel, flo
uint16_t
bufferCount
=
0
;
// overall channel count for sample
for
(
uint16_t
f
=
0
;
f
<
fileCount
;
f
++
)
{
const
string
&
filename
=
jsamples
[
f
][
"file"
].
asString
();
const
string
path
=
fullpath
(
sampleB
ase
,
filename
);
const
string
path
=
fullpath
(
instb
ase
,
filename
);
const
float
filegain
=
jsamples
[
f
].
isMember
(
"gain"
)
?
jsamples
[
f
][
"gain"
].
asFloat
()
:
0.0
;
const
float
gain
=
db2ratio
(
ogaindb
+
instgain
+
layergain
+
filegain
);
...
...
@@ -330,7 +331,7 @@ Instrument *Plugin::loadInstrument(Json::Value &jsonInstr, uint16_t channel, flo
SampleFileBuffer
*
buffers
=
new
SampleFileBuffer
[
bufferCount
];
uint16_t
index
=
0
;
for
(
uint16_t
f
=
0
;
f
<
fileCount
;
f
++
)
{
const
string
path
=
fullpath
(
sampleB
ase
,
jsamples
[
f
][
"file"
].
asString
());
const
string
path
=
fullpath
(
instb
ase
,
jsamples
[
f
][
"file"
].
asString
());
SampleFile
*
file
=
filecache
[
path
];
uint64_t
frames
=
file
->
frames
();
for
(
uint16_t
c
=
0
;
c
<
bufferCount
;
c
++
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment