- uint32_t sink_idx = device[5] == ':' ? (uint32_t)atoi(device + 6)
- : DEFAULT_SINK_INDEX;
- int cvolume = pulse_initialize() ? volume_pulseaudio(sink_idx) : 0;
+ uint32_t sink_idx = device[strlen("pulse")] == ':' ? (uint32_t)atoi(device + strlen("pulse:")) : DEFAULT_SINK_INDEX;
+ const char *sink_name = device[strlen("pulse")] == ':' &&
+ !isdigit(device[strlen("pulse:")])
+ ? device + strlen("pulse:")
+ : NULL;
+ int cvolume = pulse_initialize() ? volume_pulseaudio(sink_idx, sink_name) : 0;