From e7e3946492ecef8b19c044085684c7c77727b322 Mon Sep 17 00:00:00 2001 From: mashiros <490328928@qq.com> Date: Mon, 18 Apr 2022 22:47:25 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locales/ja_JP.qm | Bin 2999 -> 3164 bytes Locales/zh.qm | Bin 2909 -> 3058 bytes Locales/zh_CN.qm | Bin 2909 -> 3058 bytes Presets/Gradient_Line/settings.xml | 2 +- Presets/Line/settings.xml | 2 +- qml/StylePreferences.qml | 2 +- styles/Preset_Ordinal_Scale_UI_bottom/Style.qml | 48 +++---- styles/Preset_circle/Style.qml | 68 ++++------ styles/Preset_gradient_line/Style.qml | 158 +++++++---------------- styles/Preset_line/Style.qml | 159 +++++++----------------- styles/Preset_solidcircle/Style.qml | 67 +++------- styles/Preset_waves/Style.qml | 92 +++++--------- 12 files changed, 180 insertions(+), 418 deletions(-) diff --git a/Locales/ja_JP.qm b/Locales/ja_JP.qm index 204b7ce7d96d855119e7e8dc36f5809403b4dae4..06df9546eb6dad5c7262b8abece1e22836a29c06 100644 GIT binary patch delta 491 zcmdlken(=0oZuxz`>z`$I{AiQfS0|Uo_iS}Yi?6wRa zewi{bFlsOgt$D-1z{1HWeP|5>1DiIJ-l`y=>d8!(4vPRyI?ntyG8L#UiIsIeP&Z2g zE2mg10|PrdtATeDkiU(!nqw2t)Gw^7PV5KLGg#L!9cEzQ3Z1xI-g6pT_IDMaAw_Hp z{{szSn83E{^H!jyTWqK2e+7y!Vte)C5zw$Awl|6YfKGnL_P0(0$p6T0p)Lw^%yIVk z%_Ttb+{yfm;({|dUxfStdT2kFn!{b7?yr;08RhCZba-lBB>}mdJhT4n0V;Oq+09rC zv@9D!bE)v0T)+q9Gw_^U1k}#b!t*_B2~fQYudMeXpmFBB4?=;C<4EI^c+3ivH{_ec z>@aw4@R?)t8O910WuDk)1_uou z8+>o^C#e04{?I27e587(6%l k%mFfx4Tv|tVJu+T+{aeNIQanw`(`^1Bc{zWxQ;La0E3ZXp#T5? diff --git a/Locales/zh.qm b/Locales/zh.qm index 70de469b4448420ae2e47e5acb4aa6a1306b8ad9..41930fc8e843135b3447aa37560da62537f49b6e 100644 GIT binary patch delta 556 zcmY+AYemQF^ZYNr=Q$_m{p9PeNL&Nd zeZb5@_FMvtFyzf~z|n;A!Hev-V*QiX)YWL;y#T;l>_27#x`e{FC4lgY*{LbcC&au5 zDY8mNV4#6|mob)^Lw(BeVMCOAjY{>BCzmVBdyw}T6|C<967sOxYhI_(2{rKe9_tE~ zGBSYmQN8$FN5g;`-*SV1M>_bdmI23fFkeo)IlJBu)8M!%&$Tf5RWln-@?fcz zZ=9y#Wmom89DxsAx4u$4L~^C@C7#;*CR=Hjv(HT5VeEJIZLyOvBEPG3*Ut8Ns9}%x z^GdeZrSJt({OBr-3=XW f?SB@II{k)E?-^MaYA*Z(=ukWwi|$DGSi|BM3wx6p delta 467 zcmew)ephUQT>T6N2G#=%3>-cTEYnsnFffHNuxz`>z`z{NAiQfS0|Wb0hJbTVfqV^y zj7oV128QPhjr|-93~UP+KKwFeU|^JB6k78JDF2j6Z&eVGu4KA&SOjQhF7w;SRG@qa zE9-oqIV?7;oMNp&eL1WK-c3M$0&6wLCI*Ij4sq5sOotg5IEz?se{lg?pvQVIc`H!k zF*bvX#y|&MVKaCk4AjWXmi=7?Xs{I9!v8>n8CuwOeFmyyX<<7(|0_`3gYDIeM?iHK z+1@1n1DeOl_P0(0=m95o3w2STxCwjw<`SSsC$TrZJ`Oa05(mq?I0j_~=8YUD!zKeI zc5%K4`2)0YEti_ZU7&%pxpw{l@|l?@`!kBySMt=nN&;H9nP=9YJwVktJi8f-fzF7B z(43AuCl~Mm`3yYY!ydx<}kYgO+U+b)2N=XaHv=(ySZYymX8z{4j5C~7+{Lnn ZadQ$|F5~0?7W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z{4j5C "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