de.sciss.lucre.synth.Group.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lucresynth_2.11 Show documentation
Show all versions of lucresynth_2.11 Show documentation
Transactional extension for ScalaCollider
/*
* Group.scala
* (SoundProcesses)
*
* Copyright (c) 2010-2016 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Lesser General Public License v2.1+
*
*
* For further information, please contact Hanns Holger Rutz at
* [email protected]
*/
package de.sciss.lucre.synth
import de.sciss.lucre.synth.impl.{GroupImpl => Impl}
import de.sciss.synth.{AddAction, addToHead, Group => SGroup}
object Group {
def apply(server: Server)(implicit tx: Txn): Group = {
val nodeID = server.nextNodeID()
Impl(server, SGroup(server.peer, nodeID))(online0 = false)
}
def play(target: Node, addAction: AddAction = addToHead)(implicit tx: Txn): Group = {
val g = apply(target.server)
g.play(target, addAction)
g
}
private[synth] def wrap(server: Server, peer: SGroup): Group = {
require(server.peer == peer.server)
Impl(server, peer)(online0 = true)
}
}
trait Group extends Node {
def peer: SGroup
def freeAll()(implicit tx: Txn): Unit
def play(target: Node, addAction: AddAction)(implicit tx: Txn): Unit
}