diff --git a/qpulse.cpp b/qpulse.cpp index 5739d29..9e199f4 100644 --- a/qpulse.cpp +++ b/qpulse.cpp @@ -37,6 +37,7 @@ bool QPulse::RequestServerInfo() } pa_operation_unref(o); + return true; } bool QPulse::RequestCardInfo() @@ -49,6 +50,18 @@ bool QPulse::RequestCardInfo() } pa_operation_unref(o); + return true; +} + +bool QPulse::SetCardProfile(int32_t card_index, const char* profile_name) +{ + pa_operation* o = pa_context_set_card_profile_by_index(c, card_index, profile_name, &QPulse::onSetCardProfileCompleteSt, this); + if (! o) { + return false; + } + + pa_operation_unref(o); + return true; } void QPulse::onGotCardInfoListSt(pa_context*, const pa_card_info *i, int eol, void *userdata) @@ -74,3 +87,11 @@ void QPulse::onConnectionStateChangedSt(pa_context*, void *userdata) emit qp->ConnectionStateChanged(); } + +void QPulse::onSetCardProfileCompleteSt(pa_context*, int success, void *userdata) +{ + QPulse* qp = static_cast(userdata); + //ThreadedMainLoopLock lock(qp->ml); + + emit qp->SetCardProfileOperationCompleted(success); +} diff --git a/qpulse.h b/qpulse.h index 0974036..c3aafcd 100644 --- a/qpulse.h +++ b/qpulse.h @@ -15,11 +15,13 @@ public: bool RequestServerInfo(); bool RequestCardInfo(); + bool SetCardProfile(int32_t card_index, const char* profile_name); signals: void ConnectionStateChanged(); void GotServerInfo(const pa_server_info& i); void GotCardInfoList(const pa_card_info& i, int eol); + void SetCardProfileOperationCompleted(int success); public slots: @@ -31,6 +33,7 @@ private: static void onConnectionStateChangedSt(pa_context *c, void *userdata); static void onGotServerInfoSt(pa_context *c, const pa_server_info *i, void *userdata); static void onGotCardInfoListSt(pa_context *c, const pa_card_info *i, int eol, void *userdata); + static void onSetCardProfileCompleteSt(pa_context *c, int success, void *userdata); };