PageSourceSearch

https://www.stringkick.com/wp-content/themes/sk-genesis/js/sk-vue/TabPlayer.ce.K6LLMWtD.js

js stringkick.com collected 2026-10-03 22:47:38 UTC 15,629 bytes, 1 lines download raw bytes

vendor: 4,084 bytes, line 1
1import{o as t,c as e,F as s,r as a,t as i,d as o,b as n,a as r,u as l,ba as h,K as c,x as p,au as u,f as d,ay as b,e as f,m as _}from"./sk-vue.BcAGqpPP.js";import{u as m,o as y,v as g,g as x,w as v,x as k,y as E,z as T,A as w,B as S,E as P,H as I,I as D,S as L}from"./index.0bwconjg.js";import{p as O,e as R,n as z,f as A,j as N,k as B,l as $,m as C,g as M,o as q}from"./nylon_guitar_Bb4.1rk7J8Is.js";import"./soundPreference.Blft6w-I.js";class j extends m{constructor(){const t=y(j.getDefaults(),arguments,["callback","value"]);super(t),this.name="ToneEvent",this._state=new g("stopped"),this._startOffset=0,this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._playbackRate=t.playbackRate,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this._playbackRate=t.playbackRate,this._state.increasing=!0,this._rescheduleEvents()}static getDefaults(){return Object.assign(m.getDefaults(),{callback:x,humanize:!1,loop:!1,loopEnd:"1m",loopStart:0,mute:!1,playbackRate:1,probability:1,value:null})}_rescheduleEvents(t=-1){this._state.forEachFrom(t,t=>{let e;if("started"===t.state){-1!==t.id&&this.context.transport.clear(t.id);const s=t.time+Math.round(this.startOffset/this._playbackRate);if(!0===this._loop||v(this._loop)&&this._loop>1){e=1/0,v(this._loop)&&(e=this._loop*this._getLoopDuration());const a=this._state.getAfter(s);null!==a&&(e=Math.min(e,a.time-s)),e!==1/0&&(e=new k(this.context,e));const i=new k(this.context,this._getLoopDuration());t.id=this.context.transport.scheduleRepeat(this._tick.bind(this),i,new k(this.context,s),e)}else t.id=this.context.transport.schedule(this._tick.bind(this),new k(this.context,s))}})}get state(){return this._state.getValueAtTime(this.context.transport.ticks)}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t}get probability(){return this._probability}set probability(t){this._probability=t}get humanize(){return this._humanize}set humanize(t){this._humanize=t}start(t){const e=this.toTicks(t);return"stopped"===this._state.getValueAtTime(e)&&(this._state.add({id:-1,state:"started",time:e}),this._rescheduleEvents(e)),this}stop(t){this.cancel(t);const e=this.toTicks(t);if("started"===this._state.getValueAtTime(e)){this._state.setStateAtTime("stopped",e,{id:-1});const t=this._state.getBefore(e);let s=e;null!==t&&(s=t.time),this._rescheduleEvents(s)}return this}cancel(t){t=T(t,-1/0);const e=this.toTicks(t);return this._state.forEachFrom(e,t=>{this.context.transport.clear(t.id)}),this._state.cancel(e),this}_tick(t){const e=this.context.transport.getTicksAtTime(t);if(!this.mute&&"started"===this._state.getValueAtTime(e)){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){let e=.02;E(this.humanize)||(e=this.toSeconds(this.humanize)),t+=(2*Math.random()-1)*e}this.callback(t,this.value)}}_getLoopDuration(){return(this._loopEnd-this._loopStart)/this._playbackRate}get loop(){return this._loop}set loop(t){this._loop=t,this._rescheduleEvents()}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._rescheduleEvents()}get loopEnd(){return new k(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}get loopStart(){return new k(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}get progress(){if(this._loop){const t=this.context.transport.ticks,e=this._state.get(t);if(null!==e&&"started"===e.state){const s=this._getLoopDuration();return(t-e.time)%s/s}return 0}return 0}dispose(){return super.dispose(),this.cancel(),this._state.dispose(),this}}class H extends j{constructor(){const t=y(H.getDefaults(),arguments,["callback","events"]);super(t),this.name="Part",this._state=new g("stopped"),this._events=new Set,this._state.increasing=!0,t.events.forEach(t=>{w(t)?this.add(t[0],t[1]):this.add(t)})}static getDefaults(){return Object.assign(j.getDefaults(),{events:[]})}
1start(t,e){const s=this.toTicks(t);if("started"!==this._state.getValueAtTime(s)){e=T(e,this._loop?this._loopStart:0),e=this._loop?T(e,this._loopStart):T(e,0);const t=this.toTicks(e);this._state.add({id:-1,offset:t,state:"started",time:s}),this._forEach(e=>{this._startNote(e,s,t)})}return this}_startNote(t,e,s){e-=s,this._loop?t.startOffset>=this._loopStart&&t.startOffset<this._loopEnd?(t.startOffset<s&&(e+=this._getLoopDuration()),t.start(new k(this.context,e))):t.startOffset<this._loopStart&&t.startOffset>=s&&(t.loop=!1,t.start(new k(this.context,e))):t.startOffset>=s&&t.start(new k(this.context,e))}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t,this._forEach(t=>{t.startOffset+=this._startOffset})}stop(t){const e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._forEach(e=>{e.stop(t)}),this}at(t,e){const s=new S(this.context,t).toTicks(),a=new k(this.context,1).toSeconds(),i=this._events.values();let o=i.next();for(;!o.done;){const t=o.value;if(Math.abs(s-t.startOffset)<a)return P(e)&&(t.value=e),t;o=i.next()}return P(e)?(this.add(t,e),this.at(t)):null}add(t,e){t instanceof Object&&Reflect.has(t,"time")&&(t=(e=t).time);const s=this.toTicks(t);let a;return e instanceof j?(a=e,a.callback=this._tick.bind(this)):a=new j({callback:this._tick.bind(this),context:this.context,value:e}),a.startOffset=s,a.set({humanize:this.humanize,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,playbackRate:this.playbackRate,probability:this.probability}),this._events.add(a),this._restartEvent(a),this}_restartEvent(t){this._state.forEach(e=>{"started"===e.state?this._startNote(t,e.time,e.offset):t.stop(new k(this.context,e.time))})}remove(t,e){return I(t)&&t.hasOwnProperty("time")&&(t=(e=t).time),t=this.toTicks(t),this._events.forEach(s=>{s.startOffset===t&&(D(e)||P(e)&&s.value===e)&&(this._events.delete(s),s.dispose())}),this}clear(){return this._forEach(t=>t.dispose()),this._events.clear(),this}cancel(t){return this._forEach(e=>e.cancel(t)),this._state.cancel(this.toTicks(t)),this}_forEach(t){return this._events&&this._events.forEach(e=>{e instanceof H?e._forEach(t):t(e)}),this}_setAll(t,e){this._forEach(s=>{s[t]=e})}_tick(t,e){this.mute||this.callback(t,e)}_testLoopBoundries(t){this._loop&&(t.startOffset<this._loopStart||t.startOffset>=this._loopEnd)?t.cancel(0):"stopped"===t.state&&this._restartEvent(t)}get probability(){return this._probability}set probability(t){this._probability=t,this._setAll("probability",t)}get humanize(){return this._humanize}set humanize(t){this._humanize=t,this._setAll("humanize",t)}get loop(){return this._loop}set loop(t){this._loop=t,this._forEach(e=>{e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.loop=t,this._testLoopBoundries(e)})}get loopEnd(){return new k(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach(e=>{e.loopEnd=t,this._testLoopBoundries(e)})}get loopStart(){return new k(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach(t=>{t.loopStart=this.loopStart,this._testLoopBoundries(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._setAll("playbackRate",t)}get length(){return this._events.size}dispose(){return super.dispose(),this.clear(),this}}const W=["width","viewBox","height"],F=["x1","y1","x2","y2"],V=["x1","y1","x2","y2"],G=["x","y"],K=["x","y"],U=["x","y"],Y=["x","y","fill"],J={__name:"TabRenderer",props:{notePositions:{type:Array,required:!0},stringLines:{type:Array,required:!0},barLines:{type:Array,required:!0},stringLabels:{type:Array,required:!0},svgHeight:{type:Number,required:!0},svgWidth:{type:Number,required:!0},currentNoteIndex:{type:Number,default:-1}},setup:r=>(l,h)=>(t(),e("svg",{class:"tab-renderer",width:r.svgWidth,viewBox:`0 0 ${r.svgWidth} ${r.svgHeight}`,height:r.svgHeight,xmlns:"http://www.w3.org/2000/svg"},[(t(!0),e(s,null,a(r.stringLines,(s,a)=>(t(),e("line",{key:"string-"+a,class:"tab-string",x1:s.x1,y1:s.y,x2:s.x2,y2:s.y,stroke:"#999","stroke-width":"1"},null,8,F))),128)),(t(!0),e(s,null,a(r.barLines,(s,a)=>(t(),e("line",{key:"bar-"+a,class:"tab-barline",x1:s.x,y1:s.y1,x2:s.x,y2:s.y2,stroke:"#666","stroke-width":"1.5"},null,8,V))),128)),(t(!0),e(s,null,a(r.stringLabels,(s,a)=>(t(),e("text",{key:"label-"+a,class:"tab-label",x:s.x,y:s.y,"text-anchor":"end","dominant-baseline":"middle","font-size":"12","font-family":"monospace",fill:"#666"},i(s.label),9,G))),128)),r.currentNoteIndex>=0&&r.currentNoteIndex<r.notePositions.length?(t(),e("rect",{key:0,class:"tab-highlight",x:r.notePositions[r.currentNoteIndex].x-8,y:r.notePositions[r.currentNoteIndex].y-8,width:16,height:16,rx:"3",fill:"#4A90D9",opacity:"0.3"}
1,null,8,K)):o("",!0),(t(!0),e(s,null,a(r.notePositions,(a,o)=>(t(),e(s,{key:"note-"+o},[n("rect",{x:a.x-6,y:a.y-7,width:12,height:14,fill:"white"},null,8,U),n("text",{class:"tab-fret",x:a.x,y:a.y,"text-anchor":"middle","dominant-baseline":"middle","font-size":"12","font-family":"monospace","font-weight":"bold",fill:o===r.currentNoteIndex?"#4A90D9":"#333"},i(a.fret),9,Y)],64))),128))],8,W))},Q={class:"tab-controls"},X={class:"tab-controls-buttons"},Z={class:"tab-controls-tempo"},tt=["min","max","value"],et={class:"tab-tempo-display"},st=r({__name:"TabControls",props:{isPlaying:{type:Boolean,required:!0},currentTempo:{type:Number,required:!0},baseTempo:{type:Number,required:!0}},emits:["play","pause","stop","tempoChange"],setup:s=>(a,o)=>(t(),e("div",Q,[n("div",X,[n("button",{class:"tab-play-btn",onClick:o[0]||(o[0]=t=>s.isPlaying?a.$emit("pause"):a.$emit("play"))},i(s.isPlaying?"Pause":"Play"),1),n("button",{class:"tab-stop-btn",onClick:o[1]||(o[1]=t=>a.$emit("stop"))}," Stop ")]),n("div",Z,[n("input",{type:"range",class:"tab-tempo-slider",min:Math.round(.5*s.baseTempo),max:Math.round(1.5*s.baseTempo),value:s.currentTempo,onInput:o[2]||(o[2]=t=>a.$emit("tempoChange",Number(t.target.value)))},null,40,tt),n("span",et,i(s.currentTempo)+" BPM",1)])]))},[["styles",[".tab-controls[data-v-93f0eb47]{display:flex;align-items:center;gap:16px;padding:8px 0}.tab-controls-buttons[data-v-93f0eb47]{display:flex;gap:8px}.tab-controls-buttons button[data-v-93f0eb47]{padding:6px 16px;border:1px solid #ccc;border-radius:4px;background:#f5f5f5;cursor:pointer;font-size:14px}.tab-controls-buttons button[data-v-93f0eb47]:hover{background:#e8e8e8}.tab-controls-tempo[data-v-93f0eb47]{display:flex;align-items:center;gap:8px}.tab-tempo-slider[data-v-93f0eb47]{width:120px}.tab-tempo-display[data-v-93f0eb47]{font-size:13px;font-family:monospace;color:#666;min-width:65px}"]],["__scopeId","data-v-93f0eb47"]]),at=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],it={6:40,5:45,4:50,3:55,2:59,1:64};function ot(t,e){const s=it[t]+e;return`${at[s%12]}${Math.floor(s/12)-1}`}function nt(t){const e=l(!1),s=l(-1),a=l(t.tempo);let i=null,o=null,n=null;const r=parseInt(t.timeSignature.split("/")[0]),u=p(()=>{const e=[];return t.bars.forEach((t,s)=>{t.notes.forEach(t=>{const a=t.position.split(":"),i=`${s+parseInt(a[0])}:${a[1]}:${a[2]}`;e.push({...t,absolutePosition:i,pitch:ot(t.string,t.fret)})})}),e});function d(){const t=O();t.stop(),t.position="0:0:0",o&&(o.dispose(),o=null),null!==n&&(t.clear(n),n=null),t.cancel(),e.value=!1,s.value=-1}const b=q(()=>{if(o){try{o.dispose()}catch{}o=null}if(i){try{i.dispose()}catch{}i=null}n=null,e.value=!1,s.value=-1});return h()&&c(()=>{(i||o)&&d(),b(),i&&(i.dispose(),i=null)}),{isPlaying:e,currentNoteIndex:s,currentTempo:a,noteList:u,play:async function(){await R(),i||(i=new L({urls:{E2:C,Bb2:$,E3:B,Bb3:N,E4:A,Bb4:z},release:1,attack:.01,context:M()}).toDestination(),i.volume.value=-1);const l=O();l.bpm.value=a.value,l.timeSignature=r,e.value||("0:0:0"!==l.position&&-1!==s.value||function(){const e=O();o&&o.dispose(),null!==n&&e.clear(n);const a=u.value.map((t,e)=>({time:t.absolutePosition,pitch:t.pitch,duration:t.duration,index:e}));o=new H((t,e)=>{i.triggerAttackRelease(e.pitch,e.duration,t),s.value=e.index},a.map(t=>[t.time,t])),o.start(0);const r=`${t.bars.length}:0:0`;n=e.schedule(()=>{d()},r)}(),l.start(),e.value=!0)},pause:function(){O().pause(),e.value=!1},stop:d,setTempo:function(t){a.value=t,O().bpm.value=t}}}const rt=30;const lt={key:0,class:"tab-player-title"};const ht=r({name:"TabPlayer",components:{TabPlayerCore:r({__name:"TabPlayerCore",props:{tabData:{type:Object,required:!0}},setup(s){const a=s,n=l(null),r=l(600);let h=null;u(()=>{n.value&&(r.value=n.value.clientWidth,h=new ResizeObserver(t=>{r.value=t[0].contentRect.width}),h.observe(n.value))}),c(()=>{h&&h.disconnect()});const{notePositions:f,stringLines:_,barLines:m,stringLabels:y,svgHeight:g}=function(t,e){const s=parseInt(t.timeSignature.split("/")[0]),a=105,i=p(()=>20*s*2);function o(t){return 25+14*(t-1)}const n=p(()=>{const s=e.value-rt,a=i.value+30,o=Math.max(1,Math.floor(s/a)),n=[];for(let e=0;e<t.bars.length;e+=o)n.push({barIndices:t.bars.slice(e,e+o).map((t,s)=>e+s),startBarIndex:e});return n}),r=p(()=>{const t=n.value[0]?.barIndices.length||1;return(e.value-rt)/t});function l(t){return r.value}
1const h=p(()=>{const e=[];let a=0;return n.value.forEach((i,n)=>{const l=125*n;i.barIndices.forEach((i,h)=>{const c=t.bars[i],p=rt+h*r.value;c.notes.forEach(t=>{const i=t.position.split(":"),h=15+(parseInt(i[1])+parseInt(i[2])/4)/s*(r.value-30);e.push({x:p+h,y:l+o(t.string),noteIndex:a,lineIndex:n,fret:t.fret}),a++})})}),e}),c=p(()=>{const t=[];return n.value.forEach((e,s)=>{const a=125*s,i=a+o(1),n=a+o(6);t.push({x:rt,y1:i,y2:n,lineIndex:s}),e.barIndices.forEach((e,a)=>{const o=rt+(a+1)*l();t.push({x:o,y1:i,y2:n,lineIndex:s})})}),t}),u=p(()=>{const t=[];return n.value.forEach((e,s)=>{const a=125*s,i=rt+e.barIndices.length*l();for(let n=1;n<=6;n++)t.push({x1:30,x2:i,y:a+o(n),string:n,lineIndex:s})}),t}),d=["e","B","G","D","A","E"],b=p(()=>{const t=[];return n.value.forEach((e,s)=>{const a=125*s;for(let i=1;i<=6;i++)t.push({x:25,y:a+o(i),label:d[i-1],lineIndex:s})}),t}),f=p(()=>{const t=n.value.length;return t*a+20*(t-1)});return{notePositions:h,barLines:c,stringLines:u,stringLabels:b,lines:n,svgHeight:f,barWidth:r,stringY:o}}(a.tabData,r),{isPlaying:x,currentNoteIndex:v,currentTempo:k,play:E,pause:T,stop:w,setTempo:S}=nt(a.tabData);return(a,l)=>(t(),e("div",{class:"tab-player",ref_key:"containerRef",ref:n},[s.tabData.title?(t(),e("div",lt,i(s.tabData.title),1)):o("",!0),d(J,{notePositions:b(f),stringLines:b(_),barLines:b(m),stringLabels:b(y),svgHeight:b(g),svgWidth:r.value,currentNoteIndex:b(v)},null,8,["notePositions","stringLines","barLines","stringLabels","svgHeight","svgWidth","currentNoteIndex"]),d(st,{isPlaying:b(x),currentTempo:b(k),baseTempo:s.tabData.tempo,onPlay:b(E),onPause:b(T),onStop:b(w),onTempoChange:b(S)},null,8,["isPlaying","currentTempo","baseTempo","onPlay","onPause","onStop","onTempoChange"])],512))}},[["styles",[".tab-player[data-v-f1969105]{width:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.tab-player-title[data-v-f1969105]{font-size:14px;font-weight:600;color:#333;margin-bottom:8px}"]],["__scopeId","data-v-f1969105"]])},props:{prefix:{type:String,default:"tabPlayer"}},data:()=>({tabData:null}),created(){const t=this.prefix+"_externalData";window[t]?this.tabData=window[t]:console.warn(`[TabPlayer] No external data found for ${t}`)}},[["render",function(e,s,a,i,n,r){const l=f("TabPlayerCore");return n.tabData?(t(),_(l,{key:0,tabData:n.tabData},null,8,["tabData"])):o("",!0)}]]);export{ht as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.