Exemple #1
0
        public RESULT createStream(string name, MODE mode, out Sound sound)
        {
            CREATESOUNDEXINFO cREATESOUNDEXINFO = default(CREATESOUNDEXINFO);

            cREATESOUNDEXINFO.cbsize = Marshal.SizeOf(cREATESOUNDEXINFO);
            return(this.createStream(name, mode, ref cREATESOUNDEXINFO, out sound));
        }
Exemple #2
0
        private static void Play(string path, bool isBGM)
        {
            var file = NLVFS.NLVFS.LoadFile(path);
            if (file == null)
            {
                NLog.Warn("fmod Play file not Found " + path);
                return;
            }

            var info = new CREATESOUNDEXINFO();
            info.length = (uint)file.Length;
            Sound s;
            var result = _fmod.createSound(file, MODE.OPENMEMORY, ref info, out s);
            if (result != RESULT.OK)
            {
                NLog.Error("fmod createSound " + result);
            }
            
            Channel channel;
            result = _fmod.playSound(s, null, false, out channel);
            _fmod.update();
            int index;
            channel.getIndex(out index);
            if (result != RESULT.OK)
            {
                NLog.Error("fmod playSound " + result);
            }

            if (isBGM)
            {
                _channelBGM = channel;
            }
        }
        public RESULT createStream(string name, MODE mode, out Sound sound)
        {
            CREATESOUNDEXINFO exinfo = default(CREATESOUNDEXINFO);

            exinfo.cbsize = Marshal.SizeOf(exinfo);
            return(createStream(name, mode, ref exinfo, out sound));
        }
Exemple #4
0
    // Use this for initialization
    void Start () {
        lowLevelSystem = RuntimeManager.LowlevelSystem;
        channel = new FMOD.Channel();
        lowLevelSystem.getMasterChannelGroup(out channelGroup);

        soundInfo = new FMOD.CREATESOUNDEXINFO();
        soundInfo.cbsize = Marshal.SizeOf(soundInfo);
        soundInfo.decodebuffersize = (uint)sampleRate / 10;
        soundInfo.length = (uint)(sampleRate * numberOfChannels * sizeof(short));
        soundInfo.numchannels = numberOfChannels;
        soundInfo.defaultfrequency = sampleRate;
        soundInfo.format = FMOD.SOUND_FORMAT.PCM16;

        soundInfo.pcmreadcallback = PCMReadCallback;
        soundInfo.pcmsetposcallback = PCMSetPositionCallback;

        lowLevelSystem.setStreamBufferSize(65536, FMOD.TIMEUNIT.RAWBYTES);
        lowLevelSystem.createStream("SoundGeneratorStream", FMOD.MODE.OPENUSER, ref soundInfo, out generatedSound);

        generatedSound.setMode(FMOD.MODE.OPENUSER | FMOD.MODE._3D | FMOD.MODE._3D_LINEARSQUAREROLLOFF);

        lowLevelSystem.playSound(generatedSound, channelGroup, true, out channel);
        channel.setLoopCount(-1);
        channel.setMode(FMOD.MODE.LOOP_NORMAL);
        channel.setPosition(0, FMOD.TIMEUNIT.MS);
        channel.set3DMinMaxDistance(minDistance, maxDistance);
        Update();
        channel.setPaused(false);
    }
 public RESULT createStream(string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
 {
     using (StringHelper.ThreadSafeEncoding threadSafeEncoding = StringHelper.GetFreeHelper())
     {
         return(FMOD5_System_CreateStream(handle, threadSafeEncoding.byteFromStringUTF8(name), mode, ref exinfo, out sound.handle));
     }
 }
Exemple #6
0
        public RESULT createStream(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound         = null;
            exinfo.cbsize = Marshal.SizeOf(exinfo);
            IntPtr raw;
            RESULT result = System.FMOD5_System_CreateStream(this.rawPtr, data, mode, ref exinfo, out raw);

            sound = new Sound(raw);
            return(result);
        }
Exemple #7
0
        public RESULT createStream(string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound = null;
            byte[] bytes = Encoding.UTF8.GetBytes(name + '\0');
            exinfo.cbsize = Marshal.SizeOf(exinfo);
            IntPtr raw;
            RESULT result = System.FMOD5_System_CreateStream(this.rawPtr, bytes, mode, ref exinfo, out raw);

            sound = new Sound(raw);
            return(result);
        }
Exemple #8
0
        public void Play(byte[] audiodata, int length)
        {
            this.Init();
            FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
            exinfo.cbsize = Marshal.SizeOf(exinfo);
            exinfo.length = (uint)length;
            result        = system.createSound(audiodata, (FMOD.MODE.HARDWARE | FMOD.MODE.OPENMEMORY), ref exinfo, ref music);
            if (music != null)
            {
                result = this.music.setMode(FMOD.MODE.LOOP_OFF);
                ErrorCheck();
            }

            result = this.system.playSound(FMOD.CHANNELINDEX.FREE, music, false, ref channel);
            ErrorCheck();
        }
Exemple #9
0
    // Use this for initialization
    void Start()
    {
        channel = new FMOD.Channel();

        soundInfo                    = new FMOD.CREATESOUNDEXINFO();
        soundInfo.cbsize             = Marshal.SizeOf(soundInfo);
        soundInfo.suggestedsoundtype = FMOD.SOUND_TYPE.MPEG;

        lowLevelSystem = FMODUnity.RuntimeManager.LowlevelSystem;
        FMODUnity.RuntimeManager.LowlevelSystem.getMasterChannelGroup(out channelGroup);
        lowLevelSystem.setStreamBufferSize(64000, FMOD.TIMEUNIT.RAWBYTES);
        channel.setMode(FMOD.MODE.IGNORETAGS | FMOD.MODE.MPEGSEARCH);
        lowLevelSystem.createStream("http://stream4.nadaje.com:15274/live", //"http://stream.gensokyoradio.net:8000/stream/1/" "http://stream4.nadaje.com:12818/test"
                                    FMOD.MODE.DEFAULT | FMOD.MODE.NONBLOCKING | FMOD.MODE.CREATESTREAM | FMOD.MODE.MPEGSEARCH,
                                    ref soundInfo,
                                    out radioStream);

        StartCoroutine(WaitForStreamBuffer());
    }
Exemple #10
0
    void InitSampleGeneration()
    {
        soundInfo                  = new FMOD.CREATESOUNDEXINFO();
        soundInfo.cbsize           = System.Runtime.InteropServices.Marshal.SizeOf(soundInfo);
        soundInfo.decodebuffersize = (uint)sampleRate;

        // Sample rate * number of channels * bits per sample per channel * number of seconds
        soundInfo.length = (uint)(sampleRate * channels * sizeof(short) * soundLength);
        //UnityEngine.Debug.Log(soundInfo.length);
        soundInfo.numchannels       = channels;
        soundInfo.defaultfrequency  = sampleRate;
        soundInfo.format            = SOUND_FORMAT.PCM16;
        soundInfo.pcmreadcallback   = PCMReadCallbackImpl;
        soundInfo.pcmsetposcallback = PCMSetPosCallbackImpl;

        //zwiekszenie bufora
        lowlevelSystem.setStreamBufferSize(65536, TIMEUNIT.RAWBYTES);
        lowlevelSystem.createStream("generatedSound", MODE.OPENUSER, ref soundInfo, out generatedSound);
        sampleCreated = true;
    }
Exemple #11
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;
        }
