module Sound.Iteratee.Base (
AudioStreamState (..),
WritableAudio (..),
AudioMonad,
module Control.Monad.Trans.State,
defaultChunkLength,
AudioFormat (..),
SupportedBitDepths (..),
NumChannels,
SampleRate,
BitDepth,
FrameCount,
SupportedFileFormat (..)
)
where
import Prelude as P
import Control.Monad.Trans.State
import System.IO
data AudioStreamState =
WaveState !(Maybe Handle) !(Maybe AudioFormat) !Integer !Integer !Integer
| NoState
deriving (Eq, Show)
data SupportedFileFormat = Raw
| Wave
deriving (Show, Enum, Bounded, Eq)
class WritableAudio a where
emptyState :: a -> AudioStreamState
initState :: a -> Handle -> AudioStreamState
supportedBitDepths :: a -> SupportedBitDepths
fileType :: a -> SupportedFileFormat
type AudioMonad = StateT AudioStreamState IO
data AudioFormat = AudioFormat {
numberOfChannels :: NumChannels,
sampleRate :: SampleRate,
bitDepth :: BitDepth
} deriving (Show, Eq)
type NumChannels = Integer
type SampleRate = Integer
type BitDepth = Integer
type FrameCount = Integer
data SupportedBitDepths = Any | Supported [BitDepth]
defaultChunkLength :: Int
defaultChunkLength = 8190