static int pulse_set_volume(PulseData *s, double volume)

{

    pa_operation *op;

    pa_cvolume cvol;

    pa_volume_t vol;

    const pa_sample_spec *ss = pa_stream_get_sample_spec(s->stream);



    vol = pa_sw_volume_multiply(lround(volume * PA_VOLUME_NORM), s->base_volume);

    pa_cvolume_set(&cvol, ss->channels, PA_VOLUME_NORM);

    pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol);

    pa_threaded_mainloop_lock(s->mainloop);

    op = pa_context_set_sink_input_volume(s->ctx, pa_stream_get_index(s->stream),

                                          &cvol, pulse_context_result, s);

    return pulse_finish_context_operation(s, op, "pa_context_set_sink_input_volume");

}

static int pulse_set_volume(PulseData *s, double volume)

{

    pa_operation *op;

    pa_cvolume cvol;

    pa_volume_t vol;

    const pa_sample_spec *ss = pa_stream_get_sample_spec(s->stream);



    vol = pa_sw_volume_multiply(lround(volume * PA_VOLUME_NORM), s->base_volume);

    pa_cvolume_set(&cvol, ss->channels, PA_VOLUME_NORM);

    pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol);

    pa_threaded_mainloop_lock(s->mainloop);

    op = pa_context_set_sink_input_volume(s->ctx, pa_stream_get_index(s->stream),

                                          &cvol, pulse_context_result, s);

    return pulse_finish_context_operation(s, op, "pa_context_set_sink_input_volume");

}

static int FUNC_0(PulseData *VAR_0, double VAR_1)

{

    pa_operation *op;

    pa_cvolume cvol;

    pa_volume_t vol;

    const pa_sample_spec *VAR_2 = pa_stream_get_sample_spec(VAR_0->stream);



    vol = pa_sw_volume_multiply(lround(VAR_1 * PA_VOLUME_NORM), VAR_0->base_volume);

    pa_cvolume_set(&cvol, VAR_2->channels, PA_VOLUME_NORM);

    pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol);

    pa_threaded_mainloop_lock(VAR_0->mainloop);

    op = pa_context_set_sink_input_volume(VAR_0->ctx, pa_stream_get_index(VAR_0->stream),

                                          &cvol, pulse_context_result, VAR_0);

    return pulse_finish_context_operation(VAR_0, op, "pa_context_set_sink_input_volume");

}

static int FUNC_0(PulseData *VAR_0, double VAR_1)
{ pa_operation *op; pa_cvolume cvol; pa_volume_t vol; const pa_sample_spec *VAR_2 = pa_stream_get_sample_spec(VAR_0->stream); vol = pa_sw_volume_multiply(lround(VAR_1 * PA_VOLUME_NORM), VAR_0->base_volume); pa_cvolume_set(&cvol, VAR_2->channels, PA_VOLUME_NORM); pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol); pa_threaded_mainloop_lock(VAR_0->mainloop); op = pa_context_set_sink_input_volume(VAR_0->ctx, pa_stream_get_index(VAR_0->stream),
&cvol, pulse_context_result, VAR_0); return pulse_finish_context_operation(VAR_0, op, "pa_context_set_sink_input_volume"); }