Changeset 37254 for gs3-installations
- Timestamp:
- 2023-02-02T17:34:42+13:00 (15 months ago)
- Location:
- gs3-installations/mars/trunk/sites/mars/collect/amc-essentia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/etc/collectionConfig.xml
r37238 r37254 620 620 <span id="hide-av-chart" class="display-view-modes hd-chart-label" onclick="return hideAVChart();">Hide AV Chart</span> 621 621 </span> 622 <!-- Keep if ever wanting to go back to logging in to record AV experience --> 623 <!-- 622 624 <span style="display: inline-block; width: 270px;"> 623 625 | <span id="login-to-record-av" class="display-view-modes" onclick="loginToRecord()">⏺ Login to record <i>your</i> AV experience</span> 624 <span id="record-av" class="display-view-modes" onclick="loginToRecord()">625 ⏺ Record <i>your</i> AV experience (<a id="record-av-logout" href="">logout</a>)626 <span id="record-av" class="display-view-modes" onclick="loginToRecord()"> 627 ⏺ Record <i>your</i> AV experience (<a id="record-av-logout" href="">logout</a>) 626 628 </span> 627 629 </span> 630 --> 631 632 <span style="display: inline-block; width: 270px;"> 633 | <span id="record-av" class="display-view-modes" style="display: inline;" onclick="loginToRecord()"> 634 ⏺ Customise your AV experience 635 </span> 636 </span> 637 628 638 </div> 629 639 … … 732 742 <style> 733 743 .recommend-cursor { 734 cursor: url(<xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collName"/>/images/ font_awesome--crosshair-black32.png) 16 16, crosshair744 cursor: url(<xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collName"/>/images/crosshair-cursor-black32.png) 16 16, crosshair 735 745 } 736 746 .record-cursor { 737 cursor: url(<xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collName"/>/images/ font_awesome--crosshair-red32.png) 16 16, crosshair747 cursor: url(<xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collName"/>/images/crosshair-cursor-red32.png) 16 16, crosshair 738 748 } 739 749 </style> 740 750 <gsf:variable name="collImagesURL"><xsl:value-of select="$library_name"/>/sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="$collName"/>/images</gsf:variable> 741 751 <div id="start-av-recording" style="display:none;"> 742 To make an AV-Recording: <span id="av-recording-coords" style="display:none;">AV coord: </span> 752 To customise your Musical Affect Recommender experience, use the AV circle below to record 753 the Arousal-Valence levels you perceive. This is used by MARS to personalise the 754 recommendations the system makes. The more musical works you record AV values for, 755 the more data MARS has to go on. 756 <span id="av-recording-coords" style="display:none;">AV coord: </span> 743 757 <ul> 744 758 <li>Click in the centre of the Arousal-Valence space below to initiate recording</li> 745 759 <li>Move your mouse-cursor around inside the circle to reflect the Arousal-Valence levels you perceive</li> 746 <li>Click again inside the circle at any point, if you want to cancel the recording</li> 760 <li>Click again inside the circle at any point, if you want to cancel/pause or save the recording</li> 761 <li>If you listen all the way through to the end of the work, you will be promted at the end about canceling or saving the recording.</li> 747 762 </ul> 748 763 </div> 749 764 765 <gsf:div id="cancel-resume-save-confirm-div"/> 750 766 751 <div id="av-chart-div" style="position: relative; heightXXX: 325px; width: 300px; margin: auto"> <!-- av-chart-width av-chart-height + 25-->752 <div style="position: absolute; top: 0; left : 0; width: 300px; height: 300px; pointer-events: none;"> <!-- av-chart-width -->767 <div id="av-chart-div" style="position: relative; heightXXX: 325px; width: 300px; widthXXXYYY: 400px; margin: auto"> <!-- av-chart-width av-chart-height + 25--> 768 <div style="position: absolute; top: 0; leftXXXYYY: 50px; width: 300px; height: 300px; pointer-events: none;"> <!-- av-chart-width --> 753 769 <canvas id="av-chart-canvas" style="XXwidth: 100%; height: 300px;"> <!-- av-chart-width --> 754 770 Your browser does not support the canvas element … … 756 772 </div> 757 773 <!-- VVV av-chart-width --> 758 <img id="av-chart-img" classXXXX="recommend-cursor" width="300"759 style="cursor: crosshair; "774 <img id="av-chart-img" width="300" 775 style="cursor: crosshair; padding-leftXXXYYY: 50px;" 760 776 src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/av-diagram-bw.svg" /> 761 762 <img id="av-chart-img-unlabeled" class="record-cursor" width="400" 763 style="cursorXX: crosshair; background-colorXX: #fefefe; display: none;" 764 src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/av-diagram-bw--unlabeled.svg" /> 765 777 778 <div> 779 <canvas id="av-chart-canvas-unlabeled" width="400" height="362" 780 style="position: absolute; top: 0; left: 0px; widthXXX: 400px; heightXXX: 362px; heightXXX: 100%; opacity:1.0; pointer-events: none;"> 781 Your browser does not support the canvas element 782 </canvas> 783 <img id="av-chart-img-unlabeled" class="record-cursor" width="400" 784 style="background-colorXX: #fefefe; display: none;" 785 src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/av-diagram-bw--unlabeled.svg" /> 786 </div> 766 787 767 788 <!-- -
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/js/av_document.js
r37238 r37254 18 18 function AVPlay() 19 19 { 20 // Restore play/pause toggle button back to 'ready to play' i.e., showing pause button 20 21 $('#ws-play-icon' ).hide(); 21 22 $('#ws-pause-icon').show(); … … 387 388 }); 388 389 390 wavesurfer.on('finish', function () { 391 // auto stop RecordingUserAV 392 av_chart_record_finish(); 393 }); 394 389 395 wavesurfer.on('ready', function () { 390 396 … … 532 538 } 533 539 540 var isRecordingUserAV = false; 541 542 function crsc_popup_close($elem) 543 { 544 $elem.parents('.dialog-ovelay').fadeOut(500, function () { 545 $elem.remove(); 546 }); 547 } 548 549 function crsc_popup_cancel_callback() 550 { 551 console.log("Canceling RecordingUserAV"); 552 553 var av_canvas = document.getElementById("av-chart-canvas-unlabeled"); 554 var av_context = av_canvas.getContext("2d"); 555 556 av_context.clearRect(0, 0, av_canvas.width, av_canvas.height); 557 558 crsc_popup_close($(this)); 559 560 561 if ('p_frameOffset' in gs.cgiParams) { 562 var frameOffset = gs.cgiParams['p_frameOffset']; 563 wavesurfer.seekTo(frameOffset/AMC_SONG_DURATION); 564 recommendFromPos(); 565 displayClampedCurrentTimeAndAV(); 566 } 567 else { 568 AVSeekTo(0); 569 } 570 571 } 572 573 function crsc_popup_resume_callback() 574 { 575 console.log("Resuming RecordingUserAV"); 576 isRecordingUserAV = true; 577 crsc_popup_close($(this)); 578 AVPlay(); 579 } 580 581 function crsc_popup_save_callback() 582 { 583 console.log("Saving to your browser RecordingUserAV"); 584 crsc_popup_close($(this)); 585 } 586 587 534 588 535 589 function av_chart_record_click(elem,event) 536 590 { 537 console.error("Recording mode to be implemented!") 591 if (isRecordingUserAV == false) { 592 isRecordingUserAV = true; 593 594 if (!wavesurfer.backend.isPaused()) { 595 console.log("Starting recording user's AV values"); 596 AVSeekTo(0); 597 } 598 else { 599 console.log("Resuming recording user's AV values"); 600 } 601 AVPlay() 602 } 603 else { 604 AVEnsurePaused(); 605 // Have stopped recording 606 // => Store recorded values into LocalStorage 607 isRecordingUserAV = false; 608 609 610 CancelResumeSaveConfirm('Customised AV Recording', 'Would you like to save this AV Recording?', 611 'Cancel and Start Over', 'Resume Recording', "Save", 612 crsc_popup_cancel_callback, crsc_popup_resume_callback, crsc_popup_save_callback 613 ); 614 615 } 616 } 617 618 function av_chart_record_finish(elem,event) 619 { 620 // Restore play/pause toggle button back to 'ready to play' 538 621 AVSeekTo(0); 539 AVPlayPause(); 540 if (wavesurfer.backend.isPaused()) { 541 alert("Sorry, capturing and saving of AV values not currently implemented!"); 542 } 543 } 544 622 $('#ws-play-icon' ).show(); 623 $('#ws-pause-icon').hide(); 624 $('#ws-playpause-label').html("Play"); 625 626 if (isRecordingUserAV == true) { 627 isRecordingUserAV = false; 628 629 CancelResumeSaveConfirm('Customised AV Recording', 'Would you like to save this AV Recording?', 630 'Cancel and Start Over', null, "Save", 631 crsc_popup_cancel_callback, null, crsc_popup_save_callback 632 ); 633 } 634 635 636 } 637 638 545 639 function initPlayerVisual() { 546 640 … … 581 675 582 676 $('#av-chart-img-unlabeled').hide(); 677 $('#av-chart-canvas-unlabeled').hide(); 583 678 $('#av-chart-img').show(); 679 $('#av-chart-canvas').show(); 584 680 585 681 $('#start-av-recommendation').show(); … … 603 699 // Reset what is being display to the default (the av-chart, not the record one) 604 700 $('#av-chart-img-unlabeled').hide(); 701 $('#av-chart-chart-unlabeled').hide(); 605 702 $('#av-chart-img').show(); 703 $('#av-chart-canvas').show(); 606 704 607 705 $('#start-av-recommendation').show(); … … 687 785 // Ensure it is the RecordAV chart that is shown 688 786 $('#av-chart-img').hide(); 787 $('#av-chart-canvas').hide(); 689 788 $('#av-chart-img-unlabeled').show(); 789 $('#av-chart-canvas-unlabeled').show(); 690 790 691 791 $('#start-av-recommendation').hide(); … … 707 807 function mouse_xy_to_av(elem,event,circ_x_org,circ_y_org,circ_radius) 708 808 { 709 //var circ_x_org = 183;710 //var circ_y_org = 194;711 //var circ_radius = 130;712 713 809 var relX = event.pageX - $(elem).offset().left; 714 810 var relY = event.pageY - $(elem).offset().top; … … 722 818 } 723 819 724 820 821 // Need to be very careful with order of valenceVal and arousalVal 822 // Here they are ordered to match x,y 823 824 function av_to_canvas_xy(valenceVal, arousalVal, circ_x_org,circ_y_org,circ_radius) 825 { 826 //var canvasX = (valenceVal * circ_radius) - circ_x_org; // effectively "times -1" 827 var canvasX = circ_x_org - (valenceVal * circ_radius); 828 var canvasY = circ_y_org - (arousalVal * circ_radius); 829 830 831 return { 'canvasX': canvasX, 'canvasY': canvasY }; 832 } 833 834 725 835 $(document).ready(function() { 726 836 727 console.log(`loggedInUsername = '${gs.variables.loggedInUsername}'`); 837 console.log("AV Recording now always possible, without logging in (pseudo username: mars)"); 838 gs.variables.loggedInUsername = "mars"; 839 //console.log(`loggedInUsername = '${gs.variables.loggedInUsername}'`); 728 840 if (gs.variables.loggedInUsername != "") { 841 // Logged in 729 842 $('#login-to-record-av').hide(); 730 843 $('#record-av').show(); … … 760 873 var circ_x_org = 137; 761 874 var circ_y_org = 145; 762 //var circ_radius = 234 - 137;763 875 var circ_radius = 97; 764 876 765 //var relX = event.pageX - $(this).offset().left;766 //var relY = event.pageY - $(this).offset().top;767 768 //var recValenceVal = -1 * (circ_x_org - relX) / circ_radius;769 //var recArousalVal = +1 * (circ_y_org - relY) / circ_radius;770 771 772 //var avRadius = Math.sqrt(recValenceVal*recValenceVal + recArousalVal*recArousalVal);773 774 877 var av_rec = mouse_xy_to_av(this,event,circ_x_org,circ_y_org,circ_radius); 775 878 … … 806 909 $('#av-chart-img-unlabeled').on("click",function(event) { 807 910 av_chart_record_click(this,event); 808 //console.error("Recording mode to be implemented!")809 //AVSeekTo(0);810 //AVPlayPause();811 //if (wavesurfer.backend.isPaused()) {812 // alert("Sorry, capturing and saving of AV values not currently implemented!");813 //}814 911 }); 815 912 … … 823 920 var circ_radius = 130; 824 921 825 //var relX = event.pageX - $(this).offset().left;826 //var relY = event.pageY - $(this).offset().top;827 828 //var recValenceVal = -1 * (circ_x_org - relX) / circ_radius;829 //var recArousalVal = +1 * (circ_y_org - relY) / circ_radius;830 831 832 //var avRadius = Math.sqrt(recValenceVal*recValenceVal + recArousalVal*recArousalVal);833 834 922 var av_rec = mouse_xy_to_av(this,event,circ_x_org,circ_y_org,circ_radius); 835 923 … … 847 935 $("#av-recording-coords").text(relBoxCoords); 848 936 } 937 938 if ((recAVInside) && (isRecordingUserAV)) { 939 //var xy_rec = av_to_canvas_xy(recValenceVal,recArousalVal, circ_x_org,circ_y_org, circ_radius); 940 //var canvas_x = xy_rec.canvasX; 941 //var canvas_y = xy_rec.canvasY; 942 943 var canvas_x = event.pageX - $(this).offset().left; 944 var canvas_y = event.pageY - $(this).offset().top; 945 946 console.log("canvas x,y = " + canvas_x + " , " + canvas_y); 947 948 var av_canvas = document.getElementById("av-chart-canvas-unlabeled"); 949 var av_context = av_canvas.getContext("2d"); 950 951 av_context.fillStyle = "rgba(190,0,0,0.1)"; 952 //av_context.fillStyle = "rgba(130,0,0,0.1)"; 953 //av_context.fillStyle = "rgba(78,196,108,0.1)"; 954 av_context.beginPath(); 955 av_context.arc(canvas_x, canvas_y, 5, 0, 2 * Math.PI); 956 av_context.fill(); 957 } 849 958 850 959 if (recAVInside != prevRecAVInside) { 851 960 if (recAVInside) { 852 961 // crosshairs on 853 //$('#av-chart-img-unlabeled').css("cursor","crosshair"); 854 var crosshair_record_url = gs.variables.collImagesURL + "/font_awesome--crosshair-red32.png"; 855 //console.log("crosshair_record_url = " + crosshair_record_url); 856 //console.log("url('"+crosshair_record_url+"') 16 16, crosshair"); 857 962 var crosshair_record_url = gs.variables.collImagesURL + "/crosshair-cursor-red32.png"; 858 963 $('#av-chart-img-unlabeled').css("cursor","url('"+crosshair_record_url+"') 16 16, crosshair"); 859 964 }
Note:
See TracChangeset
for help on using the changeset viewer.