private void UpdateMusicVolume() { // volume factor used in order to adjust Sound Music and Sound Effect Maximum volumes const float volumeAdjustFactor = 0.5f; if (streamVolume != null) { var vol = volumeAdjustFactor * currentMusic.Volume; streamVolume.SetAllVolumes(2, new[] { vol, vol }); } }
private void UpdateMusicVolume() { // volume factor used in order to adjust Sound Music and Sound Effect Maximum volumes const float volumeAdjustFactor = 0.5f; if (streamVolume != null) { var vol = volumeAdjustFactor * currentMusic.Volume; // Query number of channels var channelCount = streamVolume.ChannelCount; var volumes = new float[channelCount]; for (int i = 0; i < channelCount; ++i) { volumes[i] = vol; } // Set volumes streamVolume.SetAllVolumes(volumes.Length, volumes); } }