removed useless _ folders
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<Solution name="HUD_Music_player_with_trigger">
|
||||
<Project name="HUD_Music_player_with_trigger" path="HUD_Music_player_with_trigger\HUD_Music_player_with_trigger.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Project name="HUD_Music_player_with_trigger" guid="D8DE4DE7-6C00-1014-B904-200204C60A89">
|
||||
<Object name="Object" guid="D8DE5073-6C00-1014-B904-200204C60A89">
|
||||
<Script name="HUD_Music_player_with_trigger_1.lsl" guid="D8DE75FF-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
<Script name="HUD_Music_player_with_trigger_2.lsl" guid="D8DE92EA-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
@@ -0,0 +1,115 @@
|
||||
// :CATEGORY:Music
|
||||
// :NAME:HUD_Music_player_with_trigger
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :CREATED:2012-10-09 15:42:19.730
|
||||
// :EDITED:2013-09-18 15:38:55
|
||||
// :ID:394
|
||||
// :NUM:547
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// The Sensor Script - put this script and your 10 second wav file clips into a prim. Anyone approaching this prim will trigger the music to play for just that avatar./ The avatar must wear a headset or HUD prim with the player script.
|
||||
// :CODE:
|
||||
// general purpose avatar sensor for the music playert
|
||||
|
||||
// When someone gets in range, this starts the music sequence
|
||||
|
||||
// if used in HUD mode, only the avatar wearing the HUD and also in range of some location can hear the sounds/music.
|
||||
|
||||
// When used in PRIM mode, anyone standing near will trigger the sound.
|
||||
|
||||
|
||||
|
||||
// 10-09-2012 by Ferd Frederix
|
||||
|
||||
|
||||
|
||||
// This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
|
||||
|
||||
// http://creativecommons.org/licenses/by-nc/3.0/deed.en_US
|
||||
|
||||
// This script cannot be sold even as part of another object, it must always remain free and fully modifiable.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Tuneable thing:
|
||||
|
||||
float range = 5.0; // how far a avatar has to be before sound plays, in meters
|
||||
|
||||
float howoften = 5.0; // how often we look for avatars. Average time before it detects is half this.
|
||||
|
||||
// The longer you make this, the less lag it causes.
|
||||
|
||||
|
||||
|
||||
// for a HUD, put the player in the HUD and put the sensor somewhere in-world to trigger the HUD
|
||||
|
||||
|
||||
|
||||
// best to leave these bits alone
|
||||
|
||||
integer secret_channel = 9876; // just a magic number
|
||||
|
||||
list playingKeys; // a list of all avatars that have been controlled
|
||||
|
||||
list sensedKeys; // a list of avatars within range.
|
||||
|
||||
integer debugflag = FALSE; // set to true to see it as it works
|
||||
|
||||
|
||||
|
||||
DEBUG (string msg)
|
||||
|
||||
{
|
||||
|
||||
if (debugflag) llOwnerSay(msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// send a list of UUIDs to a player
|
||||
|
||||
Send(key id)
|
||||
|
||||
{
|
||||
|
||||
integer i;
|
||||
|
||||
integer j = llGetInventoryNumber(INVENTORY_SOUND);
|
||||
|
||||
llSay(secret_channel,(string) id + "^" + "stop" + "^" );
|
||||
|
||||
for (i = 0; i < j; i++) {
|
||||
|
||||
string name = llGetInventoryName(INVENTORY_SOUND,i);
|
||||
|
||||
key soundKey = llGetInventoryKey(name); // get key of named sound
|
||||
|
||||
llSay(secret_channel,(string) id + "^" + "queue" + "^" + (string) soundKey + "^" + name + "^");
|
||||
|
||||
}
|
||||
|
||||
llSay(secret_channel,(string) id + "^" + "play" + "^" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
default
|
||||
|
||||
{
|
||||
|
||||
state_entry()
|
||||
|
||||
{
|
||||
|
||||
llSensorRepeat("","",AGENT,range, PI, howoften);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
// :CATEGORY:Music
|
||||
// :NAME:HUD_Music_player_with_trigger
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :CREATED:2012-10-09 15:42:19.730
|
||||
// :EDITED:2013-09-18 15:38:55
|
||||
// :ID:394
|
||||
// :NUM:548
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Player Script. Put this in a HUD or other worn item. If worn as a HUD, only the player wearing the HUD can hear it. This is just like a museum player.
|
||||
// :CODE:
|
||||
// suitable for museum-like headphone action. Where you stand in front of something and it talks to you until you move away.
|
||||
|
||||
|
||||
|
||||
// 10/9/2012
|
||||
|
||||
// This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
|
||||
|
||||
// http://creativecommons.org/licenses/by-nc/3.0/deed.en_US
|
||||
|
||||
// This script cannot be sold even as part of another object, it must always remain free and fully modifiable.
|
||||
|
||||
|
||||
|
||||
// This script goes into a prim worn as a HUD.
|
||||
|
||||
// Drop 10 second song clips in the inventory of the Sensor object, not the HUD.
|
||||
|
||||
// A great free tool to make these files is the slice audio file splitter at http://www.nch.com.au/splitter
|
||||
|
||||
//
|
||||
|
||||
// Set the variable loop = TRUE to loop over and over after reaching the end, set it to FALSE to play once.
|
||||
|
||||
// Requires another trigger prim in world with the Sensor script in it.
|
||||
|
||||
|
||||
|
||||
integer loop = FALSE; // set to TRUE to loop again and again
|
||||
|
||||
float set_text_alpha = 1; // the text transparency fo alpha text. Set this to 0 to disable hovertext
|
||||
|
||||
integer debugflag = FALSE; // chat debug info to owner if TRUE
|
||||
|
||||
|
||||
|
||||
// Suff that you should not mess with.
|
||||
|
||||
|
||||
|
||||
integer waves_to_preload = 3; // wave files to Preload ahead of the wav being played.
|
||||
|
||||
float preload_load_time = 0.5; // seconds pause between each preloaded wave file attempt b4 play comnences
|
||||
|
||||
integer secret_channel = 9876; // just a magic number
|
||||
|
||||
vector set_text_colour = <1,1,1>; // colour of floating text label ( white)
|
||||
|
||||
list soundQueue; // a list of sound UUIDs from the sensor
|
||||
|
||||
list nameQueue; // a list of sound names from the sensor
|
||||
|
||||
float timer_interval = 9.8; // time interval between requesting server to play the next 10 second wave
|
||||
|
||||
// times just below 10 seconds are suitable as we use sound queueing
|
||||
|
||||
integer total_wave_files; //number of wave files
|
||||
|
||||
integer i_playcounter; //used by timer() player
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEBUG (string msg)
|
||||
|
||||
{
|
||||
|
||||
if (debugflag) llOwnerSay(msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
go(integer play) {
|
||||
|
||||
|
||||
|
||||
if (play)
|
||||
|
||||
{
|
||||
|
||||
sound();
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
llSetTimerEvent(0.0);
|
||||
|
||||
llStopSound();
|
||||
|
||||
DEBUG("Stoped");
|
||||
|
||||
llSetText(llGetObjectName() + "\n.", <0,1,0>, set_text_alpha);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sound() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
total_wave_files = llGetListLength(soundQueue);
|
||||
|
||||
integer counter = 0; //do full preload of sound
|
||||
|
||||
llSetSoundQueueing(TRUE); // only works on llPlaySound not llTriggerSound, so we can queue these silently
|
||||
|
||||
integer local_total_wave_files = total_wave_files -1 ;
|
||||
|
||||
|
||||
|
||||
float length = total_wave_files * 10.0;
|
||||
|
||||
for (counter = 0 ; counter < waves_to_preload ; counter ++) //preload X wave files b4 we play
|
||||
|
||||
{
|
||||
|
||||
key preloading_wave_key = llList2Key(soundQueue,counter);
|
||||
|
||||
string preloading_wave_name = llList2Key(nameQueue,counter);
|
||||
|
||||
|
||||
|
||||
//Attempt to preload first x wave files to local machines cache!
|
||||
|
||||
llPreloadSound(preloading_wave_key);
|
||||
|
||||
|
||||
|
||||
DEBUG("Preloading wav: " + (string)counter + " " + preloading_wave_name);
|
||||
|
||||
|
||||
|
||||
llSleep(preload_load_time);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
llSetTimerEvent(0.1);
|
||||
|
||||
i_playcounter=0;
|
||||
|
||||
counter=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default
|
||||
|
||||
{
|
||||
|
||||
state_entry()
|
||||
|
||||
Reference in New Issue
Block a user