Added some drawing methods
This commit is contained in:
@ -463,6 +463,16 @@ export abstract class AudibleEvent extends AbstractEvent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public draw = (lambda: Function) => {
|
||||
lambda(this.values);
|
||||
return this;
|
||||
}
|
||||
|
||||
public clear = () => {
|
||||
this.app.api.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
freq = (value: number | number[], ...kwargs: number[]): this => {
|
||||
/*
|
||||
* This function is used to set the frequency of the Event.
|
||||
|
||||
@ -6,6 +6,7 @@ import {
|
||||
filterObject,
|
||||
arrayOfObjectsToObjectWithArrays,
|
||||
objectWithArraysToArrayOfObjects,
|
||||
maybeAtomic,
|
||||
} from "../Utils/Generic";
|
||||
|
||||
export type MidiParams = {
|
||||
@ -110,8 +111,8 @@ export class MidiEvent extends AudibleEvent {
|
||||
|
||||
const newArrays = arrayOfObjectsToObjectWithArrays(events) as MidiParams;
|
||||
|
||||
this.values.note = newArrays.note;
|
||||
if (newArrays.bend) this.values.bend = newArrays.bend;
|
||||
this.values.note = maybeAtomic(newArrays.note);
|
||||
if (newArrays.bend) this.values.bend = maybeAtomic(newArrays.bend);
|
||||
};
|
||||
|
||||
out = (): void => {
|
||||
|
||||
@ -5,6 +5,7 @@ import {
|
||||
filterObject,
|
||||
arrayOfObjectsToObjectWithArrays,
|
||||
objectWithArraysToArrayOfObjects,
|
||||
maybeAtomic,
|
||||
} from "../Utils/Generic";
|
||||
import { midiToFreq, resolvePitchClass } from "zifferjs";
|
||||
|
||||
@ -414,11 +415,11 @@ export class SoundEvent extends AudibleEvent {
|
||||
|
||||
const newArrays = arrayOfObjectsToObjectWithArrays(events) as SoundParams;
|
||||
|
||||
this.values.note = newArrays.note;
|
||||
this.values.freq = newArrays.freq;
|
||||
this.values.pitch = newArrays.pitch;
|
||||
this.values.octave = newArrays.octave;
|
||||
this.values.pitchOctave = newArrays.pitchOctave;
|
||||
this.values.note = maybeAtomic(newArrays.note);
|
||||
this.values.freq = maybeAtomic(newArrays.freq);
|
||||
this.values.pitch = maybeAtomic(newArrays.pitch);
|
||||
this.values.octave = maybeAtomic(newArrays.octave);
|
||||
this.values.pitchOctave = maybeAtomic(newArrays.pitchOctave);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user