-- Copyright 2022 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

module User.Generic.Instrument.Surge where
import qualified Data.String as String

import qualified Cmd.Instrument.MidiInst as MidiInst


synth :: MidiInst.Synth
synth :: Synth
synth =
    SynthName -> SynthName -> [Patch] -> Synth
MidiInst.synth SynthName
"surge" SynthName
"https://surge-synthesizer.github.io/index.html" ([Patch] -> Synth) -> [Patch] -> Synth
forall a b. (a -> b) -> a -> b
$
        [(Control, Control)] -> [Patch] -> [Patch]
MidiInst.synth_controls [(Control, Control)]
controls
        [PbRange -> [(Control, Control)] -> Patch
MidiInst.default_patch PbRange
pb_range []]
    where
    controls :: [(Control, Control)]
controls = [(Control
40 Control -> Control -> Control
forall a. Num a => a -> a -> a
+ Control
n, String -> Control
forall a. IsString a => String -> a
String.fromString (String -> Control) -> String -> Control
forall a b. (a -> b) -> a -> b
$ String
"macro" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Control -> String
forall a. Show a => a -> String
show Control
n) | Control
n <- [Control
1..Control
8]]

-- PB range when in MPE mode.
pb_range :: (Int, Int)
pb_range :: PbRange
pb_range = (-Int
48, Int
48)