fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
IndexedVector.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic synthesis toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include <vector>
24
25namespace fsh::util
26{
33{
34public:
36 void resize(size_t newSize);
37
39 auto get() const -> float;
40
42 void add(float val);
43
45 void set(float val);
46
48 void incrementIndex();
49
51 void clear();
52
53private:
54 size_t index = 0;
55 std::vector<float> data;
56};
57} // namespace fsh::util
Primitive ring buffer class.
Definition IndexedVector.h:33
void incrementIndex()
Increment the index with wraparound.
Definition IndexedVector.cpp:65
void add(float val)
Add a value to the element at the current index.
Definition IndexedVector.cpp:43
void resize(size_t newSize)
Resize the underlying vector.
Definition IndexedVector.cpp:27
auto get() const -> float
Get the element at the current index.
Definition IndexedVector.cpp:33
void clear()
Set all elements to zero.
Definition IndexedVector.cpp:70
void set(float val)
Set the element at the current index.
Definition IndexedVector.cpp:54