Skip to content

Commit

Permalink
fix(synthesizer): update
Browse files Browse the repository at this point in the history
  • Loading branch information
ThornWalli committed Aug 30, 2023
1 parent 059a169 commit 3cacc6f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
17 changes: 2 additions & 15 deletions packages/disks/extras13/synthesizer/classes/NoteDescription.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import { Time } from 'tone';
import Notation from './Notation';
import Notation from './TimeNotation';

export default class NoteDescription {
// eslint-disable-next-line complexity
constructor({
name,
duration,
velocity,
time,
dot,
triplet,
selected,
position,
index
}) {
constructor({ name, duration, velocity, time, dot, triplet }) {
if (typeof duration === 'string') {
const durationNotation = Notation.parse(duration);

Expand All @@ -33,9 +23,6 @@ export default class NoteDescription {
this.time = time;
this.dot = dot || false;
this.triplet = triplet || false;
// this.selected = selected !== undefined ? selected : false;
// this.position = position !== undefined ? position : 0;
// this.index = index !== undefined ? index : -1;
}

get bindingCount() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default class Notation {
export default class TimeNotation {
constructor(notation) {
const { number, character, dot } = splitNotation(notation);
this.number = Number(number);
Expand All @@ -16,12 +16,12 @@ export default class Notation {
}

static parse(duration) {
return new Notation(duration);
return new TimeNotation(duration);
}
}

function splitNotation(notation) {
if (notation instanceof Notation) {
if (notation instanceof TimeNotation) {
return notation;
}
if (typeof notation === 'number') {
Expand Down
2 changes: 1 addition & 1 deletion packages/disks/extras13/synthesizer/classes/Track.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '../utils';
import NoteDescription from './NoteDescription';
import TimelineNoteDescription from './TimelineNoteDescription';
import Notation from './Notation';
import Notation from './TimeNotation';
const DEFAULT_TYPE = 'Synth';

export default class Track {
Expand Down
14 changes: 13 additions & 1 deletion packages/disks/extras13/synthesizer/components/Track.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ export default {
fill: true,
title: 'Triplet',
name: CONFIG_NAMES.SYNTHESIZER_INPUT_TRIPLET
},
{
fill: true,
title: 'Sharp',
name: CONFIG_NAMES.SYNTHESIZER_INPUT_SHARP
},
{
fill: true,
title: '2x Sharp',
name: CONFIG_NAMES.SYNTHESIZER_INPUT_DOUBLE_SHARP
}
]
]
Expand Down Expand Up @@ -466,7 +476,9 @@ export default {
name,
time: this.duration,
dot: this.model[CONFIG_NAMES.SYNTHESIZER_INPUT_DOT],
triplet: this.model[CONFIG_NAMES.SYNTHESIZER_INPUT_TRIPLET]
triplet: this.model[CONFIG_NAMES.SYNTHESIZER_INPUT_TRIPLET],
sharp: this.model[CONFIG_NAMES.SYNTHESIZER_INPUT_SHARP],
doubleSharp: this.model[CONFIG_NAMES.SYNTHESIZER_INPUT_DOUBLE_SHARP]
});
console.log(note.notation.toString());
Expand Down
6 changes: 5 additions & 1 deletion packages/disks/extras13/synthesizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ export const CONFIG_NAMES = {
SYNTHESIZER_TRACK: 'extras13_synthesizer_track',
SYNTHESIZER_TRACKS: 'extras13_synthesizer_tracks',
SYNTHESIZER_INPUT_DOT: 'extras13_synthesizer_input_dot',
SYNTHESIZER_INPUT_TRIPLET: 'extras13_synthesizer_input_triplet'
SYNTHESIZER_INPUT_TRIPLET: 'extras13_synthesizer_input_triplet',
SYNTHESIZER_INPUT_SHARP: 'extras13_synthesizer_input_sharp',
SYNTHESIZER_INPUT_DOUBLE_SHARP: 'extras13_synthesizer_input_double_sharp'
};

export const CONFIG_DEFAULTS = {};
Expand Down Expand Up @@ -236,6 +238,8 @@ function getDefaultTrackModel(track) {
[CONFIG_NAMES.SYNTHESIZER_SHOW_KEYBOARD]: true,
[CONFIG_NAMES.SYNTHESIZER_INPUT_DOT]: false,
[CONFIG_NAMES.SYNTHESIZER_INPUT_TRIPLET]: false,
[CONFIG_NAMES.SYNTHESIZER_INPUT_SHARP]: false,
[CONFIG_NAMES.SYNTHESIZER_INPUT_DOUBLE_SHARP]: false,
[CONFIG_NAMES.SYNTHESIZER_START_OCTAVE]: 4,
[CONFIG_NAMES.SYNTHESIZER_OCTAVE_COUNT]: 2
};
Expand Down

0 comments on commit 3cacc6f

Please sign in to comment.