Ejemplo n.º 1
0
        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 });
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }