Example #1
0
    void SetRandomPattern()
    {
        int sendSize    = 2;
        int subdivision = (int)2.Pow(Random.Range(2, 5));

        float[,] pattern = new float[sendSize, subdivision];

        for (int row = 0; row < sendSize; row++)
        {
            for (int column = 0; column < subdivision; column++)
            {
                pattern[row, column] = Random.Range(0, 10) + Random.Range(10, 500) * row;
            }
        }

        if (sequence != null)
        {
            sequence.ApplyOptions(PureDataOption.TrackPattern(1, 2, pattern));
        }
    }
Example #2
0
        void ShowOptions()
        {
            SerializedProperty optionsProperty = currentSubContainerProperty.FindPropertyRelative("options");

            if (AddFoldOut(optionsProperty, "Options".ToGUIContent()))
            {
                optionsProperty.GetLastArrayElement().isExpanded = true;
                containerManagerSerialized.ApplyModifiedProperties();
                currentSubContainer.options[currentSubContainer.options.Length - 1].SetDefaultValue();
            }

            if (currentSubContainer.options != null && optionsProperty.isExpanded)
            {
                EditorGUI.indentLevel += 1;

                for (int i = 0; i < currentSubContainer.options.Length; i++)
                {
                    currentOption         = currentSubContainer.options[i];
                    currentOptionProperty = optionsProperty.GetArrayElementAtIndex(i);

                    BeginBox();

                    GUIStyle style = new GUIStyle("foldout");
                    style.fontStyle = FontStyle.Bold;
                    if (DeleteFoldOut(optionsProperty, i, string.Format("{0} | {1}", currentOption.type, currentOption.GetValueDisplayName()).ToGUIContent(), style))
                    {
                        break;
                    }

                    ShowOption();
                    EndBox();
                }

                Separator();
                EditorGUI.indentLevel -= 1;
            }
        }
Example #3
0
 /// <summary>
 /// Overrides a previously set option of an item.
 /// </summary>
 /// <param name = "option">The overriding option.</param>
 /// <remarks>Some options can only be applied when an item is initialized.</remarks>
 public virtual void ApplyOption(PureDataOption option)
 {
     ApplyOption(option, 0);
 }
Example #4
0
 /// <summary>
 /// Overrides a previously set option of an item.
 /// </summary>
 /// <param name = "option">The overriding option.</param>
 /// <param name = "delay">The delay in seconds before applying the option.</param>
 /// <remarks>Some options can only be applied when an item is initialized.</remarks>
 public abstract void ApplyOption(PureDataOption option, float delay);
		void ShowOptions() {
			SerializedProperty optionsProperty = currentSubContainerProperty.FindPropertyRelative("options");
		
			if (AddFoldOut(optionsProperty, "Options".ToGUIContent())) {
				currentSubContainer.options[currentSubContainer.options.Length - 1] = PureDataOption.Volume(0);
				containerManagerSerialized.Update();
			}
		
			if (currentSubContainer.options != null && optionsProperty.isExpanded) {
				EditorGUI.indentLevel += 1;
		
				for (int i = 0; i < currentSubContainer.options.Length; i++) {
					currentOption = currentSubContainer.options[i];
					currentOptionProperty = optionsProperty.GetArrayElementAtIndex(i);
		
					BeginBox();
					
					GUIStyle style = new GUIStyle("foldout");
					style.fontStyle = FontStyle.Bold;
					if (DeleteFoldOut(optionsProperty, i, string.Format("{0} | {1}", currentOption.type, currentOption.GetValueDisplayName()).ToGUIContent(), style)) {
						break;
					}
					
					ShowOption();
					EndBox();
				}
		
				Separator();
				EditorGUI.indentLevel -= 1;
			}
		}
Example #6
0
 public override void ApplyOption(PureDataOption option, float delay)
 {
     audioSource.ApplyOption(option, delay);
 }
Example #7
0
    public static void PlayNextAudioClip()
    {
        if (currentAudioClipIndex > 29)
        {
            return;
        }

        if (currentAudioClip != null && currentAudioClip.State == PureDataStates.Stopped)
        {
            currentAudioClip.Stop();
            currentAudioClip = null;
        }

        if (currentAudioClip == null)
        {
            currentAudioClipIndex += 1;
            currentAudioClip       = PureData.Play(audioClipPrefix + (currentAudioClipIndex < 10 ? "0" + currentAudioClipIndex : currentAudioClipIndex.ToString()), PureDataOption.Output("Voice"));
        }
    }
Example #8
0
        void OnGUI()
        {
            GUILayout.Label("Current Item: " + (sourceItem == null ? "None" : sourceItem.ToString()));

            GUILayout.Space(16);

            scroll = GUILayout.BeginScrollView(scroll, GUILayout.Width(Screen.width - 50));

            GUILayout.Label("Plays the looping sound named 'Synth_Up' spatialized around the listener.");
            if (GUILayout.Button("Play"))
            {
                sourceItem = PureData.Play("Synth_Up");
            }

            GUILayout.Space(8);

            GUILayout.Label("Plays the sound named 'Synth_Chaotic' spatialized around the example transform and changes it's pitch to 0.25.");
            if (GUILayout.Button("Play Long"))
            {
                sourceItem = PureData.Play("Synth_Chaotic", transform, PureDataOption.Pitch(0.25F));
            }

            if (sourceItem != null)
            {
                GUILayout.Space(8);

                GUILayout.Label("Ramps the volume of the last played sound to 0.01 in 2 seconds.");
                if (GUILayout.Button("Fade Down"))
                {
                    sourceItem.ApplyOptions(PureDataOption.Volume(0.01F, 2));
                }

                GUILayout.Space(8);

                GUILayout.Label("Sets the volume of the last played sound to target.");
                GUILayout.Label("Volume: " + sourceItem.Volume);
                float volume = GUILayout.HorizontalSlider(sourceItem.Volume, 0, 0.5F);
                if (volume != sourceItem.Volume)
                {
                    sourceItem.ApplyOptions(PureDataOption.Volume(volume, 0.01F));
                }

                GUILayout.Space(8);

                GUILayout.Label("Ramps the pitch of the last played sound to target after a 1 second delay.");
                GUILayout.Label("Pitch: " + sourceItem.Pitch);
                float pitch = GUILayout.HorizontalSlider(sourceItem.Pitch, 0, 5);
                if (pitch != sourceItem.Pitch)
                {
                    sourceItem.ApplyOptions(PureDataOption.Pitch(pitch, 0.5F, 1));
                }

                GUILayout.Space(8);

                GUILayout.Label("Stops the last played sound if it is still playing with it's fade out.");
                if (GUILayout.Button("Stop"))
                {
                    sourceItem.Stop();
                    sourceItem = null;
                }

                GUILayout.Space(8);

                GUILayout.Label("Stops the last played sound if it is still playing without fade out.");
                if (GUILayout.Button("Stop Immediatly"))
                {
                    sourceItem.StopImmediate();
                    sourceItem = null;
                }

                GUILayout.Space(8);

                GUILayout.Label("Stops all sounds with fade out.");
                if (GUILayout.Button("Stop All"))
                {
                    PureData.StopAll();
                    sourceItem = null;
                }
            }

            GUILayout.EndScrollView();
        }
Example #9
0
 public void ApplyOption(PureDataOption option, float delay = 0)
 {
     option.Apply(this, delay);
 }