Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change static vector to etl so I can use etl queues for some other stuff #3296

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ add_executable(deluge)

# Link external libraries
target_link_libraries(deluge PUBLIC
argon
argon
etl::etl
)

option(MAINTAINER_MODE "Enables all warnings and errors" OFF)
Expand Down
11 changes: 9 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ cmake_policy(SET CMP0135 NEW)
include(FetchContent)

FetchContent_Declare(argon
GIT_REPOSITORY https://github.com/stellar-aria/argon
GIT_TAG 3779c5315a978a2f8c892e320ac12ecbb77c3759
GIT_REPOSITORY https://github.com/stellar-aria/argon
GIT_TAG 3779c5315a978a2f8c892e320ac12ecbb77c3759
)
FetchContent_MakeAvailable(argon)

FetchContent_Declare(
etl
GIT_REPOSITORY https://github.com/ETLCPP/etl
GIT_TAG 20.39.4
)

FetchContent_MakeAvailable(etl)
1 change: 0 additions & 1 deletion src/OSLikeStuff/task_scheduler/task_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "OSLikeStuff/task_scheduler/task_scheduler.h"

#include "io/debug/log.h"
#include "util/container/static_vector.hpp"
#include <algorithm>
#include <iostream>

Expand Down
5 changes: 3 additions & 2 deletions src/deluge/gui/menu_item/active_scales.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#include "model/song/song.h"
#include "source_selection/range.h"
#include "source_selection/regular.h"
#include "util/container/static_vector.hpp"
#include "util/functions.h"

#include <etl/vector.h>