Exemple #12
0
 public MediaObject()
 {
     // Zero out the extra info structure.
     extraInfo        = new FMOD.CREATESOUNDEXINFO();
     extraInfo.cbsize = Marshal.SizeOf(extraInfo);
 }
Exemple #13
0
 private static extern RESULT FMOD5_System_CreateStream(IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound);
 public RESULT createStream(IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
 {
     return(FMOD5_System_CreateStream(handle, name_or_data, mode, ref exinfo, out sound.handle));
 }
 public CreateSoundExInfo(ref CREATESOUNDEXINFO exinfo)
 {
     FMODInfo = exinfo;
 }
        private Sound CreateSound()
        {
            var createSoundInfo = new CREATESOUNDEXINFO();

            createSoundInfo.cbsize = Marshal.SizeOf(createSoundInfo);
            createSoundInfo.defaultfrequency = this.sampleRate;
            createSoundInfo.numchannels = this.channelCount;
            createSoundInfo.format = SOUND_FORMAT.PCM16;
            createSoundInfo.length = (uint)(createSoundInfo.defaultfrequency * createSoundInfo.numchannels * sizeof(short) * 0.5f);

            Sound sound;

            this.fmodSystem.createSound("sound", MODE.LOOP_NORMAL | MODE.OPENUSER | MODE._2D, ref createSoundInfo, out sound);

            return sound;
        }
 public RESULT createSound(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
 {
     return(FMOD5_System_CreateSound(handle, data, mode, ref exinfo, out sound.handle));
 }
Exemple #18
0
 public RESULT createSound(byte[] buf, MODE m, ref CREATESOUNDEXINFO info, out Sound s) => throw new NotImplementedException();
Exemple #19
0
        public RESULT createStream(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, ref Sound sound)
        {
            RESULT result           = RESULT.OK;
            IntPtr      soundraw    = new IntPtr();
            Sound       soundnew    = null;

            try
            {
                result = FMOD_System_CreateStream(systemraw, data, mode, ref exinfo, ref soundraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (sound == null)
            {
                soundnew = new Sound();
                soundnew.setRaw(soundraw);
                sound = soundnew;
            }
            else
            {
                sound.setRaw(soundraw);
            }

            return result;
        }
Exemple #20
0
        public RESULT createStream            (byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound = null;

            exinfo.cbsize = Marshal.SizeOf(exinfo);

            IntPtr soundraw;
            RESULT result = FMOD_System_CreateStream(rawPtr, data, mode, ref exinfo, out soundraw);
            sound = new Sound(soundraw);

            return result;
        }
Exemple #21
0
        public RESULT createStream            (byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound = null;

            CREATESOUNDEXINFO_INTERNAL exinfoInternal = CREATESOUNDEXINFO_INTERNAL.CreateFromExternal(ref exinfo);

            IntPtr soundraw;
            RESULT result = FMOD5_System_CreateStream(rawPtr, data, mode, ref exinfoInternal, out soundraw);
            sound = new Sound(soundraw);

            return result;
        }
Exemple #22
0
        public static CREATESOUNDEXINFO CreateFromInternal(ref CREATESOUNDEXINFO_INTERNAL exinfoInt)
        {
            CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO();
            exinfo.cbsize = Marshal.SizeOf(typeof(CREATESOUNDEXINFO_INTERNAL));
            
            exinfo.fileoffset            = exinfoInt.fileoffset;
            exinfo.numchannels           = exinfoInt.numchannels;
            exinfo.defaultfrequency      = exinfoInt.defaultfrequency;
            exinfo.format                = exinfoInt.format;
            exinfo.decodebuffersize      = exinfoInt.decodebuffersize;
            exinfo.initialsubsound       = exinfoInt.initialsubsound;
            exinfo.numsubsounds          = exinfoInt.numsubsounds;
            exinfo.inclusionlist         = exinfoInt.inclusionlist;
            exinfo.inclusionlistnum      = exinfoInt.inclusionlistnum;
            exinfo.pcmreadcallback       = exinfoInt.pcmreadcallback != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.pcmreadcallback, typeof(SOUND_PCMREADCALLBACK)) as SOUND_PCMREADCALLBACK : null;
            exinfo.pcmsetposcallback     = exinfoInt.pcmsetposcallback != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.pcmsetposcallback, typeof(SOUND_PCMSETPOSCALLBACK)) as SOUND_PCMSETPOSCALLBACK : null;
            exinfo.nonblockcallback      = exinfoInt.nonblockcallback != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.nonblockcallback, typeof(SOUND_NONBLOCKCALLBACK)) as SOUND_NONBLOCKCALLBACK : null;
            exinfo.dlsname               = exinfoInt.dlsname;
            exinfo.encryptionkey         = exinfoInt.encryptionkey;
            exinfo.maxpolyphony          = exinfoInt.maxpolyphony;
            exinfo.userdata              = exinfoInt.userdata;
            exinfo.suggestedsoundtype    = exinfoInt.suggestedsoundtype;
            exinfo.fileuseropen          = exinfoInt.fileuseropen != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.fileuseropen, typeof(FILE_OPENCALLBACK)) as FILE_OPENCALLBACK : null;
            exinfo.fileuserclose         = exinfoInt.fileuserclose != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.fileuserclose, typeof(FILE_CLOSECALLBACK)) as FILE_CLOSECALLBACK : null;
            exinfo.fileuserread          = exinfoInt.fileuserread != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.fileuserread, typeof(FILE_READCALLBACK)) as FILE_READCALLBACK : null;
            exinfo.fileuserseek          = exinfoInt.fileuserseek != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.fileuserseek, typeof(FILE_SEEKCALLBACK)) as FILE_SEEKCALLBACK : null;
            exinfo.fileuserasyncread     = exinfoInt.fileuserasyncread != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.fileuserasyncread, typeof(FILE_ASYNCREADCALLBACK)) as FILE_ASYNCREADCALLBACK : null;
            exinfo.fileuserasynccancel   = exinfoInt.fileuserasynccancel != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer(exinfoInt.fileuserasynccancel, typeof(FILE_ASYNCCANCELCALLBACK)) as FILE_ASYNCCANCELCALLBACK : null;
            exinfo.fileuserdata          = exinfoInt.fileuserdata;
            exinfo.filebuffersize        = exinfoInt.filebuffersize;
            exinfo.channelorder          = exinfoInt.channelorder;
            exinfo.channelmask           = exinfoInt.channelmask;
            exinfo.initialsoundgroup     = exinfoInt.initialsoundgroup;
            exinfo.initialseekposition   = exinfoInt.initialseekposition;
            exinfo.initialseekpostype    = exinfoInt.initialseekpostype;
            exinfo.ignoresetfilesystem   = exinfoInt.ignoresetfilesystem;
            exinfo.audioqueuepolicy      = exinfoInt.audioqueuepolicy;
            exinfo.minmidigranularity    = exinfoInt.minmidigranularity;
            exinfo.nonblockthreadid      = exinfoInt.nonblockthreadid;
            exinfo.fsbguid               = exinfoInt.fsbguid;

            return exinfo;
        }
        public RESULT createStream(string name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, ref Sound sound)
        {
            var result = RESULT.OK;
            var soundraw = new IntPtr();
            Sound soundnew = null;

            mode = mode | MODE.UNICODE;

            try
            {
                result = FMOD_System_CreateStream(systemraw, name_or_data, mode, ref exinfo, ref soundraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (sound == null)
            {
                soundnew = new Sound();
                soundnew.setRaw(soundraw);
                sound = soundnew;
            }
            else
            {
                sound.setRaw(soundraw);
            }

            return result;
        }
Exemple #24
0
        public IntPtr                      fsbguid;                /* [r/w] Optional. Specify 0 to ignore. Allows you to provide the GUID lookup for cached FSB header info. Once loaded the GUID will be written back to the pointer. This is to avoid seeking and reading the FSB header. */

        public static CREATESOUNDEXINFO_INTERNAL CreateFromExternal(ref CREATESOUNDEXINFO exinfoExt)
        {
            CREATESOUNDEXINFO_INTERNAL exinfoInt = new CREATESOUNDEXINFO_INTERNAL();
            exinfoInt.cbsize = Marshal.SizeOf(typeof(CREATESOUNDEXINFO_INTERNAL));
            exinfoInt.fileoffset            = exinfoExt.fileoffset;
            exinfoInt.numchannels           = exinfoExt.numchannels;
            exinfoInt.defaultfrequency      = exinfoExt.defaultfrequency;
            exinfoInt.format                = exinfoExt.format;
            exinfoInt.decodebuffersize      = exinfoExt.decodebuffersize;
            exinfoInt.initialsubsound       = exinfoExt.initialsubsound;
            exinfoInt.numsubsounds          = exinfoExt.numsubsounds;
            exinfoInt.inclusionlist         = exinfoExt.inclusionlist;
            exinfoInt.inclusionlistnum      = exinfoExt.inclusionlistnum;
            exinfoInt.pcmreadcallback       = exinfoExt.pcmreadcallback != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.pcmreadcallback) : IntPtr.Zero;
            exinfoInt.pcmsetposcallback     = exinfoExt.pcmsetposcallback != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.pcmsetposcallback) : IntPtr.Zero;
            exinfoInt.nonblockcallback      = exinfoExt.nonblockcallback != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.nonblockcallback) : IntPtr.Zero;
            exinfoInt.dlsname               = exinfoExt.dlsname;
            exinfoInt.encryptionkey         = exinfoExt.encryptionkey;
            exinfoInt.maxpolyphony          = exinfoExt.maxpolyphony;
            exinfoInt.userdata              = exinfoExt.userdata;
            exinfoInt.suggestedsoundtype    = exinfoExt.suggestedsoundtype;
            exinfoInt.fileuseropen          = exinfoExt.fileuseropen != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.fileuseropen) : IntPtr.Zero;
            exinfoInt.fileuserclose         = exinfoExt.fileuserclose != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.fileuserclose) : IntPtr.Zero;
            exinfoInt.fileuserread          = exinfoExt.fileuserread != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.fileuserread) : IntPtr.Zero;
            exinfoInt.fileuserseek          = exinfoExt.fileuserseek != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.fileuserseek) : IntPtr.Zero;
            exinfoInt.fileuserasyncread     = exinfoExt.fileuserasyncread != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.fileuserasyncread) : IntPtr.Zero;
            exinfoInt.fileuserasynccancel   = exinfoExt.fileuserasynccancel != null ? Marshal.GetFunctionPointerForDelegate(exinfoExt.fileuserasynccancel) : IntPtr.Zero;
            exinfoInt.fileuserdata          = exinfoExt.fileuserdata;
            exinfoInt.filebuffersize        = exinfoExt.filebuffersize;
            exinfoInt.channelorder          = exinfoExt.channelorder;
            exinfoInt.channelmask           = exinfoExt.channelmask;
            exinfoInt.initialsoundgroup     = exinfoExt.initialsoundgroup;
            exinfoInt.initialseekposition   = exinfoExt.initialseekposition;
            exinfoInt.initialseekpostype    = exinfoExt.initialseekpostype;
            exinfoInt.ignoresetfilesystem   = exinfoExt.ignoresetfilesystem;
            exinfoInt.audioqueuepolicy      = exinfoExt.audioqueuepolicy;
            exinfoInt.minmidigranularity    = exinfoExt.minmidigranularity;
            exinfoInt.nonblockthreadid      = exinfoExt.nonblockthreadid;
            exinfoInt.fsbguid               = exinfoExt.fsbguid;

            return exinfoInt;
        }
