Initial Upload
This commit is contained in:
17
SoundBoardAndSpeaker/ButtonControl.lsl
Normal file
17
SoundBoardAndSpeaker/ButtonControl.lsl
Normal file
@ -0,0 +1,17 @@
|
||||
integer button_listen_chan = 1347453635;
|
||||
string button_name = "button_01";
|
||||
|
||||
default
|
||||
{
|
||||
state_entry() {
|
||||
}
|
||||
|
||||
on_rez(integer start_param) {
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
touch_end(integer total_number)
|
||||
{
|
||||
llSay(button_listen_chan, button_name);
|
||||
}
|
||||
}
|
||||
17
SoundBoardAndSpeaker/ButtonControlLoop.lsl
Normal file
17
SoundBoardAndSpeaker/ButtonControlLoop.lsl
Normal file
@ -0,0 +1,17 @@
|
||||
integer button_listen_chan = 1347453635;
|
||||
string button_name = "button_01+loop";
|
||||
|
||||
default
|
||||
{
|
||||
state_entry() {
|
||||
}
|
||||
|
||||
on_rez(integer start_param) {
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
touch_end(integer total_number)
|
||||
{
|
||||
llSay(button_listen_chan, button_name);
|
||||
}
|
||||
}
|
||||
24
SoundBoardAndSpeaker/SpeakerControl.lsl
Normal file
24
SoundBoardAndSpeaker/SpeakerControl.lsl
Normal file
@ -0,0 +1,24 @@
|
||||
integer speaker_listen_chan = 1347453636;
|
||||
string this_speaker = "1";
|
||||
|
||||
default
|
||||
{
|
||||
state_entry() {
|
||||
llListen(speaker_listen_chan, "", NULL_KEY, "");
|
||||
}
|
||||
|
||||
on_rez(integer start_param) {
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
touch_end(integer total_number) {
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string message) {
|
||||
list call_parts = llParseString2List(message, ["+"], []);
|
||||
if (llList2String(call_parts, 0) == this_speaker) {
|
||||
llPlaySound(llList2String(call_parts, 1),1.0);
|
||||
//llOwnerSay("speaker uuid - " + llList2String(call_parts, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
109
SoundBoardAndSpeaker/SpeakerMainControl.lsl
Normal file
109
SoundBoardAndSpeaker/SpeakerMainControl.lsl
Normal file
@ -0,0 +1,109 @@
|
||||
integer button_listen_chan = 1347453635;
|
||||
integer speaker_listen_chan = 1347453636;
|
||||
integer number_of_speakers = 6;
|
||||
integer loop_length = 5;
|
||||
integer current_timer_sec = 1;
|
||||
integer current_speaker = 1;
|
||||
integer reset_count_start = 0;
|
||||
list sound_list = [
|
||||
"button_01", "219c5d93-6c09-31c5-fb3f-c5fe7495c115",
|
||||
"button_02", "e057c244-5768-1056-c37e-1537454eeb62",
|
||||
"button_03", "0cb7b00a-4c10-6948-84de-a93c09af2ba9",
|
||||
"button_04", "3c8fc726-1fd6-862d-fa01-16c5b2568db6",
|
||||
"button_05", "2c346eda-b60c-ab33-1119-b8941916a499",
|
||||
"button_06", "c825dfbc-9827-7e02-6507-3713d18916c1"
|
||||
];
|
||||
list timer_events = [];
|
||||
|
||||
default
|
||||
{
|
||||
state_entry() {
|
||||
llListen(button_listen_chan, "", NULL_KEY, "");
|
||||
llSetTimerEvent(1.0);
|
||||
reset_count_start = 0;
|
||||
}
|
||||
|
||||
on_rez(integer start_param) {
|
||||
llResetScript();
|
||||
reset_count_start = 0;
|
||||
}
|
||||
|
||||
touch_start(integer total_number) {
|
||||
reset_count_start = 1;
|
||||
}
|
||||
|
||||
touch_end(integer total_number) {
|
||||
reset_count_start = 0;
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string message) {
|
||||
integer button_index = llListFindList(sound_list, [message]);
|
||||
string sound_uuid = "";
|
||||
if (button_index != -1) {
|
||||
sound_uuid = llList2String(sound_list, button_index + 1);
|
||||
} else {
|
||||
list call_parts = llParseString2List(message, ["+"], []);
|
||||
//llOwnerSay("sound parts - " + llDumpList2String(call_parts, " > ") + " - message - " + message);
|
||||
if (llList2String(call_parts, 1) == "loop") {
|
||||
integer button_index = llListFindList(sound_list, [llList2String(call_parts, 0)]);
|
||||
if (button_index != -1) {
|
||||
string loop_sound_uuid = llList2String(sound_list, button_index + 1);
|
||||
if (llStringLength(loop_sound_uuid) == 36) {
|
||||
timer_events += [(current_timer_sec), loop_sound_uuid];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (llStringLength(sound_uuid) > 0) {
|
||||
//llOwnerSay("sound UUID - " + sound_uuid);
|
||||
llSay(speaker_listen_chan, (string) current_speaker + "+" + sound_uuid);
|
||||
if (current_speaker < number_of_speakers) {
|
||||
++current_speaker;
|
||||
} else {
|
||||
current_speaker = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
timer() {
|
||||
integer number_of_items = llGetListLength(timer_events);
|
||||
integer list_looper = 0;
|
||||
|
||||
for (list_looper = 0; list_looper <= number_of_items; list_looper += 2) {
|
||||
if (llList2Integer(timer_events, list_looper) == current_timer_sec) {
|
||||
string sound_uuid = llList2String(timer_events, list_looper + 1);
|
||||
//llOwnerSay("sound looped UUID - " + sound_uuid);
|
||||
llSay(speaker_listen_chan, (string) current_speaker + "+" + sound_uuid);
|
||||
if (current_speaker < number_of_speakers) {
|
||||
++current_speaker;
|
||||
} else {
|
||||
current_speaker = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (current_timer_sec < loop_length) {
|
||||
list_looper = 0;
|
||||
++ current_timer_sec;
|
||||
} else {
|
||||
//llOwnerSay("Loop reset - " + llDumpList2String(timer_events, " > "));
|
||||
current_timer_sec = 1;
|
||||
}
|
||||
|
||||
if (reset_count_start > 0) {
|
||||
integer reset_in = 4 - reset_count_start;
|
||||
if (reset_in < 0) {
|
||||
reset_in = 0;
|
||||
}
|
||||
llOwnerSay("Resetting in: " + (string) reset_in + "...");
|
||||
if (reset_count_start >= 4) {
|
||||
timer_events = [];
|
||||
reset_count_start = 0;
|
||||
llOwnerSay("Loops Reset");
|
||||
} else {
|
||||
++reset_count_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user