Further implementation of poitional sound
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Sound.Data
|
||||
where
|
||||
import qualified SDL.Mixer as Mix
|
||||
import qualified Data.IntMap as IM
|
||||
import qualified Data.Map as M
|
||||
import Control.Lens
|
||||
import Geometry
|
||||
import Data.Word (Word8)
|
||||
import Data.Int (Int16)
|
||||
|
||||
data SoundStatus
|
||||
= Playing
|
||||
| FadingOut
|
||||
| ToStart
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
data SoundData a = SoundData
|
||||
{_loadedChunks :: IM.IntMap Mix.Chunk
|
||||
,_playingSounds :: M.Map a Sound
|
||||
}
|
||||
data Sound = Sound
|
||||
{ _soundTime :: Maybe Int
|
||||
, _soundFadeTime :: Int
|
||||
, _soundStatus :: SoundStatus
|
||||
, _soundChannel :: Maybe Mix.Channel
|
||||
, _soundPos :: Maybe (Int16,Word8)
|
||||
, _soundChunkID :: Int
|
||||
}
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
makeLenses ''SoundData
|
||||
makeLenses ''Sound
|
||||
|
||||
cleanUpSoundPreload :: SoundData a -> IO ()
|
||||
cleanUpSoundPreload sd = Mix.closeAudio
|
||||
Reference in New Issue
Block a user