handle objects in getPlayableNoteValue
This commit is contained in:
parent
6025dd6f79
commit
467b3db824
1 changed files with 3 additions and 0 deletions
|
|
@ -50,6 +50,9 @@ export const mod = (n, m) => ((n % m) + m) % m;
|
||||||
|
|
||||||
export const getPlayableNoteValue = (hap) => {
|
export const getPlayableNoteValue = (hap) => {
|
||||||
let { value: note, context } = hap;
|
let { value: note, context } = hap;
|
||||||
|
if (typeof note === 'object' && !Array.isArray(note)) {
|
||||||
|
note = note.note || note.n || note.value;
|
||||||
|
}
|
||||||
// if value is number => interpret as midi number as long as its not marked as frequency
|
// if value is number => interpret as midi number as long as its not marked as frequency
|
||||||
if (typeof note === 'number' && context.type !== 'frequency') {
|
if (typeof note === 'number' && context.type !== 'frequency') {
|
||||||
note = fromMidi(hap.value);
|
note = fromMidi(hap.value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue