699fdb0ab7
- Phase 6: 7/8 smoke tests passed on live hardware (PING/STATUS/overflow/paths/JSON validated) - Phase 7: 4 functional apps compiled + uploaded (Audio, Calculator, Timer, Flashlight) * RAM stable 87.5%, Flash 41.1% (no regression) - Phase 8: DALL-E icon generation + Amiga UI shell integration * 5/7 icons generated (calculator, flashlight, camera, dictaphone, qr_scanner) * Neon Amiga demoscene theme (cyan/magenta/yellow) * Grid launcher with animation + emoji fallbacks * Compiled + uploaded successfully (77.3s) * All P1/P2 security features active Next: Retry DALL-E for audio_player + timer, test touch input mapping
50 lines
1.0 KiB
C++
50 lines
1.0 KiB
C++
// app_audio.h - Audio Player App
|
|
// Features: Play/Pause/Stop, Volume control, Playlist navigation
|
|
#pragma once
|
|
|
|
#include "app/app_runtime_types.h"
|
|
#include <Arduino.h>
|
|
|
|
class AppAudio {
|
|
public:
|
|
// Lifecycle
|
|
bool init(const AppContext& ctx);
|
|
void onStart();
|
|
void onStop();
|
|
void onTick(uint32_t dt_ms);
|
|
void onAction(const AppAction& action);
|
|
|
|
// Audio control
|
|
bool play(const char* filepath);
|
|
void pause();
|
|
void resume();
|
|
void stop();
|
|
void setVolume(uint8_t vol_percent); // 0-100
|
|
|
|
// Status
|
|
const char* getStatus() const;
|
|
uint32_t getCurrentPlaybackMs() const;
|
|
uint32_t getTotalDurationMs() const;
|
|
|
|
private:
|
|
AppContext context_;
|
|
bool initialized_ = false;
|
|
|
|
enum {
|
|
STATE_IDLE = 0,
|
|
STATE_PLAYING = 1,
|
|
STATE_PAUSED = 2,
|
|
STATE_ERROR = 3,
|
|
};
|
|
|
|
uint8_t current_state_ = STATE_IDLE;
|
|
char current_file_[96] = "";
|
|
uint8_t volume_percent_ = 50;
|
|
uint32_t playback_ms_ = 0;
|
|
uint32_t duration_ms_ = 0;
|
|
uint32_t last_tick_ms_ = 0;
|
|
};
|
|
|
|
// Global instance
|
|
extern AppAudio g_app_audio;
|