-
Notifications
You must be signed in to change notification settings - Fork 1
/
wav_player_view.h
82 lines (56 loc) · 1.87 KB
/
wav_player_view.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
#include <gui/view.h>
#include <furi.h>
#include <furi_hal.h>
#include <cli/cli.h>
#include <gui/gui.h>
#include <stm32wbxx_ll_dma.h>
#include <dialogs/dialogs.h>
#include <notification/notification_messages.h>
#include <gui/view_dispatcher.h>
#include <toolbox/stream/file_stream.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WavPlayerView WavPlayerView;
typedef enum {
WavPlayerCtrlVolUp,
WavPlayerCtrlVolDn,
WavPlayerCtrlMoveL,
WavPlayerCtrlMoveR,
WavPlayerCtrlOk,
WavPlayerCtrlBack,
} WavPlayerCtrl;
typedef void (*WavPlayerCtrlCallback)(WavPlayerCtrl ctrl, void* context);
#define DATA_COUNT 116
struct WavPlayerView {
View* view;
WavPlayerCtrlCallback callback;
void* context;
};
typedef struct {
bool play;
float volume;
size_t start;
size_t end;
size_t current;
uint8_t data[DATA_COUNT];
uint16_t bits_per_sample;
uint16_t num_channels;
} WavPlayerViewModel;
WavPlayerView* wav_player_view_alloc();
void wav_player_view_free(WavPlayerView* wav_view);
View* wav_player_view_get_view(WavPlayerView* wav_view);
void wav_player_view_set_volume(WavPlayerView* wav_view, float volume);
void wav_player_view_set_start(WavPlayerView* wav_view, size_t start);
void wav_player_view_set_end(WavPlayerView* wav_view, size_t end);
void wav_player_view_set_current(WavPlayerView* wav_view, size_t current);
void wav_player_view_set_play(WavPlayerView* wav_view, bool play);
void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t data_count);
void wav_player_view_set_bits(WavPlayerView* wav_view, uint16_t bit);
void wav_player_view_set_chans(WavPlayerView* wav_view, uint16_t chn);
void wav_player_view_set_ctrl_callback(WavPlayerView* wav_view, WavPlayerCtrlCallback callback);
void wav_player_view_set_context(WavPlayerView* wav_view, void* context);
#ifdef __cplusplus
}
#endif