@lox-audioserver/node-librespot 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lox-audioserver/node-librespot",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Node.js bindings for librespot (Spotify Connect) via N-API with prebuild support.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/lib.rs CHANGED
@@ -1894,8 +1894,10 @@ fn start_connect_device_inner(
1894
1894
  name: name.clone(),
1895
1895
  device_type: DeviceType::Speaker,
1896
1896
  is_group: false,
1897
- // Start with full volume so we rely on zone-side volume control; we do not sync Spotify volume.
1898
- // Spotify volume scale is 0..65535; use max to avoid muted start.
1897
+ // Start at full volume: the Player does not attenuate locally (NoOpVolume below),
1898
+ // so the PCM stays full-scale and the zone applies volume once on output. Volume
1899
+ // changes from the Spotify picker are still forwarded to the zone via VolumeChanged.
1900
+ // Spotify volume scale is 0..65535; use max to avoid a muted start.
1899
1901
  initial_volume: u16::MAX,
1900
1902
  disable_volume: false,
1901
1903
  volume_steps: 64,
@@ -1903,9 +1905,16 @@ fn start_connect_device_inner(
1903
1905
  };
1904
1906
 
1905
1907
  let player_config = PlayerConfig::default();
1908
+ // The SoftMixer is still handed to the Spirc below so it tracks connect volume
1909
+ // state and keeps emitting VolumeChanged events (forwarded to the zone). But the
1910
+ // Player must NOT attenuate the PCM locally: volume is owned by the zone, which
1911
+ // applies it once on output. Feeding the SoftMixer's soft volume into the Player
1912
+ // here would double-attenuate (librespot volume × zone volume) whenever the
1913
+ // Spotify slider is moved. NoOpVolume keeps the PCM at full scale so the zone is
1914
+ // the sole attenuator while the Spotify picker still drives the zone volume.
1906
1915
  let mixer = SoftMixer::open(MixerConfig::default())
1907
1916
  .map_err(|e| Error::from_reason(format!("mixer init failed: {e}")))?;
1908
- let volume_getter = mixer.get_soft_volume();
1917
+ let volume_getter: Box<dyn VolumeGetter + Send> = Box::new(NoOpVolume);
1909
1918
 
1910
1919
  let (tx, mut rx) = mpsc::channel::<Bytes>(256);
1911
1920