Skip to content

Commit

Permalink
[pipewire] Fix sample rate handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Sep 3, 2023
1 parent 91a610f commit f1bc920
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/ossia/audio/pipewire_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,27 @@ class pipewire_audio_protocol : public audio_engine
this->loop = loop;

auto lp = loop->lp;
// clang-format off
// Create the filter (the main pipewire object which will represent the
// software)
auto filter_props = pw.properties_new(
PW_KEY_MEDIA_TYPE, "Audio", PW_KEY_MEDIA_CATEGORY, "Duplex", PW_KEY_MEDIA_ROLE,
"DSP", PW_KEY_MEDIA_NAME, "ossia", PW_KEY_NODE_LATENCY,
fmt::format("{}/{}", setup.buffer_size, setup.rate).c_str(),
PW_KEY_NODE_ALWAYS_PROCESS, "true", PW_KEY_NODE_FORCE_RATE, "true",
PW_KEY_NODE_PAUSE_ON_IDLE, "false", PW_KEY_NODE_SUSPEND_ON_IDLE, "false",
nullptr);

auto filter_props{
pw.properties_new(
PW_KEY_MEDIA_TYPE, "Audio",
PW_KEY_MEDIA_CATEGORY, "Duplex",
PW_KEY_MEDIA_ROLE, "DSP",
PW_KEY_MEDIA_NAME, "ossia",
PW_KEY_NODE_LATENCY, fmt::format("{}/{}", setup.buffer_size, setup.rate).c_str(),
PW_KEY_NODE_FORCE_QUANTUM, fmt::format("{}", setup.buffer_size).c_str(),
PW_KEY_NODE_LOCK_QUANTUM, "true",
PW_KEY_NODE_RATE, fmt::format("{}/{}", 1, setup.rate).c_str(),
PW_KEY_NODE_FORCE_RATE, fmt::format("{}", setup.rate).c_str(),
PW_KEY_NODE_LOCK_RATE, "true",
PW_KEY_NODE_ALWAYS_PROCESS, "true",
PW_KEY_NODE_PAUSE_ON_IDLE, "false",
PW_KEY_NODE_SUSPEND_ON_IDLE, "false",
nullptr)};

// clang-format on
this->filter = pw.filter_new_simple(
lp, setup.name.c_str(), filter_props, &filter_events, this);
if(!this->filter)
Expand Down

0 comments on commit f1bc920

Please sign in to comment.