Skip to content

Commit

Permalink
Correctly load all submix volumes on profile load (Thanks Dadbeard!)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyCoolSlug committed Aug 6, 2024
1 parent 9753ce9 commit 6a734b8
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions daemon/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,8 @@ impl<'a> Device<'a> {

if linked_volume != mix_current_volume {
self.profile.set_submix_volume(mix, linked_volume)?;

debug!("Setting Sub Mix volume for {} to {}", mix, linked_volume);
self.goxlr.set_sub_volume(mix, linked_volume)?;
}
}
Expand Down Expand Up @@ -3676,7 +3678,7 @@ impl<'a> Device<'a> {

if submix_enabled && apply_volumes {
for channel in ChannelName::iter() {
self.sync_submix_volume(channel)?;
self.load_submix_volume(channel)?;
}
}

Expand All @@ -3692,16 +3694,19 @@ impl<'a> Device<'a> {
Ok(())
}

fn sync_submix_volume(&mut self, channel: ChannelName) -> Result<()> {
fn load_submix_volume(&mut self, channel: ChannelName) -> Result<()> {
if let Some(mix) = self.profile.get_submix_from_channel(channel) {
if self.profile.is_channel_linked(mix) {
// Get the channels volume..
let volume = if self.profile.is_channel_linked(mix) {
let volume = self.profile.get_channel_volume(channel);
self.update_submix_for(channel, volume)?;
let ratio = self.profile.get_submix_ratio(mix);

(volume as f64 * ratio) as u8
} else {
let sub_volume = self.profile.get_submix_volume(mix);
self.goxlr.set_sub_volume(mix, sub_volume)?;
}
self.profile.get_submix_volume(mix)
};

debug!("Setting Sub Mix volume for {} to {}", mix, volume);
self.goxlr.set_sub_volume(mix, volume)?;
}
Ok(())
}
Expand All @@ -3726,6 +3731,8 @@ impl<'a> Device<'a> {

// Apply the submix volume..
self.profile.set_submix_volume(mix, volume)?;

debug!("Setting Sub Mix volume for {} to {}", mix, volume);
self.goxlr.set_sub_volume(mix, volume)?;
}
Ok(())
Expand Down

0 comments on commit 6a734b8

Please sign in to comment.