module Sound.Conductive.ConductiveBaseData where
import Control.Concurrent.MVar
import Data.IORef
import Data.Map
data Generator a = Generator
{ generatorSource :: MVar [a]
, sourceLength :: IORef Int
, generatorCounter :: IORef Int
}
data MusicalTime = MusicalTime { measure :: Int
, beat :: Double
} deriving (Show)
data TempoChange = TempoChange { newTempo :: Double
, beatOfTempoChange :: Double
, timeOfTempoChange :: Double
} deriving (Show)
data TimeSignature = TimeSignature { startingMeasure :: Int
, startingBeat :: Double
, timeSignature :: Int
} deriving (Show)
data TempoClock = TempoClock { startTime :: Double
, tempoChanges :: [TempoChange]
, timeSignatureChanges :: [TimeSignature]
} deriving (Show)
data MusicalEnvironment = MusicalEnvironment
{ environmentName :: String
, playerStore :: Map String Player
, tempoClockStore :: Map String TempoClock
, iOIStore :: Map String (MVar MusicalEnvironment -> Player -> IO Double)
, actionStore :: Map String (MVar MusicalEnvironment -> Player -> IO ())
, interruptStore :: Map String ([IO ()])
, doubleGeneratorStore :: Map String (Generator Double)
, iOIListStore :: Map String [Double]
}
instance Show MusicalEnvironment where
show x = environmentName x
data PlayerStatus = Stopped
| Playing
| Pausing
| Paused
| Stopping
| Resetting
deriving (Eq,Show)
data Player = Player
{ playerName :: String
, playerStatus :: PlayerStatus
, playerCounter :: Integer
, playerClock :: String
, playerIOI :: String
, playerAction :: String
, playerInterrupt :: String
, playerBeat :: Double
, playerStartingBeat :: Double
, playerPauseTime :: Double
} deriving (Show)