| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| 'use strict';
|
|
|
| goog.provide('Blockly.Blocks.sound');
|
|
|
| goog.require('Blockly.Blocks');
|
| goog.require('Blockly.Colours');
|
| goog.require('Blockly.constants');
|
| goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
|
| Blockly.Blocks['sound_sounds_menu'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": "%1",
|
| "args0": [
|
| {
|
| "type": "field_dropdown",
|
| "name": "SOUND_MENU",
|
| "options": [
|
| ['1', '0'],
|
| ['2', '1'],
|
| ['3', '2'],
|
| ['4', '3'],
|
| ['5', '4'],
|
| ['6', '5'],
|
| ['7', '6'],
|
| ['8', '7'],
|
| ['9', '8'],
|
| ['10', '9'],
|
| ['call a function', function() {
|
| window.alert('function called!');}
|
| ]
|
| ]
|
| }
|
| ],
|
| "colour": Blockly.Colours.sounds.secondary,
|
| "colourSecondary": Blockly.Colours.sounds.secondary,
|
| "colourTertiary": Blockly.Colours.sounds.tertiary,
|
| "extensions": ["output_string"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_play'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_PLAY,
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_playuntildone'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_PLAYUNTILDONE,
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_stop'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": "stop sound %1",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_pause'] = {
|
| |
| |
| |
|
|
| init: function () {
|
| this.jsonInit({
|
| "message0": "pause sound %1",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_set_stop_fadeout_to'] = {
|
| |
| |
| |
| |
|
|
| init: function () {
|
| this.jsonInit({
|
| "message0": "set fade out to %1 seconds on %2",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "VALUE"
|
| },
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_play_at_seconds'] = {
|
| |
| |
| |
|
|
| init: function () {
|
| this.jsonInit({
|
| "message0": "start sound %1 at %2 seconds",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| },
|
| {
|
| "type": "input_value",
|
| "name": "VALUE"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_play_at_seconds_until_done'] = {
|
| |
| |
| |
| |
| |
|
|
| init: function () {
|
| this.jsonInit({
|
| "message0": "play sound %1 starting at %2 seconds until done",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| },
|
| {
|
| "type": "input_value",
|
| "name": "VALUE"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_stopallsounds'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_STOPALLSOUNDS,
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_pauseallsounds'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": "pause all sounds",
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_playallsounds'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": "play all sounds",
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_seteffectto'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_SETEFFECTO,
|
| "args0": [
|
| {
|
| "type": "field_dropdown",
|
| "name": "EFFECT",
|
| "options": [
|
| [Blockly.Msg.SOUND_EFFECTS_PITCH, 'PITCH'],
|
| [Blockly.Msg.SOUND_EFFECTS_PAN, 'PAN']
|
| ]
|
| },
|
| {
|
| "type": "input_value",
|
| "name": "VALUE"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
|
|
| Blockly.Blocks['sound_changeeffectby'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_CHANGEEFFECTBY,
|
| "args0": [
|
| {
|
| "type": "field_dropdown",
|
| "name": "EFFECT",
|
| "options": [
|
| [Blockly.Msg.SOUND_EFFECTS_PITCH, 'PITCH'],
|
| [Blockly.Msg.SOUND_EFFECTS_PAN, 'PAN']
|
| ]
|
| },
|
| {
|
| "type": "input_value",
|
| "name": "VALUE"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_cleareffects'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_CLEAREFFECTS,
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_getEffectValue'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "inputsInline": true,
|
| "message0": "%1 effect",
|
| "checkboxInFlyout": true,
|
| "category": Blockly.Categories.sound,
|
| "args0": [
|
| {
|
| "type": "field_dropdown",
|
| "name": "EFFECT",
|
| "options": [
|
| [Blockly.Msg.SOUND_EFFECTS_PITCH, 'PITCH'],
|
| [Blockly.Msg.SOUND_EFFECTS_PAN, 'PAN']
|
| ]
|
| }
|
| ],
|
| "extensions": ["colours_sounds", "output_number"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_changevolumeby'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_CHANGEVOLUMEBY,
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "VOLUME"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_setvolumeto'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_SETVOLUMETO,
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "VOLUME"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "shape_statement"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_volume'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": Blockly.Msg.SOUND_VOLUME,
|
| "category": Blockly.Categories.sound,
|
| "checkboxInFlyout": true,
|
| "extensions": ["colours_sounds", "output_number"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks["sound_isSoundPlaying"] = {
|
| init: function() {
|
| this.jsonInit({
|
| "inputsInline": true,
|
| "category": Blockly.Categories.sound,
|
| "message0": "is %1 playing?",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "extensions": [
|
| "output_boolean",
|
| "colours_sounds"
|
| ]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_getLength'] = {
|
| |
| |
| |
|
|
| init: function() {
|
| this.jsonInit({
|
| "message0": "length of %1",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "output_number"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_getTimePosition'] = {
|
| |
| |
| |
|
|
| init: function () {
|
| this.jsonInit({
|
| "message0": "current time position of %1",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "output_number"]
|
| });
|
| }
|
| };
|
|
|
| Blockly.Blocks['sound_getSoundVolume'] = {
|
| |
| |
| |
|
|
| init: function () {
|
| this.jsonInit({
|
| "message0": "current volume of %1",
|
| "args0": [
|
| {
|
| "type": "input_value",
|
| "name": "SOUND_MENU"
|
| }
|
| ],
|
| "category": Blockly.Categories.sound,
|
| "extensions": ["colours_sounds", "output_number"]
|
| });
|
| }
|
| };
|
|
|