182 lines
3.3 KiB
PHP
182 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace NoccyLabs\PulseAudio;
|
|
|
|
use NoccyLabs\PulseAudio\Module\ModuleList;
|
|
use NoccyLabs\PulseAudio\Module\Loopback;
|
|
use NoccyLabs\PulseAudio\Sink\SinkList;
|
|
use NoccyLabs\PulseAudio\Sink\SinkInputList;
|
|
use NoccyLabs\PulseAudio\Sink\NullSink;
|
|
use NoccyLabs\PulseAudio\Sink\Sink;
|
|
use NoccyLabs\PulseAudio\Source\SourceList;
|
|
use NoccyLabs\PulseAudio\Source\SourceOutputList;
|
|
use NoccyLabs\PulseAudio\Source\Source;
|
|
use NoccyLabs\PulseAudio\Client\ClientList;
|
|
use NoccyLabs\PulseAudio\Card\CardList;
|
|
|
|
/**
|
|
* @class PulseAudio
|
|
*
|
|
*
|
|
*/
|
|
class PulseAudio
|
|
{
|
|
|
|
protected $server;
|
|
|
|
public function __construct($server=null)
|
|
{
|
|
$this->server = $server;
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return ModuleList
|
|
*/
|
|
public function getModules()
|
|
{
|
|
return new ModuleList($this);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return SinkList
|
|
*/
|
|
public function getSinks()
|
|
{
|
|
return new SinkList($this);
|
|
}
|
|
|
|
/**
|
|
* Create a new null sink that can be used
|
|
*
|
|
* @param Source $source The source to use as input
|
|
* @param Sink $sink The sink to use as output
|
|
* @return Loopback The created loopback module
|
|
*/
|
|
public function createNullSink($name=null, $description=null, array $properties=[])
|
|
{
|
|
return new NullSink($this, $name, $description, $properties);
|
|
}
|
|
|
|
/**
|
|
* Create a new loopback, connecting a source to a sink.
|
|
*
|
|
* @param Source $source The source to use as input
|
|
* @param Sink $sink The sink to use as output
|
|
* @return Loopback The created loopback module
|
|
*/
|
|
public function createLoopback(Source $source, Sink $sink)
|
|
{
|
|
return new Loopback($this, $source, $sink);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return Sink
|
|
*/
|
|
public function getDefaultSink()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* Get an object representing a sink that exist on the system. Both index
|
|
* and name can be used to select the sink.
|
|
*
|
|
* @param int|string $index The index OR name of the sink to retrieve
|
|
* @return Sink|null The sink, or null if none found
|
|
*/
|
|
public function getSink($index)
|
|
{
|
|
$sinks = $this->getSinks();
|
|
return $sinks[$index];
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
*
|
|
* @return SinkInputList
|
|
*/
|
|
public function getSinkInputs()
|
|
{
|
|
return new SinkInputList($this);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return SourceList
|
|
*/
|
|
public function getSources()
|
|
{
|
|
return new SourceList($this);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return Source
|
|
*/
|
|
public function getDefaultSource()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return Source
|
|
*/
|
|
public function getSource($index)
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return SourceOutputList
|
|
*/
|
|
public function getSourceOutputs()
|
|
{
|
|
return new SourceOutputList($this);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return ClientList
|
|
*/
|
|
public function getClients()
|
|
{
|
|
return new ClientList($this);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return Client
|
|
*/
|
|
public function getClientByIndex($index)
|
|
{
|
|
$clients = $this->getClients();
|
|
return $clients[$index];
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @return CardList
|
|
*/
|
|
public function getCards()
|
|
{
|
|
return new CardList($this);
|
|
}
|
|
|
|
}
|
|
|