Exemple #1
0
 private void OnDisable()
 {
     DroneSynth_Delete(_droneSynthPtr);
     _droneSynthPtr = IntPtr.Zero;
     WavetableSet.Unload();
     DroneMachine.Instance.UnregisterDroneSynth(this);
 }
Exemple #2
0
        /// <summary>
        /// Make wavetables from a list of AudioClips
        /// </summary>
        /// <param name="audioClips">the list of AudioClips</param>
        /// <returns>the collection of WavetableSets</returns>
        public static WavetableSet[] MakeFromAudioClips(List <AudioClip> audioClips)
        {
            WavetableSet[] wavetableSets = new WavetableSet[audioClips.Count];

            for (int i = 0; i < audioClips.Count; i++)
            {
                wavetableSets[i] = MakeFromAudioClip(audioClips[i]);
            }

            return(wavetableSets);
        }
Exemple #3
0
        private void OnEnable()
        {
            DroneMachine.Instance.RegisterDroneSynth(this);

            WavetableSet.Load();
            _droneSynthPtr = DroneSynth_New(1.0 / AudioSettings.outputSampleRate);

            ApplyPreset();

            // create a dummy clip and start playing it so 3d positioning works
            var dummyClip = AudioClip.Create("dummyclip", 1, 1, AudioSettings.outputSampleRate, false);

            dummyClip.SetData(new float[] { 1 }, 0);
            var audioSource = GetComponent <AudioSource>();

            audioSource.clip = dummyClip;
            audioSource.loop = true;
            audioSource.Play();
        }