diff --git a/Locales/ja_JP.qm b/Locales/ja_JP.qm index 204b7ce..06df954 100644 Binary files a/Locales/ja_JP.qm and b/Locales/ja_JP.qm differ diff --git a/Locales/zh.qm b/Locales/zh.qm index 70de469..41930fc 100644 Binary files a/Locales/zh.qm and b/Locales/zh.qm differ diff --git a/Locales/zh_CN.qm b/Locales/zh_CN.qm index ef3937b..705aee3 100644 Binary files a/Locales/zh_CN.qm and b/Locales/zh_CN.qm differ diff --git a/Presets/Gradient_Line/settings.xml b/Presets/Gradient_Line/settings.xml index f60ec93..a14c747 100644 --- a/Presets/Gradient_Line/settings.xml +++ b/Presets/Gradient_Line/settings.xml @@ -1,5 +1,5 @@ "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}} + {"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,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}} \ No newline at end of file diff --git a/Presets/Line/settings.xml b/Presets/Line/settings.xml index 1a4a28b..9b4df8e 100644 --- a/Presets/Line/settings.xml +++ b/Presets/Line/settings.xml @@ -1,5 +1,5 @@ - {"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}} + {"Center Line":true,"Center Color":"#ff4500","Line Color":"#ff4500","Line Position":0,"Data Length":0,"Channel":2,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}} "nvg://advp.widget.mashiros.top/advp-style-preset/line" \ No newline at end of file diff --git a/qml/StylePreferences.qml b/qml/StylePreferences.qml index 38a8484..849bdef 100644 --- a/qml/StylePreferences.qml +++ b/qml/StylePreferences.qml @@ -77,8 +77,8 @@ NVG.Window { onPreferenceEdited: { if (widget.settings.current_style !== Common.stylesURL[styleList.value]) { widget.settings[widget.settings.current_style] = old_style_cfg; - old_style_cfg = widget.settings[Common.stylesURL[styleList.value]]; widget.settings.current_style = Common.stylesURL[styleList.value]; + old_style_cfg = widget.settings[widget.settings.current_style]; } let cfg = rootPreference.save(); widget.settings[widget.settings.current_style] = cfg[widget.settings.current_style]; diff --git a/styles/Preset_Ordinal_Scale_UI_bottom/Style.qml b/styles/Preset_Ordinal_Scale_UI_bottom/Style.qml index 5ebb6b8..062d5be 100644 --- a/styles/Preset_Ordinal_Scale_UI_bottom/Style.qml +++ b/styles/Preset_Ordinal_Scale_UI_bottom/Style.qml @@ -20,11 +20,11 @@ AdvpStyleTemplate { readonly property real halfWidth: width/2 readonly property real rHeight: 0.6*height - readonly property real this_speed: configs["Speed"]/100 - readonly property real this_MAX: (height/2)-4 - readonly property real this_noise: configs["Static AM"]/100*this_MAX - readonly property real this_delta: this_MAX-this_noise - property real this_phase: 0 + readonly property real speed: configs["Speed"]/100 + readonly property real _MAX: (height/2)-4 + readonly property real _noise: configs["Static AM"]/100*_MAX + readonly property real _delta: _MAX-_noise + property real _phase: 0 readonly property var _globalAttenuationArray: [0.0017856573042805614, 0.002090029027424354, 0.0024428709787506155, 0.0028511620549328143, 0.003322734461672416, 0.0038663486688144872, 0.004491769417010894, 0.0052098416088514335, 0.0060325646905618185, 0.006973163895798498, 0.008046156486762173, 0.009267410897150058, 0.010654196465028541, 0.012225221251394174, 0.014000655282882916, 0.016002136446407085, 0.018252756211446522, 0.0207770223741957, 0.023600796118042038, 0.026751200876932862, 0.03025650078017051, 0.034145946854542274, 0.038449589664666724, 0.04319805768336597, 0.048422301394722714, 0.054153303932507744, 0.06042175993022312, 0.06725772518564865, 0.07469024069755677, 0.08274693558633812, 0.09145361433175414, 0.10083383461611592, 0.11090848281544048, 0.12169535480100475, 0.13320875016810133, 0.14545908827055729, 0.15845255448710202, 0.1721907849641367, 0.18667059766189825, 0.20188377687903944, 0.21781691755482288, 0.23445133456773634, 0.2517630409920839, 0.26972279787490494, 0.28829623659542597, 0.3074440533134911, 0.32712227344992756, 0.3472825826188692, 0.36787271899666724, 0.38883692080749416, 0.4101164214705023, 0.43164998401902316, 0.4533744656929005, 0.4752254031360044, 0.4971376084092084, 0.5190457660525851, 0.5408850216893105, 0.562591553140178, 0.5841031156880014, 0.6053595539666616, 0.6263032739177719, 0.6468796693242911, 0.6670374985596821, 0.6867292083486696, 0.7059112024886071, 0.7245440545987721, 0.7425926650223671, 0.760026362980347, 0.7768189559498792, 0.7929487290003452, 0.8083983974579334, 0.8231550167821777, 0.8372098539242965, 0.8505582247014246, 0.8631993018695427, 0.875135898619801, 0.8863742321691508, 0.8969236719785354, 0.9067964769231723, 0.9160075254728139, 0.9245740426279158, 0.9325153270127456, 0.9398524811601155, 0.9466081476449091, 0.9528062533442774, 0.9584717637292349, 0.9636304487320935, 0.9683086613922199, 0.9725331301632185, 0.9763307654708479, 0.9797284808449854, 0.9827530287117202, 0.9854308507237252, 0.9877879423279077, 0.9898497311182406, 0.9916409683972773, 0.9931856332704053, 0.9945068485207086, 0.9956268074571305, 0.9965667108926166, 0.9973467133897048, 0.997985877906754, 0.9985021379865716, 0.9989122666488067, 0.9992318511763106, 0.9994752730222837, 0.9996556921079202, 0.9997850348281199, 0.9998739851348633, 0.999931978122665, 0.9999671955978632, 0.999986563172305, 0.9999957484820413, 0.9999991601923922, 0.9999999475120023, 1.0, 0.9999999475120023, 0.9999991601923922, 0.9999957484820413, 0.999986563172305, 0.9999671955978632, 0.999931978122665, 0.9998739851348633, 0.9997850348281199, 0.9996556921079202, 0.9994752730222837, 0.9992318511763106, 0.9989122666488067, 0.9985021379865716, 0.997985877906754, 0.9973467133897048, 0.9965667108926166, 0.9956268074571305, 0.9945068485207086, 0.9931856332704053, 0.9916409683972773, 0.9898497311182406, 0.9877879423279077, 0.9854308507237252, 0.9827530287117202, 0.9797284808449854, 0.9763307654708498, 0.9725331301632185, 0.9683086613922199, 0.9636304487320935, 0.9584717637292349, 0.9528062533442774, 0.9466081476449091, 0.9398524811601155, 0.9325153270127456, 0.9245740426279158, 0.9160075254728139, 0.9067964769231723, 0.8969236719785354, 0.8863742321691508, 0.875135898619801, 0.8631993018695436, 0.8505582247014246, 0.8372098539242965, 0.8231550167821794, 0.8083983974579334, 0.7929487290003452, 0.7768189559498792, 0.760026362980347, 0.7425926650223671, 0.7245440545987721, 0.7059112024886071, 0.6867292083486696, 0.6670374985596821, 0.6468796693242911, 0.6263032739177719, 0.6053595539666616, 0.5841031156880014, 0.562591553140178, 0.5408850216893111, 0.5190457660525862, 0.49713760840920945, 0.4752254031360049, 0.4533744656929005, 0.43164998401902366, 0.4101164214705023, 0.3888369208074946, 0.36787271899666724, 0.34728258261887, 0.3271222734499283, 0.30744405331349145, 0.28829623659542597, 0.26972279787490555, 0.2517630409920839, 0.2344513345677366, 0.21781691755482313, 0.2018837768790397, 0.18667059766189847, 0.17219078496413692, 0.15845255448710202, 0.14545908827055729, 0.13320875016810133, 0.12169535480100475, 0.11090848281544048, 0.10083383461611592, 0.09145361433175414, 0.08274693558633812, 0.07469024069755677, 0.06725772518564865, 0.060421759930223286, 0.054153303932507744, 0.048422301394722776, 0.0431980576833661, 0.038449589664666724, 0.034145946854542274, 0.0302565007801706, 0.026751200876932904, 0.023600796118042038, 0.020777022374195733, 0.018252756211446522, 0.016002136446407085, 0.014000655282882938, 0.012225221251394195, 0.010654196465028541, 0.009267410897150073, 0.008046156486762187, 0.00697316389579851, 0.006032564690561829, 0.0052098416088514335, 0.004491769417010894, 0.0038663486688144872, 0.003322734461672416, 0.0028511620549328143, 0.0024428709787506155, 0.002090029027424354, 0.0017856573042805614, 0.0015235572708080104, 0.001298240554271166, 0.001104862087804041, 0.0009391569963475799, 0.000797381501252183, 0.0006762579957286263, 0.0005729243418569506, 0.00048488735639869217, 0.0004099803857607644, 0.00034632481850304286, 0.00029229534504994666, 0.0002464887470267302, 0.00020769598120373757, 0.00017487731379413836, 0.0001471402583278278, 0.0001237200731699464, 0.00010396258176888504, 8.730908885950263e-05, 7.328317821506653e-05]; @@ -52,9 +52,7 @@ AdvpStyleTemplate { context.resetTransform(); for (let i=0; i<=249; i+=1) { x = halfWidth*(0.54+i/250); - // y = rHeight + (this.noise + ns) * _globalAttenuationArray[i] * Math.sin((-24.84+i*4.5*12/n)-phase); - y = rHeight + (this_noise + ns) * _globalAttenuationArray[i] * Math.sin((-24.84+i*0.216)-_phase); - // ctx.transform(1, -0.066284+i*0.0454/n, 0, 1, 0, 0); + y = rHeight + (_noise + ns) * _globalAttenuationArray[i] * Math.sin((-24.84+i*0.216)-_phase); context.transform(1, -0.066284+i*0.0001816, 0, 1, 0, 0); context.lineTo(x, y); context.resetTransform(); @@ -72,7 +70,16 @@ AdvpStyleTemplate { context.stroke(); } - function draw() { + onAudioDataUpdeted: { + if(autoNormalizing) { + for (let i = 0; i < 128; i++) { + audioData[i] = data[i] / data[128]; + } + } else { + for (let i = 0; i < 128; i++) { + audioData[i] = data[i] * amplitude; + } + } let trebleAm = 0; let altoAm = 0; let bassAm = 0; @@ -91,28 +98,15 @@ AdvpStyleTemplate { altoAm = altoAm / 19.2; bassAm = bassAm / 6.4; - this_phase = (this_phase+this_speed)%(Math.PI*64); + _phase = (_phase+speed)%(Math.PI*64); context.clearRect(0, 0, width+32, height+32); - drawLine(this_delta*trebleAmRatio*trebleAm, trebleColor, 1.5, this_phase, false); - drawLine(this_delta*bassAmRatio*bassAm, bassColor, 1.5, this_phase+0.8, false); - drawLine(this_delta*altoAmRatio*altoAm, altoColor, 2, this_phase+0.4, true); + drawLine(_delta*trebleAmRatio*trebleAm, trebleColor, 1.5, _phase, false); + drawLine(_delta*bassAmRatio*bassAm, bassColor, 1.5, _phase+0.8, false); + drawLine(_delta*altoAmRatio*altoAm, altoColor, 2, _phase+0.4, true); context.beginPath(); context.stroke(); - } - - onAudioDataUpdeted: { - if(autoNormalizing) { - for (let i = 0; i < 128; i++) { - audioData[i] = data[i] / data[128]; - } - } else { - for (let i = 0; i < 128; i++) { - audioData[i] = data[i] * amplitude; - } - } - draw(); requestPaint(); } @@ -205,8 +199,6 @@ AdvpStyleTemplate { displayValue: value + "%" } - P.Separator {} - P.SliderPreference { name: "Speed" label: qsTr("Wave Speed") diff --git a/styles/Preset_circle/Style.qml b/styles/Preset_circle/Style.qml index 45a3fa2..2cf2dcd 100644 --- a/styles/Preset_circle/Style.qml +++ b/styles/Preset_circle/Style.qml @@ -18,7 +18,7 @@ AdvpStyleTemplate { 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 real amplitude: 400/configs["Data Settings"]["Amplitude"] readonly property int unitStyle: configs["Data Settings"]["Unit Style"] readonly property int total: channel*dataLength @@ -37,7 +37,6 @@ AdvpStyleTemplate { 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: { @@ -45,13 +44,9 @@ AdvpStyleTemplate { context.strokeStyle = configs["Main Color"]; } - function getPos(r, deg) { - return [halfWidth+Math.cos(deg)*r,halfHeight+Math.sin(deg)*r]; - } - function createPoint() { - outerPos = []; - innerPos = []; + outerPos.length = 0; + innerPos.length = 0; let deg, deltaR, r1, r2, _rhmLen; _rhmLen = mainRatio*halfMinLength; @@ -61,56 +56,35 @@ AdvpStyleTemplate { 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)); + outerPos.push([halfWidth+Math.cos(deg)*r1,halfHeight+Math.sin(deg)*r1]); + innerPos.push([halfWidth+Math.cos(deg)*r2,halfHeight+Math.sin(deg)*r2]); } } offsetAngle = rotateFlag ? ((offsetAngle + rSpeed) % 360) : angle; } onAudioDataUpdeted: { - if(autoNormalizing) { - if (unitStyle) { - //对数化显示 - let logPeak = Math.log10(data[128]); - for(let i=0; i