I
- type of the input values from the associated SignalSource
public class SignalPump<I> extends Object
Pumps a signal from a SignalSource
through a graph of SignalProcessor
s,
also known as processing pipelines and lets you collect the results in a Map
.
After being added to this pump, the pipelines are optimized to avoid
redundant processing, if at all possible.
To use a pump,
SignalSource
.add(com.tagtraum.jipes.SignalProcessor)
one or more already configured processors or pipelines.pump()
.Constructor and Description |
---|
SignalPump() |
SignalPump(SignalSource<I> signalSource) |
Modifier and Type | Method and Description |
---|---|
void |
add(SignalProcessor<I,?> signalProcessor)
Lets you add a
SignalProcessor -pipeline (that is a processor and its kids)
to this pump. |
void |
cancel()
Cancels
pump() . |
String |
getDescription()
Produces a readable ASCII description of this pump and its pipelines.
|
Set<SignalProcessor<I,?>> |
getEffectiveProcessorGraphs()
Returns the currently effective processing graphs.
|
SignalSource<I> |
getSignalSource()
Returns the currently set signal source.
|
boolean |
isCancelled()
Indicates, whether a pump operation has been cancelled.
|
Map<Object,Object> |
pump()
'Pumps' the provided
SignalSource until it's dry and pushes the produced data into the configured
SignalProcessor s. |
void |
setSignalSource(SignalSource<I> signalSource)
Lets you set the
SignalSource that this pump will use
as source. |
String |
toString() |
public SignalPump(SignalSource<I> signalSource)
public SignalPump()
public SignalSource<I> getSignalSource()
public void setSignalSource(SignalSource<I> signalSource)
SignalSource
that this pump will use
as source.signalSource
- signal sourcepublic void add(SignalProcessor<I,?> signalProcessor)
SignalProcessor
-pipeline (that is a processor and its kids)
to this pump. To be of any use, most processors will have one or more children to execute multiple
processing steps. Internally, pipelines are optimized (i.e. re-organized) to drop redundant steps.
This implies, that you must never change the state of a processor or the makeup of a pipeline/graph,
after it has been added to the pipeline: results would be unpredictable.
SignalProcessor.process(Object)
,
and SignalProcessor.flush()
are called on processors in the order they were added.signalProcessor
- ready to use processor with kids (a.k.a. pipeline)public Map<Object,Object> pump() throws IOException, IllegalStateException
SignalSource
until it's dry and pushes the produced data into the configured
SignalProcessor
s. Then collects the output by calling
SignalProcessor.getOutput()
of all registered processors (and their children).
Note that every output/result id in all pipelines must be unique, if you actually want to be certain
that it is from the one processor you are interested in. Standard ids are not unique
(see AbstractSignalProcessor.getId()
).
SignalProcessor.getId()
}) and
their associated output (see SignalProcessor.getOutput()
)IOException
- if any IO problems occurIllegalStateException
- if the SignalSource
is not setAbstractSignalProcessor
,
AudioSignalSource
public void cancel()
pump()
. May be called from another thread.public boolean isCancelled()
cancel()
public Set<SignalProcessor<I,?>> getEffectiveProcessorGraphs()
add(com.tagtraum.jipes.SignalProcessor)
.
This graph is read-only. Do not modify it.public String getDescription()
Copyright © 2011–2020 tagtraum industries incorporated. All rights reserved.