<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>sprRecord</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>0</depth>
  <persistent>0</persistent>
  <parentName>&lt;undefined&gt;</parentName>
  <maskName>&lt;undefined&gt;</maskName>
  <events>
    <event eventtype="0" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>init_jukebox()

ok = 0
arm_angle_start = 234
arm_angle_final = 205
arm_angle = arm_angle_start
record_angle = 0
audio_length = 0
audio_position = 0
now_playing = 0
now_playing_id = 0
now_playing_audio = 0
pause = 0
restarting = 0

ini_open(global.config_fname)
last_chapter_unlocked = ini_read_real("Settings","last",0)
ini_close()

//Select by chapter
max_song_id = 13

alarm[0] = 1
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="3">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>/*/Move arm to correct position in case of desync
if audio_is_playing(now_playing) and !restarting {
    var angle_mod = ((arm_angle_start - arm_angle_final) / audio_length) ;
    arm_angle -= angle_mod
    write_line("Audio length: "+string(audio_length)+" Audio position: "+string(audio_position)+" Arm angle mod: "+string(angle_mod))
    alarm[3] = 60
} 
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="2">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>/// Move arm to starting position
if arm_angle &lt; arm_angle_start {
    arm_angle += 0.5
    alarm[2] = 1
} else {
    audio_position = 0
    restarting = 0
    pause = 0
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="1">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Spin record and move arm
if audio_is_playing(now_playing) {
    if !pause {
        arm_angle -= (arm_angle_start - arm_angle_final) / audio_length
        record_angle -= 1    
        alarm[1] = 1
    }
} else {
    pause = 1
    restarting = 1
    alarm[2] = 1
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>ok = 1
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="3" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Keyboard controls
if ok {
    if keyboard_check_pressed(vk_left) and !audio_is_playing(now_playing) {
        if now_playing_id &gt; 0 {
            now_playing_id--;
            audio_play_sound(sndselect,0,0)
        }
    } else if keyboard_check_pressed(vk_right) and !audio_is_playing(now_playing) {
        if now_playing_id &lt; max_song_id {
            now_playing_id++;
            audio_play_sound(sndselect,0,0)
        }
    } else if keyboard_check_pressed(global.kb_choose) and !restarting {
        audio_play_sound(sndchoose,0,0)
        if pause {
            audio_resume_sound(now_playing)
            pause = 0
            alarm[1] = 1
            alarm[3] = 60 
        } else {
            if audio_is_playing(now_playing) {
                audio_play_sound(sndchoose,0,0)
                pause = 1
                audio_pause_sound(now_playing)
            } else {
                arm_angle = arm_angle_start
                now_playing_audio = jukebox[now_playing_id,1]
                audio_length = audio_sound_length(now_playing_audio) * 60
                now_playing = audio_play_sound(now_playing_audio,10,0)
                alarm[1] = 1
                alarm[3] = 60 
            }
        }
    } else if keyboard_check_pressed(global.kb_back) {
        if !audio_is_playing(now_playing) {
            audio_play_sound(sndback,0,0)
            ok = 0;
            global.theroom = rmMenu
            instance_create(0,0,objFadeOut)
        } else {
            audio_stop_sound(now_playing)
            pause = 1
            restarting = 1
            alarm[2] = 1
        }
    }
}
</string>
          </argument>
        </arguments>
      </action>
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Update song position
write_line(string(audio_is_playing(now_playing)))
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="8" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>draw_set_color(c_white)
draw_set_halign(fa_center)
draw_set_font(global.thenfont)
draw_set_alpha(1)

draw_sprite_ext(sprRecord,0,x,y,1,1,record_angle,image_blend,image_alpha)
draw_sprite_ext(sprTurntableArm,0,x+300,y-74,1,1,arm_angle,image_blend,image_alpha)

draw_text(332,160,iff(audio_is_playing(now_playing),"~Now Playing~","")+"#"+
                  iff(now_playing_id &lt; 10,"00",iff(now_playing_id &lt; 100,"0",""))+string(now_playing_id)+": "+jukebox[now_playing_id,0]+"##"+
                  key_name(global.kb_choose)+" / Button "+ string(global.gamepad_choose)+" - "+iff(audio_is_playing(now_playing),iff(pause,"Resume","Pause"),"Play")+"#"+
                  key_name(global.kb_back)+" / Button "+ string(global.gamepad_back)+" - "+iff(audio_is_playing(now_playing),"Stop","Exit")+"#")

draw_set_font(global.theifont)
draw_set_halign(fa_right)

draw_text(410,16,"Jukebox");
</string>
          </argument>
        </arguments>
      </action>
    </event>
  </events>
  <PhysicsObject>0</PhysicsObject>
  <PhysicsObjectSensor>0</PhysicsObjectSensor>
  <PhysicsObjectShape>0</PhysicsObjectShape>
  <PhysicsObjectDensity>0.5</PhysicsObjectDensity>
  <PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
  <PhysicsObjectGroup>0</PhysicsObjectGroup>
  <PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
  <PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
  <PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
  <PhysicsObjectAwake>-1</PhysicsObjectAwake>
  <PhysicsObjectKinematic>0</PhysicsObjectKinematic>
  <PhysicsShapePoints/>
</object>
