Example #1
0
        /// <summary>
        /// Loads a sound into memory, or opens it for streaming.
        /// </summary>
        /// <param name="name">
        /// Name of the file or URL to open. For CD playback, Windows-only, the name should be a drive letter with a colon.
        /// </param>
        /// <param name="mode">Behaviour modifier for opening the sound. See SoundMode.</param>
        /// <param name="sound">Address of a variable to receive a newly created FMOD Sound object.</param>
        /// <returns></returns>
        public Result CreateSound(string name, SoundMode mode, ref Sound sound)
        {
            var exinfo = new CreateSoundExInfo();

            exinfo.Size = Marshal.SizeOf(exinfo);
            return(CreateSound(name, mode, ref exinfo, out sound));
        }
Example #2
0
        /// <summary>
        /// Loads a sound into memory, or opens it for streaming.
        /// </summary>
        /// <param name="data">A pointer to a preloaded sound.</param>
        /// <param name="mode">Behaviour modifier for opening the sound. See SoundMode.</param>
        /// <param name="exInfo">
        /// Pointer to a CreateSoundExInfo structure which lets the user provide extended information while playing the sound.
        /// </param>
        /// <param name="sound">Address of a variable to receive a newly created FMOD Sound object.</param>
        /// <returns></returns>
        public Result CreateSound(byte[] data, SoundMode mode, ref CreateSoundExInfo exInfo, ref Sound sound)
        {
            sound       = null;
            exInfo.Size = Marshal.SizeOf(exInfo);
            IntPtr soundraw;
            Result result = FMOD_System_CreateSound(rawPtr, data, mode, ref exInfo, out soundraw);

            sound = new Sound(soundraw);
            return(result);
        }
Example #3
0
        /// <summary>
        /// Loads a sound into memory, or opens it for streaming.
        /// </summary>
        /// <param name="name">
        /// Name of the file or URL to open. For CD playback, Windows-only, the name should be a drive letter with a colon.
        /// </param>
        /// <param name="mode">Behaviour modifier for opening the sound. See SoundMode.</param>
        /// <param name="exInfo">
        /// Pointer to a CreateSoundExInfo structure which lets the user provide extended information while playing the sound.
        /// </param>
        /// <param name="sound">Address of a variable to receive a newly created FMOD Sound object.</param>
        /// <returns></returns>
        public Result CreateSound(string name, SoundMode mode, ref CreateSoundExInfo exInfo, out Sound sound)
        {
            sound = null;
            byte[] stringData;
            stringData  = Encoding.UTF8.GetBytes(name + Char.MinValue);
            exInfo.Size = Marshal.SizeOf(exInfo);
            IntPtr soundraw;
            Result result = FMOD_System_CreateSound(rawPtr, stringData, mode, ref exInfo, out soundraw);

            sound = new Sound(soundraw);
            return(result);
        }
Example #4
0
 private static extern Result FMOD_System_CreateStream(IntPtr system, byte[] name_or_data, SoundMode mode, ref CreateSoundExInfo exinfo, out IntPtr sound);