package com.digero.common.abc;

public enum Dynamics {
	// In LotRO, +pppp+ seems to be 50% volume
	pppp(8, 64), //
	ppp(16, 71), //
	pp(32, 78), //
	p(48, 85), //
	mp(64, 92), //
	mf(80, 100), //
	f(92, 106), //
	ff(104, 113), //
	fff(116, 120), //
	ffff(127, 127);

	public static final Dynamics DEFAULT = mf;
	public static final Dynamics MAXIMUM = ffff;
	public static final Dynamics MINIMUM = pppp;

	public static final Dynamics fromMidiVelocity(int velocity) {
		Dynamics[] values = values();
		Dynamics best = values[0];
		for (int i = 1; i < values.length; i++) {
			if (Math.abs(velocity - values[i].midiVol) < Math.abs(velocity - best.midiVol))
				best = values[i];
			else
				break;
		}
		return best;
	}

	public final int midiVol;
	public final int abcVol;

	public int getVol(boolean abc) {
		return abc ? abcVol : midiVol;
	}

	private Dynamics(int midiVol, int abcVol) {
		this.midiVol = midiVol;
		this.abcVol = abcVol;
	}
}
@@ -204,17 +204,17 @@
 //%0D%0A%09f(9
-2
+6
 , 106), 
@@ -226,10 +226,10 @@
 ff(1
-04
+12
 , 11
@@ -242,18 +242,18 @@
 %0D%0A%09fff(1
-16
+27
 , 120), 

Tweak dynamics