-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
302 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "CircularBuffer.h" | ||
|
||
CircularBuffer::CircularBuffer (juce::AudioBuffer<float> & buffer) | ||
: buffer_ (buffer) | ||
{ | ||
} | ||
|
||
SplitBlock CircularBuffer::GetNext (std::size_t advancement) | ||
{ | ||
juce::dsp::AudioBlock<float> block {buffer_}; | ||
auto num_samples = buffer_.getNumSamples (); | ||
head_position_ = (head_position_ + advancement) % num_samples; | ||
|
||
auto first_samples_to_take = num_samples - head_position_; | ||
auto wrapped_samples_to_take = num_samples - first_samples_to_take; | ||
|
||
return {block.getSubBlock (head_position_, first_samples_to_take), | ||
block.getSubBlock (0, wrapped_samples_to_take)}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include "SplitBlock.h" | ||
|
||
#include <juce_dsp/juce_dsp.h> | ||
|
||
class CircularBuffer | ||
{ | ||
public: | ||
explicit CircularBuffer (juce::AudioBuffer<float> & buffer); | ||
SplitBlock GetNext (std::size_t advancement); | ||
|
||
private: | ||
std::size_t head_position_ = 0; | ||
juce::AudioBuffer<float> & buffer_; | ||
}; |
Oops, something went wrong.