forked from Mashiro_Sorata/ADV-Plugin
30 changed files with 1693 additions and 1560 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<map> |
||||
<value name="styles">{"index":3}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/circle#Style.qml"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/circle#Style.qml">{"__version":"1.0.0","__cfg_height":740,"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":50,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/circle"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/circle">{"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":50,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
</map> |
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<map> |
||||
<value name="styles">{"index":1}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/gradient_line#Style.qml"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/gradient_line#Style.qml">{"__version":"1.0.0","__cfg_height":660,"Gradient Direction":0,"Start Position Color":"#f44336","Middle Position Color":"#4caf50","End Position Color":"#03a9f4","Center Line":true,"Line Position":0,"Data Length":0,"Channel":2,"Reverse":false,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/gradient_line"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/gradient_line">{"Gradient Direction":0,"Start Position Color":"#f44336","Middle Position Color":"#4caf50","End Position Color":"#03a9f4","Center Line":true,"Line Position":0,"Data Length":0,"Channel":2,"Reverse":false,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
</map> |
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<map> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/line#Style.qml">{"__version":"1.0.0","__cfg_height":580,"Center Line":true,"Center Color":"#ff4500","Line Color":"#ff4500","Line Position":0,"Data Length":0,"Channel":2,"Reverse":false,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
<value name="styles">{"index":0}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/line#Style.qml"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/line">{"Center Line":true,"Center Color":"#ff4500","Line Color":"#ff4500","Line Position":0,"Data Length":0,"Channel":2,"Reverse":false,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/line"</value> |
||||
</map> |
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<map> |
||||
<value name="styles">{"index":5}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/ordinal_scale_ui_bottom#Style.qml"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/ordinal_scale_ui_bottom#Style.qml">{"__version":"1.0.0","__cfg_height":710,"Bass Color":"#dc143c","Alto Color":"#f8f8ff","Treble Color":"#4169e1","Bass AM":100,"Alto AM":150,"Treble AM":200,"Static AM":25,"Speed":20,"Data Settings":{"Auto Normalizing":true,"Amplitude":10}}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/ordinal_scale_ui_bottom"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/ordinal_scale_ui_bottom">{"Bass Color":"#dc143c","Alto Color":"#f8f8ff","Treble Color":"#4169e1","Bass AM":100,"Alto AM":150,"Treble AM":200,"Static AM":25,"Speed":20,"Data Settings":{"Auto Normalizing":true,"Amplitude":10}}</value> |
||||
</map> |
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<map> |
||||
<value name="styles">{"index":4}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/solidcircle#Style.qml"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/solidcircle#Style.qml">{"__version":"1.0.0","__cfg_height":740,"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":50,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/solidcircle"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/solidcircle">{"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":50,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
</map> |
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<map> |
||||
<value name="styles">{"index":2}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/waves#Style.qml"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/waves#Style.qml">{"__version":"1.0.0","__cfg_height":580,"Line Width":1,"Line Color":"#ff4500","Data Settings":{"Auto Normalizing":true,"Amplitude":10}}</value> |
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/waves"</value> |
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/waves">{"Line Width":1,"Line Color":"#ff4500","Data Length":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value> |
||||
</map> |
@ -0,0 +1,9 @@
|
||||
import QtQuick 2.12 |
||||
|
||||
QtObject { |
||||
property Component style |
||||
|
||||
property var defaultValues |
||||
|
||||
property Component preference |
||||
} |
@ -1,111 +0,0 @@
|
||||
import QtQuick 2.12 |
||||
import NERvGear.Preferences 1.0 as P |
||||
|
||||
import "../../qml/api" //导入CfgAPI.qml |
||||
|
||||
CfgAPI { |
||||
version: "1.0.0" |
||||
cfg_height: 710 |
||||
|
||||
P.ColorPreference { |
||||
name: "Bass Color" |
||||
label: qsTr("Bass Line Color") |
||||
defaultValue: "#DC143C" |
||||
} |
||||
|
||||
P.ColorPreference { |
||||
name: "Alto Color" |
||||
label: qsTr("Alto Line Color") |
||||
defaultValue: "#F8F8FF" |
||||
} |
||||
|
||||
P.ColorPreference { |
||||
name: "Treble Color" |
||||
label: qsTr("Treble Line Color") |
||||
defaultValue: "#4169E1" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SliderPreference { |
||||
name: "Bass AM" |
||||
label: qsTr("Bass Amplitude") |
||||
from: 10 |
||||
to: 300 |
||||
stepSize: 5 |
||||
defaultValue: 100 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Alto AM" |
||||
label: qsTr("Alto Amplitude") |
||||
from: 10 |
||||
to: 300 |
||||
stepSize: 5 |
||||
defaultValue: 150 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Treble AM" |
||||
label: qsTr("Treble Amplitude") |
||||
from: 10 |
||||
to: 300 |
||||
stepSize: 5 |
||||
defaultValue: 200 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SliderPreference { |
||||
name: "Static AM" |
||||
label: qsTr("Static Amplitude") |
||||
from: 5 |
||||
to: 100 |
||||
stepSize: 1 |
||||
defaultValue: 15 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SliderPreference { |
||||
name: "Speed" |
||||
label: qsTr("Wave Speed") |
||||
from: 1 |
||||
to: 100 |
||||
stepSize: 1 |
||||
defaultValue: 20 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.DialogPreference { |
||||
name: "Data Settings" |
||||
label: qsTr("Data Settings") |
||||
live: true |
||||
icon.name: "regular:\uf1de" |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_osui_dataSettings_autoNormalizing |
||||
name: "Auto Normalizing" |
||||
label: qsTr("Auto Normalizing") |
||||
defaultValue: true |
||||
} |
||||
|
||||
P.SpinPreference { |
||||
name: "Amplitude" |
||||
label: qsTr("Amplitude Ratio") |
||||
enabled: !_cfg_preset_osui_dataSettings_autoNormalizing.value |
||||
message: "1 to 100" |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: true |
||||
from: 1 |
||||
to: 100 |
||||
defaultValue: 10 |
||||
} |
||||
} |
||||
} |
File diff suppressed because one or more lines are too long
@ -1,139 +0,0 @@
|
||||
import QtQuick 2.12 |
||||
import NERvGear.Preferences 1.0 as P |
||||
|
||||
import "../../qml/api" //导入CfgAPI.qml |
||||
|
||||
CfgAPI { |
||||
version: "1.0.0" |
||||
cfg_height: 740 |
||||
|
||||
P.ColorPreference { |
||||
name: "Main Color" |
||||
label: qsTr("Spectrum Line Color") |
||||
defaultValue: "#FF4500" |
||||
} |
||||
|
||||
P.SelectPreference { |
||||
name: "Line Position" |
||||
label: qsTr("Spectrum Line Position") |
||||
defaultValue: 0 |
||||
model: [qsTr("Both"), qsTr("Outside"), qsTr("Inside")] |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Line Width" |
||||
label: qsTr("Spectrum Line Width") |
||||
from: 0.1 |
||||
to: 10 |
||||
stepSize: 0.1 |
||||
defaultValue: 1 |
||||
displayValue: value.toFixed(1) + "px" |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Max Range" |
||||
label: qsTr("Max Amplitude") |
||||
from: 0 |
||||
to: 100 |
||||
stepSize: 1 |
||||
defaultValue: 50 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.SelectPreference { |
||||
name: "Data Length" |
||||
label: qsTr("Spectrum Length") |
||||
defaultValue: 0 |
||||
model: [64, 32, 16, 8] |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SpinPreference { |
||||
name: "Channel" |
||||
label: qsTr("Channel") |
||||
message: "1 to 2" |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: false |
||||
from: 1 |
||||
to: 2 |
||||
defaultValue: 2 |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
name: "Reverse" |
||||
label: qsTr("Reverse Spectrum") |
||||
defaultValue: false |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_line_rotate |
||||
name: "Rotate" |
||||
label: qsTr("Auto Rotate") |
||||
defaultValue: false |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Ratate Speed" |
||||
label: qsTr("Ratate Speed") |
||||
enabled: _cfg_preset_line_rotate.value |
||||
from: 1 |
||||
to: 100 |
||||
stepSize: 1 |
||||
defaultValue: 10 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.SpinPreference { |
||||
name: "Angle" |
||||
label: qsTr("Initial Angle") |
||||
message: "0 to 359" |
||||
enabled: !_cfg_preset_line_rotate.value |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: true |
||||
from: 0 |
||||
to: 359 |
||||
defaultValue: 0 |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.DialogPreference { |
||||
name: "Data Settings" |
||||
label: qsTr("Data Settings") |
||||
live: true |
||||
icon.name: "regular:\uf1de" |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_circle_dataSettings_autoNormalizing |
||||
name: "Auto Normalizing" |
||||
label: qsTr("Auto Normalizing") |
||||
defaultValue: true |
||||
} |
||||
|
||||
P.SpinPreference { |
||||
name: "Amplitude" |
||||
label: qsTr("Amplitude Ratio") |
||||
enabled: !_cfg_preset_circle_dataSettings_autoNormalizing.value |
||||
message: "1 to 100" |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: true |
||||
from: 1 |
||||
to: 100 |
||||
defaultValue: 10 |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SelectPreference { |
||||
name: "Unit Style" |
||||
label: qsTr("Display Style") |
||||
defaultValue: 0 |
||||
model: [qsTr("Linear"), qsTr("Decibel")] |
||||
} |
||||
} |
||||
} |
@ -1,132 +1,286 @@
|
||||
import QtQuick 2.12 |
||||
import QtQuick.Controls 2.12 |
||||
import NERvGear.Preferences 1.0 as P |
||||
|
||||
import "../../qml/api" |
||||
|
||||
StyleAPI { |
||||
readonly property var audioData: new Array(128) |
||||
|
||||
//configs |
||||
readonly property string color: configs["Main Color"] |
||||
readonly property int linePosition: configs["Line Position"] |
||||
readonly property real lineWidth: configs["Line Width"] |
||||
readonly property real maxRange: configs["Max Range"] / 100 |
||||
readonly property int uDataLen: Math.pow(2, configs["Data Length"]) |
||||
readonly property int dataLength: 64/uDataLen |
||||
readonly property int channel: configs["Channel"] |
||||
readonly property bool reverse: configs["Reverse"] |
||||
readonly property bool rotateFlag: configs["Rotate"] |
||||
readonly property real rSpeed: configs["Ratate Speed"] / 100 |
||||
readonly property real angle: configs["Angle"] |
||||
readonly property bool autoNormalizing: configs["Data Settings"]["Auto Normalizing"] |
||||
readonly property real amplitude: configs["Data Settings"]["Amplitude"] / 400 |
||||
readonly property int unitStyle: configs["Data Settings"]["Unit Style"] |
||||
|
||||
readonly property int total: channel*dataLength |
||||
|
||||
readonly property real dotGap: 360/total |
||||
property real offsetAngle: 0 |
||||
property var outerPos: [] |
||||
property var innerPos: [] |
||||
readonly property real degUnit: Math.PI/180 |
||||
|
||||
readonly property real subRatio: 0.2*maxRange |
||||
readonly property real mainRatio: 1-subRatio*2.5 |
||||
|
||||
readonly property real minLength: Math.min(width, height) |
||||
readonly property real ratio:minLength*subRatio |
||||
readonly property real halfWidth: width/2 |
||||
readonly property real halfHeight: height/2 |
||||
readonly property real halfMinLength: minLength/2 |
||||
readonly property real logAmplitude: Math.log10(amplitude) |
||||
|
||||
|
||||
onConfigsUpdated: { |
||||
context.lineWidth = lineWidth; |
||||
context.strokeStyle = color; |
||||
} |
||||
AdvpStyleTemplate { |
||||
style: AdvpCanvasTemplate { |
||||
readonly property var audioData: new Array(128) |
||||
|
||||
function getPos(r, deg) { |
||||
return [halfWidth+Math.cos(deg)*r,halfHeight+Math.sin(deg)*r]; |
||||
} |
||||
//configs |
||||
readonly property int linePosition: configs["Line Position"] |
||||
readonly property real maxRange: configs["Max Range"] / 100 |
||||
readonly property int uDataLen: Math.pow(2, configs["Data Length"]) |
||||
readonly property int dataLength: 64/uDataLen |
||||
readonly property int channel: configs["Channel"] |
||||
readonly property bool reverse: configs["Reverse"] |
||||
readonly property bool rotateFlag: configs["Rotate"] |
||||
readonly property real rSpeed: configs["Ratate Speed"] / 100 |
||||
readonly property real angle: configs["Angle"] |
||||
readonly property bool autoNormalizing: configs["Data Settings"]["Auto Normalizing"] |
||||
readonly property real amplitude: configs["Data Settings"]["Amplitude"] / 400 |
||||
readonly property int unitStyle: configs["Data Settings"]["Unit Style"] |
||||
|
||||
function createPoint() { |
||||
outerPos = []; |
||||
innerPos = []; |
||||
let deg, deltaR, r1, r2, _rhmLen; |
||||
_rhmLen = mainRatio*halfMinLength; |
||||
|
||||
for (let j=0; j < channel; j++) { |
||||
for (let i=0; i < dataLength; i++) { |
||||
deg = degUnit*((i+j*dataLength)*dotGap + offsetAngle); |
||||
deltaR = audioData[reverse*(dataLength-i-1)+(!reverse)*(i+j*dataLength)] * ratio; |
||||
r1 = _rhmLen+1+deltaR*(linePosition!==2); |
||||
r2 = _rhmLen-1-deltaR*(linePosition!==1); |
||||
outerPos.push(getPos(r1, deg)); |
||||
innerPos.push(getPos(r2, deg)); |
||||
} |
||||
readonly property int total: channel*dataLength |
||||
|
||||
readonly property real dotGap: 360/total |
||||
property real offsetAngle: 0 |
||||
property var outerPos: [] |
||||
property var innerPos: [] |
||||
readonly property real degUnit: Math.PI/180 |
||||
|
||||
readonly property real subRatio: 0.2*maxRange |
||||
readonly property real mainRatio: 1-subRatio*2.5 |
||||
|
||||
readonly property real minLength: Math.min(width, height) |
||||
readonly property real ratio:minLength*subRatio |
||||
readonly property real halfWidth: width/2 |
||||
readonly property real halfHeight: height/2 |
||||
readonly property real halfMinLength: minLength/2 |
||||
readonly property real logAmplitude: Math.log10(amplitude) |
||||
|
||||
|
||||
onConfigsUpdated: { |
||||
context.lineWidth = configs["Line Width"]; |
||||
context.strokeStyle = configs["Main Color"]; |
||||
} |
||||
offsetAngle = rotateFlag ? ((offsetAngle + rSpeed) % 360) : angle; |
||||
} |
||||
|
||||
onAudioDataUpdeted: { |
||||
if(autoNormalizing) { |
||||
if (unitStyle) { |
||||
//对数化显示 |
||||
let logPeak = Math.log10(data[128]); |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += Math.max(0, 0.4 * (Math.log10(data[i*uDataLen+j])-logPeak) + 1.0); |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
} |
||||
} else { |
||||
//线性化显示 |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += data[i*uDataLen+j] / data[128]; |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
function getPos(r, deg) { |
||||
return [halfWidth+Math.cos(deg)*r,halfHeight+Math.sin(deg)*r]; |
||||
} |
||||
|
||||
function createPoint() { |
||||
outerPos = []; |
||||
innerPos = []; |
||||
let deg, deltaR, r1, r2, _rhmLen; |
||||
_rhmLen = mainRatio*halfMinLength; |
||||
|
||||
for (let j=0; j < channel; j++) { |
||||
for (let i=0; i < dataLength; i++) { |
||||
deg = degUnit*((i+j*dataLength)*dotGap + offsetAngle); |
||||
deltaR = audioData[reverse*(dataLength-i-1)+(!reverse)*(i+j*dataLength)] * ratio; |
||||
r1 = _rhmLen+1+deltaR*(linePosition!==2); |
||||
r2 = _rhmLen-1-deltaR*(linePosition!==1); |
||||
outerPos.push(getPos(r1, deg)); |
||||
innerPos.push(getPos(r2, deg)); |
||||
} |
||||
} |
||||
} else { |
||||
if (unitStyle) { |
||||
//对数化显示 |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += Math.max(0, 0.35 * (Math.log10(data[i*uDataLen+j])+logAmplitude) + 1.0); |
||||
offsetAngle = rotateFlag ? ((offsetAngle + rSpeed) % 360) : angle; |
||||
} |
||||
|
||||
onAudioDataUpdeted: { |
||||
if(autoNormalizing) { |
||||
if (unitStyle) { |
||||
//对数化显示 |
||||
let logPeak = Math.log10(data[128]); |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += Math.max(0, 0.4 * (Math.log10(data[i*uDataLen+j])-logPeak) + 1.0); |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
} |
||||
} else { |
||||
//线性化显示 |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += data[i*uDataLen+j] / data[128]; |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
} |
||||
} else { |
||||
//线性化显示 |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += data[i*uDataLen+j] * amplitude; |
||||
if (unitStyle) { |
||||
//对数化显示 |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += Math.max(0, 0.35 * (Math.log10(data[i*uDataLen+j])+logAmplitude) + 1.0); |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
} |
||||
} else { |
||||
//线性化显示 |
||||
for(let i=0; i<total; i++) { |
||||
audioData[i] = 0; |
||||
for(let j=0; j<uDataLen; j++) { |
||||
audioData[i] += data[i*uDataLen+j] * amplitude; |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
} |
||||
audioData[i] /= uDataLen; |
||||
} |
||||
} |
||||
context.clearRect(0, 0, width+32, height+32); |
||||
createPoint(); |
||||
|
||||
context.beginPath(); |
||||
for(let i=0; i<total; i++) { |
||||
context.moveTo(outerPos[i][0], outerPos[i][1]); |
||||
context.lineTo(innerPos[i][0], innerPos[i][1]); |
||||
} |
||||
context.stroke(); |
||||
requestPaint(); |
||||
} |
||||
context.clearRect(0, 0, width+32, height+32); |
||||
createPoint(); |
||||
|
||||
context.beginPath(); |
||||
for(let i=0; i<total; i++) { |
||||
context.moveTo(outerPos[i][0], outerPos[i][1]); |
||||
context.lineTo(innerPos[i][0], innerPos[i][1]); |
||||
Component.onCompleted: { |
||||
for (let i = 0; i < 128; i++) { |
||||
audioData[i] = 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
defaultValues: { |
||||
"Version": "1.0.0", |
||||
"Main Color": "#ff4500", |
||||
"Line Position": 0, |
||||
"Line Width": 1, |
||||
"Max Range": 50, |
||||
"Data Length": 0, |
||||
"Channel": 2, |
||||
"Reverse": false, |
||||
"Rotate": false, |
||||
"Ratate Speed": 10, |
||||
"Angle": 0, |
||||
"Data Settings": { |
||||
"Auto Normalizing": true, |
||||
"Amplitude": 10, |
||||
"Unit Style": 0 |
||||
} |
||||
context.stroke(); |
||||
requestPaint(); |
||||
} |
||||
|
||||
Component.onCompleted: { |
||||
for (let i = 0; i < 128; i++) { |
||||
audioData[i] = 0; |
||||
preference: AdvpPreference { |
||||
version: defaultValues["Version"] |
||||
cfg_height: 740 |
||||
|
||||
P.ColorPreference { |
||||
name: "Main Color" |
||||
label: qsTr("Spectrum Line Color") |
||||
defaultValue: defaultValues["Main Color"] |
||||
} |
||||
|
||||
P.SelectPreference { |
||||
name: "Line Position" |
||||
label: qsTr("Spectrum Line Position") |
||||
defaultValue: defaultValues["Line Position"] |
||||
model: [qsTr("Both"), qsTr("Outside"), qsTr("Inside")] |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Line Width" |
||||
label: qsTr("Spectrum Line Width") |
||||
from: 0.1 |
||||
to: 10 |
||||
stepSize: 0.1 |
||||
defaultValue: defaultValues["Line Width"] |
||||
displayValue: value.toFixed(1) + "px" |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Max Range" |
||||
label: qsTr("Max Amplitude") |
||||
from: 0 |
||||
to: 100 |
||||
stepSize: 1 |
||||
defaultValue: defaultValues["Max Range"] |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.SelectPreference { |
||||
name: "Data Length" |
||||
label: qsTr("Spectrum Length") |
||||
defaultValue: defaultValues["Data Length"] |
||||
model: [64, 32, 16, 8] |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SpinPreference { |
||||
name: "Channel" |
||||
label: qsTr("Channel") |
||||
message: "1 to 2" |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: false |
||||
from: 1 |
||||
to: 2 |
||||
defaultValue: defaultValues["Channel"] |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
name: "Reverse" |
||||
label: qsTr("Reverse Spectrum") |
||||
defaultValue: defaultValues["Reverse"] |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_line_rotate |
||||
name: "Rotate" |
||||
label: qsTr("Auto Rotate") |
||||
defaultValue: defaultValues["Rotate"] |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Ratate Speed" |
||||
label: qsTr("Ratate Speed") |
||||
enabled: _cfg_preset_line_rotate.value |
||||
from: 1 |
||||
to: 100 |
||||
stepSize: 1 |
||||
defaultValue: defaultValues["Ratate Speed"] |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.SpinPreference { |
||||
name: "Angle" |
||||
label: qsTr("Initial Angle") |
||||
message: "0 to 359" |
||||
enabled: !_cfg_preset_line_rotate.value |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: true |
||||
from: 0 |
||||
to: 359 |
||||
defaultValue: defaultValues["Angle"] |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.DialogPreference { |
||||
name: "Data Settings" |
||||
label: qsTr("Data Settings") |
||||
live: true |
||||
icon.name: "regular:\uf1de" |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_circle_dataSettings_autoNormalizing |
||||
name: "Auto Normalizing" |
||||
label: qsTr("Auto Normalizing") |
||||
defaultValue: defaultValues["Data Settings"]["Auto Normalizing"] |
||||
} |
||||
|
||||
P.SpinPreference { |
||||
name: "Amplitude" |
||||
label: qsTr("Amplitude Ratio") |
||||
enabled: !_cfg_preset_circle_dataSettings_autoNormalizing.value |
||||
message: "1 to 100" |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: true |
||||
from: 1 |
||||
to: 100 |
||||
defaultValue: defaultValues["Data Settings"]["Amplitude"] |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SelectPreference { |
||||
name: "Unit Style" |
||||
label: qsTr("Display Style") |
||||
defaultValue: defaultValues["Data Settings"]["Unit Style"] |
||||
model: [qsTr("Linear"), qsTr("Decibel")] |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,161 +0,0 @@
|
||||
import QtQuick 2.12 |
||||
import NERvGear.Preferences 1.0 as P |
||||
|
||||
import "../../qml/api" //导入CfgAPI.qml |
||||
|
||||
CfgAPI { |
||||
version: "1.0.0" |
||||
cfg_height: 660 |
||||
|
||||
P.SelectPreference { |
||||
name: "Gradient Direction" |
||||
label: qsTr("Gradient Direction") |
||||
defaultValue: 0 |
||||
model: [qsTr("Horizontal"), qsTr("Vertical"), qsTr("Oblique Upward"), qsTr("Oblique downward")] |
||||
} |
||||
|
||||
P.ColorPreference { |
||||
name: "Start Position Color" |
||||
label: qsTr("Start Position Color") |
||||
defaultValue: "#f44336" |
||||
} |
||||
|
||||
P.ColorPreference { |
||||
name: "Middle Position Color" |
||||
label: qsTr("Middle Position Color") |
||||
defaultValue: "#4caf50" |
||||
} |
||||
|
||||
P.ColorPreference { |
||||
name: "End Position Color" |
||||
label: qsTr("End Position Color") |
||||
defaultValue: "#03a9f4" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
name: "Center Line" |
||||
label: qsTr("Show Center Line") |
||||
defaultValue: true |
||||
} |
||||
|
||||
P.SelectPreference { |
||||
name: "Line Position" |
||||
label: qsTr("Spectrum Line Position") |
||||
defaultValue: 0 |
||||
model: [qsTr("Both"), qsTr("Up"), qsTr("Down")] |
||||
} |
||||
|
||||
P.SelectPreference { |
||||
name: "Data Length" |
||||
label: qsTr("Spectrum Length") |
||||
defaultValue: 0 |
||||
model: [64, 32, 16, 8] |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SpinPreference { |
||||
id: _cfg_preset_line_Channel |
||||
name: "Channel" |
||||
label: qsTr("Channel") |
||||
message: "1 to 2" |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: false |
||||
from: 1 |
||||
to: 2 |
||||
defaultValue: 2 |
||||
} |
||||
|
||||
P.SwitchPreference { |
||||
name: "Reverse" |
||||
label: qsTr("Reverse Spectrum") |
||||
enabled: _cfg_preset_line_Channel.value === 1 |
||||
defaultValue: false |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.DialogPreference { |
||||
name: "Rotate Settings" |
||||
label: qsTr("Rotate Settings") |
||||
live: true |
||||
icon.name: "regular:\uf1de" |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_line_Rotate_Center_Enable |
||||
name: "Center Enable" |
||||
label: qsTr("Rotate Center Line") |
||||
defaultValue: false |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Center Angle" |
||||
label: qsTr("Angle of Center Line") |
||||
enabled: _cfg_preset_line_Rotate_Center_Enable.value |
||||
from: -45 |
||||
to: 45 |
||||
stepSize: 1 |
||||
defaultValue: 10 |
||||
displayValue: value + "°" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_line_Rotate_Line_Enable |
||||
name: "Line Enable" |
||||
label: qsTr("Rotate Spectrum Line") |
||||
defaultValue: false |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "Line Angle" |
||||
label: qsTr("Angle of Spectrum Line") |
||||
enabled: _cfg_preset_line_Rotate_Line_Enable.value |
||||
from: -75 |
||||
to: 75 |
||||
stepSize: 1 |
||||
defaultValue: 10 |
||||
displayValue: value + "°" |
||||
} |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.DialogPreference { |
||||
name: "Data Settings" |
||||
label: qsTr("Data Settings") |
||||
live: true |
||||
icon.name: "regular:\uf1de" |
||||
|
||||
P.SwitchPreference { |
||||
id: _cfg_preset_line_dataSettings_autoNormalizing |
||||
name: "Auto Normalizing" |
||||
label: qsTr("Auto Normalizing") |
||||
defaultValue: true |
||||
} |
||||
|
||||
P.SpinPreference { |
||||
name: "Amplitude" |
||||
label: qsTr("Amplitude Ratio") |
||||
enabled: !_cfg_preset_line_dataSettings_autoNormalizing.value |
||||
message: "1 to 100" |
||||
display: P.TextFieldPreference.ExpandLabel |
||||
editable: true |
||||
from: 1 |
||||
to: 100 |
||||
defaultValue: 10 |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SelectPreference { |
||||
name: "Unit Style" |
||||
label: qsTr("Display Style") |
||||
defaultValue: 0 |
||||
model: [qsTr("Linear"), qsTr("Decibel")] |
||||
} |
||||
} |
||||
} |
@ -1,187 +1,367 @@
|
||||
import QtQuick 2.12 |
||||
import QtQuick.Controls 2.12 |
||||
|
||||
import QtGraphicalEffects 1.12 |
||||
import NERvGear.Preferences 1.0 as P |
||||
|
||||
import "../../qml/api" //导入CfgAPI.qml |
||||
import "../../qml/api" |
||||
|
||||
Rectangle { |
||||
width: widget.width; |
||||
height: widget.height; |
||||
AdvpStyleTemplate { |
||||
style: Rectangle { |
||||
width: widget.width; |
||||
height: widget.height; |
||||
|
||||
LinearGradient { |
||||
id: gradient_mask |
||||
anchors.fill: parent |
||||
gradient: Gradient { |
||||
GradientStop { id: p_start; position: 0.0 } |
||||
GradientStop { id: p_middle; position: 0.5 } |
||||
GradientStop { id: p_end; position: 1.0 } |
||||
LinearGradient { |
||||
id: gradient_mask |
||||
anchors.fill: parent |
||||
gradient: |