summaryrefslogtreecommitdiff
path: root/src/audio/sink_mixer.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-08-07 09:47:44 +1000
committerjacqueline <me@jacqueline.id.au>2023-08-07 09:47:44 +1000
commit4118d880c3f20dbd9304a3f50d6d111f194592c8 (patch)
tree844aebfea5e2d688802a47f497495c602896b641 /src/audio/sink_mixer.cpp
parent60f767713227b5405b855e6e6e2a0475ecd96bcc (diff)
downloadtangara-fw-4118d880c3f20dbd9304a3f50d6d111f194592c8.tar.gz
Fix dangle build issues, do some tweaks to investigate performance
Diffstat (limited to 'src/audio/sink_mixer.cpp')
-rw-r--r--src/audio/sink_mixer.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/audio/sink_mixer.cpp b/src/audio/sink_mixer.cpp
index ba306626..8a40fd63 100644
--- a/src/audio/sink_mixer.cpp
+++ b/src/audio/sink_mixer.cpp
@@ -15,7 +15,6 @@
#include "freertos/projdefs.h"
#include "resample.hpp"
#include "sample.hpp"
-#include "samplerate.h"
#include "stream_info.hpp"
#include "tasks.hpp"
@@ -23,7 +22,7 @@
static constexpr char kTag[] = "mixer";
static constexpr std::size_t kSourceBufferLength = 2 * 1024;
-static constexpr std::size_t kSampleBufferLength = 4 * 1024;
+static constexpr std::size_t kSampleBufferLength = 2 * 1024;
namespace audio {
@@ -33,8 +32,8 @@ SinkMixer::SinkMixer(StreamBufferHandle_t dest)
resampler_(nullptr),
source_(xStreamBufferCreate(kSourceBufferLength, 1)),
sink_(dest) {
- input_stream_.reset(new RawStream(kSampleBufferLength));
- resampled_stream_.reset(new RawStream(kSampleBufferLength));
+ input_stream_.reset(new RawStream(kSampleBufferLength, MALLOC_CAP_SPIRAM));
+ resampled_stream_.reset(new RawStream(kSampleBufferLength, MALLOC_CAP_SPIRAM));
tasks::StartPersistent<tasks::Type::kMixer>([&]() { Main(); });
}
@@ -188,9 +187,6 @@ auto SinkMixer::Resample(InputStream& in, OutputStream& out) -> bool {
auto res = resampler_->Process(in.data_as<sample::Sample>(),
out.data_as<sample::Sample>(), false);
- ESP_LOGI(kTag, "resampler sent %u samples, consumed %u, produced %u",
- in.data().size(), res.first, res.second);
-
in.consume(res.first * sizeof(sample::Sample));
out.add(res.first * sizeof(sample::Sample));