Skip to content

Commit 0535af3

Browse files
authored
[v0.1.1] Fix invalid iteration, update capo and gvdi (#2)
* capo v2.0.0 * Add `Config` * Fix invalid iterator ops * More iterator fixes * Update klib and capo * 🐛 Update gvdi, fix validation sync error - Fix flags in presets - Enable workflow_dispatch - Update capo to v2.0.1 * Bump version
1 parent b27165f commit 0535af3

File tree

18 files changed

+377
-79
lines changed

18 files changed

+377
-79
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: ci-pr
2-
on:
3-
pull_request
2+
on: [pull_request, workflow_dispatch]
43
jobs:
54
x64-linux-gcc:
65
runs-on: ubuntu-latest
@@ -9,11 +8,11 @@ jobs:
98
- name: init
109
run: uname -m; sudo apt update -yqq && sudo apt install -yqq ninja-build mesa-common-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
1110
- name: configure
12-
run: export CC=gcc-14; export CXX=g++-14; cmake -S . --preset=default -B build -DGLFW_BUILD_X11=OFF
11+
run: cmake -S . --preset=ninja-gcc -B build -DGLFW_BUILD_X11=OFF -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
1312
- name: build debug
14-
run: cmake --build build --config=Debug
13+
run: cmake --build build --config=Debug -- -v
1514
- name: build release
16-
run: cmake --build build --config=Release
15+
run: cmake --build build --config=Release -- -v
1716
- name: test debug
1817
run: cd build && ctest -V -C Debug
1918
- name: test release
@@ -27,9 +26,9 @@ jobs:
2726
- name: configure
2827
run: cmake -S . --preset=ninja-clang -B build -DGLFW_BUILD_X11=OFF
2928
- name: build debug
30-
run: cmake --build build --config=Debug
29+
run: cmake --build build --config=Debug -- -v
3130
- name: build release
32-
run: cmake --build build --config=Release
31+
run: cmake --build build --config=Release -- -v
3332
- name: test debug
3433
run: cd build && ctest -V -C Debug
3534
- name: test release
@@ -41,11 +40,11 @@ jobs:
4140
- name: init
4241
run: uname -m; sudo apt update -yqq && sudo apt install -yqq ninja-build mesa-common-dev libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
4342
- name: configure
44-
run: export CC=gcc-14; export CXX=g++-14; cmake -S . --preset=default -B build -DGLFW_BUILD_X11=OFF
43+
run: cmake -S . --preset=ninja-gcc -B build -DGLFW_BUILD_X11=OFF -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14
4544
- name: build debug
46-
run: cmake --build build --config=Debug
45+
run: cmake --build build --config=Debug -- -v
4746
- name: build release
48-
run: cmake --build build --config=Release
47+
run: cmake --build build --config=Release -- -v
4948
- name: test debug
5049
run: cd build && ctest -V -C Debug
5150
- name: test release
@@ -59,9 +58,9 @@ jobs:
5958
- name: configure
6059
run: cmake -S . --preset=ninja-clang -B build -DGLFW_BUILD_X11=OFF
6160
- name: build debug
62-
run: cmake --build build --config=Debug
61+
run: cmake --build build --config=Debug -- -v
6362
- name: build release
64-
run: cmake --build build --config=Release
63+
run: cmake --build build --config=Release -- -v
6564
- name: test debug
6665
run: cd build && ctest -V -C Debug
6766
- name: test release
@@ -89,9 +88,9 @@ jobs:
8988
- name: configure
9089
run: cmake -S . --preset=ninja-clang -B clang
9190
- name: build debug
92-
run: cmake --build clang --config=Debug
91+
run: cmake --build clang --config=Debug -- -v
9392
- name: build release
94-
run: cmake --build clang --config=Release
93+
run: cmake --build clang --config=Release -- -v
9594
- name: test debug
9695
run: cd clang && ctest -V -C Debug
9796
- name: test release

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ compile_commands.json
1717

1818
# Dear ImGui
1919
imgui.ini
20+
21+
riff.conf
22+
notes.txt

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.23)
22

3-
project(riff VERSION "0.1.0")
3+
project(riff VERSION "0.1.1")
44

55
set(CMAKE_CXX_STANDARD 23)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -23,8 +23,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
2323
gvdi::gvdi
2424
capo::capo
2525
klib::klib
26-
capo::warnings
27-
klib::klib-ndwerror
2826
icons::kenny
2927
)
3028

CMakePresets.json

