Skip to content

Commit

Permalink
refactor: moved TempoMapper to blue.time.TempoMap
Browse files Browse the repository at this point in the history
  • Loading branch information
kunstmusik committed Oct 22, 2023
1 parent e2bfde6 commit f185541
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 292 deletions.
221 changes: 0 additions & 221 deletions blue-core/src/main/java/blue/noteProcessor/TempoMapper.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import blue.soundObject.Note;
import blue.soundObject.NoteList;
import blue.soundObject.NoteParseException;
import blue.time.TempoMap;
import electric.xml.Element;

/**
Expand Down Expand Up @@ -37,7 +38,7 @@ public TimeWarpProcessor(TimeWarpProcessor twp) {
@Override
public NoteList processNotes(NoteList in) throws NoteProcessorException {
Note temp;
TempoMapper tm = TempoMapper.createTempoMapper(this.timeWarpString);
TempoMap tm = TempoMap.createTempoMap(this.timeWarpString);

if (tm == null) {
throw new NoteProcessorException(this, BlueSystem
Expand Down
4 changes: 2 additions & 2 deletions blue-core/src/main/java/blue/time/TempoMap.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* blue - object composition environment for csound
* Copyright (c) 2023 Steven Yi ([email protected])
* Copyright (c) 2000-2006, 2023 Steven Yi ([email protected])
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
Expand Down Expand Up @@ -213,7 +213,7 @@ public double secondsToBeats(double seconds) {
public String toString() {
StringBuilder buffer = new StringBuilder();

buffer.append("[TempoMapper]").append("\n");
buffer.append("[TempoMap]").append("\n");

for (BeatTempoPair pair : timeMap) {
buffer.append(pair.beat).append(" : ").append(pair.tempo).append(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,33 @@

import blue.automation.Parameter;
import blue.event.PlayModeListener;
import blue.noteProcessor.TempoMapper;
import blue.score.ScoreGenerationException;
import blue.services.render.CSDRenderService;
import blue.services.render.CsdRenderResult;
import blue.services.render.DiskRenderJob;
import blue.services.render.DiskRenderService;
import blue.services.render.RenderTimeManager;
import blue.settings.PlaybackSettings;
import blue.time.TempoMap;
import blue.utility.FileUtilities;
import com.kunstmusik.csoundjni.Csound;

import java.awt.Color;
import java.io.IOException;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.windows.IOColors;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
import blue.score.ScoreGenerationException;
import blue.services.render.CSDRenderService;
import blue.services.render.CsdRenderResult;
import blue.services.render.DiskRenderJob;
import blue.services.render.DiskRenderService;
import blue.services.render.RenderTimeManager;
import blue.settings.PlaybackSettings;
import blue.utility.FileUtilities;
import com.kunstmusik.csoundjni.Csound;
import java.awt.Color;
import java.io.IOException;
import org.openide.util.Exceptions;
Expand Down Expand Up @@ -63,7 +79,7 @@ private void initialize() {
private void exec(String[] args,
File currentWorkingDirectory,
double startTime,
TempoMapper mapper,
TempoMap tempoMap,
ArrayList<Parameter> parameters) {

//csnd.csoundInitialize(null, null, csnd.CSOUNDINIT_NO_SIGNAL_HANDLER);
Expand Down Expand Up @@ -139,9 +155,9 @@ private void exec(String[] args,
double currentTime = 0.0f;

if (startTime >= 0.0f) {
if (mapper != null) {
double renderStartSeconds = mapper.beatsToSeconds(startTime);
currentTime = mapper.secondsToBeats(
if (tempoMap != null) {
double renderStartSeconds = tempoMap.beatsToSeconds(startTime);
currentTime = tempoMap.secondsToBeats(
scoreTime + renderStartSeconds);
currentTime -= startTime;
} else {
Expand Down Expand Up @@ -179,7 +195,7 @@ private void exec(String[] args,
public void execWait(String[] args,
File currentWorkingDirectory,
double startTime,
TempoMapper mapper,
TempoMap mapper,
ArrayList<Parameter> parameters) {
initialize();
exec(args, currentWorkingDirectory, startTime, mapper, parameters);
Expand Down
Loading

0 comments on commit f185541

Please sign in to comment.