79 lines
2.2 KiB
C++
79 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include "page.h"
|
|
#include "db/database_manager.h"
|
|
#include "audio/audio_manager.h"
|
|
#include "text_cache.h"
|
|
#include <SDL3_ttf/SDL_ttf.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class AudioSettingsPage : public Page {
|
|
public:
|
|
void onPush(AppState& state) override;
|
|
void onResume(AppState& state) override;
|
|
void onPause(AppState& state) override;
|
|
void onPop(AppState& state) override;
|
|
void handleEvent(const SDL_Event& event) override;
|
|
void update(float dt) override;
|
|
void render(SDL_Renderer* renderer) override;
|
|
|
|
private:
|
|
// Modal states
|
|
enum class ModalState {
|
|
None,
|
|
DeviceSelector,
|
|
TrackSelector
|
|
};
|
|
|
|
void refreshDeviceAndTrackLists();
|
|
void renderModal(SDL_Renderer* renderer, float fw, float fh, const char* title, const std::vector<std::string>& items, int selectedIndex);
|
|
void createFonts();
|
|
void destroyFonts();
|
|
void destroyTextures();
|
|
|
|
// Audio mode selection (used by the track selector handlers).
|
|
void enableDynamicAudio();
|
|
void selectTrack(int trackIdx);
|
|
|
|
AppState* state_ = nullptr;
|
|
int selectedItem_ = 0; // 0 = Volume, 1 = Device, 2 = Track, 3 = Status, 4 = Back
|
|
|
|
// Modal state
|
|
ModalState modalState_ = ModalState::None;
|
|
int modalSelectedIndex_ = 0;
|
|
|
|
// Device & Track Data
|
|
std::vector<radiantwave::audio::AudioDeviceItem> devices_;
|
|
int currentDeviceIndex_ = 0;
|
|
|
|
std::vector<radiantwave::db::AudioFileRecord> tracks_;
|
|
int currentTrackIndex_ = 0;
|
|
|
|
std::string statusMessage_ = "";
|
|
|
|
TTF_Font* fontTitle_ = nullptr;
|
|
TTF_Font* fontHeader_ = nullptr;
|
|
TTF_Font* fontBody_ = nullptr;
|
|
TTF_Font* fontSmall_ = nullptr;
|
|
|
|
TTF_Font* modalFontTitle_ = nullptr;
|
|
TTF_Font* modalFontBody_ = nullptr;
|
|
TTF_Font* modalFontSmall_ = nullptr;
|
|
|
|
CachedText titleText_;
|
|
CachedText audioStatusText_;
|
|
CachedText deviceText_;
|
|
CachedText statusMsgText_;
|
|
CachedText footerText_;
|
|
CachedText volumeLabelText_;
|
|
CachedText volumePercentText_;
|
|
std::vector<CachedText> menuRows_;
|
|
|
|
CachedText modalTitleText_;
|
|
CachedText modalHintText_;
|
|
std::vector<CachedText> modalItems_;
|
|
|
|
float updateTimer_ = 0.0f;
|
|
};
|