Example #1
0
        public Sound(SoundSystem soundSystem, byte[] data)
        {
            soundSystem.ThrowIfNull("soundSystem");
            data.ThrowIfNull("data");

            var createsoundexinfo = new CREATESOUNDEXINFO
                                        {
                                            cbsize = Marshal.SizeOf(typeof(CREATESOUNDEXINFO)),
                                            length = (uint)data.Length
                                        };
            // ReSharper disable BitwiseOperatorOnEnumWihtoutFlags
            RESULT result = soundSystem.System.createSound(data, MODE.HARDWARE | MODE.OPENMEMORY, ref createsoundexinfo, ref _sound);
            // ReSharper restore BitwiseOperatorOnEnumWihtoutFlags

            if (result != RESULT.OK)
            {
                throw new Exception(GetExceptionMessage("Failed to create FMOD sound.", result));
            }

            _soundSystem = soundSystem;
        }
Example #2
0
        public Sound(SoundSystem soundSystem, byte[] data)
        {
            soundSystem.ThrowIfNull("soundSystem");
            data.ThrowIfNull("data");

            var createsoundexinfo = new CREATESOUNDEXINFO
            {
                cbsize = Marshal.SizeOf(typeof(CREATESOUNDEXINFO)),
                length = (uint)data.Length
            };
            // ReSharper disable BitwiseOperatorOnEnumWihtoutFlags
            RESULT result = soundSystem.System.createSound(data, MODE.HARDWARE | MODE.OPENMEMORY, ref createsoundexinfo, ref _sound);

            // ReSharper restore BitwiseOperatorOnEnumWihtoutFlags

            if (result != RESULT.OK)
            {
                throw new Exception(GetExceptionMessage("Failed to create FMOD sound.", result));
            }

            _soundSystem = soundSystem;
        }