Cleanup module pathing
This commit is contained in:
+56
-36
@@ -1,54 +1,74 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Sound.Data
|
||||
where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import qualified SDL.Mixer as Mix
|
||||
import qualified IntMapHelp as IM
|
||||
--import qualified Data.Map.Strict as M
|
||||
|
||||
module Sound.Data where
|
||||
|
||||
import Control.Lens
|
||||
import Geometry.Data
|
||||
import Data.Word (Word8)
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Data.Int (Int16)
|
||||
import Data.Word (Word8)
|
||||
import Geometry.Data
|
||||
import qualified IntMapHelp as IM
|
||||
import qualified SDL.Mixer as Mix
|
||||
|
||||
data SoundStatus = SoundStatus
|
||||
{_playStatus :: PlayStatus
|
||||
,_isLooping :: Bool
|
||||
{ _playStatus :: PlayStatus
|
||||
, _isLooping :: Bool
|
||||
}
|
||||
deriving (Eq,Ord,Show,Generic)
|
||||
instance ToJSON SoundStatus where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON SoundStatus
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
|
||||
|
||||
-- TODO make this more sensible (use product rather than union in some cases)
|
||||
data PlayStatus
|
||||
data PlayStatus
|
||||
= JustStartedPlaying
|
||||
| Playing
|
||||
| ToStart
|
||||
| ToContinueStart
|
||||
| ToStop
|
||||
deriving (Eq,Ord,Show,Generic)
|
||||
instance ToJSON PlayStatus where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON PlayStatus
|
||||
newtype SoundID = SoundID { _getSoundID :: Int }
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON SoundID where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON SoundID
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
|
||||
|
||||
newtype SoundID = SoundID {_getSoundID :: Int}
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
|
||||
|
||||
newtype SoundData = SoundData
|
||||
{_loadedChunks :: IM.IntMap Mix.Chunk
|
||||
{ _loadedChunks :: IM.IntMap Mix.Chunk
|
||||
}
|
||||
data Sound = Sound
|
||||
{ _soundTime :: Maybe Int
|
||||
, _soundStatus :: SoundStatus
|
||||
, _soundChannel :: Maybe Mix.Channel
|
||||
, _soundAngDist :: Maybe (Int16,Word8) -- why do BOTH of
|
||||
, _soundPos :: Point2 -- these exist?
|
||||
, _soundVolume :: Float
|
||||
|
||||
data ToPlaySound = ToPlaySound
|
||||
{ _toPlaySoundTime :: Maybe Int
|
||||
, _toPlaySoundStatus :: SoundStatus
|
||||
, _toPlaySoundPos :: Point2 -- these exist?
|
||||
, _toPlaySoundVolume :: Float
|
||||
, _toPlaySoundVolumeFraction :: Float -- this needs cleaning up/combining
|
||||
, _toPlaySoundChunkID :: SoundID
|
||||
}
|
||||
deriving (Eq, Show)
|
||||
|
||||
|
||||
|
||||
data Sound = Sound
|
||||
{ _soundTime :: Maybe Int
|
||||
, _soundStatus :: SoundStatus
|
||||
, _soundChannel :: Maybe Mix.Channel
|
||||
, _soundAngDist :: Maybe (Int16, Word8) -- why do BOTH of
|
||||
, _soundPos :: Point2 -- these exist?
|
||||
, _soundVolume :: Float
|
||||
, _soundVolumeFraction :: Float -- this needs cleaning up/combining
|
||||
, _soundChunkID :: SoundID
|
||||
, _soundChunkID :: SoundID
|
||||
}
|
||||
deriving (Eq,Ord,Show)
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
makeLenses ''SoundData
|
||||
makeLenses ''Sound
|
||||
makeLenses ''SoundID
|
||||
makeLenses ''SoundStatus
|
||||
deriveJSON defaultOptions ''SoundStatus
|
||||
deriveJSON defaultOptions ''PlayStatus
|
||||
deriveJSON defaultOptions ''SoundID
|
||||
deriveJSON defaultOptions ''ToPlaySound
|
||||
|
||||
Reference in New Issue
Block a user