Performance tweaks for smoother tunes

- Pin the decoder task to APP_CORE to reduce context switches
 - Increase sample buffer sizes
This commit is contained in:
jacqueline
2023-08-25 15:58:54 +10:00
parent 795f268737
commit 485e9adfce
5 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
static constexpr char kTag[] = "mixer";
static constexpr std::size_t kSourceBufferLength = 8 * 1024;
static constexpr std::size_t kSampleBufferLength = 240 * 2;
static constexpr std::size_t kSampleBufferLength = 240 * 2 * 4;
namespace audio {
+2 -2
View File
@@ -46,7 +46,7 @@ namespace audio {
static const char* kTag = "audio_dec";
static constexpr std::size_t kCodecBufferLength = 240 * 4;
static constexpr std::size_t kCodecBufferLength = 240 * 4 * 4;
Timer::Timer(const codecs::ICodec::OutputFormat& format)
: current_seconds_(0),
@@ -79,7 +79,7 @@ auto Timer::AddSamples(std::size_t samples) -> void {
auto Decoder::Start(std::shared_ptr<IAudioSource> source,
std::shared_ptr<SampleConverter> sink) -> Decoder* {
Decoder* task = new Decoder(source, sink);
tasks::StartPersistent<tasks::Type::kAudio>([=]() { task->Main(); });
tasks::StartPersistent<tasks::Type::kAudio>(1, [=]() { task->Main(); });
return task;
}
+1 -1
View File
@@ -37,7 +37,7 @@ static constexpr uint16_t kMaxVolume = 0x1ff;
static constexpr uint16_t kMinVolume = 0b0;
static constexpr uint16_t kMaxVolumeBeforeClipping = 0x185;
static constexpr uint16_t kLineLevelVolume = 0x13d;
static constexpr uint16_t kDefaultVolume = 0x128;
static constexpr uint16_t kDefaultVolume = 0x100;
static constexpr size_t kDrainBufferSize = 8 * 1024;
+1 -1
View File
@@ -49,7 +49,7 @@
namespace ui {
static const char* kTag = "lv_task";
static const TickType_t kMaxFrameRate = pdMS_TO_TICKS(66);
static const TickType_t kMaxFrameRate = pdMS_TO_TICKS(100);
static int sTimerId;
static SemaphoreHandle_t sFrameSemaphore;
+7 -7
View File
@@ -58,23 +58,23 @@ auto TopBar::Update(const State& state) -> void {
lv_label_set_text(playback_, "-");
break;
case PlaybackState::kPaused:
lv_label_set_text(playback_, "");
lv_label_set_text(playback_, LV_SYMBOL_PAUSE);
break;
case PlaybackState::kPlaying:
lv_label_set_text(playback_, "");
lv_label_set_text(playback_, LV_SYMBOL_PLAY);
break;
}
if (state.battery_percent >= 95) {
lv_label_set_text(battery_, "");
lv_label_set_text(battery_, LV_SYMBOL_BATTERY_FULL);
} else if (state.battery_percent >= 70) {
lv_label_set_text(battery_, "");
lv_label_set_text(battery_, LV_SYMBOL_BATTERY_1);
} else if (state.battery_percent >= 40) {
lv_label_set_text(battery_, "");
lv_label_set_text(battery_, LV_SYMBOL_BATTERY_2);
} else if (state.battery_percent >= 10) {
lv_label_set_text(battery_, "");
lv_label_set_text(battery_, LV_SYMBOL_BATTERY_3);
} else {
lv_label_set_text(battery_, "");
lv_label_set_text(battery_, LV_SYMBOL_BATTERY_EMPTY);
}
}