Skip to content

Commit

Permalink
New buffer size 256; Fixed duplicating for AD, Compressor, Delay, Fil…
Browse files Browse the repository at this point in the history
…ter, Oscillator, Recorder, Scope, Speaker and Stereoverb.
  • Loading branch information
ludzeller committed Feb 4, 2022
1 parent 86e5ffb commit 839a625
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Assets/Resources/Prefabs/ADSR.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Transform:
m_GameObject: {fileID: 1053862283098478}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.008, y: 0.001, z: 0.008}
m_LocalScale: {x: 0.0118728, y: 0.0014841, z: 0.0118728}
m_Children: []
m_Father: {fileID: 4570438196366278}
m_RootOrder: 0
Expand Down Expand Up @@ -475,7 +475,7 @@ Transform:
m_GameObject: {fileID: 1256886302706904}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.008, y: 0.001, z: 0.008}
m_LocalScale: {x: 0.0118728, y: 0.0014841, z: 0.0118728}
m_Children: []
m_Father: {fileID: 4570438196366278}
m_RootOrder: 1
Expand Down Expand Up @@ -1580,7 +1580,7 @@ Transform:
m_GameObject: {fileID: 1740135425574956}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.008, y: 0.001, z: 0.008}
m_LocalScale: {x: 0.0118728, y: 0.0014841, z: 0.0118728}
m_Children: []
m_Father: {fileID: 4570438196366278}
m_RootOrder: 2
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/AD/ADDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public override InstrumentData GetData()

data.attackState = attackDial.percent;
data.releaseState = releaseDial.percent;
data.linearityState = linearityDial.percent;

data.jackInID = input.transform.GetInstanceID();
data.jackOutID = output.transform.GetInstanceID();
Expand All @@ -68,13 +69,15 @@ public override void Load(InstrumentData d)

attackDial.setPercent(data.attackState);
releaseDial.setPercent(data.releaseState);
linearityDial.setPercent(data.linearityState);
}
}

public class ADData : InstrumentData
{
public float attackState;
public float releaseState;
public float linearityState;

public int jackOutID;
public int jackInID;
Expand Down
4 changes: 4 additions & 0 deletions Assets/Scripts/Compressor/compressorDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public override InstrumentData GetData()
data.thresholdState = thresholdDial.percent;
data.ratioState = ratioDial.percent;
data.makeupState = makeupDial.percent;
data.bypassState = bypassSwitch.switchVal;

data.jackInID = input.transform.GetInstanceID();
data.jackOutID = output.transform.GetInstanceID();
Expand All @@ -89,16 +90,19 @@ public override void Load(InstrumentData d)
thresholdDial.setPercent(data.thresholdState);
ratioDial.setPercent(data.ratioState);
makeupDial.setPercent(data.makeupState);
bypassSwitch.setSwitch(data.bypassState, true);
}
}

public class compressorData : InstrumentData
{

public float attackState;
public float releaseState;
public float thresholdState;
public float ratioState;
public float makeupState;
public bool bypassState;

public int jackOutID;
public int jackInID;
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/Delay/delayDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public override InstrumentData GetData()
data.feedbackState = feedbackDial.percent;
data.wetState = wetDial.percent;
data.dryState = dryDial.percent;
data.modeState = modeDial.percent;

data.jackInID = input.transform.GetInstanceID();
data.jackOutID = output.transform.GetInstanceID();
Expand All @@ -77,6 +78,7 @@ public override void Load(InstrumentData d)
feedbackDial.setPercent(data.feedbackState);
wetDial.setPercent(data.wetState);
dryDial.setPercent(data.dryState);
modeDial.setPercent(data.modeState);
}
}

Expand All @@ -86,6 +88,7 @@ public class delayData : InstrumentData
public float feedbackState;
public float wetState;
public float dryState;
public float modeState;

public int jackOutID;
public int jackInID;
Expand Down
13 changes: 11 additions & 2 deletions Assets/Scripts/Filter/filterDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public override InstrumentData GetData() {
data.jackOutID = output.transform.GetInstanceID();
data.jackControlInID = controlInput.transform.GetInstanceID();

data.resonance = resonanceDial.percent;
data.frequency = frequencyDial.percent;
data.filterMode = modeDial.percent;

return data;
}

Expand All @@ -104,16 +108,21 @@ public override void Load(InstrumentData d) {
input.ID = data.jackInID;
output.ID = data.jackOutID;
controlInput.ID = data.jackControlInID;

resonanceDial.setPercent(data.resonance);
frequencyDial.setPercent(data.frequency);
modeDial.setPercent(data.filterMode);
}


}


