<commit_before><html ng-app="brouserSynth">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>Viretual DAW</title>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  <script type="text/javascript" src="/socket.io/socket.io.js"></script>
  <script type="text/javascript" src="/js/angular.min.js"></script>
  <script type="text/javascript" src="/js/underscore-min.js"></script>
  <script type="text/javascript" src="/js/jazz-plugin-handler.js"></script>
  
  <link rel="stylesheet" type="text/css" href="/css/base.css"/>
  <script type="text/javascript">
  
  var module = angular.module('brouserSynth', []);
  var id = 0;
  module.factory('Synth', function($rootScope) {
    var Synth = function(name, url){
      this.name = name;
      this.url = url;
      this.sy = null;
    };
    Synth.prototype.load = function() {
      if(!this.sy){
        this.sy = window.open(this.url, "sy" + id, "width=900,height=670,scrollbars=yes,resizable=yes");
      }
    };
    Synth.prototype.noteOn = function(note, velo) {
      this.sendMessage("midi,90," + note.toString(16) + "," + velo.toString(16));
    };
    Synth.prototype.noteOff = function(note) {
      this.sendMessage("midi,80," + note.toString(16) + ",0");
    };
    Synth.prototype.allSoundOff = function() {
      this.sendMessage("midi,b0,78,0");
    };
    Synth.prototype.sendMidiMessage = function(m0, m1, m2) {
      this.sendMessage('midi,' + m0.toString(16) +','+ m1.toString(16)+','+ m2.toString(16));
    };
    Synth.prototype.sendMessage = function(s) {
      if(this.sy)
          this.sy.postMessage(s, "*");
    };
    return Synth;
  });
  
  var Track = function(arg){
    this.name = arg.name;
    this.synth = arg.synth;
    this.channel = arg.channel || 1;
    this.program = arg.program || 1;
    this.keyCount = 0;
    this.rec = false;
  };
  Track.prototype.noteOn = function(note, velo) {
    this.putMidi(0x90, note, velo);
  };
  Track.prototype.noteOff = function(note) {
    this.putMidi(0x80, note, 0);
  };
  Track.prototype.programChange = function(number) {
    console.log(number);
    this.putMidi(0xc0, number, 0);
  };
  Track.prototype.allSoundOff = function() {
    this.synth.allSoundOff();
    this.keyCount = 0;
  };
  Track.prototype.putMidi = function(m0, m1, m2){
    console.log(this.name + ":" + m0 + ','+ m1 + ',' + m2);
    if(this.rec){
      if(m0 >> 4 == 9){
        this.keyCount++;
      }else if(m0 >> 4 == 8){
        this.keyCount--;
      }
      this.synth.sendMidiMessage(m0 + this.channel - 1, m1, m2);//キーボードからはchannel1で来る前提
    }
  };
  Track.prototype.keyIsPressed = function(){
    return this.keyCount > 0 ? 'pressed' : '';
  };
  
  function KeyboardCtrl($scope, Synth, jazz) {
    $scope.connection = 'disconnected';
    $scope.echoms = '';
  
    var socket = io.connect('/');
    socket.on('connect', function() {
      $scope.connection = 'connected';
      console.log('connected');
      socket.on('disconnect', function() {
        $scope.connection = 'disconnected';
        $scope.echoms = '';
      });
      socket.on('midi', function(abc){
        var splitted = abc.split(',');
        var a = parseInt(splitted[0]);
        var b = parseInt(splitted[1]);
        var c = parseInt(splitted[2]);
        midiProcCommon(a,b,c);
      });
      socket.on('echo', function(message){
        $scope.echoms = '(echo:' + (new Date().getMilliseconds() - parseInt(message)) + 'ms)';
      });
      socket.emit('echo', new Date().getMilliseconds());
    });
  
    $scope.synths = [];
    $scope.synths.push(new Synth('WebModular', 'http://www.g200kg.com/en/docs/webmodular/webmodular.html'));<commit_msg>デグレ修正中<commit_after><html ng-app="brouserSynth">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>Viretual DAW</title>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  <script type="text/javascript" src="/js/angular.min.js"></script>
  <script type="text/javascript" src="/js/underscore-min.js"></script>
  <script type="text/javascript" src="/js/jazz-plugin-handler.js"></script>
  
  <link rel="stylesheet" type="text/css" href="/css/base.css"/>
  <script type="text/javascript">
  
  var module = angular.module('brouserSynth', []);
  JazzPlugin.attachTo(module);
  var id = 0;
  module.factory('Synth', function($rootScope) {
    var Synth = function(name, url){
      this.name = name;
      this.url = url;
      this.sy = null;
    };
    Synth.prototype.load = function() {
      if(!this.sy){
        this.sy = window.open(this.url, "sy" + id, "width=900,height=670,scrollbars=yes,resizable=yes");
      }
    };
    Synth.prototype.noteOn = function(note, velo) {
      this.sendMessage("midi,90," + note.toString(16) + "," + velo.toString(16));
    };
    Synth.prototype.noteOff = function(note) {
      this.sendMessage("midi,80," + note.toString(16) + ",0");
    };
    Synth.prototype.allSoundOff = function() {
      this.sendMessage("midi,b0,78,0");
    };
    Synth.prototype.sendMidiMessage = function(m0, m1, m2) {
      this.sendMessage('midi,' + m0.toString(16) +','+ m1.toString(16)+','+ m2.toString(16));
    };
    Synth.prototype.sendMessage = function(s) {
      if(this.sy)
          this.sy.postMessage(s, "*");
    };
    return Synth;
  });
  
  var Track = function(arg){
    this.name = arg.name;
    this.synth = arg.synth;
    this.channel = arg.channel || 1;
    this.program = arg.program || 1;
    this.keyCount = 0;
    this.rec = false;
  };
  Track.prototype.noteOn = function(note, velo) {
    this.putMidi(0x90, note, velo);
  };
  Track.prototype.noteOff = function(note) {
    this.putMidi(0x80, note, 0);
  };
  Track.prototype.programChange = function(number) {
    console.log(number);
    this.putMidi(0xc0, number, 0);
  };
  Track.prototype.allSoundOff = function() {
    this.synth.allSoundOff();
    this.keyCount = 0;
  };
  Track.prototype.putMidi = function(m0, m1, m2){
    console.log(this.name + ":" + m0 + ','+ m1 + ',' + m2);
    if(this.rec){
      if(m0 >> 4 == 9){
        this.keyCount++;
      }else if(m0 >> 4 == 8){
        this.keyCount--;
      }
      this.synth.sendMidiMessage(m0 + this.channel - 1, m1, m2);//キーボードからはchannel1で来る前提
    }
  };
  Track.prototype.keyIsPressed = function(){
    return this.keyCount > 0 ? 'pressed' : '';
  };
  
  function KeyboardCtrl($scope, Synth, jazz) {
    $scope.connection = 'disconnected';
    $scope.echoms = '';
  
    $scope.synths = [];
    $scope.synths.push(new Synth('WebModular', 'http://www.g200kg.com/en/docs/webmodular/webmodular.html'));
{'fraction_non_alphanumeric': 0.19187358916478556, 'fraction_numerical': 0.022422874341610232, 'mean_word_length': 3.01813784764208, 'pattern_counts': {'":': 2, '<': 35, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2422263', 'n_tokens_mistral': 2481, 'n_tokens_neox': 2403, 'n_words': 360}