For some time, I’ve been having problems with my Mac completely freezing during the execution of a LiveCode script, part of a stack that makes use of embedded sounds—each card of some 500 can have one or no sound embedded (most cards have such a sound).
After some testing, I have discovered that the number of Threads shown to be in use by Activity Monitor increases greatly when sounds are included in the stack: removing the sound elements causes no such increase in Threads.
To perform the test, I removed OpenCard scripts (there were no CloseCard scripts) and the script under Button is nothing more than
on mouseUp
repeat the number of cards in bg "original"
go next cd of bg "original"
end repeat
end mouseUp
Here are some videos to show the tests and their results.
Firstly, using the stack without sound elements. Here the Threads count starts at 5 and ends at 7:
Now using the same stack and script, but with sound elements included. Here the Threads count starts at 10 and ends at 894:
LiveCode was started afresh for each test.
I believe that this has something to do with the apparent freezing of OS X.
The script I use to place a clip on each card is linked to the Soundclip button:
on mouseUp
if the hilite of btn "Soundclip” then
answer "Remove link to soundclip?" with "Yes" or “No"
if it is "No" then exit mouseUp
put empty into fld “soundclip”
set the filename of player "Player" to empty
set the visible of player "Player" to false
set the hilite of btn "Soundclip" to not the hilite of btn “Soundclip"
exit mouseUp
end if
answer file "Select original soundclip” with "/Users/username/Documents/soundclips/“
if the result is not "Cancel” then
put it into soundClipFile
put soundClipFile into fld “soundclip"
create invisible player “Player"
set the filename of player "Player" to fld “soundclip"
set the showController of player "Player" to true
set the location of player "Player" to 287,587
set the width of player "Player" to 306
set the height of player "Player" to 22
set the threeD of player "Player" to true
set the borderWidth of player "Player" to 3
set the visible of player "Player" to true
set the hilite of btn "Soundclip" to not the hilite of btn "Soundclip"
end if
end mouseUp
I have the problem with all recent versions of LiveCode, but it seems to be getting progressively worse: LiveCode 8.1.1 and 8.1.3 can’t even complete the simple test script shown at the top of this post, for example, whereas 8.0.2 can.