namespace deluge::gui::menu_item {

void ActiveScaleMenu::beginSession(MenuItem* navigatedBackwardFrom) {
Expand All @@ -36,7 +37,7 @@ void ActiveScaleMenu::drawPixelsForOled() {
uint8_t sel;

// Build a vector with visible scale items. No wrap-around.
static_vector<uint8_t, kOLEDMenuNumOptionsVisible> visible = {};
etl::vector<uint8_t, kOLEDMenuNumOptionsVisible> visible = {};
if (currentPos == 0) {
sel = 0;
// beginning of the list
Expand Down
4 changes: 2 additions & 2 deletions src/deluge/gui/menu_item/dx/cartridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#include "processing/sound/sound.h"
#include "processing/source.h"
#include "storage/DX7Cartridge.h"
#include "util/container/static_vector.hpp"
#include "util/functions.h"
#include "util/try.h"
#include <etl/vector.h>
#include <memory>

static bool openFile(std::string_view path, DX7Cartridge* data) {
Expand Down Expand Up @@ -116,7 +116,7 @@ void DxCartridge::drawPixelsForOled() {
char names[32][11];
pd->getProgramNames(names);

static_vector<std::string_view, 32> itemNames = {};
etl::vector<std::string_view, 32> itemNames = {};
for (int i = 0; i < pd->numPatches(); i++) {
itemNames.push_back(names[i]);
}
Expand Down
5 changes: 3 additions & 2 deletions src/deluge/gui/menu_item/dx/engine_select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include "hid/display/display.h"
#include "memory/general_memory_allocator.h"
#include "processing/source.h"
#include "util/container/static_vector.hpp"

#include <etl/vector.h>

namespace deluge::gui::menu_item {

Expand All @@ -42,7 +43,7 @@ void DxEngineSelect::readValueAgain() {
constexpr int numValues = 3;

void DxEngineSelect::drawPixelsForOled() {
static_vector<std::string_view, numValues> itemNames = {"auto", "modern", "vintage"};
etl::vector<std::string_view, numValues> itemNames = {"auto", "modern", "vintage"};
drawItemsForOled(itemNames, currentValue, 0);
}

Expand Down
5 changes: 3 additions & 2 deletions src/deluge/gui/menu_item/dx/global_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
#include "hid/display/display.h"
#include "memory/general_memory_allocator.h"
#include "processing/source.h"
#include "util/container/static_vector.hpp"

#include <etl/vector.h>

namespace deluge::gui::menu_item {

Expand Down Expand Up @@ -57,7 +58,7 @@ struct {
constexpr int numValues = sizeof(items) / sizeof(items[0]);

void DxGlobalParams::drawPixelsForOled() {
static_vector<std::string_view, numValues> itemNames = {};
etl::vector<std::string_view, numValues> itemNames = {};
for (auto& item : items) {
itemNames.push_back(item.name);
}
Expand Down
4 changes: 2 additions & 2 deletions src/deluge/gui/menu_item/dx/operator_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "hid/display/display.h"
#include "memory/general_memory_allocator.h"
#include "processing/source.h"
#include "util/container/static_vector.hpp"
#include <etl/vector.h>

namespace deluge::gui::menu_item {

Expand Down Expand Up @@ -60,7 +60,7 @@ struct {
constexpr int numValues = sizeof(items) / sizeof(items[0]);

void DxOperatorParams::drawPixelsForOled() {
static_vector<std::string_view, numValues> itemNames = {};
etl::vector<std::string_view, numValues> itemNames = {};
for (auto& item : items) {
itemNames.push_back(item.name);
}
Expand Down
4 changes: 2 additions & 2 deletions src/deluge/gui/menu_item/midi/devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "io/midi/cable_types/usb_hosted.h"
#include "io/midi/midi_device.h"
#include "io/midi/midi_device_manager.h"
#include "util/container/static_vector.hpp"
#include <etl/vector.h>
#include <string_view>

extern deluge::gui::menu_item::midi::Device midiDeviceMenu;
Expand Down Expand Up @@ -150,7 +150,7 @@ MenuItem* Devices::selectButtonPress() {
}

void Devices::drawPixelsForOled() {
static_vector<std::string_view, kOLEDMenuNumOptionsVisible> itemNames = {};
etl::vector<std::string_view, kOLEDMenuNumOptionsVisible> itemNames = {};

int32_t selectedRow = -1;

Expand Down
4 changes: 2 additions & 2 deletions src/deluge/gui/menu_item/multi_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#include "processing/sound/sound.h"
#include "processing/source.h"
#include "storage/multi_range/multisample_range.h"
#include "util/container/static_vector.hpp"
#include "util/functions.h"
#include <cstring>
#include <etl/vector.h>

namespace deluge::gui::menu_item {

Expand Down Expand Up @@ -425,7 +425,7 @@ bool MultiRange::mayEditRangeEdge(RangeEdit whichEdge) {
}

void MultiRange::drawPixelsForOled() {
static_vector<std::string_view, kOLEDMenuNumOptionsVisible> itemNames{};
etl::vector<std::string_view, kOLEDMenuNumOptionsVisible> itemNames{};
char nameBuffers[kOLEDMenuNumOptionsVisible][20];
int32_t actualCurrentRange = this->getValue();

Expand Down
5 changes: 3 additions & 2 deletions src/deluge/gui/menu_item/source_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include "modulation/params/param_manager.h"
#include "modulation/patch/patch_cable_set.h"
#include "processing/sound/sound.h"
#include "util/container/static_vector.hpp"

#include <etl/vector.h>

namespace deluge::gui::menu_item {
const PatchSource sourceMenuContents[] = {
Expand All @@ -43,7 +44,7 @@ uint8_t SourceSelection::shouldDrawDotOnValue() {
int32_t SourceSelection::selectedRowOnScreen;

void SourceSelection::drawPixelsForOled() {
static_vector<std::string_view, kOLEDMenuNumOptionsVisible> itemNames{};
etl::vector<std::string_view, kOLEDMenuNumOptionsVisible> itemNames{};

selectedRowOnScreen = 0;

Expand Down
8 changes: 4 additions & 4 deletions src/deluge/gui/menu_item/submenu.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "submenu.h"
#include "etl/vector.h"
#include "gui/views/automation_view.h"
#include "hid/display/display.h"
#include "hid/display/oled.h"
#include "model/settings/runtime_feature_settings.h"
#include "util/container/static_vector.hpp"

namespace deluge::gui::menu_item {
void Submenu::beginSession(MenuItem* navigatedBackwardFrom) {
Expand Down Expand Up @@ -57,7 +57,7 @@ void Submenu::drawPixelsForOled() {

void Submenu::drawVerticalMenu() {
// Collect items before the current item, this is possibly more than we need.
static_vector<MenuItem*, kOLEDMenuNumOptionsVisible> before = {};
etl::vector<MenuItem*, kOLEDMenuNumOptionsVisible> before = {};
for (auto it = current_item_ - 1; it != items.begin() - 1 && before.size() < before.capacity(); it--) {
MenuItem* menuItem = (*it);
if (menuItem->isRelevant(soundEditor.currentModControllable, soundEditor.currentSourceIndex)) {
Expand All @@ -67,7 +67,7 @@ void Submenu::drawVerticalMenu() {
std::reverse(before.begin(), before.end());

// Collect current item and fill the tail
static_vector<MenuItem*, kOLEDMenuNumOptionsVisible> after = {};
etl::vector<MenuItem*, kOLEDMenuNumOptionsVisible> after = {};
for (auto it = current_item_; it != items.end() && after.size() < after.capacity(); it++) {
MenuItem* menuItem = (*it);
if (menuItem->isRelevant(soundEditor.currentModControllable, soundEditor.currentSourceIndex)) {
Expand All @@ -89,7 +89,7 @@ void Submenu::drawVerticalMenu() {
}

// Put it together.
static_vector<MenuItem*, kOLEDMenuNumOptionsVisible> visible;
etl::vector<MenuItem*, kOLEDMenuNumOptionsVisible> visible;
visible.insert(visible.begin(), before.end() - pos, before.end());
visible.insert(visible.begin() + pos, after.begin(), after.begin() + tail);

Expand Down
Loading
Loading