Exemple #1
0
		void PlaySound(byte type, Soundboard board) {
			if (type == SoundType.None || monoOutputs == null) return;
			Sound snd = board.PickRandomSound(type);
			if (snd == null) return;
			
			chunk.Channels = snd.Channels;
			chunk.BitsPerSample = snd.BitsPerSample;
			chunk.BytesOffset = 0;
			chunk.BytesUsed = snd.Data.Length;
			chunk.Data = snd.Data;
			
			float volume = game.SoundsVolume / 100.0f;
			if (board == digBoard) {
				if (type == SoundType.Metal) chunk.SampleRate = (snd.SampleRate * 6) / 5;
				else chunk.SampleRate = (snd.SampleRate * 4) / 5;
			} else {
				volume *= 0.50f;
				
				if (type == SoundType.Metal) chunk.SampleRate = (snd.SampleRate * 7) / 5;
				else chunk.SampleRate = snd.SampleRate;
			}
			
			if (snd.Channels == 1) {
				PlayCurrentSound(monoOutputs, volume);
			} else if (snd.Channels == 2) {
				PlayCurrentSound(stereoOutputs, volume);
			}
		}
        void PlaySound(SoundType type, Soundboard board)
        {
            if (type == SoundType.None || monoOutputs == null)
            {
                return;
            }
            Sound snd = board.PickRandomSound(type);

            if (snd == null)
            {
                return;
            }

            chunk.Channels      = snd.Channels;
            chunk.Frequency     = snd.SampleRate;
            chunk.BitsPerSample = snd.BitsPerSample;
            chunk.BytesOffset   = 0;
            chunk.BytesUsed     = snd.Data.Length;
            chunk.Data          = snd.Data;

            if (snd.Channels == 1)
            {
                PlayCurrentSound(monoOutputs);
            }
            else if (snd.Channels == 2)
            {
                PlayCurrentSound(stereoOutputs);
            }
        }
        void PlaySound(byte type, Soundboard board)
        {
            if (type == SoundType.None || monoOutputs == null)
            {
                return;
            }
            Sound snd = board.PickRandomSound(type);

            if (snd == null)
            {
                return;
            }

            format       = snd.Format;
            chunk.Data   = snd.Data;
            chunk.Length = snd.Data.Length;

            float volume = game.SoundsVolume / 100.0f;

            if (board == digBoard)
            {
                if (type == SoundType.Metal)
                {
                    format.SampleRate = (format.SampleRate * 6) / 5;
                }
                else
                {
                    format.SampleRate = (format.SampleRate * 4) / 5;
                }
            }
            else
            {
                volume *= 0.50f;
                if (type == SoundType.Metal)
                {
                    format.SampleRate = (format.SampleRate * 7) / 5;
                }
            }

            if (format.Channels == 1)
            {
                PlayCurrentSound(monoOutputs, volume);
            }
            else if (format.Channels == 2)
            {
                PlayCurrentSound(stereoOutputs, volume);
            }
        }
        void PlaySound( SoundType type, Soundboard board )
        {
            if( type == SoundType.None || monoOutputs == null )
                return;
            Sound snd = board.PickRandomSound( type );
            if( snd == null ) return;

            chunk.Channels = snd.Channels;
            chunk.Frequency = snd.SampleRate;
            chunk.BitsPerSample = snd.BitsPerSample;
            chunk.BytesOffset = 0;
            chunk.BytesUsed = snd.Data.Length;
            chunk.Data = snd.Data;

            if( snd.Channels == 1 )
                PlayCurrentSound( monoOutputs );
            else if( snd.Channels == 2 )
                PlayCurrentSound( stereoOutputs );
        }