예제 #1
0
 void InitSoundboards()
 {
     digBoard = new Soundboard();
     digBoard.Init("dig_", files);
     stepBoard = new Soundboard();
     stepBoard.Init("step_", files);
 }
        void PlaySound(SoundType type, Soundboard board)
        {
            if (type == SoundType.None || monoOutputs == null)
            {
                return;
            }
            Sound snd = board.PlayRandomSound(type);

            snd.Metadata        = board == digBoard ? (byte)1 : (byte)2;
            chunk.Channels      = snd.Channels;
            chunk.Frequency     = snd.SampleRate;
            chunk.BitsPerSample = snd.BitsPerSample;
            chunk.BytesOffset   = snd.Offset;
            chunk.BytesUsed     = snd.Length;
            chunk.Data          = board.Data;

            if (snd.Channels == 1)
            {
                PlayCurrentSound(monoOutputs);
            }
            else if (snd.Channels == 2)
            {
                PlayCurrentSound(stereoOutputs);
            }
        }
 void InitSoundboards()
 {
     digBoard = new Soundboard();
     digBoard.Init("dig");
     stepBoard = new Soundboard();
     stepBoard.Init("step");
 }
예제 #4
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);
			}
		}
예제 #5
0
        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.BitsPerSample = snd.BitsPerSample;
            chunk.BytesOffset   = 0;
            chunk.BytesUsed     = snd.Data.Length;
            chunk.Data          = snd.Data;
            if (board == digBoard)
            {
                if (type == SoundType.Metal)
                {
                    chunk.SampleRate = (snd.SampleRate * 6) / 5;
                }
                else
                {
                    chunk.SampleRate = (snd.SampleRate * 4) / 5;
                }
            }
            else
            {
                if (type == SoundType.Metal)
                {
                    chunk.SampleRate = (snd.SampleRate * 7) / 5;
                }
                else
                {
                    chunk.SampleRate = snd.SampleRate;
                }
            }

            if (snd.Channels == 1)
            {
                PlayCurrentSound(monoOutputs);
            }
            else if (snd.Channels == 2)
            {
                PlayCurrentSound(stereoOutputs);
            }
        }
예제 #6
0
        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 );
        }
 void InitSoundboards()
 {
     digBoard = new Soundboard();
     digBoard.Init( "dig_", files );
     stepBoard = new Soundboard();
     stepBoard.Init( "step_", files );
 }