de.sciss.fscape.graph.Poll.scala Maven / Gradle / Ivy
/*
* Poll.scala
* (FScape)
*
* Copyright (c) 2001-2016 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU General Public License v2+
*
*
* For further information, please contact Hanns Holger Rutz at
* [email protected]
*/
package de.sciss.fscape
package graph
import de.sciss.fscape.stream.StreamIn
import scala.collection.immutable.{IndexedSeq => Vec}
/** A UGen that prints snapshots of its input to the console.
* Note that arguments have different order than in ScalaCollider!
*
* @param in the input to be pulled. If this is a constant,
* the UGen will close after polling it. This is to
* prevent a dangling `Poll` whose trigger is
* infinite (such as `Impulse`). If you want to avoid
* that, you should wrap the input in a `DC`.
* @param trig trigger that causes the UGen to print a snapshot
* of the input.
* @param label an identifying label to prepend to the printing.
*/
final case class Poll(in: GE, trig: GE, label: String = "poll") extends UGenSource.ZeroOut {
protected def makeUGens(implicit b: UGenGraph.Builder): Unit =
unwrap(Vector(in.expand, trig.expand))
protected def makeUGen(args: Vec[UGenIn])(implicit b: UGenGraph.Builder): Unit =
UGen.ZeroOut(this, inputs = args, rest = label)
private[fscape] def makeStream(args: Vec[StreamIn])(implicit b: stream.Builder): Unit = {
val Vec(in, trig) = args
stream.Poll(in = in.toAny, trig = trig.toInt, label = label)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy