///////////////////////////////////////////////////////////////////////////// /*** MOD: MIXER ***/ // TODO: Add code for making sound circles fade between states. group { name: "e/modules/mixer/main"; images { image: "O/mixer.png" COMP; image: "O/mixer_low_left.png" COMP; image: "O/mixer_low_right.png" COMP; image: "O/mixer_med_left.png" COMP; image: "O/mixer_med_right.png" COMP; image: "O/mixer_high_left.png" COMP; image: "O/mixer_high_right.png" COMP; } max: 128 128; min: 1 1; script { public message(Msg_Type:type, id, ...) { if ((type == MSG_INT_SET) && (id == 0)) { new mute, left, right; mute = getarg(2); left = getarg(3); right = getarg(4); if (mute) run_program(PROGRAM:"mute"); else run_program(PROGRAM:"unmute"); if (left <= 0) run_program(PROGRAM:"left_none"); else if (left < 33) run_program(PROGRAM:"left_low"); else if (left < 66) run_program(PROGRAM:"left_medium"); else if (left >= 66) run_program(PROGRAM:"left_high"); if (right <= 0) run_program(PROGRAM:"right_none"); else if (right < 33) run_program(PROGRAM:"right_low"); else if (right < 66) run_program(PROGRAM:"right_medium"); else if (right >= 66) run_program(PROGRAM:"right_high"); } } } parts { part { name: "speaker"; type: IMAGE; mouse_events: 0; description { state: "default" 0.0; aspect: 1 1; aspect_preference: BOTH; image.normal: "O/mixer.png"; } } part { name: "left"; type: IMAGE; clip_to: "mute"; mouse_events: 0; description { state: "default" 0.0; visible: 0; aspect: 1 1; aspect_preference: BOTH; rel1.to: "speaker"; rel2.to: "speaker"; image.normal: "O/mixer_low_left.png"; } description { state: "low" 0.0; inherit: "default" 0.0; visible: 1; } description { state: "medium" 0.0; inherit: "default" 0.0; visible: 1; image.normal: "O/mixer_med_left.png"; } description { state: "high" 0.0; inherit: "default" 0.0; visible: 1; image.normal: "O/mixer_high_left.png"; } } part { name: "right"; type: IMAGE; clip_to: "mute"; mouse_events: 0; description { state: "default" 0.0; visible: 0; aspect: 1 1; aspect_preference: BOTH; rel1.to: "speaker"; rel2.to: "speaker"; image.normal: "O/mixer_low_right.png"; } description { state: "low" 0.0; inherit: "default" 0.0; visible: 1; } description { state: "medium" 0.0; inherit: "default" 0.0; visible: 1; image.normal: "O/mixer_med_right.png"; } description { state: "high" 0.0; inherit: "default" 0.0; visible: 1; image.normal: "O/mixer_high_right.png"; } } part { name: "mute"; mouse_events: 0; type: RECT; description { state: "default" 0.0; color: 255 255 255 255; } description { state: "active" 0.0; color: 255 255 255 64; } } part { name: "over"; type: RECT; description { state: "default" 0.0; rel1.to: "speaker"; rel2.to: "speaker"; color: 255 255 255 0; } } } programs { program { name: "mute"; action: STATE_SET "active" 0.0; transition: LINEAR 0.3; target: "mute"; } program { name: "unmute"; action: STATE_SET "default" 0.0; transition: LINEAR 0.2; target: "mute"; } program { name: "left_none"; action: STATE_SET "default" 0.0; target: "left"; } program { name: "left_low"; action: STATE_SET "low" 0.0; target: "left"; } program { name: "left_medium"; action: STATE_SET "medium" 0.0; target: "left"; } program { name: "left_high"; action: STATE_SET "high" 0.0; target: "left"; } program { name: "right_none"; action: STATE_SET "default" 0.0; target: "right"; } program { name: "right_low"; action: STATE_SET "low" 0.0; target: "right"; } program { name: "right_medium"; action: STATE_SET "medium" 0.0; target: "right"; } program { name: "right_high"; action: STATE_SET "high" 0.0; target: "right"; } } }