Your code doesn't go past 1 because it is deleting the sound.
Take off the delete and viola, we get a crash at 299
So that gives us actually 299 sound objects loaded... yes, not 300.
So if you are deleting the sounds, there is no problem because that ID is freed.
The below code illustrates that removal of a sound by DeleteSound() indeed frees up the ID assignment.
for c = 1 to 299
sound = loadsound("a.wav")
//deletesound(sound)
print(sound)
sync()
sleep(20)
next c
DeleteSound(100)
for i = 1 to 299
if GetSoundExists(i) = 1
Print("sound found at " + str(i))
s = 20
else
Print("sound NOT found at " + str(i))
s = 1000
endif
Sync()
Sleep(s)
next i
discard = LoadSound("a.wav")
for i = 1 to 299
if GetSoundExists(i) = 1
Print("sound found at " + str(i))
s = 20
else
Print("sound NOT found at " + str(i))
s = 1000
endif
Sync()
Sleep(s)
next i