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);
        }
Example #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);
        }
        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);
        }
        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));
     }
 }
        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);
        }
Example #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);
        }
        public RESULT getMute(ref bool mute)
        {
            int    num    = 0;
            RESULT result = ChannelGroup.FMOD_ChannelGroup_GetMute(channelgroupraw, ref num);

            mute = (num != 0);
            return(result);
        }
 public static ChannelGroup FromFmod(FMOD.ChannelGroup group)
 {
     if (group == null)
     {
         throw new ArgumentException("group");
     }
     return(new ChannelGroup(group));
 }
Example #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);
        }
Example #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;
 }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
Example #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);
        }
        public RESULT release()
        {
            RESULT rESULT = ChannelGroup.FMOD5_ChannelGroup_Release(base.getRaw());

            if (rESULT == RESULT.OK)
            {
                this.rawPtr = IntPtr.Zero;
            }
            return(rESULT);
        }
Example #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);
        }
Example #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);
        }
        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);
        }
        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);
        }
        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);
        }
Example #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);
    }
        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);
        }
Example #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;
        }
Example #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);
    }
Example #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();
        }
Example #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;

        }
Example #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;
        }
Example #30
0
 public RESULT setChannelGroup(ChannelGroup channelgroup)
 {
     return FMOD_Channel_SetChannelGroup(channelraw, channelgroup.getRaw());
 }
Example #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;
        }
Example #32
0
 // Routing to ports.
 public RESULT attachChannelGroupToPort(uint portType, ulong portIndex, ChannelGroup channelgroup)
 {
     return FMOD_System_AttachChannelGroupToPort(rawPtr, portType, portIndex, channelgroup.getRaw());
 }
Example #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;
        }
Example #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;
        }
Example #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);
 }
Example #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;
        }
Example #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;                                                                    
        }
Example #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;
 }
Example #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;
 }
Example #40
0
 public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup)
 {
     return System.FMOD5_System_DetachChannelGroupFromPort(this.rawPtr, channelgroup.getRaw());
 }
Example #41
0
 // Nested channel groups.
 public RESULT addGroup               (ChannelGroup group)
 {
     return FMOD5_ChannelGroup_AddGroup(getRaw(), group.getRaw());
 }
Example #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));
 }
Example #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;
        }
Example #44
0
 public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup)
 {
     return(System.FMOD5_System_DetachChannelGroupFromPort(this.rawPtr, channelgroup.getRaw()));
 }
Example #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;
        }
Example #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;
        }
Example #47
0
 public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup)
 {
     return FMOD_System_DetachChannelGroupFromPort(rawPtr, channelgroup.getRaw());
 }
        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;
        }
Example #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);
        }
Example #51
0
 // Nested channel groups.
 public RESULT addGroup(ChannelGroup group)
 {
     return FMOD_ChannelGroup_AddGroup(channelgroupraw, group.getRaw());
 }
Example #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);
 }
Example #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;
        }
Example #54
0
 public RESULT setChannelGroup(ChannelGroup channelgroup)
 {
     return(FMOD_Channel_SetChannelGroup(channelraw, channelgroup.getRaw()));
 }