qpulse: wrappers for setting card profile

This commit is contained in:
mappu 2018-10-02 20:11:22 +13:00
parent 257d26248d
commit 06c38bda9c
2 changed files with 24 additions and 0 deletions

View File

@ -37,6 +37,7 @@ bool QPulse::RequestServerInfo()
} }
pa_operation_unref(o); pa_operation_unref(o);
return true;
} }
bool QPulse::RequestCardInfo() bool QPulse::RequestCardInfo()
@ -49,6 +50,18 @@ bool QPulse::RequestCardInfo()
} }
pa_operation_unref(o); 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) 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(); emit qp->ConnectionStateChanged();
} }
void QPulse::onSetCardProfileCompleteSt(pa_context*, int success, void *userdata)
{
QPulse* qp = static_cast<QPulse*>(userdata);
//ThreadedMainLoopLock lock(qp->ml);
emit qp->SetCardProfileOperationCompleted(success);
}

View File

@ -15,11 +15,13 @@ public:
bool RequestServerInfo(); bool RequestServerInfo();
bool RequestCardInfo(); bool RequestCardInfo();
bool SetCardProfile(int32_t card_index, const char* profile_name);
signals: signals:
void ConnectionStateChanged(); void ConnectionStateChanged();
void GotServerInfo(const pa_server_info& i); void GotServerInfo(const pa_server_info& i);
void GotCardInfoList(const pa_card_info& i, int eol); void GotCardInfoList(const pa_card_info& i, int eol);
void SetCardProfileOperationCompleted(int success);
public slots: public slots:
@ -31,6 +33,7 @@ private:
static void onConnectionStateChangedSt(pa_context *c, void *userdata); static void onConnectionStateChangedSt(pa_context *c, void *userdata);
static void onGotServerInfoSt(pa_context *c, const pa_server_info *i, 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 onGotCardInfoListSt(pa_context *c, const pa_card_info *i, int eol, void *userdata);
static void onSetCardProfileCompleteSt(pa_context *c, int success, void *userdata);
}; };