mirror of
https://github.com/clockworkpi/PicoCalc.git
synced 2026-03-19 18:42:38 +01:00
try to sync mp3 player with latest YAHAL
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include "main_task.h"
|
||||
#include "logo50.h"
|
||||
#include "icon_enter.h"
|
||||
@@ -293,7 +294,7 @@ void main_task::menu_start(sd_reader_task&sd_reader,mp3_decoder_task &decoder,pc
|
||||
assert(res == FatFs::FR_OK);
|
||||
sd_reader.start(&_fs, &_file);
|
||||
decoder.reset();
|
||||
decoder.start();
|
||||
decoder.sign_up();
|
||||
update_required = 1;
|
||||
playing =1;
|
||||
last_play_pos = 0;
|
||||
@@ -310,7 +311,7 @@ void main_task::menu_start_all(sd_reader_task &sd_reader, mp3_decoder_task &deco
|
||||
assert(res == FatFs::FR_OK);
|
||||
sd_reader.start(&_fs, &_file);
|
||||
decoder.reset();
|
||||
decoder.start();
|
||||
decoder.sign_up();
|
||||
update_required = 1;
|
||||
playing =1;
|
||||
last_play_pos = 0;
|
||||
@@ -515,7 +516,7 @@ void main_task::run() {
|
||||
draw_header("Playlist");
|
||||
while (true){
|
||||
if(playing){
|
||||
if (sd_reader.isAlive() && decoder.isAlive()) {
|
||||
if (sd_reader.isLinkedIn() && decoder.isLinkedIn()) {
|
||||
//printf("playing now\n");
|
||||
|
||||
if(update_required) {
|
||||
|
||||
@@ -81,22 +81,22 @@ public:
|
||||
void draw_playing();
|
||||
void draw_wrap_text(const char *);
|
||||
private:
|
||||
gpio_rp2040_pin _cs; // CS Line of SD card SPI interface
|
||||
gpio_rp2040 _cs; // CS Line of SD card SPI interface
|
||||
spi_rp2040 _spi; // SPI interface used for the SD card reader
|
||||
sd_spi_drv _sd; // SD card low level driver
|
||||
|
||||
gpio_rp2040_pin _next; // Next button
|
||||
gpio_rp2040_pin _part; // Partition button
|
||||
gpio_rp2040_pin _ps; // Pico Power save pin
|
||||
gpio_rp2040 _next; // Next button
|
||||
gpio_rp2040 _part; // Partition button
|
||||
gpio_rp2040 _ps; // Pico Power save pin
|
||||
|
||||
FatFs _fs;
|
||||
FatFs::DIR _dir{};
|
||||
FatFs::FILEINFO _finfo{};
|
||||
FatFs::FILE _file{}; // MP3 file on SD
|
||||
|
||||
gpio_rp2040_pin _lcd_rst;
|
||||
gpio_rp2040_pin _lcd_dc;
|
||||
gpio_rp2040_pin _lcd_cs;
|
||||
gpio_rp2040 _lcd_rst;
|
||||
gpio_rp2040 _lcd_dc;
|
||||
gpio_rp2040 _lcd_cs;
|
||||
spi_rp2040 _lcd_spi;
|
||||
ili9488_drv _lcd;
|
||||
uGUI _gui;
|
||||
|
||||
@@ -170,6 +170,7 @@ int16_t mp3_decoder_task::scale(mad_fixed_t sample)
|
||||
// Therefore rounding and clipping is normally not
|
||||
// necessary!
|
||||
// round
|
||||
#if 0
|
||||
sample += (1L << (MAD_F_FRACBITS - 16));
|
||||
// clip
|
||||
if (sample >= MAD_F_ONE)
|
||||
@@ -178,8 +179,9 @@ int16_t mp3_decoder_task::scale(mad_fixed_t sample)
|
||||
sample = -MAD_F_ONE;
|
||||
// Convert to a standard 16 bit PCM value
|
||||
// (signed) in the range of -32768...32767
|
||||
#endif
|
||||
sample >>= (MAD_F_FRACBITS + 1 - 16);
|
||||
return (int16_t)sample;
|
||||
return sample;
|
||||
}
|
||||
|
||||
uint16_t mp3_decoder_task::get_position(unsigned long fsize, int max_pos) {
|
||||
|
||||
@@ -28,7 +28,7 @@ private:
|
||||
pcm_audio_interface & _pcm_if;
|
||||
sd_reader_task & _sd_reader;
|
||||
mad_decoder _decoder{};
|
||||
gpio_rp2040_pin _led;
|
||||
gpio_rp2040 _led;
|
||||
uint8_t _mp3_buf[MP3_BUF_SIZE]{};
|
||||
uint32_t _pcm_rate;
|
||||
mad_timer_t _timer;
|
||||
|
||||
@@ -19,7 +19,7 @@ int main()
|
||||
task::sleep_ms(2000);//really neccessary form uart debug
|
||||
// Start Main task as privileged task
|
||||
main_task Main;
|
||||
Main.start(MAIN_PRIORITY, true);
|
||||
Main.sign_up(core_t::CURRENT_CORE, 50, true);
|
||||
// Start the multitasking
|
||||
task::start_scheduler();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ void sd_reader_task::start(FatFs * fs, FatFs::FILE * file) {
|
||||
_eof = false;
|
||||
_force_eof = false;
|
||||
_execute = false;
|
||||
task::start();
|
||||
task::sign_up();
|
||||
}
|
||||
|
||||
FatFs::FRESULT sd_reader_task::read_data(uint8_t* buff, uint16_t btr, uint16_t* br) {
|
||||
|
||||
Reference in New Issue
Block a user