-- Copyright 2013 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

-- | Setup 'StaticConfig.StaticConfig'.  This is an empty example config, which
-- you'll want to customize locally.
module User.Generic.Config (load_static_config) where
import qualified App.Config as Config
import qualified App.LoadInstruments as LoadInstruments
import qualified App.ParseArgs as ParseArgs
import qualified App.Path as Path
import qualified App.StaticConfig as StaticConfig

import qualified Cmd.Cmd as Cmd
import qualified Cmd.Msg as Msg
import qualified Cmd.SyncKeycaps as SyncKeycaps

import qualified Derive.C.All as C.All

import           Global


load_static_config :: IO StaticConfig.StaticConfig
load_static_config :: IO StaticConfig
load_static_config = do
    AppDir
app_dir <- IO AppDir
Path.get_app_dir
    Db InstrumentCode
instrument_db <- AppDir -> IO (Db InstrumentCode)
LoadInstruments.load AppDir
app_dir
    Midi
midi <- Db InstrumentCode -> IO Midi
get_midi_config Db InstrumentCode
instrument_db
    forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ StaticConfig.StaticConfig
        { instrument_db :: Db InstrumentCode
instrument_db = Db InstrumentCode
instrument_db
        , global_cmds :: [Msg -> CmdT IO Status]
global_cmds = [Msg -> CmdT IO Status]
global_cmds
        , builtins :: Builtins
builtins = Builtins
C.All.builtins
        , setup_cmd :: [String] -> Either Text (CmdT IO Status)
setup_cmd = [String] -> Either Text (CmdT IO Status)
ParseArgs.parse_args
        , post_setup_cmd :: CmdT IO ()
post_setup_cmd = forall (m :: * -> *). M m => m ()
SyncKeycaps.open
        , midi :: Midi
midi = Midi
midi
        , highlight_colors :: Map Highlight Color
highlight_colors = Map Highlight Color
Config.highlight_colors
        -- Set to True to play im via portaudio, instead of the play_cache vst.
        , im_play_direct :: Bool
im_play_direct = Bool
False
        }

global_cmds :: [Msg.Msg -> Cmd.CmdT IO Cmd.Status]
global_cmds :: [Msg -> CmdT IO Status]
global_cmds = []

get_midi_config :: Cmd.InstrumentDb -> IO StaticConfig.Midi
get_midi_config :: Db InstrumentCode -> IO Midi
get_midi_config Db InstrumentCode
_db = forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ StaticConfig.Midi
    { rdev_map :: Map ReadDevice ReadDevice
rdev_map = [(Text, Text)] -> Map ReadDevice ReadDevice
StaticConfig.make_rdev_map []
    -- This assumes OS X, and IAC ports named 1, 2, 3, 4.
    , wdev_map :: Map WriteDevice WriteDevice
wdev_map = [(Text, Text)] -> Map WriteDevice WriteDevice
StaticConfig.make_wdev_map
        [(Text
"loop" forall a. Semigroup a => a -> a -> a
<> forall a. Show a => a -> Text
showt Integer
n, Text
"IAC Driver " forall a. Semigroup a => a -> a -> a
<> forall a. Show a => a -> Text
showt Integer
n) | Integer
n <- [Integer
1..Integer
4]]
    , read_devices :: Set ReadDevice
read_devices = forall a. Monoid a => a
mempty
    }