trying to save the curve presets
This commit is contained in:
1 parent
e12f876255
commit
ee89516056
11 files changed
+347
-229
No files matched your search
@@ -1,23 +0,0 @@
|
||||
using Assets.WasapiAudio.Scripts.Unity;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioSelector : MonoBehaviour {
|
||||
public WasapiAudioSource[] sources;
|
||||
private int sources_i = 0;
|
||||
|
||||
void Awake() {
|
||||
sources_i = 0;
|
||||
Debug.Log($"{sources[sources_i]}");
|
||||
}
|
||||
|
||||
public void UseNextSource() {
|
||||
sources_i = (sources_i + 1) % sources.Length;
|
||||
}
|
||||
|
||||
public WasapiAudioSource CurrentSource() {
|
||||
return sources[sources_i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using Assets.WasapiAudio.Scripts.Core;
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class AudioSource : MonoBehaviour {
|
||||
public WasapiCaptureType CaptureType = WasapiCaptureType.Loopback;
|
||||
public int SpectrumSize = 32;
|
||||
public int MinFrequency = 100;
|
||||
public int MaxFrequency = 20000;
|
||||
public ScalingStrategy ScalingStrategy = ScalingStrategy.Sqrt;
|
||||
public WasapiAudioFilter[] Filters;
|
||||
|
||||
private WasapiAudio _wasapiAudio;
|
||||
private float[] _spectrumData;
|
||||
|
||||
public void Awake() {
|
||||
Initialise();
|
||||
}
|
||||
|
||||
void Initialise() {
|
||||
_wasapiAudio?.StopListen();
|
||||
|
||||
_wasapiAudio = new WasapiAudio(CaptureType, SpectrumSize, ScalingStrategy, MinFrequency, MaxFrequency, Filters, spectrumData =>
|
||||
{
|
||||
_spectrumData = spectrumData;
|
||||
});
|
||||
|
||||
_wasapiAudio.StartListen();
|
||||
}
|
||||
|
||||
public float[] GetSpectrumData() {
|
||||
return _spectrumData;
|
||||
}
|
||||
|
||||
void OnDestroy() {
|
||||
_wasapiAudio?.StopListen();
|
||||
}
|
||||
|
||||
public void ToggleCaptureType() {
|
||||
if (CaptureType == WasapiCaptureType.Loopback) {
|
||||
CaptureType = WasapiCaptureType.Microphone;
|
||||
} else {
|
||||
CaptureType = WasapiCaptureType.Loopback;
|
||||
}
|
||||
|
||||
Initialise();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc21ac8b706913b47897e9f83d170bc5
|
||||
guid: 66a6b9c6a6e18884ebeb1bf742e3be4d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -6,7 +6,7 @@ using UnityEngine.VFX;
|
||||
using UnityEngine;
|
||||
|
||||
[AddComponentMenu("VFX/Property Binders/Kaiju - Theme Binder")]
|
||||
[VFXBinder("Kaiju/Kaiju Theme Binder")]
|
||||
[VFXBinder("Kaiju/Kaiju - Theme Binder")]
|
||||
public class ThemeVfxBinder : VFXBinderBase {
|
||||
public Preferences preferences;
|
||||
|
||||
@@ -36,4 +36,8 @@ public class ThemeVfxBinder : VFXBinderBase {
|
||||
protected override void OnDisable() {
|
||||
// Debug.Log("OnDisable");
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return "Kaiju VFX Theme Binder";
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using UnityEngine.VFX.Utility;
|
||||
using Assets.WasapiAudio.Scripts.Unity;
|
||||
|
||||
[AddComponentMenu("VFX/Property Binders/Kaiju/VFX Spectrum Binder")]
|
||||
[VFXBinder("Kaiju/VFX Spectrum Binder")]
|
||||
[VFXBinder("Kaiju/Kaiju - VFX Spectrum Binder")]
|
||||
public class VfxSpectrumBinder : VfxAudioVisualizationEffect {
|
||||
[VFXPropertyBinding("System.UInt32"), SerializeField]
|
||||
protected ExposedProperty SpectrumSizeParameter = "SpectrumSize";
|
||||
@@ -67,6 +67,6 @@ public class VfxSpectrumBinder : VfxAudioVisualizationEffect {
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return "Audio Spectrum Data";
|
||||
return "Kaiju VFX Spectrum Binder";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user