X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2Fcontroller%2FFader.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2Fcontroller%2FFader.java;h=4cb6f28235e67022aee20346b5bd127f8b9318b3;hb=7fd39e525f49730b76e756b613f20b9dd72808b9;hp=0000000000000000000000000000000000000000;hpb=4988daaa80c5134d977b16cad8c09ea5b9ceebb1;p=sonitus.git
diff --git a/src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java b/src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java
new file mode 100644
index 0000000..4cb6f28
--- /dev/null
+++ b/src/main/java/net/pterodactylus/sonitus/data/controller/Fader.java
@@ -0,0 +1,44 @@
+/*
+ * Sonitus - Fader.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.pterodactylus.sonitus.data.controller;
+
+import net.pterodactylus.sonitus.data.Controller;
+
+/**
+ * A {@link Controller} that implements a simple fader.
+ *
+ * @author David âBombeâ Roden
+ */
+public abstract class Fader extends AbstractController {
+
+ /** Creates a new fader that is at maximum position. */
+ public Fader() {
+ this(1.0);
+ }
+
+ /**
+ * Creates a new fader that is at the given position.
+ *
+ * @param currentValue
+ * The current value of the fader (from {@code 0.0} to {@code 1.0})
+ */
+ public Fader(double currentValue) {
+ super(0, Integer.MAX_VALUE, false, (int) (Math.max(0, Math.min(1, currentValue)) * Integer.MAX_VALUE));
+ }
+
+}