public class FilterData : InstrumentData {
public float resonance, frequency, width; // width is for BP
public float resonance, frequency; // width is for BP
//public int filterMode; // 0 = LP, 1 == BP, 2 = HP, 4 = NO(TCH)
public filterSignalGenerator.filterType filterMode; // possible?
//public filterSignalGenerator.filterType filterMode; // possible?
public float filterMode;
public int jackOutID;
public int jackInID;
public int jackControlInID;
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Menu/menuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ void loadMenu() {
if (Application.platform == RuntimePlatform.Android)
{
if ((menuItem.deviceType)i == menuItem.deviceType.Camera) continue;
//if ((menuItem.deviceType)i == menuItem.deviceType.MIDIIN) continue;
//if ((menuItem.deviceType)i == menuItem.deviceType.MIDIOUT) continue;
if ((menuItem.deviceType)i == menuItem.deviceType.MIDIIN) continue;
if ((menuItem.deviceType)i == menuItem.deviceType.MIDIOUT) continue;
}
// skip unneeded devices
if ((menuItem.deviceType)i == menuItem.deviceType.Airhorn) continue;
Expand Down
4 changes: 3 additions & 1 deletion Assets/Scripts/Oscillator/oscillatorDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public override void Load(InstrumentData d)

freqDial.setPercent(data.freq);
ampDial.setPercent(data.amp);
waveSlider.setVal(Mathf.RoundToInt(data.wave * 3));

waveSlider.setValByPercent(data.wave);

lfoSwitch.setSwitch(!data.lfo);

ID = data.ID;
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/Recorder/recorderDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public override InstrumentData GetData() {
data.playTriggerID = playTrigger.transform.GetInstanceID();
data.backTriggerID = backTrigger.transform.GetInstanceID();
data.dur = durSlider.switchVal;
data.normalize = normalizeSwitch.switchVal;
return data;
}

Expand All @@ -79,6 +80,7 @@ public override void Load(InstrumentData d) {
playTrigger.ID = data.playTriggerID;
backTrigger.ID = data.backTriggerID;
durSlider.setVal(data.dur);
normalizeSwitch.setSwitch(data.normalize, true);
}
}

Expand All @@ -89,5 +91,6 @@ public class RecorderData : InstrumentData {
public int playTriggerID;
public int backTriggerID;
public int dur;
public bool normalize;
public string audioFilename;
}
6 changes: 6 additions & 0 deletions Assets/Scripts/SamplerAndClipPlayer/samplerDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public override InstrumentData GetData() {
GetTransformData(data);
data.speedDial = speedDial.percent;
data.ampDial = volumeDial.percent;
data.headTrimDial = headTrimDial.percent;
data.tailTrimDial = tailTrimDial.percent;

data.file = GetComponent<samplerLoad>().CurFile;
data.label = GetComponent<samplerLoad>().CurTapeLabel;
Expand Down Expand Up @@ -130,6 +132,8 @@ public override void Load(InstrumentData d) {
base.Load(data);
speedDial.setPercent(data.speedDial);
volumeDial.setPercent(data.ampDial);
headTrimDial.setPercent(data.headTrimDial);
tailTrimDial.setPercent(data.tailTrimDial);
GetComponent<samplerLoad>().SetSample(data.label, data.file);

volumeInput.ID = data.jackInAmpID;
Expand All @@ -154,6 +158,8 @@ public class SamplerData : InstrumentData {
public string file;
public float ampDial;
public float speedDial;
public float headTrimDial;
public float tailTrimDial;
public int jackInAmpID;
public int jackInFreqExpID;
public int jackInFreqLinID;
Expand Down
17 changes: 15 additions & 2 deletions Assets/Scripts/Scope/scopeDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void Update()
displayFft.toggleActive(scopeSignal.incoming != null);
}


}

public override void hit(bool on, int ID = -1)
Expand All @@ -92,6 +91,10 @@ public override InstrumentData GetData() {

data.jackInID = input.transform.GetInstanceID();
data.jackOutID = output.transform.GetInstanceID();
data.periodState = periodDial.percent;
data.modeState = modeSelector.switchVal;
data.triggerState = triggerButton.isHit;
data.muteState = muteButton.isHit;

return data;
}
Expand All @@ -103,13 +106,23 @@ public override void Load(InstrumentData d) {
ID = data.ID;
input.ID = data.jackInID;
output.ID = data.jackOutID;
}

muteButton.setOnAtStart(data.muteState);
triggerButton.setOnAtStart(data.triggerState);

periodDial.setPercent(data.periodState);
modeSelector.setSwitch(data.modeState, true);
}

}


