getDefaults() public méthode

public getDefaults ( float &frequency, int &priority ) : RESULT
frequency float
priority int
Résultat RESULT
Exemple #1
0
        public Defaults?GetDefaults()
        {
            float freq;
            int   prio;

            if (!_fmodSound.getDefaults(out freq, out prio).Check(Suppressions()))
            {
                return(null);
            }

            return(new Defaults(prio, freq));
        }
        //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);
        }
Exemple #3
0
        //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();
            beatWait     = false;
            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);
        }