Ejemplo n.º 1
0
        // private List<Sound> m_SFXList;
        /// <summary>
        /// Class constructor.
        /// </summary>
        public SoundManager()
        {
            //Empties variable
            m_System		= null;
            m_BGM			= null;
            m_BGMChannel	= null;

            //Create FMOD system
            CheckError(Factory.System_Create(ref m_System));

            //Check version
            uint Version = 0;
            CheckError(m_System.getVersion(ref Version));
            if (Version < VERSION.number) throw new System.Exception(Global.FMODVERSION_ERROR);

            //Check driver
            CheckDriver();
        }
Ejemplo n.º 2
0
        public RESULT playSound(CHANNELINDEX channelid, Sound sound, bool paused, ref Channel channel)
        {
            RESULT result      = RESULT.OK;
            IntPtr      channelraw;
            Channel     channelnew  = null;

            if (channel != null)
            {
                channelraw = channel.getRaw();
            }
            else
            {
                channelraw  = new IntPtr();
            }

            try
            {
                result = FMOD_System_PlaySound(systemraw, channelid, sound.getRaw(), (paused ? 1 : 0), ref channelraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channel == null)
            {
                channelnew = new Channel();
                channelnew.setRaw(channelraw);
                channel = channelnew;
            }
            else
            {
                channel.setRaw(channelraw);
            }

            return result;
        }
Ejemplo n.º 3
0
        public RESULT getChannel(int channelid, ref Channel channel)
        {
            RESULT result      = RESULT.OK;
            IntPtr      channelraw  = new IntPtr();
            Channel     channelnew  = null;

            try
            {
                result = FMOD_System_GetChannel(systemraw, channelid, ref channelraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channel == null)
            {
                channelnew = new Channel();
                channelnew.setRaw(channelraw);
                channel = channelnew;
            }
            else
            {
                channel.setRaw(channelraw);
            }

            return result;
        }