{-# LINE 1 "src/Sound/PlSynth/FFI.hsc" #-}
module Sound.PlSynth.FFI
( plSynthInit
, plSynthTabSize
, plSynthSoundLen
, plSynthSound
, plSynthSongLen
, plSynthSong
, plSynthWavWrite
, PlSynthT(..)
, emptyPlSynthT
, pattern SIN
, pattern SAW
, pattern SQR
, pattern TRI
, PlSynthSoundT(..)
, PlSynthPatternT(..)
, PlSynthTrackT(..)
, PlSynthSongT(..)
, pattern PL_SYNTH_SAMPLERATE
, pattern PL_SYNTH_TAB_LEN
, pattern PL_SYNTH_PATTERN_LEN
) where
import Prelude hiding (sequence)
import Data.Int (Int16)
import Data.Word (Word8, Word32)
import Foreign.C.String
import Foreign.C.Types
import Foreign.Marshal.Array
import Foreign.Marshal.Utils
import Foreign.Ptr
import Foreign.Storable
pattern PL_SYNTH_SAMPLERATE :: Int
pattern $mPL_SYNTH_SAMPLERATE :: forall {r}. Int -> ((# #) -> r) -> ((# #) -> r) -> r
$bPL_SYNTH_SAMPLERATE :: Int
PL_SYNTH_SAMPLERATE = 44100
pattern PL_SYNTH_TAB_LEN :: Int
pattern $mPL_SYNTH_TAB_LEN :: forall {r}. Int -> ((# #) -> r) -> ((# #) -> r) -> r
$bPL_SYNTH_TAB_LEN :: Int
PL_SYNTH_TAB_LEN = 4096
pattern PL_SYNTH_PATTERN_LEN :: Int
pattern $mPL_SYNTH_PATTERN_LEN :: forall {r}. Int -> ((# #) -> r) -> ((# #) -> r) -> r
$bPL_SYNTH_PATTERN_LEN :: Int
PL_SYNTH_PATTERN_LEN = 32
plSynthTabSize :: Int
plSynthTabSize :: Int
plSynthTabSize = CFloat -> Int
forall a. Storable a => a -> Int
sizeOf (CFloat
forall a. HasCallStack => a
undefined :: CFloat) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
PL_SYNTH_TAB_LEN Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
4
data PlSynthT = PlSynthT
{ PlSynthT -> Word8
osc0_oct :: Word8
, PlSynthT -> Word8
osc0_det :: Word8
, PlSynthT -> Word8
osc0_detune :: Word8
, PlSynthT -> Word8
osc0_xenv :: Word8
, PlSynthT -> Word8
osc0_vol :: Word8
, PlSynthT -> Word8
osc0_waveform :: Word8
, PlSynthT -> Word8
osc1_oct :: Word8
, PlSynthT -> Word8
osc1_det :: Word8
, PlSynthT -> Word8
osc1_detune :: Word8
, PlSynthT -> Word8
osc1_xenv :: Word8
, PlSynthT -> Word8
osc1_vol :: Word8
, PlSynthT -> Word8
osc1_waveform :: Word8
, PlSynthT -> Word8
noise_fader :: Word8
, PlSynthT -> Word32
env_attack :: Word32
, PlSynthT -> Word32
env_sustain :: Word32
, PlSynthT -> Word32
env_release :: Word32
, PlSynthT -> Word32
env_master :: Word32
, PlSynthT -> Word8
fx_filter :: Word8
, PlSynthT -> Word32
fx_freq :: Word32
, PlSynthT -> Word8
fx_resonance :: Word8
, PlSynthT -> Word8
fx_delay_time :: Word8
, PlSynthT -> Word8
fx_delay_amt :: Word8
, PlSynthT -> Word8
fx_pan_freq :: Word8
, PlSynthT -> Word8
fx_pan_amt :: Word8
, PlSynthT -> Word8
lfo_osc_freq :: Word8
, PlSynthT -> Word8
lfo_fx_freq :: Word8
, PlSynthT -> Word8
lfo_freq :: Word8
, PlSynthT -> Word8
lfo_amt :: Word8
, PlSynthT -> Word8
lfo_waveform :: Word8
}
deriving (PlSynthT -> PlSynthT -> Bool
(PlSynthT -> PlSynthT -> Bool)
-> (PlSynthT -> PlSynthT -> Bool) -> Eq PlSynthT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PlSynthT -> PlSynthT -> Bool
== :: PlSynthT -> PlSynthT -> Bool
$c/= :: PlSynthT -> PlSynthT -> Bool
/= :: PlSynthT -> PlSynthT -> Bool
Eq, Int -> PlSynthT -> ShowS
[PlSynthT] -> ShowS
PlSynthT -> String
(Int -> PlSynthT -> ShowS)
-> (PlSynthT -> String) -> ([PlSynthT] -> ShowS) -> Show PlSynthT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PlSynthT -> ShowS
showsPrec :: Int -> PlSynthT -> ShowS
$cshow :: PlSynthT -> String
show :: PlSynthT -> String
$cshowList :: [PlSynthT] -> ShowS
showList :: [PlSynthT] -> ShowS
Show)
emptyPlSynthT :: PlSynthT
emptyPlSynthT :: PlSynthT
emptyPlSynthT = PlSynthT
{ $sel:osc0_oct:PlSynthT :: Word8
osc0_oct = Word8
0
, $sel:osc0_det:PlSynthT :: Word8
osc0_det = Word8
0
, $sel:osc0_detune:PlSynthT :: Word8
osc0_detune = Word8
0
, $sel:osc0_xenv:PlSynthT :: Word8
osc0_xenv = Word8
0
, $sel:osc0_vol:PlSynthT :: Word8
osc0_vol = Word8
0
, $sel:osc0_waveform:PlSynthT :: Word8
osc0_waveform = Word8
0
, $sel:osc1_oct:PlSynthT :: Word8
osc1_oct = Word8
0
, $sel:osc1_det:PlSynthT :: Word8
osc1_det = Word8
0
, $sel:osc1_detune:PlSynthT :: Word8
osc1_detune = Word8
0
, $sel:osc1_xenv:PlSynthT :: Word8
osc1_xenv = Word8
0
, $sel:osc1_vol:PlSynthT :: Word8
osc1_vol = Word8
0
, $sel:osc1_waveform:PlSynthT :: Word8
osc1_waveform = Word8
0
, $sel:noise_fader:PlSynthT :: Word8
noise_fader = Word8
0
, $sel:env_attack:PlSynthT :: Word32
env_attack = Word32
0
, $sel:env_sustain:PlSynthT :: Word32
env_sustain = Word32
0
, $sel:env_release:PlSynthT :: Word32
env_release = Word32
0
, $sel:env_master:PlSynthT :: Word32
env_master = Word32
0
, $sel:fx_filter:PlSynthT :: Word8
fx_filter = Word8
0
, $sel:fx_freq:PlSynthT :: Word32
fx_freq = Word32
0
, $sel:fx_resonance:PlSynthT :: Word8
fx_resonance = Word8
0
, $sel:fx_delay_time:PlSynthT :: Word8
fx_delay_time = Word8
0
, $sel:fx_delay_amt:PlSynthT :: Word8
fx_delay_amt = Word8
0
, $sel:fx_pan_freq:PlSynthT :: Word8
fx_pan_freq = Word8
0
, $sel:fx_pan_amt:PlSynthT :: Word8
fx_pan_amt = Word8
0
, $sel:lfo_osc_freq:PlSynthT :: Word8
lfo_osc_freq = Word8
0
, $sel:lfo_fx_freq:PlSynthT :: Word8
lfo_fx_freq = Word8
0
, $sel:lfo_freq:PlSynthT :: Word8
lfo_freq = Word8
0
, $sel:lfo_amt:PlSynthT :: Word8
lfo_amt = Word8
0
, $sel:lfo_waveform:PlSynthT :: Word8
lfo_waveform = Word8
0
}
pattern SIN :: Word8
pattern $mSIN :: forall {r}. Word8 -> ((# #) -> r) -> ((# #) -> r) -> r
$bSIN :: Word8
SIN = 0
pattern SAW :: Word8
pattern $mSAW :: forall {r}. Word8 -> ((# #) -> r) -> ((# #) -> r) -> r
$bSAW :: Word8
SAW = 1
pattern SQR :: Word8
pattern $mSQR :: forall {r}. Word8 -> ((# #) -> r) -> ((# #) -> r) -> r
$bSQR :: Word8
SQR = 2
pattern TRI :: Word8
pattern $mTRI :: forall {r}. Word8 -> ((# #) -> r) -> ((# #) -> r) -> r
$bTRI :: Word8
TRI = 3
instance Storable PlSynthT where
sizeOf :: PlSynthT -> Int
sizeOf PlSynthT
_ = ((Int
52))
{-# LINE 141 "src/Sound/PlSynth/FFI.hsc" #-}
alignment _ = (4)
{-# LINE 142 "src/Sound/PlSynth/FFI.hsc" #-}
peek ptr = do
osc0_oct <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 144 "src/Sound/PlSynth/FFI.hsc" #-}
osc0_det <- ((\hsc_ptr -> peekByteOff hsc_ptr 1)) ptr
{-# LINE 145 "src/Sound/PlSynth/FFI.hsc" #-}
osc0_detune <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) ptr
{-# LINE 146 "src/Sound/PlSynth/FFI.hsc" #-}
osc0_xenv <- ((\hsc_ptr -> peekByteOff hsc_ptr 3)) ptr
{-# LINE 147 "src/Sound/PlSynth/FFI.hsc" #-}
osc0_vol <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 148 "src/Sound/PlSynth/FFI.hsc" #-}
osc0_waveform <- ((\hsc_ptr -> peekByteOff hsc_ptr 5)) ptr
{-# LINE 149 "src/Sound/PlSynth/FFI.hsc" #-}
osc1_oct <- ((\hsc_ptr -> peekByteOff hsc_ptr 6)) ptr
{-# LINE 151 "src/Sound/PlSynth/FFI.hsc" #-}
osc1_det <- ((\hsc_ptr -> peekByteOff hsc_ptr 7)) ptr
{-# LINE 152 "src/Sound/PlSynth/FFI.hsc" #-}
osc1_detune <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 153 "src/Sound/PlSynth/FFI.hsc" #-}
osc1_xenv <- ((\hsc_ptr -> peekByteOff hsc_ptr 9)) ptr
{-# LINE 154 "src/Sound/PlSynth/FFI.hsc" #-}
osc1_vol <- ((\hsc_ptr -> peekByteOff hsc_ptr 10)) ptr
{-# LINE 155 "src/Sound/PlSynth/FFI.hsc" #-}
osc1_waveform <- ((\hsc_ptr -> peekByteOff hsc_ptr 11)) ptr
{-# LINE 156 "src/Sound/PlSynth/FFI.hsc" #-}
noise_fader <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 158 "src/Sound/PlSynth/FFI.hsc" #-}
env_attack <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 160 "src/Sound/PlSynth/FFI.hsc" #-}
env_sustain <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 161 "src/Sound/PlSynth/FFI.hsc" #-}
env_release <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 162 "src/Sound/PlSynth/FFI.hsc" #-}
env_master <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 163 "src/Sound/PlSynth/FFI.hsc" #-}
fx_filter <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 165 "src/Sound/PlSynth/FFI.hsc" #-}
fx_freq <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 166 "src/Sound/PlSynth/FFI.hsc" #-}
fx_resonance <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 167 "src/Sound/PlSynth/FFI.hsc" #-}
fx_delay_time <- ((\hsc_ptr -> peekByteOff hsc_ptr 41)) ptr
{-# LINE 168 "src/Sound/PlSynth/FFI.hsc" #-}
fx_delay_amt <- ((\hsc_ptr -> peekByteOff hsc_ptr 42)) ptr
{-# LINE 169 "src/Sound/PlSynth/FFI.hsc" #-}
fx_pan_freq <- ((\hsc_ptr -> peekByteOff hsc_ptr 43)) ptr
{-# LINE 170 "src/Sound/PlSynth/FFI.hsc" #-}
fx_pan_amt <- ((\hsc_ptr -> peekByteOff hsc_ptr 44)) ptr
{-# LINE 171 "src/Sound/PlSynth/FFI.hsc" #-}
lfo_osc_freq <- ((\hsc_ptr -> peekByteOff hsc_ptr 45)) ptr
{-# LINE 173 "src/Sound/PlSynth/FFI.hsc" #-}
lfo_fx_freq <- ((\hsc_ptr -> peekByteOff hsc_ptr 46)) ptr
{-# LINE 174 "src/Sound/PlSynth/FFI.hsc" #-}
lfo_freq <- ((\hsc_ptr -> peekByteOff hsc_ptr 47)) ptr
{-# LINE 175 "src/Sound/PlSynth/FFI.hsc" #-}
lfo_amt <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
{-# LINE 176 "src/Sound/PlSynth/FFI.hsc" #-}
lfo_waveform <- ((\hsc_ptr -> peekByteOff hsc_ptr 49)) ptr
{-# LINE 177 "src/Sound/PlSynth/FFI.hsc" #-}
pure $! PlSynthT{..}
poke :: Ptr PlSynthT -> PlSynthT -> IO ()
poke Ptr PlSynthT
ptr PlSynthT{Word8
Word32
$sel:osc0_oct:PlSynthT :: PlSynthT -> Word8
$sel:osc0_det:PlSynthT :: PlSynthT -> Word8
$sel:osc0_detune:PlSynthT :: PlSynthT -> Word8
$sel:osc0_xenv:PlSynthT :: PlSynthT -> Word8
$sel:osc0_vol:PlSynthT :: PlSynthT -> Word8
$sel:osc0_waveform:PlSynthT :: PlSynthT -> Word8
$sel:osc1_oct:PlSynthT :: PlSynthT -> Word8
$sel:osc1_det:PlSynthT :: PlSynthT -> Word8
$sel:osc1_detune:PlSynthT :: PlSynthT -> Word8
$sel:osc1_xenv:PlSynthT :: PlSynthT -> Word8
$sel:osc1_vol:PlSynthT :: PlSynthT -> Word8
$sel:osc1_waveform:PlSynthT :: PlSynthT -> Word8
$sel:noise_fader:PlSynthT :: PlSynthT -> Word8
$sel:env_attack:PlSynthT :: PlSynthT -> Word32
$sel:env_sustain:PlSynthT :: PlSynthT -> Word32
$sel:env_release:PlSynthT :: PlSynthT -> Word32
$sel:env_master:PlSynthT :: PlSynthT -> Word32
$sel:fx_filter:PlSynthT :: PlSynthT -> Word8
$sel:fx_freq:PlSynthT :: PlSynthT -> Word32
$sel:fx_resonance:PlSynthT :: PlSynthT -> Word8
$sel:fx_delay_time:PlSynthT :: PlSynthT -> Word8
$sel:fx_delay_amt:PlSynthT :: PlSynthT -> Word8
$sel:fx_pan_freq:PlSynthT :: PlSynthT -> Word8
$sel:fx_pan_amt:PlSynthT :: PlSynthT -> Word8
$sel:lfo_osc_freq:PlSynthT :: PlSynthT -> Word8
$sel:lfo_fx_freq:PlSynthT :: PlSynthT -> Word8
$sel:lfo_freq:PlSynthT :: PlSynthT -> Word8
$sel:lfo_amt:PlSynthT :: PlSynthT -> Word8
$sel:lfo_waveform:PlSynthT :: PlSynthT -> Word8
osc0_oct :: Word8
osc0_det :: Word8
osc0_detune :: Word8
osc0_xenv :: Word8
osc0_vol :: Word8
osc0_waveform :: Word8
osc1_oct :: Word8
osc1_det :: Word8
osc1_detune :: Word8
osc1_xenv :: Word8
osc1_vol :: Word8
osc1_waveform :: Word8
noise_fader :: Word8
env_attack :: Word32
env_sustain :: Word32
env_release :: Word32
env_master :: Word32
fx_filter :: Word8
fx_freq :: Word32
fx_resonance :: Word8
fx_delay_time :: Word8
fx_delay_amt :: Word8
fx_pan_freq :: Word8
fx_pan_amt :: Word8
lfo_osc_freq :: Word8
lfo_fx_freq :: Word8
lfo_freq :: Word8
lfo_amt :: Word8
lfo_waveform :: Word8
..} = do
((\Ptr PlSynthT
hsc_ptr -> Ptr PlSynthT -> Int -> Word8 -> IO ()
forall b. Ptr b -> Int -> Word8 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthT
hsc_ptr Int
0)) Ptr PlSynthT
ptr Word8
osc0_oct
{-# LINE 182 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 1)) ptr osc0_det
{-# LINE 183 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 2)) ptr osc0_detune
{-# LINE 184 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 3)) ptr osc0_xenv
{-# LINE 185 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr osc0_vol
{-# LINE 186 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 5)) ptr osc0_waveform
{-# LINE 187 "src/Sound/PlSynth/FFI.hsc" #-}
((\Ptr PlSynthT
hsc_ptr -> Ptr PlSynthT -> Int -> Word8 -> IO ()
forall b. Ptr b -> Int -> Word8 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthT
hsc_ptr Int
6)) Ptr PlSynthT
ptr Word8
osc1_oct
{-# LINE 189 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 7)) ptr osc1_det
{-# LINE 190 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr osc1_detune
{-# LINE 191 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 9)) ptr osc1_xenv
{-# LINE 192 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 10)) ptr osc1_vol
{-# LINE 193 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 11)) ptr osc1_waveform
{-# LINE 194 "src/Sound/PlSynth/FFI.hsc" #-}
((\Ptr PlSynthT
hsc_ptr -> Ptr PlSynthT -> Int -> Word8 -> IO ()
forall b. Ptr b -> Int -> Word8 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthT
hsc_ptr Int
12)) Ptr PlSynthT
ptr Word8
noise_fader
{-# LINE 196 "src/Sound/PlSynth/FFI.hsc" #-}
((\Ptr PlSynthT
hsc_ptr -> Ptr PlSynthT -> Int -> Word32 -> IO ()
forall b. Ptr b -> Int -> Word32 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthT
hsc_ptr Int
16)) Ptr PlSynthT
ptr Word32
env_attack
{-# LINE 198 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr env_sustain
{-# LINE 199 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr env_release
{-# LINE 200 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr env_master
{-# LINE 201 "src/Sound/PlSynth/FFI.hsc" #-}
((\Ptr PlSynthT
hsc_ptr -> Ptr PlSynthT -> Int -> Word8 -> IO ()
forall b. Ptr b -> Int -> Word8 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthT
hsc_ptr Int
32)) Ptr PlSynthT
ptr Word8
fx_filter
{-# LINE 203 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr fx_freq
{-# LINE 204 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr fx_resonance
{-# LINE 205 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 41)) ptr fx_delay_time
{-# LINE 206 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 42)) ptr fx_delay_amt
{-# LINE 207 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 43)) ptr fx_pan_freq
{-# LINE 208 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 44)) ptr fx_pan_amt
{-# LINE 209 "src/Sound/PlSynth/FFI.hsc" #-}
((\Ptr PlSynthT
hsc_ptr -> Ptr PlSynthT -> Int -> Word8 -> IO ()
forall b. Ptr b -> Int -> Word8 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthT
hsc_ptr Int
45)) Ptr PlSynthT
ptr Word8
lfo_osc_freq
{-# LINE 211 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 46)) ptr lfo_fx_freq
{-# LINE 212 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 47)) ptr lfo_freq
{-# LINE 213 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr lfo_amt
{-# LINE 214 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 49)) ptr lfo_waveform
{-# LINE 215 "src/Sound/PlSynth/FFI.hsc" #-}
data PlSynthSoundT = PlSynthSoundT
{ PlSynthSoundT -> PlSynthT
synth :: PlSynthT
, PlSynthSoundT -> Word32
row_len :: Word32
, PlSynthSoundT -> Word8
note :: Word8
}
deriving (PlSynthSoundT -> PlSynthSoundT -> Bool
(PlSynthSoundT -> PlSynthSoundT -> Bool)
-> (PlSynthSoundT -> PlSynthSoundT -> Bool) -> Eq PlSynthSoundT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PlSynthSoundT -> PlSynthSoundT -> Bool
== :: PlSynthSoundT -> PlSynthSoundT -> Bool
$c/= :: PlSynthSoundT -> PlSynthSoundT -> Bool
/= :: PlSynthSoundT -> PlSynthSoundT -> Bool
Eq, Int -> PlSynthSoundT -> ShowS
[PlSynthSoundT] -> ShowS
PlSynthSoundT -> String
(Int -> PlSynthSoundT -> ShowS)
-> (PlSynthSoundT -> String)
-> ([PlSynthSoundT] -> ShowS)
-> Show PlSynthSoundT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PlSynthSoundT -> ShowS
showsPrec :: Int -> PlSynthSoundT -> ShowS
$cshow :: PlSynthSoundT -> String
show :: PlSynthSoundT -> String
$cshowList :: [PlSynthSoundT] -> ShowS
showList :: [PlSynthSoundT] -> ShowS
Show)
instance Storable PlSynthSoundT where
sizeOf :: PlSynthSoundT -> Int
sizeOf PlSynthSoundT
_ = ((Int
60))
{-# LINE 225 "src/Sound/PlSynth/FFI.hsc" #-}
alignment _ = (4)
{-# LINE 226 "src/Sound/PlSynth/FFI.hsc" #-}
peek ptr = do
synth <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 228 "src/Sound/PlSynth/FFI.hsc" #-}
row_len <- ((\hsc_ptr -> peekByteOff hsc_ptr 52)) ptr
{-# LINE 229 "src/Sound/PlSynth/FFI.hsc" #-}
note <- ((\hsc_ptr -> peekByteOff hsc_ptr 56)) ptr
{-# LINE 230 "src/Sound/PlSynth/FFI.hsc" #-}
pure $! PlSynthSoundT{..}
poke :: Ptr PlSynthSoundT -> PlSynthSoundT -> IO ()
poke Ptr PlSynthSoundT
ptr PlSynthSoundT{Word8
Word32
PlSynthT
$sel:synth:PlSynthSoundT :: PlSynthSoundT -> PlSynthT
$sel:row_len:PlSynthSoundT :: PlSynthSoundT -> Word32
$sel:note:PlSynthSoundT :: PlSynthSoundT -> Word8
synth :: PlSynthT
row_len :: Word32
note :: Word8
..} = do
((\Ptr PlSynthSoundT
hsc_ptr -> Ptr PlSynthSoundT -> Int -> PlSynthT -> IO ()
forall b. Ptr b -> Int -> PlSynthT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthSoundT
hsc_ptr Int
0)) Ptr PlSynthSoundT
ptr PlSynthT
synth
{-# LINE 233 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 52)) ptr row_len
{-# LINE 234 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 56)) ptr note
{-# LINE 235 "src/Sound/PlSynth/FFI.hsc" #-}
data PlSynthPatternT = PlSynthPatternT
{ PlSynthPatternT -> [Word8]
notes :: [Word8]
}
deriving (PlSynthPatternT -> PlSynthPatternT -> Bool
(PlSynthPatternT -> PlSynthPatternT -> Bool)
-> (PlSynthPatternT -> PlSynthPatternT -> Bool)
-> Eq PlSynthPatternT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PlSynthPatternT -> PlSynthPatternT -> Bool
== :: PlSynthPatternT -> PlSynthPatternT -> Bool
$c/= :: PlSynthPatternT -> PlSynthPatternT -> Bool
/= :: PlSynthPatternT -> PlSynthPatternT -> Bool
Eq, Int -> PlSynthPatternT -> ShowS
[PlSynthPatternT] -> ShowS
PlSynthPatternT -> String
(Int -> PlSynthPatternT -> ShowS)
-> (PlSynthPatternT -> String)
-> ([PlSynthPatternT] -> ShowS)
-> Show PlSynthPatternT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PlSynthPatternT -> ShowS
showsPrec :: Int -> PlSynthPatternT -> ShowS
$cshow :: PlSynthPatternT -> String
show :: PlSynthPatternT -> String
$cshowList :: [PlSynthPatternT] -> ShowS
showList :: [PlSynthPatternT] -> ShowS
Show)
instance Storable PlSynthPatternT where
sizeOf :: PlSynthPatternT -> Int
sizeOf PlSynthPatternT
_ = ((Int
32))
{-# LINE 243 "src/Sound/PlSynth/FFI.hsc" #-}
alignment _ = (1)
{-# LINE 244 "src/Sound/PlSynth/FFI.hsc" #-}
peek ptr = do
notes <- peekArray PL_SYNTH_PATTERN_LEN (castPtr ptr)
pure $! PlSynthPatternT{..}
poke :: Ptr PlSynthPatternT -> PlSynthPatternT -> IO ()
poke Ptr PlSynthPatternT
ptr PlSynthPatternT{[Word8]
$sel:notes:PlSynthPatternT :: PlSynthPatternT -> [Word8]
notes :: [Word8]
..} = do
Ptr PlSynthPatternT -> Word8 -> Int -> IO ()
forall a. Ptr a -> Word8 -> Int -> IO ()
fillBytes Ptr PlSynthPatternT
ptr Word8
0x00 Int
PL_SYNTH_PATTERN_LEN
Ptr Word8 -> [Word8] -> IO ()
forall a. Storable a => Ptr a -> [a] -> IO ()
pokeArray (Ptr PlSynthPatternT -> Ptr Word8
forall a b. Ptr a -> Ptr b
castPtr Ptr PlSynthPatternT
ptr) [Word8]
notes
data PlSynthTrackT = PlSynthTrackT
{ PlSynthTrackT -> PlSynthT
synth :: PlSynthT
, PlSynthTrackT -> Word32
sequence_len :: Word32
, PlSynthTrackT -> Ptr Word8
sequence :: Ptr Word8
, PlSynthTrackT -> Ptr PlSynthPatternT
patterns :: Ptr PlSynthPatternT
}
deriving (PlSynthTrackT -> PlSynthTrackT -> Bool
(PlSynthTrackT -> PlSynthTrackT -> Bool)
-> (PlSynthTrackT -> PlSynthTrackT -> Bool) -> Eq PlSynthTrackT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PlSynthTrackT -> PlSynthTrackT -> Bool
== :: PlSynthTrackT -> PlSynthTrackT -> Bool
$c/= :: PlSynthTrackT -> PlSynthTrackT -> Bool
/= :: PlSynthTrackT -> PlSynthTrackT -> Bool
Eq, Int -> PlSynthTrackT -> ShowS
[PlSynthTrackT] -> ShowS
PlSynthTrackT -> String
(Int -> PlSynthTrackT -> ShowS)
-> (PlSynthTrackT -> String)
-> ([PlSynthTrackT] -> ShowS)
-> Show PlSynthTrackT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PlSynthTrackT -> ShowS
showsPrec :: Int -> PlSynthTrackT -> ShowS
$cshow :: PlSynthTrackT -> String
show :: PlSynthTrackT -> String
$cshowList :: [PlSynthTrackT] -> ShowS
showList :: [PlSynthTrackT] -> ShowS
Show)
instance Storable PlSynthTrackT where
sizeOf :: PlSynthTrackT -> Int
sizeOf PlSynthTrackT
_ = ((Int
72))
{-# LINE 261 "src/Sound/PlSynth/FFI.hsc" #-}
alignment _ = (8)
{-# LINE 262 "src/Sound/PlSynth/FFI.hsc" #-}
peek ptr = do
synth <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 264 "src/Sound/PlSynth/FFI.hsc" #-}
sequence_len <- ((\hsc_ptr -> peekByteOff hsc_ptr 52)) ptr
{-# LINE 265 "src/Sound/PlSynth/FFI.hsc" #-}
sequence <- ((\hsc_ptr -> peekByteOff hsc_ptr 56)) ptr
{-# LINE 266 "src/Sound/PlSynth/FFI.hsc" #-}
patterns <- ((\hsc_ptr -> peekByteOff hsc_ptr 64)) ptr
{-# LINE 267 "src/Sound/PlSynth/FFI.hsc" #-}
pure $! PlSynthTrackT{..}
poke :: Ptr PlSynthTrackT -> PlSynthTrackT -> IO ()
poke Ptr PlSynthTrackT
ptr PlSynthTrackT{Word32
Ptr Word8
Ptr PlSynthPatternT
PlSynthT
$sel:synth:PlSynthTrackT :: PlSynthTrackT -> PlSynthT
$sel:sequence_len:PlSynthTrackT :: PlSynthTrackT -> Word32
$sel:sequence:PlSynthTrackT :: PlSynthTrackT -> Ptr Word8
$sel:patterns:PlSynthTrackT :: PlSynthTrackT -> Ptr PlSynthPatternT
synth :: PlSynthT
sequence_len :: Word32
sequence :: Ptr Word8
patterns :: Ptr PlSynthPatternT
..} = do
((\Ptr PlSynthTrackT
hsc_ptr -> Ptr PlSynthTrackT -> Int -> PlSynthT -> IO ()
forall b. Ptr b -> Int -> PlSynthT -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthTrackT
hsc_ptr Int
0)) Ptr PlSynthTrackT
ptr PlSynthT
synth
{-# LINE 270 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 52)) ptr sequence_len
{-# LINE 271 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 56)) ptr sequence
{-# LINE 272 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 64)) ptr patterns
{-# LINE 273 "src/Sound/PlSynth/FFI.hsc" #-}
data PlSynthSongT = PlSynthSongT
{ PlSynthSongT -> Word32
row_len :: Word32
, PlSynthSongT -> Word8
num_tracks :: Word8
, PlSynthSongT -> Ptr PlSynthTrackT
tracks :: Ptr PlSynthTrackT
}
deriving (PlSynthSongT -> PlSynthSongT -> Bool
(PlSynthSongT -> PlSynthSongT -> Bool)
-> (PlSynthSongT -> PlSynthSongT -> Bool) -> Eq PlSynthSongT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PlSynthSongT -> PlSynthSongT -> Bool
== :: PlSynthSongT -> PlSynthSongT -> Bool
$c/= :: PlSynthSongT -> PlSynthSongT -> Bool
/= :: PlSynthSongT -> PlSynthSongT -> Bool
Eq, Int -> PlSynthSongT -> ShowS
[PlSynthSongT] -> ShowS
PlSynthSongT -> String
(Int -> PlSynthSongT -> ShowS)
-> (PlSynthSongT -> String)
-> ([PlSynthSongT] -> ShowS)
-> Show PlSynthSongT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PlSynthSongT -> ShowS
showsPrec :: Int -> PlSynthSongT -> ShowS
$cshow :: PlSynthSongT -> String
show :: PlSynthSongT -> String
$cshowList :: [PlSynthSongT] -> ShowS
showList :: [PlSynthSongT] -> ShowS
Show)
instance Storable PlSynthSongT where
sizeOf :: PlSynthSongT -> Int
sizeOf PlSynthSongT
_ = ((Int
16))
{-# LINE 283 "src/Sound/PlSynth/FFI.hsc" #-}
alignment _ = (8)
{-# LINE 284 "src/Sound/PlSynth/FFI.hsc" #-}
peek ptr = do
row_len <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 286 "src/Sound/PlSynth/FFI.hsc" #-}
num_tracks <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 287 "src/Sound/PlSynth/FFI.hsc" #-}
tracks <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 288 "src/Sound/PlSynth/FFI.hsc" #-}
pure $! PlSynthSongT{..}
poke :: Ptr PlSynthSongT -> PlSynthSongT -> IO ()
poke Ptr PlSynthSongT
ptr PlSynthSongT{Word8
Word32
Ptr PlSynthTrackT
$sel:row_len:PlSynthSongT :: PlSynthSongT -> Word32
$sel:num_tracks:PlSynthSongT :: PlSynthSongT -> Word8
$sel:tracks:PlSynthSongT :: PlSynthSongT -> Ptr PlSynthTrackT
row_len :: Word32
num_tracks :: Word8
tracks :: Ptr PlSynthTrackT
..} = do
((\Ptr PlSynthSongT
hsc_ptr -> Ptr PlSynthSongT -> Int -> Word32 -> IO ()
forall b. Ptr b -> Int -> Word32 -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr PlSynthSongT
hsc_ptr Int
0)) Ptr PlSynthSongT
ptr Word32
row_len
{-# LINE 291 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr num_tracks
{-# LINE 292 "src/Sound/PlSynth/FFI.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr tracks
{-# LINE 293 "src/Sound/PlSynth/FFI.hsc" #-}
foreign import ccall "pl_synth_init" plSynthInit :: Ptr CFloat -> IO ()
foreign import ccall "pl_synth_sound_len" plSynthSoundLen :: Ptr PlSynthSoundT -> IO Int
foreign import ccall "pl_synth_sound" plSynthSound :: Ptr PlSynthSoundT -> Ptr Int16 -> IO Int
foreign import ccall "pl_synth_song_len" plSynthSongLen :: Ptr PlSynthSongT -> IO Int
foreign import ccall "pl_synth_song" plSynthSong :: Ptr PlSynthSongT -> Ptr Int16 -> Ptr Int16 -> IO Int
foreign import ccall "pl_synth_wav_write" plSynthWavWrite
:: CString
-> Ptr Int16
-> Int
-> Int16
-> Int
-> IO ()