Exemple #25
0
        public RESULT createSound            (byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound = null;

            IntPtr soundraw;
            RESULT result = FMOD_System_CreateSound(rawPtr, data, mode, ref exinfo, out soundraw);
            sound = new Sound(soundraw);

            return result;
        }
Exemple #26
0
        public RESULT createStream            (string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound = null;

            byte[] stringData;
            stringData = Encoding.UTF8.GetBytes(name + Char.MinValue);

            CREATESOUNDEXINFO_INTERNAL exinfoInternal = CREATESOUNDEXINFO_INTERNAL.CreateFromExternal(ref exinfo);

            IntPtr soundraw;
            RESULT result = FMOD5_System_CreateStream(rawPtr, stringData, mode, ref exinfoInternal, out soundraw);
            sound = new Sound(soundraw);

            return result;
        }
Exemple #27
0
        public RESULT createStream            (string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound = null;

            byte[] stringData;
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                stringData = Encoding.Unicode.GetBytes(name + Char.MinValue);
                mode = mode | FMOD.MODE.UNICODE;
            }
            else
            {
                stringData = Encoding.UTF8.GetBytes(name + Char.MinValue);
            }

            IntPtr soundraw;
            RESULT result = FMOD_System_CreateStream(rawPtr, stringData, mode, ref exinfo, out soundraw);
            sound = new Sound(soundraw);

            return result;
        }
