#include <lxconnection.h>
Public Member Functions | |
virtual BufferData | makeScratchSample (bool autoPush=false) |
virtual BufferData | makeScratchSamples (const uint samples, bool autoPush=false) |
virtual BufferData | makeScratchSecond (bool autoPush=false) |
virtual BufferData | makeScratchSeconds (const float seconds, bool autoPush=false) |
const uint | maximumScratchSamples (const uint minimum=1) |
const uint | maximumScratchSamplesEver () |
BufferData | operator+ (const uint samples) |
LxConnection & | operator<< (const BufferData &data) |
virtual void | push (const BufferData &data)=0 |
virtual const SignalTypeRef | type () |
~LxConnection () | |
Protected Member Functions | |
LxConnection (Source *source, const uint sourceIndex) | |
virtual BufferData | makeScratchElements (const uint elements, bool autoPush=false) |
virtual const uint | maximumScratchElements (const uint minimum=1)=0 |
virtual const uint | maximumScratchElementsEver ()=0 |
Protected Attributes | |
Source * | theSource |
uint | theSourceIndex |
Friends | |
class | DomProcessor |
class | Processor |
class | Splitter |
With proper use of Processor class's Processor::specifyOutputSpace() method you should only ever need to use two methods; makeScratchSamples() and push(). maximumScratchSamples() may also be useful for those concerned with efficiency.
Other methods are included for completeness to allow currently barely imagined uses.
Geddei::LxConnection::LxConnection | ( | Source * | source, | |
const uint | sourceIndex | |||
) | [protected] |
Simple constructor.
Geddei::LxConnection::~LxConnection | ( | ) |
Simple destructor.
virtual const uint Geddei::LxConnection::maximumScratchElements | ( | const uint | minimum = 1 |
) | [protected, pure virtual] |
Get the maximum amount of scratch elements we can make that won't cause a deadlock if we try to create a scratch of that size. If no elements are free, will block until elements are free, rather than return zero.
minimum | The minimum number of elements it should return. This must be less than or equal to maximumScratchElementsEver(). |
virtual const uint Geddei::LxConnection::maximumScratchElementsEver | ( | ) | [protected, pure virtual] |
Returns the maximum amount of scratch elements we could ever make that won't (definately) cause a deadlock.
Typically this value should be divided by two to be sure that the scratch size asked for will definately be possible.
BufferData Geddei::LxConnection::makeScratchElements | ( | const uint | elements, | |
bool | autoPush = false | |||
) | [protected, virtual] |
This method may block if no resource is available.
For internal note: This implementation makes an (inefficient) unassociated scratch object. Reimplement to provide a mroe efficient solution.
elements | The size of the data chunk required in elements. | |
autoPush | If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope. |
virtual const SignalTypeRef Geddei::LxConnection::type | ( | ) | [inline, virtual] |
Retrieves the type of signal this connection transfers.
BufferData Geddei::LxConnection::makeScratchSamples | ( | const uint | samples, | |
bool | autoPush = false | |||
) | [virtual] |
Create a new scratch pad with which data may be sent efficiently.
Use push() to send the data, or set autoPush to true for it to happen automatically.
This method may block if no resource is available.
samples | The size of the data chunk required in samples. | |
autoPush | If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope. |
virtual BufferData Geddei::LxConnection::makeScratchSample | ( | bool | autoPush = false |
) | [inline, virtual] |
Create a new scratch pad with which data may be sent efficiently. The scratch pad is one sample long.
Use push() to send the data, or set autoPush to true for it to happen automatically.
This method may block if no resource is available.
autoPush | If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope. |
BufferData Geddei::LxConnection::makeScratchSeconds | ( | const float | seconds, | |
bool | autoPush = false | |||
) | [virtual] |
Create a new scratch pad with which data may be sent efficiently.
Use push() to send the data, or set autoPush to true for it to happen automatically.
This method may block if no resource is available.
seconds | The size of the data chunk required in seconds. | |
autoPush | If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope. |
virtual BufferData Geddei::LxConnection::makeScratchSecond | ( | bool | autoPush = false |
) | [inline, virtual] |
Create a new scratch pad with which data may be sent efficiently. The scratch is exactly one second long.
Use push() to send the data, or set autoPush to true for it to happen automatically.
This method may block if no resource is available.
seconds | The size of the data chunk required in seconds. | |
autoPush | If true, then on destruction of the returned BufferData object, it will get pushed automatically. This would happen, for instance, when it goes out of semantic scope. |
virtual void Geddei::LxConnection::push | ( | const BufferData & | data | ) | [pure virtual] |
Transfers data down the connection to its sink.
If data is a native scratch, it becomes invalid, and any automatic cleanups it has will be removed.
This method will block until the data is sent (though not neccessarily received).
data | The data to be transferred down this connection. |
const uint Geddei::LxConnection::maximumScratchSamples | ( | const uint | minimum = 1 |
) | [inline] |
Get the maximum amount of scratch samples we can make that won't cause a deadlock if we try to create a scratch of that size. If no samples are free, will block until samples are free, rather than return zero.
minimum | The minimum number of samples it should return. This must be less than or equal to maximumScratchSamplesEver(). |
const uint Geddei::LxConnection::maximumScratchSamplesEver | ( | ) | [inline] |
Returns the maximum amount of scratch samples we could ever make that won't (definately) cause a deadlock.
Typically this value should be divided by two to be sure that the scratch size asked for will definately be possible.
LxConnection& Geddei::LxConnection::operator<< | ( | const BufferData & | data | ) | [inline] |
Some syntactic sugar, if you're into that sort of thing. Equivalent to the push() method.
That is, the following two statements are sematically identical:
connection.push(d); connection << d;
data | The data to be transferred down this connection. |
BufferData Geddei::LxConnection::operator+ | ( | const uint | samples | ) | [inline] |
Some syntactic sugar, if you're into that sort of thing. Equivalent to the makeScratchSamples() method.
That is, the following two statements are sematically identical:
BufferData d = connection.makeScratchSamples(5, false);
BufferData d = connection + 5;
samples | The size of the data chunk required in samples. |