summaryrefslogtreecommitdiff
path: root/src/Csound
diff options
context:
space:
mode:
Diffstat (limited to 'src/Csound')
-rw-r--r--src/Csound/Typed/GlobalState/Elements.hs18
-rw-r--r--src/Csound/Typed/Plugins.hs8
-rw-r--r--src/Csound/Typed/Plugins/AmbiRow.hs25
-rw-r--r--src/Csound/Typed/Plugins/LiveRow.hs25
-rw-r--r--src/Csound/Typed/Plugins/ZeroDelayConvolution.hs4
5 files changed, 77 insertions, 3 deletions
diff --git a/src/Csound/Typed/GlobalState/Elements.hs b/src/Csound/Typed/GlobalState/Elements.hs
index 49ba9c7..052d026 100644
--- a/src/Csound/Typed/GlobalState/Elements.hs
+++ b/src/Csound/Typed/GlobalState/Elements.hs
@@ -44,6 +44,8 @@ module Csound.Typed.GlobalState.Elements(
ringModulatorPlugin, stChorusPlugin, stereoPingPongDelayPlugin,
tapeEchoPlugin,
delay1kPlugin,
+ liveRowPlugin, liveRowsPlugin,
+ ambiRowPlugin, ambiRowMp3Plugin
) where
import Data.List
@@ -96,7 +98,14 @@ newGen = saveGenId
newTabOfGens :: [Gen] -> State GenMap Int
newTabOfGens = (saveGenId . intTab =<<) . mapM saveGenId
- where intTab ns = Gen (length ns) (IntGenId (-2)) (fmap fromIntegral ns) Nothing
+ where intTab ns = Gen (nextPowOfTwo $ length ns) (IntGenId (-2)) (fmap fromIntegral ns) Nothing
+
+nextPowOfTwo :: Int -> Int
+nextPowOfTwo n
+ | frac == 0 = n
+ | otherwise = 2 ^ (integ + 1)
+ where
+ (integ, frac) = properFraction $ logBase 2 (fromIntegral n)
saveGenId :: Ord a => a -> State (IdMap a) Int
saveGenId a = state $ \s ->
@@ -602,3 +611,10 @@ stereoPingPongDelayPlugin = UdoPlugin "MultiFX/StereoPingPongDelay"
tapeEchoPlugin = UdoPlugin "MultiFX/TapeEcho"
delay1kPlugin = UdoPlugin "Utility/Delay1k"
+
+liveRowPlugin = UdoPlugin "LiveRow" -- live like trigger, mono
+liveRowsPlugin = UdoPlugin "LiveRows" -- stereo
+
+ambiRowPlugin = UdoPlugin "AmbiRow" -- ambi trigger, wav
+ambiRowMp3Plugin = UdoPlugin "AmbiRowMp3" -- mp3
+
diff --git a/src/Csound/Typed/Plugins.hs b/src/Csound/Typed/Plugins.hs
index cf16356..f174d77 100644
--- a/src/Csound/Typed/Plugins.hs
+++ b/src/Csound/Typed/Plugins.hs
@@ -39,6 +39,12 @@ module Csound.Typed.Plugins(
-- * Tape echo
tapeRead, tapeWrite, tapeEcho,
+ -- * Live row
+ liveRow, liveRows,
+
+ -- * Ambi row
+ ambiRow, ambiRowMp3,
+
-- utilities
delay1k
@@ -52,5 +58,7 @@ import Csound.Typed.Plugins.Korg35
import Csound.Typed.Plugins.SolinaChorus
import Csound.Typed.Plugins.ZeroDelayConvolution
import Csound.Typed.Plugins.Iain
+import Csound.Typed.Plugins.AmbiRow
+import Csound.Typed.Plugins.LiveRow
import Csound.Typed.Plugins.TapeEcho
import Csound.Typed.Plugins.Utilities
diff --git a/src/Csound/Typed/Plugins/AmbiRow.hs b/src/Csound/Typed/Plugins/AmbiRow.hs
new file mode 100644
index 0000000..8ec7ab0
--- /dev/null
+++ b/src/Csound/Typed/Plugins/AmbiRow.hs
@@ -0,0 +1,25 @@
+module Csound.Typed.Plugins.AmbiRow(
+ ambiRow, ambiRowMp3
+) where
+
+import Control.Monad.Trans.Class
+import Control.Applicative
+
+import Csound.Dynamic
+
+import Csound.Typed.Types
+import Csound.Typed.GlobalState
+import qualified Csound.Typed.GlobalState.Elements as E(ambiRowPlugin, ambiRowMp3Plugin)
+
+ambiRow :: Arr1 Str -> Sig -> Sig -> D -> Sig2
+ambiRow (Arr sFiles) kSpeed kIndex iFadeTime = toTuple $ fmap ($ 2) $ do
+ addUdoPlugin E.ambiRowPlugin
+ f sFiles <$> toGE kSpeed <*> toGE kIndex <*> toGE iFadeTime
+ where f sFiles kSpeed kIndex iFadeTime = mopcs "AmbiRow" ([Ar, Ar], [Sr, Kr, Kr, Ir]) [inlineVar $ head sFiles, kSpeed, kIndex, iFadeTime]
+
+ambiRowMp3 :: Arr1 Str -> Sig -> Sig -> D -> Sig2
+ambiRowMp3 (Arr sFiles) kSpeed kIndex iFadeTime = toTuple $ fmap ($ 2) $ do
+ addUdoPlugin E.ambiRowMp3Plugin
+ f sFiles <$> toGE kSpeed <*> toGE kIndex <*> toGE iFadeTime
+ where f sFiles kSpeed kIndex iFadeTime = mopcs "AmbiRowMp3" ([Ar, Ar], [Sr, Kr, Kr, Ir]) [inlineVar $ head sFiles, kSpeed, kIndex, iFadeTime]
+
diff --git a/src/Csound/Typed/Plugins/LiveRow.hs b/src/Csound/Typed/Plugins/LiveRow.hs
new file mode 100644
index 0000000..7aa834c
--- /dev/null
+++ b/src/Csound/Typed/Plugins/LiveRow.hs
@@ -0,0 +1,25 @@
+module Csound.Typed.Plugins.LiveRow(
+ liveRow,
+ liveRows
+) where
+
+import Control.Monad.Trans.Class
+import Control.Applicative
+
+import Csound.Dynamic
+
+import Csound.Typed.Types
+import Csound.Typed.GlobalState
+import qualified Csound.Typed.GlobalState.Elements as E(liveRowPlugin, liveRowsPlugin)
+
+liveRow :: D -> TabList -> D -> D -> Sig -> Tab -> Sig
+liveRow iTabSize iTabs iBpm iBeatDur kUserIndex iAuxParams = fromGE $ do
+ addUdoPlugin E.liveRowPlugin
+ f <$> toGE iTabSize <*> toGE iTabs <*> toGE iBpm <*> toGE iBeatDur <*> toGE kUserIndex <*> toGE iAuxParams
+ where f iTabSize iTabs iBpm iBeatDur kUserIndex iAuxParams = opcs "liveRow" [(Ar, [Ir, Ir, Ir, Ir, Kr, Ir])] [iTabSize, iTabs, iBpm, iBeatDur, kUserIndex, iAuxParams]
+
+liveRows :: D -> TabList -> TabList -> D -> D -> Sig -> Tab -> Sig2
+liveRows iTabSize iLeftTabs iRightTabs iBpm iBeatDur kUserIndex iAuxParams = toTuple $ fmap ($ 2) $ do
+ addUdoPlugin E.liveRowsPlugin
+ f <$> toGE iTabSize <*> toGE iLeftTabs <*> toGE iRightTabs <*> toGE iBpm <*> toGE iBeatDur <*> toGE kUserIndex <*> toGE iAuxParams
+ where f iTabSize iLeftTabs iRightTabs iBpm iBeatDur kUserIndex iAuxParams = mopcs "liveRows" ([Ar, Ar], [Ir, Ir, Ir, Ir, Ir, Kr, Ir]) [iTabSize, iLeftTabs, iRightTabs, iBpm, iBeatDur, kUserIndex, iAuxParams]
diff --git a/src/Csound/Typed/Plugins/ZeroDelayConvolution.hs b/src/Csound/Typed/Plugins/ZeroDelayConvolution.hs
index d8ed643..3b2130d 100644
--- a/src/Csound/Typed/Plugins/ZeroDelayConvolution.hs
+++ b/src/Csound/Typed/Plugins/ZeroDelayConvolution.hs
@@ -1,4 +1,4 @@
-module Csound.Typed.Plugins.ZeroDelayConvolution(
+module Csound.Typed.Plugins.ZeroDelayConvolution(
ZConvSpec(..), zconv, zconv'
) where
@@ -33,7 +33,7 @@ zconv :: Tab -> Sig -> Sig
zconv = zconv' def
-- | zero delay convolution.
---
+--
-- > zconv' (ZConvSpec ipart irat inp) ifn ain
--
-- Original UDO code by Victor Lazzarini.