fix: volume slider and mute button race conditions
- Mute button click no longer triggers node drag (priority check in onMouseDown) - Volume slider clamped to 0-100% in both display and API - Added draggable circle handle on slider end - Volume drag state tracked globally, not per-element - Backend: fixed spa_pod_builder API usage (push_object/pop with frame) - Volume calculated from SVG coordinates properly via svgPoint conversion
This commit is contained in:
@@ -806,10 +806,12 @@ bool GraphEngine::setNodeVolume(uint32_t node_id, float volume) {
|
||||
// Build Props param with volume
|
||||
uint8_t buf[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
struct spa_pod_frame f;
|
||||
|
||||
struct spa_pod *param = (struct spa_pod*)spa_pod_builder_add_object(&b,
|
||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
||||
SPA_PROP_volume, SPA_POD_Float(volume));
|
||||
spa_pod_builder_push_object(&b, &f, SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
|
||||
spa_pod_builder_prop(&b, SPA_PROP_volume, 0);
|
||||
spa_pod_builder_float(&b, volume);
|
||||
struct spa_pod *param = (struct spa_pod*)spa_pod_builder_pop(&b, &f);
|
||||
|
||||
pw_node_set_param((pw_node*)nobj->proxy,
|
||||
SPA_PARAM_Props, 0, param);
|
||||
@@ -834,10 +836,12 @@ bool GraphEngine::setNodeMute(uint32_t node_id, bool mute) {
|
||||
|
||||
uint8_t buf[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
struct spa_pod_frame f;
|
||||
|
||||
struct spa_pod *param = (struct spa_pod*)spa_pod_builder_add_object(&b,
|
||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
||||
SPA_PROP_mute, SPA_POD_Bool(mute));
|
||||
spa_pod_builder_push_object(&b, &f, SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
|
||||
spa_pod_builder_prop(&b, SPA_PROP_mute, 0);
|
||||
spa_pod_builder_bool(&b, mute);
|
||||
struct spa_pod *param = (struct spa_pod*)spa_pod_builder_pop(&b, &f);
|
||||
|
||||
pw_node_set_param((pw_node*)nobj->proxy,
|
||||
SPA_PARAM_Props, 0, param);
|
||||
|
||||
Reference in New Issue
Block a user