I have a C # project that works with audio input from Kinect 1, Kinect 2, Microphone or something else.
waveIn.DataAvailable += (object sender, WaveInEventArgs e) => { lock(buffer){ var pos = buffer.Position; buffer.Write(e.Buffer, 0, e.BytesRecorded); buffer.Position = pos; } };
A buffer variable is a stream from component A, which will be processed by component B SpeechRecognition, working with streams.
I will add new components C, D, E, working on Streams to calculate pitch, detect sound, print a finger or anything else ...
How can I duplicate this thread for components C, D, E?
Component A dispatches the event "I have a thread that does what you want" I do not want to change the logic using the "Give me your threads" event
I'm looking for a "MultiStream" that can give me an instance of Stream and will handle the job
Component A
var MultiStream buffer = new MultiStream() ... SendMyEventWith(buffer)
Component B, C, D, E
public void HandleMyEvent(MultiStream buffer){ var stream = buffer.GetNewStream(); var engine = new EngineComponentB() engine.SetStream(stream); }
- Should MultiStream be a stream for transferring the Write () method (because Stream does not have data available for the mechanics)?
- If a Dispose () stream over component B, should MultiStream remove it from the array?
- MultiStream must throw an exception in Read () to use GetNewStream ()
EDIT: Kinect 1 provides the stream itself ... :-( should I use Thread to enter MultiStream?
Does anyone have such a MultiStream class?
thanks
source share