All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sciss.synth.proc.AuralContext.scala Maven / Gradle / Ivy

/*
 *  AuralContext.scala
 *  (SoundProcesses)
 *
 *  Copyright (c) 2010-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.synth.proc

import de.sciss.lucre.stm
import de.sciss.lucre.stm.{Disposable, Obj, Sys}
import de.sciss.lucre.synth.{Server, Sys => SSys}
import de.sciss.synth.proc.impl.{AuralContextImpl => Impl}

object AuralContext {
  def apply[S <: SSys[S]](server: Server, scheduler: Scheduler[S])
                        (implicit tx: S#Tx, workspaceHandle: WorkspaceHandle[S]): AuralContext[S] =
    Impl(server, scheduler)

  def apply[S <: SSys[S]](server: Server)(implicit tx: S#Tx, cursor: stm.Cursor[S],
                                         workspaceHandle: WorkspaceHandle[S]): AuralContext[S] = {
    val sched = Scheduler[S]
    apply(server, sched)
  }
}
trait AuralContext[S <: Sys[S]] extends AuxContext[S] {
  def server: Server

  def acquire[A <: Disposable[S#Tx]](obj: Obj[S])(init: => A)(implicit tx: S#Tx): A

  def release(obj: Obj[S])(implicit tx: S#Tx): Unit

  def get[A](obj: Obj[S])(implicit tx: S#Tx): Option[A]

  val scheduler: Scheduler[S]

  implicit def workspaceHandle: WorkspaceHandle[S]
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy