private void DoRenderPreview(AudioClip clip, AudioImporter audioImporter, Rect wantedRect, float scaleFactor) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type AudioClipInspector.\u003CDoRenderPreview\u003Ec__AnonStorey84 previewCAnonStorey84 = new AudioClipInspector.\u003CDoRenderPreview\u003Ec__AnonStorey84(); // ISSUE: reference to a compiler-generated field previewCAnonStorey84.scaleFactor = scaleFactor; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field previewCAnonStorey84.scaleFactor = previewCAnonStorey84.scaleFactor * 0.95f; // ISSUE: reference to a compiler-generated field previewCAnonStorey84.minMaxData = !((UnityEngine.Object)audioImporter == (UnityEngine.Object)null) ? AudioUtil.GetMinMaxData(audioImporter) : (float[])null; // ISSUE: reference to a compiler-generated field previewCAnonStorey84.numChannels = clip.channels; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field previewCAnonStorey84.numSamples = previewCAnonStorey84.minMaxData != null ? previewCAnonStorey84.minMaxData.Length / (2 * previewCAnonStorey84.numChannels) : 0; // ISSUE: reference to a compiler-generated field float height = wantedRect.height / (float)previewCAnonStorey84.numChannels; // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type AudioClipInspector.\u003CDoRenderPreview\u003Ec__AnonStorey85 previewCAnonStorey85 = new AudioClipInspector.\u003CDoRenderPreview\u003Ec__AnonStorey85(); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field for (previewCAnonStorey85.channel = 0; previewCAnonStorey85.channel < previewCAnonStorey84.numChannels; previewCAnonStorey85.channel = previewCAnonStorey85.channel + 1) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type AudioClipInspector.\u003CDoRenderPreview\u003Ec__AnonStorey83 previewCAnonStorey83 = new AudioClipInspector.\u003CDoRenderPreview\u003Ec__AnonStorey83(); // ISSUE: reference to a compiler-generated field previewCAnonStorey83.\u003C\u003Ef__ref\u0024132 = previewCAnonStorey84; // ISSUE: reference to a compiler-generated field previewCAnonStorey83.\u003C\u003Ef__ref\u0024133 = previewCAnonStorey85; // ISSUE: reference to a compiler-generated field Rect r = new Rect(wantedRect.x, wantedRect.y + height * (float)previewCAnonStorey85.channel, wantedRect.width, height); // ISSUE: reference to a compiler-generated field previewCAnonStorey83.curveColor = new Color(1f, 0.5490196f, 0.0f, 1f); // ISSUE: reference to a compiler-generated method AudioCurveRendering.DrawMinMaxFilledCurve(r, new AudioCurveRendering.AudioMinMaxCurveAndColorEvaluator(previewCAnonStorey83.\u003C\u003Em__143)); } }
// Passing in clip and importer separately as we're not completely done with the asset setup at the time we're asked to generate the preview. private void DoRenderPreview(bool setMaterial, AudioClip clip, AudioImporter audioImporter, Rect wantedRect, float scaleFactor) { scaleFactor *= 0.95f; // Reduce amplitude slightly to make highly compressed signals fit. float[] minMaxData = (audioImporter == null) ? null : AudioUtil.GetMinMaxData(audioImporter); int numChannels = clip.channels; int numSamples = (minMaxData == null) ? 0 : (minMaxData.Length / (2 * numChannels)); float h = (float)wantedRect.height / (float)numChannels; for (int channel = 0; channel < numChannels; channel++) { Rect channelRect = new Rect(wantedRect.x, wantedRect.y + h * channel, wantedRect.width, h); Color curveColor = new Color(1.0f, 140.0f / 255.0f, 0.0f, 1.0f); AudioCurveRendering.AudioMinMaxCurveAndColorEvaluator dlg = delegate(float x, out Color col, out float minValue, out float maxValue) { col = curveColor; if (numSamples <= 0) { minValue = 0.0f; maxValue = 0.0f; } else { float p = Mathf.Clamp(x * (numSamples - 2), 0.0f, numSamples - 2); int i = (int)Mathf.Floor(p); int offset1 = (i * numChannels + channel) * 2; int offset2 = offset1 + numChannels * 2; minValue = Mathf.Min(minMaxData[offset1 + 1], minMaxData[offset2 + 1]) * scaleFactor; maxValue = Mathf.Max(minMaxData[offset1 + 0], minMaxData[offset2 + 0]) * scaleFactor; if (minValue > maxValue) { float tmp = minValue; minValue = maxValue; maxValue = tmp; } } }; if (setMaterial) { AudioCurveRendering.DrawMinMaxFilledCurve(channelRect, dlg); } else { AudioCurveRendering.DrawMinMaxFilledCurveInternal(channelRect, dlg); } } }
private void DoRenderPreview(AudioClip clip, AudioImporter audioImporter, Rect wantedRect, float scaleFactor) { scaleFactor *= 0.95f; float[] minMaxData = (!(audioImporter == null)) ? AudioUtil.GetMinMaxData(audioImporter) : null; int numChannels = clip.channels; int numSamples = (minMaxData != null) ? (minMaxData.Length / (2 * numChannels)) : 0; float num = wantedRect.height / (float)numChannels; int channel; for (channel = 0; channel < numChannels; channel++) { Rect r = new Rect(wantedRect.x, wantedRect.y + num * (float)channel, wantedRect.width, num); Color curveColor = new Color(1f, 0.549019635f, 0f, 1f); AudioCurveRendering.DrawMinMaxFilledCurve(r, delegate(float x, out Color col, out float minValue, out float maxValue) { col = curveColor; if (numSamples <= 0) { minValue = 0f; maxValue = 0f; } else { float f = Mathf.Clamp(x * (float)(numSamples - 2), 0f, (float)(numSamples - 2)); int num2 = (int)Mathf.Floor(f); int num3 = (num2 * numChannels + channel) * 2; int num4 = num3 + numChannels * 2; minValue = Mathf.Min(minMaxData[num3 + 1], minMaxData[num4 + 1]) * scaleFactor; maxValue = Mathf.Max(minMaxData[num3], minMaxData[num4]) * scaleFactor; if (minValue > maxValue) { float num5 = minValue; minValue = maxValue; maxValue = num5; } } }); } }