Multi-agent ring-buffer
Embodiments included herein generally relate to processing data samples. More particularly, embodiments relate to processing a plurality of data samples using a multi-agent ring-buffer and a plurality of agents configured to communicate with the ring-buffer to process each of the plurality of data samples.
1 . A device, comprising:
a first ring-buffer, of a plurality of ring-buffers, including a plurality of first partitions configured to store a plurality of first audio data samples;
a second ring-buffer, of the plurality of ring-buffers, including a plurality of second partitions configured to store a plurality of second audio data samples; and
a plurality of agents configured to communicate with the first ring-buffer to process the plurality of first audio data samples and configured to communicate with the second ring-buffer to process the plurality of second audio data samples, wherein at least a first agent of the plurality of agents is configured to read an audio data sample of the plurality of first audio data samples from a first partition of the first ring-buffer, at least a second agent of the plurality of agents is configured to write the audio data sample to a second partition of the first ring-buffer, and at least a third agent of the plurality of agents is configured to write the audio data sample to both the first ring-buffer and the second ring-buffer.
2 . The device of claim 1 , wherein the plurality of first audio data samples includes at least one of a single channel audio data sample, a two-channel audio data sample, a four-channel audio data sample, and an eleven-channel audio data sample.
3 . The device of claim 1 , wherein the plurality of agents includes an input agent and an output agent, wherein the input agent writes audio data samples into the first ring-buffer, and the output agent produces an output at a fixed delay after the audio data samples are written into the first ring-buffer by the input agent.
4 . The device of claim 1 , wherein the first agent is assigned to a first position of the first ring-buffer and a fourth agent of the plurality of agents is assigned to a second position of the first ring-buffer, and
wherein the first position and the second position are separated by a number of audio data samples and the first agent operates on the number of audio data samples separating the first position and the second position.
5 . The device of claim 1 ,
wherein an agent of the plurality of agents is assigned a first position of the first ring-buffer at a first time instance and is assigned a second position of the first ring-buffer at a second time instance.
6 . The device of claim 1 , wherein the plurality of agents comprises at least one of:
a sound source;
a user interface (UI) sound source;
a content source;
an audio renderer;
an audio sink;
a digital signal processing and control (DSPC) unit;
a pulse code modulator (PCM);
a precision PCM;
a mixer;
an output device;
a speaker;
a decoder; or
a microphone.
7 . The device of claim 6 , wherein the first agent includes a combination of the audio renderer and the audio sink, the second agent includes the mixer, the third agent of the plurality of agents includes the DSPC unit, and a fourth agent of the plurality of agents includes the output device.
8 . The device of claim 7 , wherein the first agent further writes the plurality of first audio data samples into the first partition of the first ring-buffer,
wherein the plurality of first audio data samples are received from a media source and rendered by the combination of the audio renderer and the audio sink included in the first agent,
wherein the mixer of the second agent reads the plurality of first audio data samples from the first ring-buffer and processes the plurality of first audio data samples to generate a plurality of third audio data samples,
wherein the DSPC unit of the third agent reads the plurality of third audio data samples from the first ring-buffer, processes the plurality of third audio data samples to generate a fourth audio data sample, and stores the fourth audio data sample into the first ring-buffer, and
wherein the output device of the fourth agent reads the fourth audio data sample and generates an audible output.
9 . The device of claim 8 , wherein the mixer of the second agent processes the plurality of first audio data samples to generate the plurality of third audio data samples by mixing the plurality of first audio data samples with one or more other audio signals.
10 . The device of claim 1 , wherein at least one of the first ring-buffer or the second ring-buffer is used for at least one of an input monitor, an output monitor, a beamformed microphone, an echo-cancelled microphone, or a raw microphone array.
11 . A computer-implemented method, comprising:
writing, by a first subset of agents of a plurality of agents, first data samples into a first set of partitions of a plurality of partitions of a ring-buffer in response to a minimum number of partitions of the plurality of partitions being available, wherein the first subset of agents are transitioned to an inactive state until the minimum number of partitions are available;
reading, by a second subset of agents of the plurality of agents, the first data samples from the first set of partitions;
processing, by the second subset of agents, the first data samples to generate second data samples;
writing, by the second subset of agents, the second data samples into a second set of partitions; and
outputting, by a third subset of agents of the plurality of agents, the second data samples from the second set of partitions.
12 . The computer-implemented method of claim 11 , further comprising:
processing, by a fourth subset of agents of the plurality of agents, the second data samples from the second set of partitions to generate third data samples; and
writing, by the fourth subset of agents, the third data samples into a fourth set of partitions, and wherein outputting, by the third subset of agents, the second data samples from the second set of partitions comprises outputting the third data samples.
13 . The computer-implemented method of claim 11 , wherein processing, by the second subset of agents, the first data samples comprises processing the first data samples in response to the minimum number of partitions of the plurality of partitions being available, and
wherein the computer-implemented method further comprises transitioning the second subset of agents to an inactive state until the minimum number of partitions are available.
14 . The computer-implemented method of claim 11 , wherein outputting, by the third subset of agents, the second data samples comprises processing the second data samples in response to the minimum number of partitions of the plurality of partitions being available, and
wherein the computer-implemented method further comprises transitioning the second subset of agents to an inactive state until the minimum number of partitions are available.
15 . The method of claim 11 , wherein processing the first data samples to generate the second data samples includes mixing the first data samples with one or more audio signals.
16 . A non-transitory, tangible computer-readable medium having instructions stored thereon that, when executed by at least one computing device, cause the at least one computing device to perform operations comprising:
writing, by a first subset of agents of a plurality of agents, first data samples into a first set of partitions of a plurality of partitions of a ring-buffer in response to a minimum number of partitions of the plurality of partitions being available, wherein the first subset of agents are transitioned to an inactive state until the minimum number of partitions are available;
reading, by a second subset of agents of the plurality of agents, the first data samples from the first set of partitions;
processing, by the second subset of agents, the first data samples to generate second data samples;
writing, by the second subset of agents, the second data samples into a second set of partitions; and
outputting, by a third subset of agents of the plurality of agents, the second data samples from the second set of partitions.
17 . The non-transitory, tangible computer-readable medium of claim 16 , the operations further comprising:
processing, by a fourth subset of agents of the plurality of agents, the second data samples from the second set of partitions to generate third data samples; and
writing, by the fourth subset of agents, the third data samples into a fourth set of partitions, and wherein outputting, by the third subset of agents, the second data samples from the second set of partitions comprises outputting the third data samples.
18 . The non-transitory, tangible computer-readable medium of claim 16 , wherein processing, by the second subset of agents, the first data samples comprises processing the first data samples in response to the minimum number of partitions of the plurality of partitions being available, and
wherein the operations further comprise transitioning the second subset of agents to an inactive state until the minimum number of partitions are available.
19 . The non-transitory, tangible computer-readable medium of claim 16 , wherein outputting, by the third subset of agents, the second data samples comprises processing the second data samples in response to the minimum number of partitions of the plurality of partitions being available, and
wherein the operations further comprise transitioning the second subset of agents to an inactive state until the minimum number of partitions are available.
20 . The non-transitory, tangible computer-readable medium of claim 16 , wherein processing the first data samples to generate the second data samples includes mixing the first data samples with one or more audio signals.