import QtQuick 2.12 import NERvGear.Preferences 1.0 as P import "../../qml/api" AdvpStyleTemplate { style: AdvpCanvasTemplate { readonly property var audioData: new Array(128) readonly property bool autoNormalizing: configs["Data Settings"]["Auto Normalizing"] readonly property real amplitude: configs["Data Settings"]["Amplitude"] / 400.0 readonly property int uDataLen: Math.pow(2, configs["Data Length"]); readonly property int dataLength: 64/uDataLen readonly property int unitStyle: configs["Data Settings"]["Unit Style"] readonly property int total: dataLength*2 readonly property real ux: width/(total+1) readonly property real halfHeight: height/2 onConfigsUpdated: { //尽量不要使用绑定configs的属性以免造成竞争,若一定要使用推荐使用Qt.callLater(()=>{}) context.lineWidth = configs["Line Width"]; context.strokeStyle = configs["Line Color"]; } onAudioDataUpdeted: { data[128] *= 2; if(autoNormalizing) { if (unitStyle) { //对数化显示 for(let i=0; i