Exemplo n.º 1
0
        public RESULT addDSP(DSP dsp, ref DSPConnection dspconnection)
        {
            RESULT rESULT = RESULT.OK;
            IntPtr raw    = IntPtr.Zero;

            try
            {
                rESULT = ChannelGroup.FMOD_ChannelGroup_AddDSP(channelgroupraw, dsp.getRaw(), ref raw);
            }
            catch
            {
                rESULT = RESULT.ERR_INVALID_PARAM;
            }
            RESULT result;

            if (rESULT != RESULT.OK)
            {
                result = rESULT;
            }
            else
            {
                if (dspconnection == null)
                {
                    DSPConnection dSPConnection = new DSPConnection();
                    dSPConnection.setRaw(raw);
                    dspconnection = dSPConnection;
                }
                else
                {
                    dspconnection.setRaw(raw);
                }
                result = rESULT;
            }
            return(result);
        }
Exemplo n.º 2
0
        public RESULT getChannelGroup(ref ChannelGroup channelgroup)
        {
            RESULT       result          = RESULT.OK;
            IntPtr       channelgroupraw = new IntPtr();
            ChannelGroup channelgroupnew = null;

            try
            {
                result = FMOD_Channel_GetChannelGroup(channelraw, ref channelgroupraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return(result);
            }

            if (channelgroup == null)
            {
                channelgroupnew = new ChannelGroup();
                channelgroupnew.setRaw(channelgroupraw);
                channelgroup = channelgroupnew;
            }
            else
            {
                channelgroup.setRaw(channelgroupraw);
            }

            return(result);
        }
Exemplo n.º 3
0
        public RESULT getDSPHead(ref DSP dsp)
        {
            RESULT rESULT = RESULT.OK;
            IntPtr raw    = IntPtr.Zero;

            try
            {
                rESULT = ChannelGroup.FMOD_ChannelGroup_GetDSPHead(channelgroupraw, ref raw);
            }
            catch
            {
                rESULT = RESULT.ERR_INVALID_PARAM;
            }
            RESULT result;

            if (rESULT != RESULT.OK)
            {
                result = rESULT;
            }
            else
            {
                if (dsp == null)
                {
                    DSP dSP = new DSP();
                    dSP.setRaw(raw);
                    dsp = dSP;
                }
                else
                {
                    dsp.setRaw(raw);
                }
                result = rESULT;
            }
            return(result);
        }
Exemplo n.º 4
0
        public RESULT getSystemObject(ref _System system)
        {
            RESULT rESULT = RESULT.OK;
            IntPtr raw    = IntPtr.Zero;

            try
            {
                rESULT = ChannelGroup.FMOD_ChannelGroup_GetSystemObject(channelgroupraw, ref raw);
            }
            catch
            {
                rESULT = RESULT.ERR_INVALID_PARAM;
            }
            RESULT result;

            if (rESULT != RESULT.OK)
            {
                result = rESULT;
            }
            else
            {
                if (system == null)
                {
                    _System system2 = new _System();
                    system2.setRaw(raw);
                    system = system2;
                }
                else
                {
                    system.setRaw(raw);
                }
                result = rESULT;
            }
            return(result);
        }
 public RESULT createChannelGroup(string name, out ChannelGroup channelgroup)
 {
     using (StringHelper.ThreadSafeEncoding threadSafeEncoding = StringHelper.GetFreeHelper())
     {
         return(FMOD5_System_CreateChannelGroup(handle, threadSafeEncoding.byteFromStringUTF8(name), out channelgroup.handle));
     }
 }
Exemplo n.º 6
0
        public RESULT getChannel(int index, ref Channel channel)
        {
            RESULT rESULT = RESULT.OK;
            IntPtr raw    = IntPtr.Zero;

            try
            {
                rESULT = ChannelGroup.FMOD_ChannelGroup_GetChannel(channelgroupraw, index, ref raw);
            }
            catch
            {
                rESULT = RESULT.ERR_INVALID_PARAM;
            }
            RESULT result;

            if (rESULT != RESULT.OK)
            {
                result = rESULT;
            }
            else
            {
                if (channel == null)
                {
                    Channel channel2 = new Channel();
                    channel2.setRaw(raw);
                    channel = channel2;
                }
                else
                {
                    channel.setRaw(raw);
                }
                result = rESULT;
            }
            return(result);
        }
Exemplo n.º 7
0
        public RESULT getChannelGroup(ref ChannelGroup channelgroup)
        {
            RESULT rESULT = RESULT.OK;
            IntPtr raw    = IntPtr.Zero;

            try
            {
                rESULT = Channel.FMOD_Channel_GetChannelGroup(channelraw, ref raw);
            }
            catch
            {
                rESULT = RESULT.ERR_INVALID_PARAM;
            }
            RESULT result;

            if (rESULT != RESULT.OK)
            {
                result = rESULT;
            }
            else
            {
                if (channelgroup == null)
                {
                    ChannelGroup channelGroup = new ChannelGroup();
                    channelGroup.setRaw(raw);
                    channelgroup = channelGroup;
                }
                else
                {
                    channelgroup.setRaw(raw);
                }
                result = rESULT;
            }
            return(result);
        }
Exemplo n.º 8
0
        public RESULT getMute(ref bool mute)
        {
            int    num    = 0;
            RESULT result = ChannelGroup.FMOD_ChannelGroup_GetMute(channelgroupraw, ref num);

            mute = (num != 0);
            return(result);
        }
Exemplo n.º 9
0
 public static ChannelGroup FromFmod(FMOD.ChannelGroup group)
 {
     if (group == null)
     {
         throw new ArgumentException("group");
     }
     return(new ChannelGroup(group));
 }
Exemplo n.º 10
0
        public RESULT getMasterChannelGroup(out ChannelGroup channelgroup)
        {
            channelgroup = null;
            IntPtr raw;
            RESULT result = System.FMOD5_System_GetMasterChannelGroup(this.rawPtr, out raw);

            channelgroup = new ChannelGroup(raw);
            return(result);
        }
Exemplo n.º 11
0
 public RESULT createChannelGroup(string name, out ChannelGroup channelgroup)
 {
     channelgroup = null;
     byte[] bytes = Encoding.UTF8.GetBytes(name + '\0');
     IntPtr raw;
     RESULT result = System.FMOD5_System_CreateChannelGroup(this.rawPtr, bytes, out raw);
     channelgroup = new ChannelGroup(raw);
     return result;
 }
Exemplo n.º 12
0
        public RESULT getName(StringBuilder name, int namelen)
        {
            IntPtr intPtr = Marshal.AllocHGlobal(name.Capacity);
            RESULT result = ChannelGroup.FMOD5_ChannelGroup_GetName(base.getRaw(), intPtr, namelen);

            StringMarshalHelper.NativeToBuilder(name, intPtr);
            Marshal.FreeHGlobal(intPtr);
            return(result);
        }
Exemplo n.º 13
0
        public RESULT getChannel(int index, out Channel channel)
        {
            channel = null;
            IntPtr raw;
            RESULT result = ChannelGroup.FMOD5_ChannelGroup_GetChannel(base.getRaw(), index, out raw);

            channel = new Channel(raw);
            return(result);
        }
Exemplo n.º 14
0
        public RESULT addGroup(ChannelGroup group, bool propagatedspclock, out DSPConnection connection)
        {
            connection = null;
            IntPtr raw;
            RESULT result = ChannelGroup.FMOD5_ChannelGroup_AddGroup(base.getRaw(), group.getRaw(), propagatedspclock, out raw);

            connection = new DSPConnection(raw);
            return(result);
        }
Exemplo n.º 15
0
        public RESULT getParentGroup(out ChannelGroup group)
        {
            group = null;
            IntPtr raw;
            RESULT result = ChannelGroup.FMOD5_ChannelGroup_GetParentGroup(base.getRaw(), out raw);

            group = new ChannelGroup(raw);
            return(result);
        }
Exemplo n.º 16
0
        public RESULT getChannelGroup(out ChannelGroup channelgroup)
        {
            channelgroup = null;
            IntPtr raw;
            RESULT result = Channel.FMOD5_Channel_GetChannelGroup(base.getRaw(), out raw);

            channelgroup = new ChannelGroup(raw);
            return(result);
        }
Exemplo n.º 17
0
        public RESULT release()
        {
            RESULT rESULT = ChannelGroup.FMOD5_ChannelGroup_Release(base.getRaw());

            if (rESULT == RESULT.OK)
            {
                this.rawPtr = IntPtr.Zero;
            }
            return(rESULT);
        }
Exemplo n.º 18
0
        public RESULT createChannelGroup(string name, out ChannelGroup channelgroup)
        {
            channelgroup = null;
            byte[] bytes = Encoding.UTF8.GetBytes(name + '\0');
            IntPtr raw;
            RESULT result = System.FMOD5_System_CreateChannelGroup(this.rawPtr, bytes, out raw);

            channelgroup = new ChannelGroup(raw);
            return(result);
        }
Exemplo n.º 19
0
        public RESULT playDSP(DSP dsp, ChannelGroup channelGroup, bool paused, out Channel channel)
        {
            channel = null;
            IntPtr channelGroup2 = (!(channelGroup != null)) ? IntPtr.Zero : channelGroup.getRaw();
            IntPtr raw;
            RESULT result = System.FMOD5_System_PlayDSP(this.rawPtr, dsp.getRaw(), channelGroup2, paused, out raw);

            channel = new Channel(raw);
            return(result);
        }
Exemplo n.º 20
0
        public RESULT stop()
        {
            RESULT result;

            if (VERSION.platform == Platform.X64)
            {
                result = ChannelGroup.FMOD_ChannelGroup_Stop_64(channelgroupraw);
            }
            else
            {
                result = ChannelGroup.FMOD_ChannelGroup_Stop_32(channelgroupraw);
            }
            return(result);
        }
Exemplo n.º 21
0
        public RESULT setPaused(bool paused)
        {
            RESULT result;

            if (VERSION.platform == Platform.X64)
            {
                result = ChannelGroup.FMOD_ChannelGroup_SetPaused_64(channelgroupraw, paused ? 1 : 0);
            }
            else
            {
                result = ChannelGroup.FMOD_ChannelGroup_SetPaused_32(channelgroupraw, paused ? 1 : 0);
            }
            return(result);
        }
Exemplo n.º 22
0
        public RESULT getVolume(ref float volume)
        {
            RESULT result;

            if (VERSION.platform == Platform.X64)
            {
                result = ChannelGroup.FMOD_ChannelGroup_GetVolume_64(channelgroupraw, ref volume);
            }
            else
            {
                result = ChannelGroup.FMOD_ChannelGroup_GetVolume_32(channelgroupraw, ref volume);
            }
            return(result);
        }
Exemplo n.º 23
0
    // Initializes and returns the FMOD GVR Listener Plugin.
    private static FMOD.DSP Initialize()
    {
        // Search through all busses on in banks.
        int numBanks = 0;

        FMOD.Studio.Bank[] banks = null;
        RuntimeManager.StudioSystem.getBankCount(out numBanks);
        RuntimeManager.StudioSystem.getBankList(out banks);
        for (int currentBank = 0; currentBank < numBanks; ++currentBank)
        {
            int numBusses            = 0;
            FMOD.Studio.Bus[] busses = null;
            banks[currentBank].getBusCount(out numBusses);
            banks[currentBank].getBusList(out busses);
            RuntimeManager.StudioSystem.flushCommands();
            for (int currentBus = 0; currentBus < numBusses; ++currentBus)
            {
                // Make sure the channel group of the current bus is assigned properly.
                string busPath = null;
                busses[currentBus].getPath(out busPath);
                RuntimeManager.StudioSystem.getBus(busPath, out busses[currentBus]);
                RuntimeManager.StudioSystem.flushCommands();
                FMOD.ChannelGroup channelGroup = null;
                busses[currentBus].getChannelGroup(out channelGroup);
                RuntimeManager.StudioSystem.flushCommands();
                if (channelGroup != null)
                {
                    int      numDsps = 0;
                    FMOD.DSP dsp     = null;
                    channelGroup.getNumDSPs(out numDsps);
                    for (int currentDsp = 0; currentDsp < numDsps; ++currentDsp)
                    {
                        channelGroup.getDSP(currentDsp, out dsp);
                        System.Text.StringBuilder dspNameSb = new System.Text.StringBuilder(32);
                        int  unusedInt  = 0;
                        uint unusedUint = 0;
                        dsp.getInfo(dspNameSb, out unusedUint, out unusedInt, out unusedInt, out unusedInt);
                        if (dspNameSb.ToString().Equals(listenerPluginName) && dsp.isValid())
                        {
                            return(dsp);
                        }
                    }
                }
            }
        }
        Debug.LogError(listenerPluginName + " not found in the FMOD project.");
        return(null);
    }
Exemplo n.º 24
0
        public RESULT getPaused(ref bool paused)
        {
            int    num = 0;
            RESULT result;

            if (VERSION.platform == Platform.X64)
            {
                result = ChannelGroup.FMOD_ChannelGroup_GetPaused_64(channelgroupraw, ref num);
            }
            else
            {
                result = ChannelGroup.FMOD_ChannelGroup_GetPaused_32(channelgroupraw, ref num);
            }
            paused = (num != 0);
            return(result);
        }
Exemplo n.º 25
0
        public void Release()
        {
            if (this.dspEQ != null)
            {
                this.dspEQ.setActive(false).ERRCHECK();

                FMOD.ChannelGroup masterChannelGroup = null;
                this.fmodSystem.getMasterChannelGroup(out masterChannelGroup).ERRCHECK();

                masterChannelGroup.removeDSP(this.dspEQ).ERRCHECK();

                this.dspEQ.release().ERRCHECK();

                this.dspEQ      = null;
                this.fmodSystem = null;
            }
            this.IsActive = false;
        }
Exemplo n.º 26
0
    private string path = "Assets/3rdPerson+Fly/Sounds/"; // Path of the sound to listen

    void Start()
    {
        path = path + soundName;

        _channel      = new Channel();
        _channelGroup = new FMOD.ChannelGroup();


        _alt_pan_pos = new FMOD.VECTOR();
        _rigidBody   = gameObject.GetComponent <Rigidbody>();

        // Convert game object 3d attributes to FMOD.ATTRIBUTES_3D struct
        _attributes3D = RuntimeUtils.To3DAttributes(gameObject, _rigidBody);

        _soundManager.Create(path, FMOD.MODE.LOOP_NORMAL, out _sound);
        _soundManager.Play(_sound, _channelGroup, false, out _channel, _attributes3D.position, _attributes3D.velocity, _alt_pan_pos);
        _soundManager.ChangeVolume(volume);

        // minDistance: distancia a partir de la cual el sonido comienza a atenuarse
        // maxDistance: distancia a partir de la cual el sonido no se atenúa más (el volumen no es necesariamente 0.0)
        _channel.set3DMinMaxDistance(3.0f, 40.0f);
    }
Exemplo n.º 27
0
        public SoundSystem()
        {
            AudioFound       = true;
            sndActiveBGMName = "";

            RESULT result = Factory.System_Create(ref _system);

            if (result != RESULT.OK)
            {
                AudioFound = false;
                return;
            }
            uint version = 0;

            result = System.getVersion(ref version);
            if (result != RESULT.OK || version < VERSION.number)
            {
                AudioFound = false;
                return;
            }

            result = System.init(16, INITFLAGS.NORMAL, (IntPtr)null);
            if (result != RESULT.OK)
            {
                AudioFound = false;
                return;
            }

            ChannelBGM = new Channel();
            ChannelBGM.setRaw(new IntPtr());

            ChannelBackgroundSFX = new Channel();
            ChannelBackgroundSFX.setRaw(new IntPtr());

            ChannelGroupSFX = new ChannelGroup();
        }
Exemplo n.º 28
0
        // Nested channel groups.
        public RESULT addGroup               (ChannelGroup group, bool propagatedspclock, out DSPConnection connection)
        {
            connection = null;

            IntPtr connectionRaw;
            RESULT result = FMOD5_ChannelGroup_AddGroup(getRaw(), group.getRaw(), propagatedspclock, out connectionRaw);
            connection = new DSPConnection(connectionRaw);

            return result;

        }
Exemplo n.º 29
0
        public RESULT getParentGroup(ref ChannelGroup group)
        {
            RESULT result = RESULT.OK;
            IntPtr channelraw = new IntPtr();
            ChannelGroup    channelnew = null;

            try
            {
                result = FMOD_ChannelGroup_GetParentGroup(channelgroupraw, ref channelraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (group == null)
            {
                channelnew = new ChannelGroup();
                channelnew.setRaw(channelraw);
                group = channelnew;
            }
            else
            {
                group.setRaw(channelraw);
            }

            return result;
        }
Exemplo n.º 30
0
 public RESULT setChannelGroup(ChannelGroup channelgroup)
 {
     return FMOD_Channel_SetChannelGroup(channelraw, channelgroup.getRaw());
 }
Exemplo n.º 31
0
        public RESULT getChannelGroup       (out ChannelGroup channelgroup)
        {
            channelgroup = null;

            IntPtr channelgroupraw;
            RESULT result = FMOD_Channel_GetChannelGroup(getRaw(), out channelgroupraw);
            channelgroup = new ChannelGroup(channelgroupraw);

            return result;
        }
Exemplo n.º 32
0
 // Routing to ports.
 public RESULT attachChannelGroupToPort(uint portType, ulong portIndex, ChannelGroup channelgroup)
 {
     return FMOD_System_AttachChannelGroupToPort(rawPtr, portType, portIndex, channelgroup.getRaw());
 }
Exemplo n.º 33
0
        public RESULT playDSP                (DSP dsp, ChannelGroup channelGroup, bool paused, out Channel channel)
        {
            channel = null;

            IntPtr channelGroupRaw = (channelGroup != null) ? channelGroup.getRaw() : IntPtr.Zero;

            IntPtr channelraw;
            RESULT result = FMOD_System_PlayDSP(rawPtr, dsp.getRaw(), channelGroupRaw, paused, out channelraw);
            channel = new Channel(channelraw);

            return result;
        }
Exemplo n.º 34
0
        public RESULT getGroup               (int index, out ChannelGroup group)
        {
            group = null;

            IntPtr groupraw;
            RESULT result = FMOD5_ChannelGroup_GetGroup(getRaw(), index, out groupraw);
            group = new ChannelGroup(groupraw);

            return result;
        }
Exemplo n.º 35
0
 // Routing to ports.
 public RESULT attachChannelGroupToPort(uint portType, ulong portIndex, ChannelGroup channelgroup, bool passThru = false)
 {
     return FMOD5_System_AttachChannelGroupToPort(rawPtr, portType, portIndex, channelgroup.getRaw(), passThru);
 }
Exemplo n.º 36
0
        public RESULT createChannelGroup     (string name, ref ChannelGroup channelgroup)
        {
            RESULT result = RESULT.OK;
            IntPtr channelgroupraw = new IntPtr();
            ChannelGroup    channelgroupnew = null;

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

            try
            {
                result = FMOD_System_CreateChannelGroup(systemraw, stringData, ref channelgroupraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channelgroup == null)
            {
                channelgroupnew = new ChannelGroup();
                channelgroupnew.setRaw(channelgroupraw);
                channelgroup = channelgroupnew;
            }
            else
            {
                channelgroup.setRaw(channelgroupraw);
            }
                             
            return result;
        }
Exemplo n.º 37
0
        public RESULT playSound              (Sound sound, ChannelGroup channelGroup, bool paused, ref Channel channel)
        {
            RESULT result      = RESULT.OK;
            IntPtr      channelraw;
            Channel     channelnew  = null;

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

            IntPtr channelGroupRaw = (channelGroup != null) ? channelGroup.getRaw() : (IntPtr)0;


            try
            {
                result = FMOD_System_PlaySound(systemraw, sound.getRaw(), channelGroupRaw, (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;                                                                    
        }
Exemplo n.º 38
0
 public RESULT playSound(Sound sound, ChannelGroup channelGroup, bool paused, out Channel channel)
 {
     channel = null;
     IntPtr channelGroup2 = (!(channelGroup != null)) ? IntPtr.Zero : channelGroup.getRaw();
     IntPtr raw;
     RESULT result = System.FMOD5_System_PlaySound(this.rawPtr, sound.getRaw(), channelGroup2, paused, out raw);
     channel = new Channel(raw);
     return result;
 }
Exemplo n.º 39
0
 public RESULT getMasterChannelGroup(out ChannelGroup channelgroup)
 {
     channelgroup = null;
     IntPtr raw;
     RESULT result = System.FMOD5_System_GetMasterChannelGroup(this.rawPtr, out raw);
     channelgroup = new ChannelGroup(raw);
     return result;
 }
Exemplo n.º 40
0
 public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup)
 {
     return System.FMOD5_System_DetachChannelGroupFromPort(this.rawPtr, channelgroup.getRaw());
 }
Exemplo n.º 41
0
 // Nested channel groups.
 public RESULT addGroup               (ChannelGroup group)
 {
     return FMOD5_ChannelGroup_AddGroup(getRaw(), group.getRaw());
 }
Exemplo n.º 42
0
 public RESULT attachChannelGroupToPort(uint portType, ulong portIndex, ChannelGroup channelgroup, bool passThru = false)
 {
     return(System.FMOD5_System_AttachChannelGroupToPort(this.rawPtr, portType, portIndex, channelgroup.getRaw(), passThru));
 }
Exemplo n.º 43
0
        public RESULT createChannelGroup     (string name, out ChannelGroup channelgroup)
        {
            channelgroup = null;

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

            IntPtr channelgroupraw;
            RESULT result = FMOD_System_CreateChannelGroup(rawPtr, stringData, out channelgroupraw);
            channelgroup = new ChannelGroup(channelgroupraw);

            return result;
        }
Exemplo n.º 44
0
 public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup)
 {
     return(System.FMOD5_System_DetachChannelGroupFromPort(this.rawPtr, channelgroup.getRaw()));
 }
Exemplo n.º 45
0
        public RESULT getMasterChannelGroup  (out ChannelGroup channelgroup)
        {
            channelgroup = null;

            IntPtr channelgroupraw;
            RESULT result = FMOD_System_GetMasterChannelGroup(rawPtr, out channelgroupraw);
            channelgroup = new ChannelGroup(channelgroupraw);

            return result;
        }
Exemplo n.º 46
0
        public RESULT createChannelGroup(string name, ref ChannelGroup channelgroup)
        {
            var result = RESULT.OK;
            var channelgroupraw = new IntPtr();
            ChannelGroup channelgroupnew = null;

            try
            {
                result = FMOD_System_CreateChannelGroup(systemraw, name, ref channelgroupraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channelgroup == null)
            {
                channelgroupnew = new ChannelGroup();
                channelgroupnew.setRaw(channelgroupraw);
                channelgroup = channelgroupnew;
            }
            else
            {
                channelgroup.setRaw(channelgroupraw);
            }

            return result;
        }
Exemplo n.º 47
0
 public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup)
 {
     return FMOD_System_DetachChannelGroupFromPort(rawPtr, channelgroup.getRaw());
 }
Exemplo n.º 48
0
        public RESULT getChannelGroup(ref ChannelGroup channelgroup)
        {
            RESULT result   = RESULT.OK;
            IntPtr cgraw = new IntPtr();
            ChannelGroup  cgnew = null;

            try
            {
                result = FMOD_Event_GetChannelGroup(eventraw, ref cgraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channelgroup == null)
            {
                cgnew = new ChannelGroup();
                cgnew.setRaw(cgraw);
                channelgroup = cgnew;
            }
            else
            {
                channelgroup.setRaw(cgraw);
            }

            return result;
        }
Exemplo n.º 49
0
        public RESULT getParentGroup         (out ChannelGroup group)
        {
            group = null;

            IntPtr groupraw;
            RESULT result = FMOD_ChannelGroup_GetParentGroup(getRaw(), out groupraw);
            group = new ChannelGroup(groupraw);

            return result;
        }
        //Loads a song into memory given a sample size and file-path to an audio file.
        //The most commonly used and accurate Sample Size is 1024.
        public void LoadSong(int sSize, string audioString)
        {
            //Take in Aruguments
            sampleSize = sSize;
            songString = audioString;

            stopW.Start();
            areWePlaying = true;
            specFlux = 0.0f;
            timeBetween = 0;
            initialTime = (int)stopW.ElapsedMilliseconds;
            currentTime = 0;
            currentSeconds = 0;
            lastSeconds = 0;
            currentMillis = 0;
            currentMinutes = 0;
            median = 0.0f;
            smoothMedian = 0.0f;
            beatThreshold = 0.6f;
            thresholdSmoother = 0.6f;
            started = false;
            lastBeatRegistered = new TimeStamp();
            audio = new FMOD.Sound();
            songChannel1 = new FMOD.Channel();

            channelMusic = new FMOD.ChannelGroup();

            previousFFT = new float[sampleSize
                / 2 + 1];
            for (int i = 0; i < sampleSize / 2; i++)
            {
                previousFFT[i] = 0;
            }

            //Brute force for testing
            //songString = "Music/drums.wav";

            //Create channel and audio
            FMODErrorCheck(system.createChannelGroup(null, ref channelMusic));
               // CREATESOUNDEXINFO ex = new CREATESOUNDEXINFO();

            FMODErrorCheck(system.createStream(songString, FMOD.MODE.SOFTWARE, ref audio));

            audio.getLength(ref seconds, FMOD.TIMEUNIT.MS);
            audio.getDefaults(ref sampleRate, ref zeroF, ref zeroF, ref zero);
            seconds = ((seconds + 500) / 1000);
            minutes = seconds / 60;
            fullSeconds = (int)seconds;
            seconds = seconds - (minutes * 60);

            FMODErrorCheck(system.playSound(FMOD.CHANNELINDEX.FREE, audio, true, ref songChannel1));

            //hzRange = (sampleRate / 2) / static_cast<float>(sampleSize);
            songChannel1.setChannelGroup(channelMusic);
            songChannel1.setPaused(true);

            Console.WriteLine("Song Length: " + minutes + ":" + seconds);
            Console.WriteLine("Sample Rate: " + sampleRate);

            //std::cout << "Freq Range: " << hzRange << std::endl;
            //songChannel1.setVolume(0);
        }
Exemplo n.º 51
0
 // Nested channel groups.
 public RESULT addGroup(ChannelGroup group)
 {
     return FMOD_ChannelGroup_AddGroup(channelgroupraw, group.getRaw());
 }
Exemplo n.º 52
0
 public void Play(FMOD.Sound sound, FMOD.ChannelGroup channelGroup, bool paused, out FMOD.Channel channel, FMOD.VECTOR pos, FMOD.VECTOR vel, FMOD.VECTOR alt_pan_pos)
 {
     _soundSystem.playSound(sound, channelGroup, paused, out channel);
     _channel = channel;
     _channel.set3DAttributes(ref pos, ref vel, ref alt_pan_pos);
 }
Exemplo n.º 53
0
        public RESULT getMasterChannelGroup(ref ChannelGroup channelgroup)
        {
            RESULT result = RESULT.OK;
            IntPtr channelgroupraw = new IntPtr();
            ChannelGroup    channelgroupnew = null;

            try
            {
                result = FMOD_System_GetMasterChannelGroup(systemraw, ref channelgroupraw);
            }
            catch
            {
                result = RESULT.ERR_INVALID_PARAM;
            }
            if (result != RESULT.OK)
            {
                return result;
            }

            if (channelgroup == null)
            {
                channelgroupnew = new ChannelGroup();
                channelgroupnew.setRaw(channelgroupraw);
                channelgroup = channelgroupnew;
            }
            else
            {
                channelgroup.setRaw(channelgroupraw);
            }

            return result;
        }
Exemplo n.º 54
0
 public RESULT setChannelGroup(ChannelGroup channelgroup)
 {
     return(FMOD_Channel_SetChannelGroup(channelraw, channelgroup.getRaw()));
 }