Beispiel #1
0
        public void SetDefaultPitchShift(float minPitchShiftInOctaves, float maxPitchShiftInOctaves)
        {
            if (defaultCoefficient == null)
            {
                defaultCoefficient = new SoundPlayingCoefficients();
            }

            if (minPitchShiftInOctaves < -1)
            {
                throw new ArgumentException($"{nameof(minPitchShiftInOctaves)} must be greater than or equal to -1");
            }
            if (minPitchShiftInOctaves > 1)
            {
                throw new ArgumentException($"{nameof(minPitchShiftInOctaves)} must be less than or equal to 1");
            }
            if (maxPitchShiftInOctaves < -1)
            {
                throw new ArgumentException($"{nameof(maxPitchShiftInOctaves)} must be greater than or equal to -1");
            }
            if (maxPitchShiftInOctaves > 1)
            {
                throw new ArgumentException($"{nameof(maxPitchShiftInOctaves)} must be less than or equal to 1");
            }

            defaultCoefficient.MinPitchShiftInOctaves = minPitchShiftInOctaves;
            defaultCoefficient.MaxPitchShiftInOctaves = maxPitchShiftInOctaves;
        }
Beispiel #2
0
 /// <summary>
 /// Sets the default volume range for the entire sound effect group. This default will only apply
 /// if the specific sound effect being played has no specified range.
 /// </summary>
 /// <param name="minVolume"></param>
 /// <param name="maxVolume"></param>
 public void SetDefaultVolumeRange(float minVolume, float maxVolume)
 {
     if (defaultCoefficient == null)
     {
         defaultCoefficient = new SoundPlayingCoefficients();
     }
     defaultCoefficient.MinVolume = minVolume;
     defaultCoefficient.MaxVolume = maxVolume;
 }
Beispiel #3
0
        public void AddSoundVolume(SoundEffect soundEffect, float?minVolume, float?maxVolume)
        {
            sounds.Add(soundEffect);

            var newCoefficients = new SoundPlayingCoefficients();

            newCoefficients.MinVolume = minVolume;
            newCoefficients.MaxVolume = maxVolume;

            newCoefficients.MinPitchShiftInOctaves = null;
            newCoefficients.MaxPitchShiftInOctaves = null;

            coefficients.Add(newCoefficients);
        }