Skip to content

Commit

Permalink
Removes offOn
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Solomon committed May 2, 2022
1 parent 724cf2e commit d2aca38
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
6 changes: 0 additions & 6 deletions src/WAGS/Interpret.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ var NO_RAMP = "step";
var LINEAR_RAMP = "linear";
var EXPONENTIAL_RAMP = "exponential";
var ENVELOPE = "envelope";
var isOn = function (param) {
return param.type === "on" || param.type === "offOn";
};
var isCancellation = function (a) {
return a.type === CANCELLATION;
};
Expand Down Expand Up @@ -1252,9 +1249,6 @@ export function setOnOff_(aa) {
setOn_(ptr)(onOff)(state)();
} else if (onOff.x.type === "off") {
setOff_(ptr)(onOff)(state)();
} else if (onOff.x.type === "offOn") {
setOff_(ptr)({ x: { type: "off" }, o: 0.0 })(state)();
setOn_(ptr)({ x: { type: "on" }, o: onOff.o })(state)();
}
};
};
Expand Down
16 changes: 2 additions & 14 deletions src/WAGS/Parameter.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Data.Lens.Record (prop)
import Data.Newtype (class Newtype, unwrap, wrap)
import Data.Profunctor.Strong (class Strong)
import Data.Variant (Variant, inj, match)
import FRP.Event (class IsEvent, Event)
import FRP.Event (Event)
import FRP.Event.Class (bang)
import Prim.Row (class Cons)
import Type.Proxy (Proxy(..))
Expand Down Expand Up @@ -107,12 +107,6 @@ newtype OnOff = OnOff
( Variant
( on :: Unit
, off :: Unit
-- turns off immediately and then on, good for loops.
-- todo: because of the way audioParameter works, this
-- is forced to stop immediately
-- this almost always is fine, but for more fine-grained control
-- we'll need a different abstraction
, offOn :: Unit
)
)

Expand All @@ -122,17 +116,14 @@ _on = OnOff $ inj (Proxy :: _ "on") unit
_off :: OnOff
_off = OnOff $ inj (Proxy :: _ "off") unit

_offOn :: OnOff
_offOn = OnOff $ inj (Proxy :: _ "offOn") unit

derive instance eqOnOff :: Eq OnOff
derive instance ordOnOff :: Ord OnOff
derive instance newtypeOnOff :: Newtype OnOff _
derive instance genericOnOff :: Generic OnOff _

instance showOnOff :: Show OnOff where
show = unwrap >>> match
{ on: const "on", off: const "off", offOn: const "offOn" }
{ on: const "on", off: const "off" }

newtype AudioOnOff = AudioOnOff
{ x :: OnOff
Expand All @@ -151,9 +142,6 @@ bangOn = bang (wrap $ inj (Proxy :: _ "onOff") apOn)
apOff :: AudioOnOff
apOff = AudioOnOff { x: _off, o: 0.0 }

apOffOn :: AudioOnOff
apOffOn = AudioOnOff { x: _offOn, o: 0.0 }

dt
:: forall nt r
. Newtype nt { o :: Number | r }
Expand Down

0 comments on commit d2aca38

Please sign in to comment.