Conductor Final Continuous Tempo & Time Sigs
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 215 B |
Binary file not shown.
|
After Width: | Height: | Size: 204 B |
Binary file not shown.
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 186 B |
@@ -216,7 +216,7 @@ final class Conductor
|
||||
//if (beatsPerMeasure == curChange.beatsPerMeasure && stepsPerBeat == curChange.stepsPerBeat) continue;
|
||||
/* TODO: make so time sigs doesnt stop the bpm change if its in the duration of bpm change */
|
||||
|
||||
if (curChange.songTime != time) curChange = mapBPMChange(curChange, time, curChange.bpm, null, prevChange);
|
||||
if (curChange.songTime != time) curChange = mapBPMChange(prevChange = curChange, time, curChange.bpm, null, prevChange);
|
||||
curChange.beatsPerMeasure = params[0];
|
||||
curChange.stepsPerBeat = params[1];
|
||||
|
||||
@@ -278,10 +278,16 @@ final class Conductor
|
||||
|
||||
if (curChangeIndex != oldChangeIndex) {
|
||||
var prev = bpmChangeMap[oldChangeIndex];
|
||||
if (beatsPerMeasure != prev.beatsPerMeasure || stepsPerBeat != prev.stepsPerBeat)
|
||||
onTimeSignatureChange.dispatch(beatsPerMeasure, stepsPerBeat);
|
||||
if (prev) {
|
||||
if (beatsPerMeasure != prev.beatsPerMeasure || stepsPerBeat != prev.stepsPerBeat)
|
||||
onTimeSignatureChange.dispatch(beatsPerMeasure, stepsPerBeat);
|
||||
|
||||
if (curChange.bpm != prev.bpm) onBPMChange.dispatch(curChange.bpm, curChange.endSongTime);
|
||||
if (curChange.bpm != prev.bpm) onBPMChange.dispatch(curChange.bpm, curChange.endSongTime);
|
||||
}
|
||||
else {
|
||||
onTimeSignatureChange.dispatch(beatsPerMeasure, stepsPerBeat);
|
||||
onBPMChange.dispatch(curChange.bpm, curChange.endSongTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (curStep != (curStep = CoolUtil.floorInt(curStepFloat))) {
|
||||
|
||||
@@ -737,6 +737,15 @@ class CoolUtil
|
||||
@:noUsing public static inline function maxInt(p1:Int, p2:Int)
|
||||
return p1 < p2 ? p2 : p1;
|
||||
|
||||
/**
|
||||
* Equivalent of `Math.min`, except doesn't require a Int -> Float -> Int conversion.
|
||||
* @param p1
|
||||
* @param p2
|
||||
* @return return p1 > p2 ? p2 : p1
|
||||
*/
|
||||
@:noUsing public static inline function minInt(p1:Int, p2:Int)
|
||||
return p1 > p2 ? p2 : p1;
|
||||
|
||||
/**
|
||||
* Equivalent of `Math.floor`, except doesn't require a Int -> Float -> Int conversion.
|
||||
* @param e Value to get the floor of.
|
||||
@@ -778,6 +787,36 @@ class CoolUtil
|
||||
return file.file;
|
||||
}
|
||||
|
||||
public static inline function bound(Value:Float, Min:Float, Max:Float):Float {
|
||||
#if cpp
|
||||
var _hx_tmp1:Float = Value;
|
||||
var _hx_tmp2:Float = Min;
|
||||
var _hx_tmp3:Float = Max;
|
||||
return untyped __cpp__("((({0}) < ({1})) ? ({1}) : (({0}) > ({2})) ? ({2}) : ({0}))", _hx_tmp1, _hx_tmp2, _hx_tmp3);
|
||||
#else
|
||||
return (Value < Min) ? Min : (Value > Max) ? Max : Value;
|
||||
#end
|
||||
}
|
||||
|
||||
public static inline function boundInt(Value:Int, Min:Int, Max:Int):Int {
|
||||
#if cpp
|
||||
var _hx_tmp1:Int = Value;
|
||||
var _hx_tmp2:Int = Min;
|
||||
var _hx_tmp3:Int = Max;
|
||||
return untyped __cpp__("((({0}) < ({1})) ? ({1}) : (({0}) > ({2})) ? ({2}) : ({0}))", _hx_tmp1, _hx_tmp2, _hx_tmp3);
|
||||
#else
|
||||
return (Value < Min) ? Min : (Value > Max) ? Max : Value;
|
||||
#end
|
||||
}
|
||||
|
||||
public static inline function boolToInt(b:Bool):Int {
|
||||
#if cpp
|
||||
return untyped __cpp__("(({0}) ? 1 : 0)", b);
|
||||
#else
|
||||
return b ? 1 : 0;
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string of "1..3,5,7..9,8..5" into an array of numbers like [1,2,3,5,7,8,9,8,7,6,5]
|
||||
* @param input String to parse
|
||||
|
||||
Reference in New Issue
Block a user