Exemple #28
0
        public RESULT createStream            (string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
        {
            sound = null;

            byte[] stringData;
            stringData = Encoding.UTF8.GetBytes(name + Char.MinValue);
            
            exinfo.cbsize = Marshal.SizeOf(exinfo);

            IntPtr soundraw;
            RESULT result = FMOD_System_CreateStream(rawPtr, stringData, mode, ref exinfo, out soundraw);
            sound = new Sound(soundraw);

            return result;
        }
Exemple #29
0
        public RESULT createStream            (string name, MODE mode, ref CREATESOUNDEXINFO exinfo, ref Sound sound)
        {
            RESULT result           = RESULT.OK;
            IntPtr      soundraw    = new IntPtr();
            Sound       soundnew    = null;

            byte[] stringData;
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                stringData = Encoding.Unicode.GetBytes(name + Char.MinValue);
                mode = mode | FMOD.MODE.UNICODE;
            }
            else
            {
                stringData = Encoding.UTF8.GetBytes(name + Char.MinValue);
            }

            try
            {
                result = FMOD_System_CreateStream(systemraw, stringData, mode, ref exinfo, ref soundraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (sound == null)
            {
                soundnew = new Sound();
                soundnew.setRaw(soundraw);
                sound = soundnew;
            }
            else
            {
                sound.setRaw(soundraw);
            }

            return result;
        }
Exemple #30
0
        public RESULT createStream            (string name, MODE mode, out Sound sound)
        {
            CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO();
            exinfo.cbsize = Marshal.SizeOf(exinfo);

            return createStream(name, mode, ref exinfo, out sound);
        }
Exemple #31
0
 public MediaObject()
 {
     // Zero out the extra info structure.
     extraInfo = new FMOD.CREATESOUNDEXINFO();
     extraInfo.cbsize = Marshal.SizeOf(extraInfo);
 }
Exemple #32
0
 private static extern RESULT FMOD_System_CreateStream(IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, ref IntPtr sound);
Exemple #33
0
 public RESULT createSound(string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)
 {
     sound = null;
     byte[] bytes = Encoding.UTF8.GetBytes(name + '\0');
     exinfo.cbsize = Marshal.SizeOf(exinfo);
     IntPtr raw;
     RESULT result = System.FMOD5_System_CreateSound(this.rawPtr, bytes, mode, ref exinfo, out raw);
     sound = new Sound(raw);
     return result;
 }