@@ -17,11 +17,11 @@ module Abcjs.Synth
1717
1818import Prelude
1919
20−import Abcjs.Types (TimingEvent, TuneObject)
20+import Abcjs.Types (Selector, TimingEvent, TuneObject)
2121import Control.Promise (Promise, toAffE)
2222import Effect (Effect)
2323import Effect.Aff (Aff)
24−import Effect.Uncurried (EffectFn1, EffectFn3)
24+import Effect.Uncurried (EffectFn1, EffectFn2, EffectFn3, EffectFn4, runEffectFn1, runEffectFn2, runEffectFn3, runEffectFn4)
2525
2626-- | The high-level player: a transport plus an optional on-page control panel.
2727foreign import data SynthController :: Type
@@ -60,47 +60,47 @@ foreign import supportsAudio :: Effect Boolean
6060foreign import newSynthController :: Effect SynthController
6161
6262-- | Attach the controller to a control-panel element and a cursor control.
63−load :: String -> CursorControl -> ControlOptions -> SynthController -> Effect Unit
64−load = loadImpl
63+load :: Selector -> CursorControl -> ControlOptions -> SynthController -> Effect Unit
64+load = runEffectFn4 loadImpl
6565
66−foreign import loadImpl :: String -> CursorControl -> ControlOptions -> SynthController -> Effect Unit
66+foreign import loadImpl :: EffectFn4 Selector CursorControl ControlOptions SynthController Unit
6767
6868-- | Prime a tune for playback. The `Boolean` says whether this was triggered
6969-- | by a user gesture, which lets the browser unlock the audio context.
7070setTune :: TuneObject -> Boolean -> SynthController -> Aff Unit
71−setTune tune userAction controller = toAffE (setTuneImpl tune userAction controller)
71+setTune tune userAction controller = toAffE (runEffectFn3 setTuneImpl tune userAction controller)
7272
73−foreign import setTuneImpl :: TuneObject -> Boolean -> SynthController -> Effect (Promise Unit)
73+foreign import setTuneImpl :: EffectFn3 TuneObject Boolean SynthController (Promise Unit)
7474
7575-- | Toggle play/pause.
7676play :: SynthController -> Effect Unit
77−play = playImpl
77+play = runEffectFn1 playImpl
7878
79−foreign import playImpl :: SynthController -> Effect Unit
79+foreign import playImpl :: EffectFn1 SynthController Unit
8080
8181pause :: SynthController -> Effect Unit
82−pause = pauseImpl
82+pause = runEffectFn1 pauseImpl
8383
84−foreign import pauseImpl :: SynthController -> Effect Unit
84+foreign import pauseImpl :: EffectFn1 SynthController Unit
8585
8686restart :: SynthController -> Effect Unit
87−restart = restartImpl
87+restart = runEffectFn1 restartImpl
8888
89−foreign import restartImpl :: SynthController -> Effect Unit
89+foreign import restartImpl :: EffectFn1 SynthController Unit
9090
9191-- | Jump to a position given in seconds.
9292seekSeconds :: Number -> SynthController -> Effect Unit
93−seekSeconds = seekSecondsImpl
93+seekSeconds = runEffectFn2 seekSecondsImpl
9494
95−foreign import seekSecondsImpl :: Number -> SynthController -> Effect Unit
95+foreign import seekSecondsImpl :: EffectFn2 Number SynthController Unit
9696
9797-- | Set tempo as a percentage of the written tempo (100.0 = as written).
9898setWarp :: Number -> SynthController -> Effect Unit
99−setWarp = setWarpImpl
99+setWarp = runEffectFn2 setWarpImpl
100100
101−foreign import setWarpImpl :: Number -> SynthController -> Effect Unit
101+foreign import setWarpImpl :: EffectFn2 Number SynthController Unit
102102
103103toggleLoop :: SynthController -> Effect Unit
104−toggleLoop = toggleLoopImpl
104+toggleLoop = runEffectFn1 toggleLoopImpl
105105
106−foreign import toggleLoopImpl :: SynthController -> Effect Unit
106+foreign import toggleLoopImpl :: EffectFn1 SynthController Unit