music_old.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /**
  2. * @license Licensed under the Apache License, Version 2.0 (the "License"):
  3. * http://www.apache.org/licenses/LICENSE-2.0
  4. */
  5. /**
  6. * @fileoverview Ardublockly JavaScript for the Blockly resources and bindings.
  7. */
  8. /*
  9. 'use strict';
  10. goog.provide('Blockly.Blocks.music');
  11. goog.require('Blockly.Blocks');
  12. // goog.require('Blockly.Types');
  13. Blockly.Blocks['music_setup'] = {
  14. init: function() {
  15. this.appendDummyInput()
  16. .appendField("Music Setup");
  17. this.setPreviousStatement(true, null);
  18. this.setNextStatement(true, null);
  19. this.setColour(230);
  20. this.setTooltip("");
  21. this.setHelpUrl("");
  22. }
  23. };
  24. Blockly.Blocks['music_set_beat'] = {
  25. init: function() {
  26. this.appendDummyInput()
  27. .appendField("Beat")
  28. .appendField(new Blockly.FieldDropdown([["1/8","1/8"], ["1/4","1/4"], ["1/2","1/2"], ["1","1"], ["2","2"], ["4","4"]]), "beat_option");
  29. this.setOutput(true, null);
  30. this.setColour(230);
  31. this.setTooltip("");
  32. this.setHelpUrl("");
  33. }
  34. };
  35. Blockly.Blocks['music_set_bpm'] = {
  36. init: function() {
  37. this.appendDummyInput()
  38. .appendField("BPM")
  39. .appendField(new Blockly.FieldDropdown([["80","80"], ["120","120"], ["140","140"]]), "bpm");
  40. this.setOutput(true, null);
  41. this.setColour(230);
  42. this.setTooltip("");
  43. this.setHelpUrl("");
  44. }
  45. };
  46. Blockly.Blocks['music_instrument'] = {
  47. init: function() {
  48. this.appendDummyInput()
  49. .appendField("Instrument")
  50. .appendField(new Blockly.FieldDropdown([["Classic Piano","1"], ["Electric Piano","5"], ["Music Box","11"], ["Electric Guitar","28"], ["Acoustic Bass","33"], ["Cello","43"], ["Whistle","73"], ["Baritone Sax","68"]]), "instru");
  51. this.setOutput(true, null);
  52. this.setColour(230);
  53. this.setTooltip("");
  54. this.setHelpUrl("");
  55. }
  56. };
  57. Blockly.Blocks['music_volume'] = {
  58. init: function() {
  59. this.appendDummyInput()
  60. .appendField("Volume")
  61. .appendField(new Blockly.FieldNumber(0, 0, Infinity, 1), "music_volume");
  62. this.setPreviousStatement(true, null);
  63. this.setNextStatement(true, null);
  64. this.setColour(230);
  65. this.setTooltip("");
  66. this.setHelpUrl("");
  67. }
  68. };
  69. Blockly.Blocks['music_customize_melody'] = {
  70. init: function() {
  71. this.appendDummyInput()
  72. .appendField("Use ");
  73. this.appendValueInput("instru")
  74. .setCheck(null);
  75. this.appendDummyInput()
  76. .appendField("play")
  77. .appendField(new Blockly.FieldTextInput("myMelody"), "melody_name");
  78. this.appendStatementInput("composition")
  79. .setCheck(null);
  80. this.setPreviousStatement(true, null);
  81. this.setNextStatement(true, null);
  82. this.setColour(230);
  83. this.setTooltip("");
  84. this.setHelpUrl("");
  85. }
  86. };
  87. Blockly.Blocks['music_change_tempo'] = {
  88. init: function() {
  89. this.appendDummyInput()
  90. .appendField("Temporary Beat")
  91. .appendField(new Blockly.FieldDropdown([["1/8","1/8"], ["1/4","1/4"], ["1/2","1/2"], ["1","1"], ["2","2"], ["4","4"]]), "beat");
  92. this.appendStatementInput("melody")
  93. .setCheck(null);
  94. this.setPreviousStatement(true, null);
  95. this.setNextStatement(true, null);
  96. this.setColour(230);
  97. this.setTooltip("");
  98. this.setHelpUrl("");
  99. }
  100. };
  101. Blockly.Blocks['music_rest'] = {
  102. init: function() {
  103. this.appendDummyInput()
  104. .appendField("Rest for ")
  105. .appendField(new Blockly.FieldTextInput("1"), "beat")
  106. .appendField("beat");
  107. this.setPreviousStatement(true, null);
  108. this.setNextStatement(true, null);
  109. this.setColour(230);
  110. this.setTooltip("");
  111. this.setHelpUrl("");
  112. }
  113. };
  114. Blockly.Blocks['music_combination'] = {
  115. init: function() {
  116. this.appendDummyInput()
  117. .appendField("Use");
  118. this.appendValueInput("instrument")
  119. .setCheck(null);
  120. this.appendDummyInput()
  121. .appendField("play note");
  122. this.appendValueInput("note")
  123. .setCheck(null);
  124. this.appendDummyInput()
  125. .appendField("for");
  126. this.appendValueInput("beat")
  127. .setCheck(null);
  128. this.appendDummyInput()
  129. .appendField("beat");
  130. this.setPreviousStatement(true, null);
  131. this.setNextStatement(true, null);
  132. this.setColour(230);
  133. this.setTooltip("");
  134. this.setHelpUrl("");
  135. }
  136. };
  137. */