@@ -86,8 +86,8 @@ static WavPlayerApp* app_alloc() {
86
86
app -> storage = furi_record_open (RECORD_STORAGE );
87
87
app -> stream = file_stream_alloc (app -> storage );
88
88
app -> parser = wav_parser_alloc ();
89
- app -> sample_buffer = malloc (sizeof (uint16_t ) * app -> samples_count );
90
- app -> tmp_buffer = malloc (sizeof (uint8_t ) * app -> samples_count );
89
+ app -> sample_buffer = malloc (sizeof (* app -> sample_buffer ) * app -> samples_count );
90
+ app -> tmp_buffer = malloc (sizeof (* app -> tmp_buffer ) * app -> samples_count );
91
91
app -> queue = furi_message_queue_alloc (10 , sizeof (WavPlayerEvent ));
92
92
93
93
app -> volume = 10.0f ;
@@ -128,7 +128,7 @@ static void app_free(WavPlayerApp* app) {
128
128
// TODO: that works only with 8-bit 2ch audio
129
129
static bool fill_data (WavPlayerApp * app , size_t index ) {
130
130
if (app -> num_channels == 1 && app -> bits_per_sample == 8 ) {
131
- uint16_t * sample_buffer_start = & app -> sample_buffer [index ];
131
+ uint8_t * sample_buffer_start = & app -> sample_buffer [index ];
132
132
size_t count = stream_read (app -> stream , app -> tmp_buffer , app -> samples_count_half );
133
133
134
134
for (size_t i = count ; i < app -> samples_count_half ; i ++ ) {
@@ -167,7 +167,7 @@ static bool fill_data(WavPlayerApp* app, size_t index) {
167
167
}
168
168
169
169
if (app -> num_channels == 1 && app -> bits_per_sample == 16 ) {
170
- uint16_t * sample_buffer_start = & app -> sample_buffer [index ];
170
+ uint8_t * sample_buffer_start = & app -> sample_buffer [index ];
171
171
size_t count = stream_read (app -> stream , app -> tmp_buffer , app -> samples_count );
172
172
173
173
for (size_t i = count ; i < app -> samples_count ; i ++ ) {
@@ -205,7 +205,7 @@ static bool fill_data(WavPlayerApp* app, size_t index) {
205
205
}
206
206
207
207
if (app -> num_channels == 2 && app -> bits_per_sample == 16 ) {
208
- uint16_t * sample_buffer_start = & app -> sample_buffer [index ];
208
+ uint8_t * sample_buffer_start = & app -> sample_buffer [index ];
209
209
size_t count = stream_read (app -> stream , app -> tmp_buffer , app -> samples_count );
210
210
211
211
for (size_t i = 0 ; i < app -> samples_count ; i += 4 ) {
@@ -268,7 +268,7 @@ static bool fill_data(WavPlayerApp* app, size_t index) {
268
268
}
269
269
270
270
if (app -> num_channels == 2 && app -> bits_per_sample == 8 ) {
271
- uint16_t * sample_buffer_start = & app -> sample_buffer [index ];
271
+ uint8_t * sample_buffer_start = & app -> sample_buffer [index ];
272
272
size_t count = stream_read (app -> stream , app -> tmp_buffer , app -> samples_count );
273
273
274
274
for (size_t i = count ; i < app -> samples_count ; i ++ ) {
0 commit comments