Skip to content

Commit

Permalink
work in progress on aout
Browse files Browse the repository at this point in the history
  • Loading branch information
dktr0 committed Nov 22, 2024
1 parent 02f5980 commit 3d6b9e8
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 177 deletions.
338 changes: 169 additions & 169 deletions punctual.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/Action.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Signal (Signal,signalInfo)
import DefTime (DefTime(..), calculateT1)
import Transition (Transition(..), transitionToXfade)
import Duration (Duration(..))
import Output (Output(..))
import Output (Output(..),isVisualOutput,isAudioOutput)

type Action = {
signal :: Signal,
Expand Down Expand Up @@ -56,10 +56,10 @@ actionTimesAsAudioTime tempo eTime clockDiff x = Tuple t1Audio t2Audio
t2Audio = t2Posix - clockDiff

actionHasVisualOutput :: Action -> Boolean
actionHasVisualOutput a = a.output == Blend || a.output == RGBA || a.output == Add || a.output == Mul || a.output == RGB
actionHasVisualOutput a = isVisualOutput a.output

actionHasAudioOutput :: Action -> Boolean
actionHasAudioOutput a = a.output == Audio
actionHasAudioOutput a = isAudioOutput a.output

actionHasAudioInput :: Action -> Boolean
actionHasAudioInput a = unwrap (signalInfo a.signal).ain
13 changes: 8 additions & 5 deletions src/Output.purs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Output where

import Prelude (class Eq,class Show)
import Prelude (class Eq,class Show,not,(<<<),max)
import Data.Generic.Rep (class Generic)
import Data.Show.Generic (genericShow)

Expand All @@ -18,16 +18,19 @@ derive instance Generic Output _
instance Show Output where
show = genericShow

isVisualOutput :: Output -> Boolean
isVisualOutput = not <<< isAudioOutput

isAudioOutput :: Output -> Boolean
isAudioOutput Audio = true
isAudioOutput (AOut _ _) = true
isAudioOutput _ = false

audioOutputChannels :: Int -> Output -> Int
audioOutputChannels maxChnls Audio = maxChnls
audioOutputChannels _ (AOut _ n) = n
audioOutputChannels _ _ = 0
audioOutputChannels maxChnls Audio = max maxChnls 1
audioOutputChannels _ (AOut _ n) = max n 1
audioOutputChannels _ _ = 1

audioOutputOffset :: Output -> Int
audioOutputOffset (AOut o _) = o
audioOutputOffset (AOut o _) = max o 0
audioOutputOffset _ = 0

0 comments on commit 3d6b9e8

Please sign in to comment.