MIT App Inventor Project

profilechown_chmod
lab10_musicbox.zip

assets/musicbox.jpg

src/appinventor/ai_ahmetshen_us/Lab10_MusicBox/Screen1.bky

<xml xmlns="http://www.w3.org/1999/xhtml"> <block type="global_declaration" id="11" inline="false" x="39" y="30"> <field name="NAME">selectedSong</field> <value name="VALUE"> <block type="text" id="28"> <field name="TEXT"></field> </block> </value> </block> <block type="global_declaration" id="157" inline="false" x="481" y="22"> <field name="NAME">hbday</field> <value name="VALUE"> <block type="lists_create_with" id="158" inline="false"> <mutation items="13"></mutation> <value name="ADD0"> <block type="text" id="159"> <field name="TEXT">c_12</field> </block> </value> <value name="ADD1"> <block type="text" id="160"> <field name="TEXT">c_12</field> </block> </value> <value name="ADD2"> <block type="text" id="161"> <field name="TEXT">d_14</field> </block> </value> <value name="ADD3"> <block type="text" id="172"> <field name="TEXT">c_14</field> </block> </value> <value name="ADD4"> <block type="text" id="162"> <field name="TEXT">f_14</field> </block> </value> <value name="ADD5"> <block type="text" id="173"> <field name="TEXT">e_18</field> </block> </value> <value name="ADD6"> <block type="text" id="166"> <field name="TEXT">c_12</field> </block> </value> <value name="ADD7"> <block type="text" id="174"> <field name="TEXT">c_12</field> </block> </value> <value name="ADD8"> <block type="text" id="175"> <field name="TEXT">d_14</field> </block> </value> <value name="ADD9"> <block type="text" id="191"> <field name="TEXT">c_14</field> </block> </value> <value name="ADD10"> <block type="text" id="163"> <field name="TEXT">g_14</field> </block> </value> <value name="ADD11"> <block type="text" id="192"> <field name="TEXT">f_14</field> </block> </value> <value name="ADD12"> <block type="math_number" id="1106"> <field name="NUM">0</field> </block> </value> </block> </value> </block> <block type="global_declaration" id="34" inline="false" x="47" y="72"> <field name="NAME">noteNum</field> <value name="VALUE"> <block type="math_number" id="99"> <field name="NUM">1</field> </block> </value> </block> <block type="global_declaration" id="100" inline="false" x="46" y="104"> <field name="NAME">selectedNote</field> <value name="VALUE"> <block type="math_number" id="101"> <field name="NUM">1</field> </block> </value> </block> <block type="global_declaration" id="102" inline="false" x="30" y="161"> <field name="NAME">song1</field> <value name="VALUE"> <block type="lists_create_with" id="127" inline="false"> <mutation items="13"></mutation> <value name="ADD0"> <block type="text" id="138"> <field name="TEXT">c_12</field> </block> </value> <value name="ADD1"> <block type="text" id="128"> <field name="TEXT">d_12</field> </block> </value> <value name="ADD2"> <block type="text" id="139"> <field name="TEXT">e_12</field> </block> </value> <value name="ADD3"> <block type="text" id="140"> <field name="TEXT">f_12</field> </block> </value> <value name="ADD4"> <block type="text" id="141"> <field name="TEXT">g_12</field> </block> </value> <value name="ADD5"> <block type="text" id="142"> <field name="TEXT">a_22</field> </block> </value> <value name="ADD6"> <block type="text" id="143"> <field name="TEXT">b_22</field> </block> </value> <value name="ADD7"> <block type="text" id="155"> <field name="TEXT">c_22</field> </block> </value> <value name="ADD8"> <block type="text" id="156"> <field name="TEXT">0</field> </block> </value> </block> </value> </block> <block type="component_event" id="518" x="544" y="435"> <mutation component_type="Clock" instance_name="Clock1" event_name="Timer"></mutation> <field name="COMPONENT_SELECTOR">Clock1</field> <statement name="DO"> <block type="procedures_callnoreturn" id="545"> <mutation name="PlayNote"></mutation> <field name="PROCNAME">PlayNote</field> </block> </statement> </block> <block type="procedures_defnoreturn" id="521" x="823" y="421"> <mutation></mutation> <field name="NAME">PlayNote</field> <statement name="STACK"> <block type="lexical_variable_set" id="704" inline="false"> <field name="VAR">global selectedNote</field> <value name="VALUE"> <block type="lists_select_item" id="726" inline="false"> <value name="LIST"> <block type="lexical_variable_get" id="727"> <field name="VAR">global selectedSong</field> </block> </value> <value name="NUM"> <block type="lexical_variable_get" id="728"> <field name="VAR">global noteNum</field> </block> </value> </block> </value> <next> <block type="controls_if" id="834" inline="false"> <mutation else="1"></mutation> <value name="IF0"> <block type="math_compare" id="835" inline="true"> <field name="OP">EQ</field> <value name="A"> <block type="lexical_variable_get" id="836"> <field name="VAR">global selectedNote</field> </block> </value> <value name="B"> <block type="math_number" id="837"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="component_set_get" id="841" inline="false"> <mutation component_type="Clock" set_or_get="set" property_name="TimerEnabled" is_generic="false" instance_name="Clock1"></mutation> <field name="COMPONENT_SELECTOR">Clock1</field> <field name="PROP">TimerEnabled</field> <value name="VALUE"> <block type="logic_false" id="842"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="component_set_get" id="859" inline="false"> <mutation component_type="Player" set_or_get="set" property_name="Source" is_generic="false" instance_name="Player1"></mutation> <field name="COMPONENT_SELECTOR">Player1</field> <field name="PROP">Source</field> <value name="VALUE"> <block type="text_join" id="874" inline="false"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text_segment" id="889" inline="false"> <value name="TEXT"> <block type="lexical_variable_get" id="905"> <field name="VAR">global selectedNote</field> </block> </value> <value name="START"> <block type="math_number" id="839"> <field name="NUM">1</field> </block> </value> <value name="LENGTH"> <block type="math_number" id="906"> <field name="NUM">3</field> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="904"> <field name="TEXT">.mid</field> </block> </value> </block> </value> <next> <block type="component_set_get" id="989" inline="false"> <mutation component_type="Clock" set_or_get="set" property_name="TimerInterval" is_generic="false" instance_name="Clock1"></mutation> <field name="COMPONENT_SELECTOR">Clock1</field> <field name="PROP">TimerInterval</field> <value name="VALUE"> <block type="math_multiply" id="1018" inline="true"> <mutation items="2"></mutation> <value name="NUM0"> <block type="text_segment" id="1020" inline="false"> <value name="TEXT"> <block type="lexical_variable_get" id="1021"> <field name="VAR">global selectedNote</field> </block> </value> <value name="START"> <block type="math_number" id="1022"> <field name="NUM">4</field> </block> </value> <value name="LENGTH"> <block type="math_number" id="1023"> <field name="NUM">1</field> </block> </value> </block> </value> <value name="NUM1"> <block type="math_number" id="1019"> <field name="NUM">250</field> </block> </value> </block> </value> <next> <block type="lexical_variable_set" id="1029" inline="false"> <field name="VAR">global noteNum</field> <value name="VALUE"> <block type="math_add" id="1058" inline="true"> <mutation items="2"></mutation> <value name="NUM0"> <block type="lexical_variable_get" id="1059"> <field name="VAR">global noteNum</field> </block> </value> <value name="NUM1"> <block type="math_number" id="1060"> <field name="NUM">1</field> </block> </value> </block> </value> <next> <block type="component_method" id="1077"> <mutation component_type="Player" method_name="Start" is_generic="false" instance_name="Player1"></mutation> <field name="COMPONENT_SELECTOR">Player1</field> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> <block type="component_event" id="579" x="114" y="532"> <mutation component_type="Button" instance_name="song1Button" event_name="Click"></mutation> <field name="COMPONENT_SELECTOR">song1Button</field> <statement name="DO"> <block type="lexical_variable_set" id="651" inline="false"> <field name="VAR">global selectedSong</field> <value name="VALUE"> <block type="lexical_variable_get" id="657"> <field name="VAR">global song1</field> </block> </value> <next> <block type="lexical_variable_set" id="658" inline="false"> <field name="VAR">global noteNum</field> <value name="VALUE"> <block type="math_number" id="689"> <field name="NUM">1</field> </block> </value> <next> <block type="component_set_get" id="690" inline="false"> <mutation component_type="Clock" set_or_get="set" property_name="TimerEnabled" is_generic="false" instance_name="Clock1"></mutation> <field name="COMPONENT_SELECTOR">Clock1</field> <field name="PROP">TimerEnabled</field> <value name="VALUE"> <block type="logic_false" id="691"> <field name="BOOL">TRUE</field> </block> </value> </block> </next> </block> </next> </block> </statement> </block> <block type="component_event" id="692" x="115" y="664"> <mutation component_type="Button" instance_name="song2Button" event_name="Click"></mutation> <field name="COMPONENT_SELECTOR">song2Button</field> <statement name="DO"> <block type="lexical_variable_set" id="693" inline="false"> <field name="VAR">global selectedSong</field> <value name="VALUE"> <block type="lexical_variable_get" id="694"> <field name="VAR">global hbday</field> </block> </value> <next> <block type="lexical_variable_set" id="695" inline="false"> <field name="VAR">global noteNum</field> <value name="VALUE"> <block type="math_number" id="696"> <field name="NUM">1</field> </block> </value> <next> <block type="component_set_get" id="697" inline="false"> <mutation component_type="Clock" set_or_get="set" property_name="TimerEnabled" is_generic="false" instance_name="Clock1"></mutation> <field name="COMPONENT_SELECTOR">Clock1</field> <field name="PROP">TimerEnabled</field> <value name="VALUE"> <block type="logic_false" id="698"> <field name="BOOL">TRUE</field> </block> </value> </block> </next> </block> </next> </block> </statement> </block> <block type="component_event" id="245" x="145" y="803"> <mutation component_type="Form" instance_name="Screen1" event_name="Initialize"></mutation> <field name="COMPONENT_SELECTOR">Screen1</field> <statement name="DO"> <block type="component_set_get" id="410" inline="false"> <mutation component_type="Clock" set_or_get="set" property_name="TimerEnabled" is_generic="false" instance_name="Clock1"></mutation> <field name="COMPONENT_SELECTOR">Clock1</field> <field name="PROP">TimerEnabled</field> <value name="VALUE"> <block type="logic_false" id="435"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> <yacodeblocks ya-version="150" language-version="20"></yacodeblocks> </xml>

