packages feed

hCsound-0.3.1: examples/test3.hs

module Main where

import           Sound.Csound
import qualified Data.Vector.Storable as V

main :: IO ()
main = (runCsound $ runner "-W -otest3.wav test1.csd") >>= reportResult

runner :: String -> Csound ()
runner args = do
  preCompile
  setHostImplementedAudioIO 1 512
  compile args
  performBufferIO (\x y -> return $ V.replicate x 1) (\_ _ _ -> return ())
  destroy 

outFn l i b = putStrLn ("Buffer Length: " ++ (show l) ++ "Position: " ++ (show i))

reportResult :: Either CsoundError a -> IO ()
reportResult (Right _) = (putStrLn "Csound Ran! ")
reportResult (Left e) = putStrLn ("csound didn't run... " ++ (show e))