コード例 #1
0
        public static int PlaySound(ESounds Sound)
        {
            string file = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderSounds);

            switch (Sound)
            {
            case ESounds.T440:
                file = Path.Combine(file, CSettings.sSoundT440);
                break;

            default:
                break;
            }

            if (file == String.Empty)
            {
                return(-1);
            }

            int   stream = CSound.Load(file);
            float length = CSound.GetLength(stream);

            CSound.Play(stream);
            CSound.FadeAndStop(stream, 100f, length);
            return(stream);
        }
コード例 #2
0
ファイル: Audio.cs プロジェクト: OJdoesIt/alpr-plus-plus
        internal static void PlaySound(ESounds selectedSound)
        {
            string soundSet  = "";
            string soundName = "";

            GetSound(selectedSound, out soundSet, out soundName);
            NativePlaySound(soundSet, soundName);
        }
コード例 #3
0
    public void Stop(ESounds sound)  // Para el sonido que corresponda
    {
        int   i = (int)sound;
        Sound s = sounds[i];

        if (s.source.isPlaying)
        {
            s.source.Stop();
        }
    }
コード例 #4
0
    public void Play(ESounds sound)  // Hace sonar el sonido que corresponda
    {
        int   i = (int)sound;
        Sound s = sounds[i];

        if (!s.source.isPlaying)
        {
            s.source.Play();
        }
    }
コード例 #5
0
 protected Weapon(StrategyGame game, int fireTicks, int refireTicks, float range, float damage, Ship shooter, PointF offset)
 {
     ShootingTicks      = _shootingStop = fireTicks;
     ShootingDelayTicks = refireTicks;
     Shooting           = false;
     Shooter            = shooter;
     WeaponRange        = range;
     WeaponDamage       = damage;
     FireOffset         = offset;
     WeaponSound        = ESounds.plasmaac1;
     _game = game;
 }
コード例 #6
0
    public bool IsPlaying(ESounds sound) // Comprueba si un clip está sonando o no
    {
        int   i = (int)sound;
        Sound s = sounds[i];

        if (s.source.isPlaying)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #7
0
        public static void Play(ESounds sound, bool important = false)
        {
            lock (_available)
            {
                if (_available.Count < 1)
                {
                    return;
                }
            }

            var path = GetSoundFile(sound);

            Task.Run(() => PlayCatch(path));
        }
コード例 #8
0
        public static int PlaySound(ESounds sound, bool fade = true)
        {
            string file = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameSounds);

            switch (sound)
            {
            case ESounds.T440:
                file = Path.Combine(file, CSettings.FileNameSoundT440);
                break;

            default:
                return(-1);
            }

            if (!File.Exists(file))
            {
                return(-1);
            }

            int stream = Load(file, false, fade);

            if (stream < 0)
            {
                return(-1);
            }
            Play(stream);
            if (fade)
            {
                float length = -1f;
                for (int i = 0; i < 5; i++)
                {
                    length = GetLength(stream);
                    if (length >= 0f)
                    {
                        break;
                    }
                    Thread.Sleep(1);
                }
                if (length > 0f)
                {
                    SetStreamVolume(stream, 0);
                    Fade(stream, 100, length);
                }
            }
            return(stream);
        }
コード例 #9
0
ファイル: Audio.cs プロジェクト: OJdoesIt/alpr-plus-plus
        private static void GetSound(ESounds selectedSound, out string soundSet, out string soundName)
        {
            switch (selectedSound)
            {
            case ESounds.PinButton:
            {
                soundSet  = "ATM_SOUNDS";
                soundName = "PIN_BUTTON";
                break;
            }

            case ESounds.TimerStop:
            {
                soundSet  = "HUD_MINI_GAME_SOUNDSET";
                soundName = "TIMER_STOP";
                break;
            }

            case ESounds.ThermalVisionOn:
            {
                soundSet  = "";
                soundName = "THERMAL_VISION_GOGGLES_ON_MASTER";
                break;
            }

            case ESounds.ThermalVisionOff:
            {
                soundSet  = "";
                soundName = "THERMAL_VISION_GOGGLES_OFF_MASTER";
                break;
            }

            default:
            {
                soundSet  = "ATM_SOUNDS";
                soundName = "PIN_BUTTON";
                break;
            }
            }
        }
コード例 #10
0
    public AudioClip GetAudioClip(ESounds sound)
    {
        switch (sound)
        {
        case ESounds.Arrow1: return(Arrow1);

        case ESounds.Arrow2: return(Arrow2);

        case ESounds.Arrow3: return(Arrow3);

        case ESounds.Arrow4: return(Arrow4);

        case ESounds.Arrow5: return(Arrow5);

        case ESounds.Spear1: return(Spear1);

        case ESounds.Spear2: return(Spear2);

        case ESounds.Sword1: return(Sword1);

        case ESounds.Sword2: return(Sword2);

        case ESounds.Sword3: return(Sword3);

        case ESounds.Sword4: return(Sword4);

        case ESounds.Sword5: return(Sword5);

        case ESounds.Sword6: return(Sword6);

        case ESounds.Sword7: return(Sword7);

        case ESounds.Sword8: return(Sword8);

        case ESounds.Sword9: return(Sword9);

        case ESounds.Shout1: return(Shout1);

        case ESounds.Shout2: return(Shout2);

        case ESounds.Shout3: return(Shout3);

        case ESounds.Shout4: return(Shout4);

        case ESounds.Shout5: return(Shout5);

        case ESounds.Gore1: return(Gore1);

        case ESounds.Gore2: return(Gore2);

        case ESounds.Dead1: return(Dead1);

        case ESounds.Dead2: return(Dead2);

        case ESounds.Dead3: return(Dead3);

        case ESounds.Dead4: return(Dead4);

        case ESounds.BuildingDestroyed: return(BuildingDestroyed);

        case ESounds.WallDestroyed: return(WallDestroyed);

        default:
            throw new ArgumentOutOfRangeException("sound", sound, null);
        }
    }
コード例 #11
0
ファイル: CSound.cs プロジェクト: bohning/Vocaluxe
        public static int PlaySound(ESounds Sound)
        {
            string file = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderSounds);
            switch (Sound)
            {
                case ESounds.T440:
                    file = Path.Combine(file, CSettings.sSoundT440);
                    break;
                default:
                    break;
            }

            if (file == String.Empty)
                return -1;

            int stream = CSound.Load(file);
            float length = CSound.GetLength(stream);
            CSound.Play(stream);
            CSound.FadeAndStop(stream, 100f, length);
            return stream;
        }
コード例 #12
0
        public static void Play(ESounds sound, bool important = false)
        {
            var path = GetSoundFile(sound);

            Task.Run(() => PlayInBackground(path, important));
        }
コード例 #13
0
 public static string GetSoundFile(ESounds sound)
 {
     return(StrategyGame.SoundsDir + sound + ".wav");
 }