src/appinventor/ai_ahmetshen_us/Lab10_MusicBox/Screen1.scm

#| $JSON {"YaVersion":"150","Source":"Form","Properties":{"$Name":"Screen1","$Type":"Form","$Version":"19","AppName":"Lab10_MusicBox","BackgroundColor":"&HFFFFC800","Title":"Screen1","Uuid":"0","$Components":[{"$Name":"Label1","$Type":"Label","$Version":"3","FontBold":"True","FontSize":"24","Width":"-2","Text":"Digital Music Box","TextColor":"&HFF0000FF","Uuid":"1350017346"},{"$Name":"HorizontalArrangement1","$Type":"HorizontalArrangement","$Version":"3","Width":"-2","Uuid":"-875903825","$Components":[{"$Name":"Image1","$Type":"Image","$Version":"3","Height":"100","Width":"100","Picture":"musicbox.jpg","Uuid":"-1505294428"},{"$Name":"VerticalArrangement1","$Type":"VerticalArrangement","$Version":"3","AlignHorizontal":"3","BackgroundColor":"&HFFFF00FF","Width":"-2","Uuid":"-84814417","$Components":[{"$Name":"song1Button","$Type":"Button","$Version":"6","BackgroundColor":"&HFF00FFFF","Shape":"1","Text":"Song1","Uuid":"-2119027878"},{"$Name":"song2Button","$Type":"Button","$Version":"6","BackgroundColor":"&HFFFFAFAF","Shape":"1","Text":"Song2","Uuid":"-1772603321"},{"$Name":"song3Button","$Type":"Button","$Version":"6","BackgroundColor":"&HFF00FF00","Shape":"1","Text":"Song3","Uuid":"-1936034173"}]}]},{"$Name":"Clock1","$Type":"Clock","$Version":"3","Uuid":"-255105709"},{"$Name":"Sound1","$Type":"Sound","$Version":"3","Uuid":"-932866484"},{"$Name":"Notifier1","$Type":"Notifier","$Version":"4","Uuid":"-1848041213"},{"$Name":"Player1","$Type":"Player","$Version":"6","Uuid":"-667187164"}]}} |#

youngandroidproject/project.properties

main=appinventor.ai_ahmetshen_us.Lab10_MusicBox.Screen1 name=Lab10_MusicBox assets=../assets source=../src build=../build versioncode=1 versionname=1.0 useslocation=False aname=Lab10_MusicBox sizing=Fixed