Lines changed: 145 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,132 @@
11
{
2-
"version": 2,
2+
"version": 5,
33
"cmakeMinimumRequired": {
44
"major": 3,
5-
"minor": 20,
5+
"minor": 24,
66
"patch": 0
77
},
88
"configurePresets": [
99
{
1010
"name": "default",
11-
"description": "Build configuration using Ninja Multi-config",
11+
"displayName": "Default Config",
12+
"description": "Base configuration using Ninja Multi-config",
1213
"generator": "Ninja Multi-Config",
1314
"binaryDir": "${sourceDir}/out/default",
1415
"cacheVariables": {
1516
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
1617
}
1718
},
1819
{
19-
"name": "ninja-clang",
20-
"description": "Build configuration using Ninja Multi-config / clang",
20+
"name": "base-gcc",
21+
"hidden": true,
22+
"inherits": "default",
23+
"cacheVariables": {
24+
"CMAKE_C_COMPILER": "gcc",
25+
"CMAKE_CXX_COMPILER": "g++"
26+
}
27+
},
28+
{
29+
"name": "base-clang",
30+
"hidden": true,
2131
"inherits": "default",
22-
"binaryDir": "${sourceDir}/out/clang",
2332
"cacheVariables": {
2433
"CMAKE_C_COMPILER": "clang",
2534
"CMAKE_CXX_COMPILER": "clang++"
2635
}
2736
},
37+
{
38+
"name": "base-msvc",
39+
"hidden": true,
40+
"inherits": "default",
41+
"cacheVariables": {
42+
"CMAKE_C_COMPILER": "cl",
43+
"CMAKE_CXX_COMPILER": "cl"
44+
}
45+
},
46+
{
47+
"name": "ninja-gcc",
48+
"displayName": "Ninja GCC",
49+
"description": "Build configuration using Ninja Multi-config / GCC",
50+
"inherits": "base-gcc",
51+
"binaryDir": "${sourceDir}/out/gcc",
52+
"cacheVariables": {
53+
"CMAKE_CXX_FLAGS_INIT": "-Wall -Wextra -Wpedantic -Werror=return-type",
54+
"CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT": "-Werror",
55+
"CMAKE_CXX_FLAGS_RELEASE_INIT": "-Werror"
56+
}
57+
},
58+
{
59+
"name": "ninja-clang",
60+
"displayName": "Ninja Clang",
61+
"description": "Build configuration using Ninja Multi-config / Clang",
62+
"inherits": "base-clang",
63+
"binaryDir": "${sourceDir}/out/clang",
64+
"cacheVariables": {
65+
"CMAKE_CXX_FLAGS_INIT": "-Wall -Wextra -Wpedantic -Werror=return-type",
66+
"CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT": "-Werror",
67+
"CMAKE_CXX_FLAGS_RELEASE_INIT": "-Werror"
68+
}
69+
},
70+
{
71+
"name": "ninja-msvc",
72+
"displayName": "Ninja MSVC",
73+
"description": "Build configuration using Ninja Multi-config / MSVC",
74+
"inherits": "base-msvc",
75+
"binaryDir": "${sourceDir}/out/msvc",
76+
"cacheVariables": {
77+
"CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT": "/WX",
78+
"CMAKE_CXX_FLAGS_RELEASE_INIT": "/WX"
79+
}
80+
},
2881
{
2982
"name": "ninja-ubsan",
83+
"displayName": "Ninja UBSan",
3084
"description": "UBSan build configuration using Ninja Multi-config",
3185
"inherits": "default",
3286
"binaryDir": "${sourceDir}/out/ubsan",
3387
"cacheVariables": {
34-
"CMAKE_C_FLAGS": "-fsanitize=undefined",
35-
"CMAKE_CXX_FLAGS": "-fsanitize=undefined"
88+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=undefined -Wall -Wextra -Wpedantic -Werror=return-type"
3689
}
3790
},
3891
{
3992
"name": "ninja-asan",
93+
"displayName": "Ninja ASan",
4094
"description": "ASan build configuration using Ninja Multi-config",
4195
"inherits": "default",
4296
"binaryDir": "${sourceDir}/out/asan",
4397
"cacheVariables": {
44-
"CMAKE_C_FLAGS": "-fsanitize=address",
45-
"CMAKE_CXX_FLAGS": "-fsanitize=address"
98+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=address -Wall -Wextra -Wpedantic -Werror=return-type"
99+
}
100+
},
101+
{
102+
"name": "ninja-msvc-asan",
103+
"displayName": "Ninja MSVC ASan",
104+
"description": "ASan build configuration using Ninja Multi-config",
105+
"inherits": "base-msvc",
106+
"binaryDir": "${sourceDir}/out/asan",
107+
"cacheVariables": {
108+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=address"
46109
}
47110
},
48111
{
49112
"name": "ninja-tsan",
113+
"displayName": "Ninja TSan",
50114
"description": "TSan build configuration using Ninja Multi-config",
51115
"inherits": "default",
52116
"binaryDir": "${sourceDir}/out/tsan",
53117
"cacheVariables": {
54-
"CMAKE_C_FLAGS": "-fsanitize=thread",
55-
"CMAKE_CXX_FLAGS": "-fsanitize=thread"
118+
"CMAKE_CXX_FLAGS_INIT": "-fsanitize=thread -Wall -Wextra -Wpedantic -Werror=return-type"
56119
}
57120
},
58121
{
59122
"name": "vs22",
123+
"displayName": "Visual Studio 2022",
60124
"description": "Build configuration using Visual Studio 17 (2022)",
61125
"generator": "Visual Studio 17 2022",
62126
"binaryDir": "${sourceDir}/out/vs",
127+
"cacheVariables": {
128+
"CMAKE_CXX_FLAGS_INIT": "/WX"
129+
},
63130
"architecture": {
64131
"value": "x64",
65132
"strategy": "external"
@@ -82,6 +149,36 @@
82149
"configurePreset": "default",
83150
"configuration": "RelWithDebInfo"
84151
},
152+
{
153+
"name": "GCC Debug",
154+
"configurePreset": "ninja-gcc",
155+
"configuration": "Debug"
156+
},
157+
{
158+
"name": "GCC RelWithDebInfo",
159+
"configurePreset": "ninja-gcc",
160+
"configuration": "RelWithDebInfo"
161+
},
162+
{
163+
"name": "Clang Debug",
164+
"configurePreset": "ninja-clang",
165+
"configuration": "Debug"
166+
},
167+
{
168+
"name": "Clang RelWithDebInfo",
169+
"configurePreset": "ninja-clang",
170+
"configuration": "RelWithDebInfo"
171+
},
172+
{
173+
"name": "MSVC Debug",
174+
"configurePreset": "ninja-msvc",
175+
"configuration": "Debug"
176+
},
177+
{
178+
"name": "MSVC Release",
179+
"configurePreset": "ninja-msvc",
180+
"configuration": "Release"
181+
},
85182
{
86183
"name": "UBSan Debug",
87184
"configurePreset": "ninja-ubsan",
@@ -107,6 +204,42 @@
107204
"configuration": "RelWithDebInfo",
108205
"inheritConfigureEnvironment": true
109206
},
207+
{
208+
"name": "GCC Debug",
209+
"configurePreset": "ninja-gcc",
210+
"configuration": "Debug",
211+
"inheritConfigureEnvironment": true
212+
},
213+
{
214+
"name": "GCC RelWithDebInfo",
215+
"configurePreset": "ninja-gcc",
216+
"configuration": "RelWithDebInfo",
217+
"inheritConfigureEnvironment": true
218+
},
219+
{
220+
"name": "Clang Debug",
221+
"configurePreset": "ninja-clang",
222+
"configuration": "Debug",
223+
"inheritConfigureEnvironment": true
224+
},
225+
{
226+
"name": "Clang RelWithDebInfo",
227+
"configurePreset": "ninja-clang",
228+
"configuration": "RelWithDebInfo",
229+
"inheritConfigureEnvironment": true
230+
},
231+
{
232+
"name": "MSVC Debug",
233+
"configurePreset": "ninja-msvc",
234+
"configuration": "Debug",
235+
"inheritConfigureEnvironment": true
236+
},
237+
{
238+
"name": "MSVC Release",
239+
"configurePreset": "ninja-msvc",
240+
"configuration": "Release",
241+
"inheritConfigureEnvironment": true
242+
},
110243
{
111244
"name": "UBSan Debug",
112245
"configurePreset": "ninja-ubsan",

ext/src.zip

36.6 KB
Binary file not shown.

src/app.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <embedded.hpp>
55
#include <klib/version_str.hpp>
66
#include <log.hpp>
7+
#include <utility>
78

89
namespace riff {
910
namespace {
@@ -33,6 +34,7 @@ struct ImFontLoader {
3334
} // namespace
3435

3536
void App::run() {
37+
m_config.load();
3638
create_engine();
3739
create_player();
3840
create_context();
@@ -84,13 +86,13 @@ void App::create_player() {
8486
if (!source) { throw std::runtime_error{"Failed to create Audio Source"}; }
8587

8688
m_player.emplace(std::move(source));
87-
// TODO: saved state
88-
m_player->set_volume(100);
89-
m_player->set_balance(0.0f);
89+
m_player->set_volume(m_config.get_volume());
90+
m_player->set_balance(m_config.get_balance());
91+
m_player->set_repeat(m_config.get_repeat());
9092
}
9193

9294
void App::create_context() {
93-
auto const title = std::format("riff {}", klib::to_string(build_version_v));
95+
auto const title = std::format("riff {}", build_version_str);
9496
auto window = gvdi::Context::create_window({500.0f, 350.0f}, title.c_str());
9597
if (!window) { throw std::runtime_error{"Failed to create Window"}; }
9698

@@ -135,6 +137,15 @@ void App::update() {
135137
m_tracklist.update(*this);
136138
}
137139
ImGui::End();
140+
141+
update_config();
142+
}
143+
144+
void App::update_config() {
145+
m_config.set_volume(m_player->get_volume());
146+
m_config.set_balance(m_player->get_balance());
147+
m_config.set_repeat(m_player->get_repeat());
148+
m_config.update();
138149
}
139150

140151
template <typename F>
@@ -154,7 +165,7 @@ auto App::cycle(Pred pred, F get_track) -> bool {
154165

155166
void App::advance() {
156167
auto const pred = [this] {
157-
return (m_player->get_repeat() == Player::Repeat::All || m_tracklist.has_next_track()) &&
168+
return (m_player->get_repeat() == Repeat::All || m_tracklist.has_next_track()) &&
158169
m_tracklist.has_playable_track();
159170
};
160171
if (!cycle(pred, [this] { return m_tracklist.cycle_next(); })) { return; }

0 commit comments

Comments
 (0)