Exemplo n.º 1
0
        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();
        }
        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();
        }