Preston Beresford Posted November 30, 2019 Share Posted November 30, 2019 I've created a ride that has a music track that plays different songs in different "rooms" as the vehicle travels through them. I have been trying to come up with something that will preload the music clips for the rider so the playback doesn't cut out. The script I'm using calls up all of the clips by UUID when they attach the HUD at the beginning of the ride. However it doesn't seem to be working. The first ride through, the music cuts out even when wearing the HUD. The second time through it plays fine. Maybe there is something wrong in the script? Here is the one I am using: integer len; integer count; list message; integer tog; default { attach(key id) { if (id) // if attached to an avatar { llResetScript(); } } state_entry() { // make a list containing the sound uuid's - each group represents one full song track message = ["6322ea90-636b-ee51-067d-80ff29f255de","a704fed7-b95f-5b46-ada6-c8fc86bc4a24","deac461c-ffb0-69f8-a2b7-0c19474fde0c","642d552c-3f51-d7ff-a13f-a4699eee8d96","6f207e56-6d3b-5dc4-180f-7ae000b669a1","c0a9a0e1-e16a-dd09-1f24-eceb6cd9f311","96199847-1067-cccb-f0bd-f110f98ce32a","a91c5197-6fde-0632-14ae-2b4dc0793ca9","b1648271-af15-2206-d058-950378d08eee", "43af4af4-fc9a-935d-e92a-ad7509e900c3","6729d381-fb57-7237-c59f-c287737f480f","ea4720e4-7921-4611-72db-1ec645e533d0","444c35ae-046f-6c95-67d5-117786bad111","b97028af-27ca-2f0e-0d32-99b20afec75a","554d63ed-c077-eedf-c0e3-ca23cc548568","d1b93056-01c0-e2c4-6d7a-d0adc4f5012f","eaafa061-b7be-d5f0-0a70-02c6ef5a7df7","06558457-ab92-aea6-78f9-caf7ef80a273", "00d2b43a-3fbe-5b23-4897-c050d1084e22","c80e8eb6-43ee-822c-93a1-bfcc6c7af58e","b1c1d290-663f-5815-1854-b39775933dce","bf810d3d-5d34-c181-52c0-f3dab12c52a7","fd8d1f00-cca3-80f4-ffd1-c87b2c901ea9","962ca6af-4eda-94da-3b04-50a53ec7a6c6","16962a4f-678e-b89b-6596-de7818eb3ec8","898c2517-ed26-8d3b-d285-504cf823ceb6","335d9b38-399d-9f4c-3a67-2741b643781f", "e0b5ae94-d966-4cef-cf01-03703f0be2f1","49b31c00-2bc3-e56c-9468-1c79773000cd","70144860-9fe4-be5b-8ef6-e4b3950e52ad","c12f2a35-15c1-3b4c-72aa-d61194cde17c", "8794d006-5aa4-2177-0f9b-745df2b6d913","829d1956-b6dc-3445-a601-0254ff627b26","9e4d9989-7a63-317b-b044-cd45b1d0e592","c8a76e04-7cc8-f36a-0355-d593d726a80d", "08b0a3c2-2f62-2a11-d412-457fe96b210b","a9d0c856-86cd-1b21-bc36-76be505c1e64","22a28d50-1889-861d-4fcf-f2725ccabb4c","331b46eb-b840-7c4e-398e-0f40be4c20fa", "c6e90401-3532-6f8d-d573-623166d792e7","046aa05f-96b6-7c72-0a26-0574fdf5b4b9","120b0355-16d0-2210-58e9-1e465e43fc61","de5217df-e93e-7f73-3a63-1105b2d3d1d7", "ae927ba9-acb0-4637-3d67-af1ee7940251", "05f3ee69-9238-b27c-b3ca-a4e37ac6dae3","3a21d19a-c088-f06e-07a4-c92615ada204","39943028-8c2c-becf-5693-ab3cd212cacf","812e4011-8063-c977-de52-287ead1bfce1","8e87a3b0-a2af-30e8-c82d-a06208c52ccb","767215d9-7b2d-1377-23b6-a51b97d408e0","2fb860ff-9820-80be-b8c6-83d46bb1228b","c8e0467e-ad0f-128a-263d-67a4677c38f1","cd711f54-958b-4499-9647-5b72a8b77bba","94b117d8-974b-9dac-0c55-335d1ab6313f","135c9f49-3e3c-e218-fa53-ffb850cf25cf"]; len =llGetListLength(message); integer n; for(n = 0;n < len;++n) // a for loop starts at zero and runs until n equals the number of items in the list "message" { llPreloadSound( llList2String(message,n) ); } } } Am I missing something? Link to comment Share on other sites More sharing options...
KT Kingsley Posted November 30, 2019 Share Posted November 30, 2019 That's a lot of sound clips, and I suspect they're not all getting downloaded to the viewer in time for them to be ready when they're needed. Note that llPreloadSound incurs a delay of one second when its called. About the only workaround I can think of is to start the preloading whenever there's avatars within range. Maybe an in-world object that continually loops the preloads (crude) or one that fires up whenever a unique avatar comes into range? Link to comment Share on other sites More sharing options...
Preston Beresford Posted November 30, 2019 Author Share Posted November 30, 2019 5 minutes ago, KT Kingsley said: That's a lot of sound clips, and I suspect they're not all getting downloaded to the viewer in time for them to be ready when they're needed. Note that llPreloadSound incurs a delay of one second when its called. About the only workaround I can think of is to start the preloading whenever there's avatars within range. Maybe an in-world object that continually loops the preloads (crude) or one that fires up whenever a unique avatar comes into range? Yes, the number of clips has been a concern of mine, and I was thinking that may be the issue. However I can attach the HUD and wait 5-10 minutes before riding and it still doesn't queue the music properly. Yet on the 2nd ride it seems fine. I'm kinda stumped. Link to comment Share on other sites More sharing options...
Mollymews Posted December 1, 2019 Share Posted December 1, 2019 what happens if you preload in a JIT fashion ? p-code example preloading 2 ahead len = 10; p = 0; i = 0; preload(p); preload(++p); timer(10) { play(i++); if(p < len) preload(++p); } (i < len) endtimer() Link to comment Share on other sites More sharing options...
Erwin Solo Posted December 1, 2019 Share Posted December 1, 2019 (edited) On 11/30/2019 at 8:04 AM, Preston Beresford said: I've created a ride that has a music track that plays different songs in different "rooms" as the vehicle travels through them. I have been trying to come up with something that will preload the music clips for the rider so the playback doesn't cut out. The script I'm using calls up all of the clips by UUID when they attach the HUD at the beginning of the ride. However it doesn't seem to be working. The first ride through, the music cuts out even when wearing the HUD. The second time through it plays fine. Maybe there is something wrong in the script? You have to either time the tour such that you can preplay the sound at zero volume before you truly play it at volume, or have a second prim doing so silently in parallel. If your situation (timing and geometry) allows you might dedicate a prim in each room for the purpose of preplaying silently the sound intended for the next room. Edited December 1, 2019 by Erwin Solo 1 Link to comment Share on other sites More sharing options...
Erwin Solo Posted December 1, 2019 Share Posted December 1, 2019 On 11/30/2019 at 8:47 AM, Preston Beresford said: Yes, the number of clips has been a concern of mine, and I was thinking that may be the issue. However I can attach the HUD and wait 5-10 minutes before riding and it still doesn't queue the music properly. Yet on the 2nd ride it seems fine. I'm kinda stumped. The sounds are cached by your viewer. Depending on your viewer preference settings, the caching may or may not survive a viewer relog event. The complicates testing. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now