public class ScopeData : InstrumentData {
public int jackOutID;
public int jackInID;

public float periodState;
public bool modeState;
public bool triggerState;
public bool muteState;
}
4 changes: 4 additions & 0 deletions Assets/Scripts/Speaker/speakerDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public override InstrumentData GetData() {
data.deviceType = menuItem.deviceType.Speaker;
GetTransformData(data);
data.jackInID = input.transform.GetInstanceID();
data.channelState = channelSwitcher.switchVal;
return data;
}

Expand All @@ -79,9 +80,12 @@ public override void Load(InstrumentData d) {

ID = data.ID;
input.ID = data.jackInID;
channelSwitcher.setSwitch(data.channelState, true);

}
}

public class SpeakerData : InstrumentData {
public int jackInID;
public bool channelState;
}
4 changes: 2 additions & 2 deletions Assets/Scripts/StereoVerb/stereoVerbDeviceInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void Update() {

public override InstrumentData GetData() {
StereoVerbData data = new StereoVerbData();
data.deviceType = menuItem.deviceType.Reverb;
data.deviceType = menuItem.deviceType.stereoVerb;
GetTransformData(data);

data.jackInID = input.transform.GetInstanceID();
Expand All @@ -70,7 +70,7 @@ public override void Load(InstrumentData d) {
dry.setPercent(data.dry);
wet.setPercent(data.wet);
width.setPercent(data.width);
freeze.switchVal = data.freeze;
freeze.setSwitch(data.freeze, true);
}
}

Expand Down
7 changes: 6 additions & 1 deletion Assets/Scripts/UI/dial/dial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ void Update() {

public void setPercent(float p) {
percent = Mathf.Clamp01(p);
realRot = Utils.map(percent, 0f, 1f, -150f, 150f);
if (isNotched)
{
realRot = Utils.map(Mathf.Round(percent * (notchSteps - 1)), 0, notchSteps - 1, -150f, 150f);
} else {
realRot = Utils.map(percent, 0f, 1f, -150f, 150f);
}

curRot = realRot; // can be removed?
transform.localRotation = Quaternion.Euler(0, realRot, 0);
Expand Down
7 changes: 6 additions & 1 deletion Assets/Scripts/Unorganized/sliderNotched.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,15 @@ void updateSwitchVal() {
updateLabels();
}

public void setValByPercent(float p){
setVal(Mathf.RoundToInt(p * (notchCount - 1)));
}

public void setVal(int v) {
switchVal = v;
percent = (float)v / (notchCount - 1);
Vector3 pos = transform.localPosition;
pos.x = Mathf.Lerp(-xBound, xBound, (float)v / (notchCount - 1));
pos.x = Mathf.Lerp(-xBound, xBound, percent);
transform.localPosition = pos;
updateLabels();
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/masterControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void Awake() {
{
Debug.Log("Buffer size was: " + AudioSettings.GetConfiguration().dspBufferSize);
configuration = AudioSettings.GetConfiguration();
configuration.dspBufferSize = 128;
configuration.dspBufferSize = 256;
AudioSettings.Reset(configuration);

configuration = AudioSettings.GetConfiguration();
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/AudioManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ AudioManager:
Doppler Factor: 1
Default Speaker Mode: 2
m_SampleRate: 48000
m_DSPBufferSize: 512
m_DSPBufferSize: 1024
m_VirtualVoiceCount: 512
m_RealVoiceCount: 64
m_SpatializerPlugin: OculusSpatializer
m_AmbisonicDecoderPlugin: OculusSpatializer
m_DisableAudio: 0
m_VirtualizeEffects: 1
m_RequestedDSPBufferSize: 512
m_RequestedDSPBufferSize: 1024
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ PlayerSettings:
androidMaxAspectRatio: 2.1
applicationIdentifier:
Android: unity.HardLightLabsLLC.SoundStage
Standalone: unity.Hard Light Labs LLC.SoundStage
Standalone: unity.HardLightLabsLLC.SoundStage
iPhone: com.oculus.UnitySample
tvOS: com.oculus.UnitySample
buildNumber:
Expand Down

0 comments on commit 839a625

Please sign in to comment.