PlayMusic needs a FreeMusic

Archives Forums/Blitz3D Bug Reports/PlayMusic needs a FreeMusic

Tranz(Posted 2006) [#1]
PlayMusic needs a FreeMusic so it doesn't leave the music in the openfile list, which seems to be limited at 512 files, or FreeSound fixing to allow it to free music as well.


Damien Sturdy(Posted 2006) [#2]
Channel=PlayMusic(...)

StopChannel(Channel)




:-)


Tranz(Posted 2006) [#3]
StopChannel just STOPS the track, it doesn't free it.

It's still effectively an open file as far as blitz is concerned.


markcw(Posted 2006) [#4]
actually i think that playmusic handles its own memory management, which means we don't need to worry about it. it would be nice if it said that in the manual though.


Tranz(Posted 2006) [#5]
While PlayMusic may handle its own Memory Management, it does not handle blitz' openfile list, to which the loaded track is added, but never removed, till the app closes, this causes blitz to stop opening any file once it hits its 512 openfiles limit. Which only has unique music added, ie if it's already on the list, it don't get added again. not sure if this unique additions applies to open/read/writefile calls as well but it does apply to tracks loaded with PlayMusic, hence my need for a FreeMusic command so I can "Play" more than the 510 track limit, limit is lower if other files are open ofc.


jfk EO-11110(Posted 2006) [#6]
So basicly you say you cannot start more than 512 songs in one session? Did you really try that? something like

for i=0 to 511
l=playmusic("test.it)
delay 100
stopchannel l
next

what's gonna happen, a MAV?


Tranz(Posted 2006) [#7]
No, no, you misunderstand. Your example will play and stop one song over and over, which should work fine, except for 'tracker' music.

The problem is the openfile limit and no way to remove songs from the list. Music gets added to the openfile list and stays there until the app closes.


jfk EO-11110(Posted 2006) [#8]
ok, my mistake, if it's always the same file, then of course there's only one open file. But what I mean, if I open/play say test0.it to test512.it, will it crash?


Tranz(Posted 2006) [#9]
yes it will crash, but not for the same reason, it will crash when the 1st instance tries to loop, but if you try it on 512+ mp3 files, it will not start to play any tunes after it hits the openfile limit, and crash if you try to do any new file operations (OpenFile etc), PlayMusic does not check to see if it's actually loaded anything.


Litobyte(Posted 2006) [#10]
weirdo, it seems yes a fileallocation problem, because playmusic is streaming, and the file is not put in memory.

This tells me that FreeMusic should be: FreeFileAllocation

I never tried that much (512! is much!).

I guess your problem is that you want to code a mp3 player with blitz3d ?


Fernhout(Posted 2006) [#11]
I am not sure but is it not possible if you start the music and later stop the music and then use
freebank name_of_the_music
because its the same pointer in memory as create memory.