Documenting ziffers
This commit is contained in:
@ -42,10 +42,10 @@ export class NoteEvent extends AudibleEvent {
|
||||
const funcResult = func(this);
|
||||
if(funcResult instanceof Object) {
|
||||
return funcResult;
|
||||
|
||||
}
|
||||
else {
|
||||
func(this.values);
|
||||
this.update();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -63,12 +63,15 @@ export class NoteEvent extends AudibleEvent {
|
||||
}
|
||||
|
||||
update = (): void => {
|
||||
if(this.values.key && this.values.pitch && this.values.parsedScale && this.values.octave) {
|
||||
const [note,bend] = noteFromPc(this.values.key, this.values.pitch, this.values.parsedScale, this.values.octave);
|
||||
this.values.note = note;
|
||||
this.values.freq = midiToFreq(note);
|
||||
if(bend) this.values.bend = bend;
|
||||
}
|
||||
const [note, bend] = noteFromPc(
|
||||
this.values.key || "C4",
|
||||
this.values.pitch || 0,
|
||||
this.values.parsedScale || "MAJOR",
|
||||
this.values.octave || 0
|
||||
);
|
||||
this.values.note = note;
|
||||
this.values.freq = midiToFreq(note);
|
||||
if(bend) this.values.bend = bend;
|
||||
}
|
||||
|
||||
out = (): void => {
|
||||
|
||||
@ -225,6 +225,7 @@ export class SoundEvent extends AudibleEvent {
|
||||
if (funcResult instanceof Object) return funcResult;
|
||||
else {
|
||||
func(this.values);
|
||||
this.update();
|
||||
return this;
|
||||
}
|
||||
};
|
||||
@ -237,20 +238,13 @@ export class SoundEvent extends AudibleEvent {
|
||||
sus = this.sustain;
|
||||
|
||||
update = (): void => {
|
||||
if (
|
||||
this.values.key &&
|
||||
this.values.pitch &&
|
||||
this.values.parsedScale &&
|
||||
this.values.octave
|
||||
) {
|
||||
const [note, _] = noteFromPc(
|
||||
this.values.key,
|
||||
this.values.pitch,
|
||||
this.values.parsedScale,
|
||||
this.values.octave
|
||||
this.values.key || "C4",
|
||||
this.values.pitch || 0,
|
||||
this.values.parsedScale || "MAJOR",
|
||||
this.values.octave || 0
|
||||
);
|
||||
this.values.freq = midiToFreq(note);
|
||||
}
|
||||
};
|
||||
|
||||
out = (): object => {
|
||||
|
||||
@ -124,7 +124,7 @@ export class Player extends Event {
|
||||
if(this.areWeThereYet()) {
|
||||
const event = this.next() as Pitch|Chord|ZRest;
|
||||
if(event instanceof Pitch) {
|
||||
const obj = event.getExisting("freq","pitch","key","scale","octave");
|
||||
const obj = event.getExisting("freq","pitch","key","scale","octave","parsedScale");
|
||||
return new SoundEvent(obj, this.app).sound(name);
|
||||
} else if(event instanceof ZRest) {
|
||||
return RestEvent.createRestProxy(event.duration, this.app);
|
||||
@ -138,7 +138,7 @@ export class Player extends Event {
|
||||
if(this.areWeThereYet()) {
|
||||
const event = this.next() as Pitch|Chord|ZRest;
|
||||
if(event instanceof Pitch) {
|
||||
const obj = event.getExisting("note","pitch","bend","key","scale","octave");
|
||||
const obj = event.getExisting("note","pitch","bend","key","scale","octave","parsedScale");
|
||||
const note = new NoteEvent(obj, this.app);
|
||||
return value ? note.note(value) : note;
|
||||
} else if(event instanceof ZRest) {
|
||||
|
||||
Reference in New Issue
Block a user