remove +1 in ziffers object

This commit is contained in:
2023-10-27 13:53:57 +02:00
parent 662f8ef82f
commit 34b4c1c114

View File

@ -82,7 +82,7 @@ export class Player extends Event {
}; };
origin = (): number => { origin = (): number => {
return this.app.clock.pulses_since_origin + 1; return this.app.clock.pulses_since_origin;
}; };
pulse = (): number => { pulse = (): number => {
@ -109,13 +109,13 @@ export class Player extends Event {
} }
const patternIsStarting = (this.notStarted() && const patternIsStarting = (this.notStarted() &&
(this.pulse() === 0 || this.origin() >= this.nextBeatInTicks()) && (this.pulse() === 0 || this.origin() >= this.nextBeatInTicks()) &&
this.origin() >= this.waitTime); this.origin() >= this.waitTime);
const timeToPlayNext = (this.current && const timeToPlayNext = (this.current &&
this.pulseToSecond(this.origin()) >= this.pulseToSecond(this.origin()) >=
this.pulseToSecond(this.lastCallTime) + this.pulseToSecond(this.lastCallTime) +
this.pulseToSecond(this.current.duration*4*this.app.clock.ppqn) && this.pulseToSecond(this.current.duration * 4 * this.app.clock.ppqn) &&
this.origin() >= this.waitTime); this.origin() >= this.waitTime);
// If pattern is starting or it's time to play next event // If pattern is starting or it's time to play next event
@ -142,7 +142,7 @@ export class Player extends Event {
if (this.areWeThereYet()) { if (this.areWeThereYet()) {
const event = this.next() as Pitch | Chord | ZRest; const event = this.next() as Pitch | Chord | ZRest;
const noteLengthInSeconds = this.app.clock.convertPulseToSecond(event.duration*4*this.app.clock.ppqn); const noteLengthInSeconds = this.app.clock.convertPulseToSecond(event.duration * 4 * this.app.clock.ppqn);
if (event instanceof Pitch) { if (event instanceof Pitch) {
const obj = event.getExisting( const obj = event.getExisting(
"freq", "freq",
@ -152,8 +152,8 @@ export class Player extends Event {
"octave", "octave",
"parsedScale" "parsedScale"
); );
if(event.sound) name = event.sound as string; if (event.sound) name = event.sound as string;
if(event.soundIndex) obj.n = event.soundIndex; if (event.soundIndex) obj.n = event.soundIndex;
obj.dur = noteLengthInSeconds; obj.dur = noteLengthInSeconds;
return new SoundEvent(obj, this.app).sound(name || "sine"); return new SoundEvent(obj, this.app).sound(name || "sine");
} else if (event instanceof Chord) { } else if (event instanceof Chord) {
@ -167,8 +167,8 @@ export class Player extends Event {
"parsedScale" "parsedScale"
); );
}); });
const sound: SoundParams = {dur: noteLengthInSeconds}; const sound: SoundParams = { dur: noteLengthInSeconds };
if(name) sound.s = name; if (name) sound.s = name;
return new SoundEvent(sound, this.app).chord(pitches); return new SoundEvent(sound, this.app).chord(pitches);
} else if (event instanceof ZRest) { } else if (event instanceof ZRest) {
return RestEvent.createRestProxy(event.duration, this.app); return RestEvent.createRestProxy(event.duration, this.app);
@ -191,7 +191,7 @@ export class Player extends Event {
"parsedScale", "parsedScale",
); );
if (event instanceof Pitch) { if (event instanceof Pitch) {
if(event.soundIndex) obj.channel = event.soundIndex; if (event.soundIndex) obj.channel = event.soundIndex;
const note = new MidiEvent(obj, this.app); const note = new MidiEvent(obj, this.app);
return value ? note.note(value) : note; return value ? note.note(value) : note;
} else if (event instanceof ZRest) { } else if (event instanceof ZRest) {