private void Run()
        {
            soundManager = new SoundManager(new AudioDevice(), ManagerGlue.JMOD, 1, 30);
            soundManager.ContentPath = "Data/Sound/";
            soundManager.LoadSounds(true);

            playable = soundManager.GetSFX(SFX.SwordSwish1);
            //playable = soundManager.GetStream(Stream.MainMenuMusic1);
            channel = playable.Play(new Client.Sound.PlayArgs { Looping = true });
            //channel.Looping = true;
            //channel.PlaybackStopped += new EventHandler(channel_PlaybackStopped);
            //channel.PlaybackStopped += (sender, ea) => { Console.WriteLine("Playback ended. Restarting..."); channel = p.Play(); };

            float dtime = 1 / 60f;
            while (true)
            {
                soundManager.Update(dtime, Vector3.Zero, Vector3.Zero, Vector3.UnitX, Vector3.UnitZ);
                System.Threading.Thread.Sleep((int)(dtime * 1000));
                //VolumeTest(dtime / 4f);
                //PauseTest(dtime / 4f);
                //GlobalMuteTest(dtime / 4f);
            }
        }
 void Instance_SoundLoaded(object sender, EventArgs e)
 {
     soundManager = Program.Instance.SoundManager as Sound.SoundManager;
     if (soundManager != null)
         volumesPropertyGrid.SelectedObject = soundManager.VolumesPropertyTestAdapter;
 }
        public SoundManager(AudioDevice audioDevice, ManagerGlue mg, float min3DDistance, float max3DDistance, JMOD.CustomReadFileMethodDelegate customReadFileMethod)
        {
            Instance = this;
            Settings = new Settings();
            minMaxDistance = new Vector2(min3DDistance, max3DDistance);
            #if DEBUG
            if (mg == ManagerGlue.FMOD)
                managerGlue = new FMODGlue.FMODManager();
            else
                if (mg == ManagerGlue.JMOD)
            #endif
                managerGlue = new JMODGlue.JMODManager();
            try
            {
                managerGlue.Init(audioDevice, minMaxDistance, nSoundChannels, customReadFileMethod);
            }
            catch (Exception ex)
            {
                throw new SoundManagerException
                {
                    Message = ex.Message,
                    StackTrace = ex.StackTrace,
                    InitLogString = managerGlue.InitLogString
                };
            }

            // adds all soundgroups in the SoundGroups enum
            foreach (SoundGroups sg in Enum.GetValues(typeof(SoundGroups)))
            {
                soundGroups.Add(sg, new SoundGroup(managerGlue.SystemGlue, sg.ToString()));
            }
            SetupSoundGroupSettings();
        }
Beispiel #4
0
 internal void StopAll()
 {
     SoundManager.PlaySounds(new List <ISound>());
 }