packages feed

hsc3-rec 0.9 → 0.11

raw patch · 6 files changed

+97/−76 lines, 6 filesdep ~hsc3PVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hsc3

API changes (from Hackage documentation)

Files

Help/analog-bubbles.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE DisambiguateRecordFields #-}  import Sound.SC3-import Sound.SC3.UGen.Dot import Sound.SC3.UGen.Record import Sound.SC3.UGen.Record.CombN import Sound.SC3.UGen.Record.LFSaw@@ -10,24 +9,27 @@  analog_bubbles :: UGen analog_bubbles =-    let o = ugen LFSaw { rate = KR-                       , freq = mce2 8 7.23-                       , iphase = 0 } * 3 + 80-        f = ugen LFSaw { rate = KR-                       , freq = 0.4-                       , iphase = 0 } * 24 + o-        s = ugen SinOsc { rate = AR-                        , freq = midiCPS f-                        , phase = 0} * 0.04-        c = ugen CombN { rate = AR-                       , input = s-                       , maxdelaytime = 0.2-                       , delaytime = 0.2-                       , decaytime = 4 }-    in ugen Out { rate = AR-                , bus = mce2 0 1-                , input = c }+    let o = ugen LFSaw {rate = KR+                       ,freq = mce2 8 7.23+                       ,iphase = 0} * 3 + 80+        f = ugen LFSaw {rate = KR+                       ,freq = 0.4+                       ,iphase = 0} * 24 + o+        s = ugen SinOsc {rate = AR+                        ,freq = midiCPS f+                        ,phase = 0} * 0.04+        c = ugen CombN {rate = AR+                       ,input = s+                       ,maxdelaytime = 0.2+                       ,delaytime = 0.2+                       ,decaytime = 4}+    in ugen Out {rate = AR+                ,bus = mce2 0 1+                ,input = c}  main :: IO ()-main = do draw analog_bubbles-          audition analog_bubbles+main = audition analog_bubbles++{-+Sound.SC3.UGen.Dot.draw analog_bubbles+-}
Help/pitch.hs view
@@ -3,10 +3,10 @@ import qualified Sound.SC3.UGen.Record.Pitch as P  main :: IO ()-main = -    let x = mouseX KR 220 660 Linear 0.1-        y = mouseY KR 0.05 0.25 Linear 0.1+main =+    let x = mouseX' KR 220 660 Linear 0.1+        y = mouseY' KR 0.05 0.25 Linear 0.1         s = saw AR x * y         a = amplitude KR s 0.05 0.05-        MCE [f, _] = R.ugen P.pitch { P.input = s }-    in audition (out 0 (mce [s * 0.25, sinOsc AR (f / 2) 0 * a]))+        MCE [f,_] = R.ugen P.pitch {P.input = s}+    in audition (out 0 (mce [s * 0.25,sinOsc AR (f / 2) 0 * a]))
README view
@@ -1,21 +1,4 @@ hsc3-rec - haskell supercollider record variants -Provides record constructors for all unit generators-that take at least one parameter.--To be useable requires record field disambiguation-as is present in ghc >= 6.8.2.--The record variants are generated by a program using-the database at hsc3-db.  This database is-auto-generated from the supercollider language unit-generator bindings and is not entirely accurate.--In particular neither argument re-ordering or multiple-channel collapse are correctly annotated, see for-instance the Out unit generator in the help file-analog-bubbles.hs, where explicit bus numbering is-required.- (c) rohan drape and others, 2008-2011     gpl, http://gnu.org/copyleft/
Sound/SC3/UGen/Record.hs view
@@ -1,3 +1,29 @@+-- | The 'Make' class provides the 'ugen' function, and has instances+-- for record constructors for all unit generators that take at least+-- one parameter.+--+-- There are two primary use scenarios.+--+-- In the first individual record variants are used in isolatation for+-- UGens having many inputs where default values are required+--+-- In the second graphs are predominantly constructed using record+-- syntax for clarity.+--+-- In the latter case clarity is greatly enhanced using record field+-- disambiguation as is present in ghc since version 6.8.2.+--+-- The record variants are generated by a program using the database+-- at hsc3-db and are /not/ stored in the darcs repository.  This+-- database is auto-generated from the supercollider language unit+-- generator bindings and is not entirely accurate.+--+-- See <http://slavepianos.org/rd?t=hsc3-db>+--+-- In particular neither argument re-ordering or multiple channel+-- collapse are correctly annotated, see for instance the Out unit+-- generator in the help file @analog-bubbles.hs@, where explicit bus+-- numbering is required. module Sound.SC3.UGen.Record where  import Sound.SC3.UGen.UGen
hsc3-rec.cabal view
@@ -1,5 +1,5 @@ Name:              hsc3-rec-Version:           0.9+Version:           0.11 Synopsis:          Haskell SuperCollider Record Variants Description:       hsc3-rec provides record variants of the                    unit generator constructors at hsc3.@@ -10,9 +10,9 @@ Maintainer:        rd@slavepianos.org Stability:         Experimental Homepage:          http://slavepianos.org/rd/?t=hsc3-rec-Tested-With:       GHC == 6.12.1+Tested-With:       GHC == 7.2.2 Build-Type:        Simple-Cabal-Version:     >= 1.6+Cabal-Version:     >= 1.8  Data-files:        README                    Makefile@@ -22,7 +22,7 @@  Library   Build-Depends:   base == 4.*,-                   hsc3 == 0.9+                   hsc3 == 0.11.*   GHC-Options:     -Wall -fwarn-tabs   Exposed-modules: Sound.SC3.UGen.Record                    -- the lines below are generate by running
mk/build.hs view
@@ -7,26 +7,30 @@ -- Rename parameters that conflict with keywords or prelude functions, -- or which have otherwise unwieldy names. rename_input :: String -> String-rename_input "in" = "input"-rename_input "channelsArray" = "input"-rename_input "exp" = "exp_"-rename_input "id" = "id_"-rename_input "length" = "length_"-rename_input "init" = "init_"-rename_input "floor" = "floor_"-rename_input "div" = "div_"-rename_input "max" = "max_"-rename_input "min" = "min_"-rename_input "spring" = "spring_"-rename_input "rate" = "rate_"-rename_input "default" = "default_"-rename_input s = s+rename_input p =+    case p of+      "in" -> "input"+      "channelsArray" -> "input"+      "exp" -> "exp_"+      "id" -> "id_"+      "length" -> "length_"+      "init" -> "init_"+      "floor" -> "floor_"+      "div" -> "div_"+      "max" -> "max_"+      "min" -> "min_"+      "spring" -> "spring_"+      "rate" -> "rate_"+      "default" -> "default_"+      _ -> p  -- Rename unit generators that conflict with keywords or prelude -- functions. rename_ugen :: String -> String-rename_ugen "in" = "in'"-rename_ugen s = s+rename_ugen u =+    case u of+      "in" -> "in'"+      _ -> u  input_name :: D.I -> String input_name = rename_input . D.input_name@@ -39,9 +43,11 @@ -- In the case of one input rate use that instead of default rate, -- which can be innacurate (see pitch for example). fixed_rate :: D.U -> Rate-fixed_rate (D.U _ [r] _ _ _) = r-fixed_rate (D.U _ [] r _ _) = r-fixed_rate _ = undefined+fixed_rate u =+    case u of+      D.U _ [r] _ _ _ -> r+      D.U _ [] r _ _ -> r+      _ -> undefined  -- List of field names and types. inputs_of :: D.U -> [(String, String)]@@ -54,8 +60,10 @@  -- Append a character to each but the last string. with_char :: Char -> [String] -> [String]-with_char c (x:y:xs) = (x ++ [c]) : with_char c (y:xs)-with_char _ xs = xs+with_char c l =+    case l of+      x:y:xs -> (x ++ [c]) : with_char c (y:xs)+      _ -> l  with_comma :: [String] -> [String] with_comma = with_char ','@@ -64,8 +72,10 @@ with_space = with_char ' '  downcase_first_char :: String -> String-downcase_first_char [] = []-downcase_first_char (x:xs) = toLower x : xs+downcase_first_char s =+    case s of+      [] -> []+      x:xs -> toLower x : xs  -- Construct the parameter record. gen_param :: D.U -> [String]@@ -89,23 +99,23 @@  -- Generate a list of variable names (a,b..) var_names :: Int -> [String]-var_names n = map (\x -> x : "'") (take n ['a'..])+var_names n = map (: "'") (take n ['a'..])  -- Generate the constructor for the unit generator. gen_cons :: D.U -> [String]-gen_cons u@(D.U n _ _ is o) = +gen_cons u@(D.U n _ _ is o) =     let xs = var_names (length is)         nr = needs_rate u         l_opt = if nr then "r" else ""         r_opt = if nr then "r" else printf "S.%s" (show (fixed_rate u))     in [ printf "mk%s :: %s -> S.UGen" n n-       , printf "mk%s (%s %s %s) = S.mkOsc %s \"%s\" [%s] %d" +       , printf "mk%s (%s %s %s) = S.mkOsc %s \"%s\" [%s] %d"                 n                 n                 l_opt                 (concat (with_space xs))                 r_opt-                n +                n                 (concat (with_comma xs))                 o] @@ -136,7 +146,7 @@  main :: IO () main = do-  let us = filter (\u -> not (null (D.ugen_inputs u))) D.ugenDB+  let us = filter (not . null . D.ugen_inputs) D.ugenDB   mapM_ write_module us  {-@@ -149,12 +159,12 @@     in pre ++ with_comma (map f us) ++ post  gen_imports :: [D.U] -> [String]-gen_imports = +gen_imports =     let f u = printf "import Sound.SC3.UGen.Record.%s" (D.ugen_name u)     in map f  write_records :: [D.U] -> IO ()-write_records us = +write_records us =     let s = unlines (gen_module_clause us ++ gen_imports us)     in writeFile (sc3_ugen_dir </> "Record" </> "All" <.> "hs") s -}