示例#1
0
void pulseaudio_set_default(menu_info_item_t* mii)
{
    pa_operation* o = NULL;

    switch(mii->menu_info->type)
    {
        case MENU_SERVER:
            if(mii->index == 0)
                x11_property_del("PULSE_SERVER");
            else
                x11_property_set("PULSE_SERVER", mii->address);
            break;
        case MENU_SINK:
            o = pa_context_set_default_sink(context, mii->name,
                    pulseaudio_set_default_success_cb, mii);
            break;
        case MENU_SOURCE:
            o = pa_context_set_default_source(context, mii->name,
                    pulseaudio_set_default_success_cb, mii);
            break;
        case MENU_INPUT:
        case MENU_OUTPUT:
        case MENU_MODULE:
            /* nothing to do here */
            break;
    }
    if(o)
        pa_operation_unref(o);
}
示例#2
0
文件: context.cpp 项目: KDE/plasma-pa
void Context::setDefaultSink(const QString &name)
{
    const QByteArray nameData = name.toUtf8();
    if (!PAOperation(pa_context_set_default_sink(m_context,
                                                 nameData.constData(),
                                                 nullptr,
                                                 nullptr))) {
        qCWarning(PLASMAPA) << "pa_context_set_default_sink failed";
    }
}
示例#3
0
void backend_default_set(context_t *c, backend_entry_type type, const char *internalName) {
    switch(type) {
        case SINK:
            pa_context_set_default_sink(c->context, internalName, NULL, NULL);
            break;
        case SOURCE:
            pa_context_set_default_source(c->context, internalName, NULL, NULL);
            break;
        default:
            break;
    }
}
void PulseAudioSinksManager::setDefaultSink(const QString& name)
{

    defaultDevice = name;
    std::string std_name = defaultDevice.toStdString();
    qDebug() << "setting sink to "<<name<<", and from std_String to  "<<std_name.c_str();

    PaOperation op(pa_context_set_default_sink (pa_ctx.get(),std_name.c_str(),NULL,NULL));
    if (!op) {
            //g_warning ("pa_context_set_default_sink() failed: %s",
            //         pa_strerror (pa_context_errno (control->priv->pa_context)));
            return;
    }
    op = pa_ext_stream_restore_read (pa_ctx.get(), PulseAudioSinksManager::pulseAudioMixerControlStreamRestoreCallback,
                                    this);
    if (!op) {
        return;
    }    
}