Audio Import

BlitzMax Forums/BlitzMax Programming/Audio Import

gellyware(Posted 2006) [#1]
When I try using framework, my fps drops from 380 to 1fps... what am I missing here for ogg import?!?

I'm using ogg files and im importing the following:

Framework BRL.Basic
Import BRL.Max2D

Import BRL.D3D7Max2D
Import BRL.MaxUtil
Import BRL.Audio
Import BRL.PNGloader
Import BRL.Retro
Import BRL.KeyCodes
Import BRL.BmpLoader
Import BRL.timer
Import BRL.MaxGUI
Import BRL.Win32MaxGUI
Import BRL.OGGLoader
Import Pub.Win32
Import Pub.DirectX


What could cause the program to crawl now?


Dreamora(Posted 2006) [#2]
Is this the only thing you changed when the FPS dropped? Or did you perhaps activate debug


gellyware(Posted 2006) [#3]
when I comment out the audio part, it runs fine, when i add in the following (audio part) it drops to 1fps. However if I remove the framework/imports, it runs fine :S


	If Not ChannelPlaying(channel)  
		Local done= False, n  
		While Not done 
			Local n = Rand(0,totalSongs)
			If n <> currentSong 
				done = True   
				currentSong = n 
			EndIf            
		Wend
		
		music = LoadSound(musicPath[currentSong])  
		If Not music Then RuntimeError("Unable to load the song '"+musicPath[currentSong]+"'")
		PlaySound music, channel 	
	End If  

	End If


ps. ive tried debug on off as well and it doesn't help. I must be forgetting an audio import?


Dreamora(Posted 2006) [#4]
Perhaps its a broken ogg?
There have been issues because of that (oggs with incorrect header or incompatible) that cause problems

http://www.blitzbasic.com/Community/posts.php?topic=49567&hl=ogg


gellyware(Posted 2006) [#5]
Thanks for the quick response Dreamora, I'll go through that post more thoroughly tommorrow.


Why would everything work fine if ALL of the framework is included? It seems to only drop the fps to 1 (from 380ish) whenever I specify the framework above.


Dreamora(Posted 2006) [#6]
doh. thats why I asked if that was changed. So it does not drop if the framework part is not in (but the sound part is)?
ie the rem - end rem of the framework part makes all the difference?


Dreamora(Posted 2006) [#7]
doh. thats why I asked if that was changed. So it does not drop if the framework part is not in (but the sound part is)?
ie the rem - end rem of the framework part makes all the difference?

btw: you miss the pub.freeaudio module there.


gellyware(Posted 2006) [#8]
right, I added in the pub.freeaudio, If I do this

rem
Framework BRL.Basic
Import BRL.Max2D

Import BRL.D3D7Max2D
Import BRL.MaxUtil
Import BRL.Audio
Import BRL.PNGloader
Import BRL.Retro
Import BRL.KeyCodes
Import BRL.BmpLoader
Import BRL.timer
Import BRL.MaxGUI
Import BRL.Win32MaxGUI
Import BRL.OGGLoader
Import Pub.Win32
Import Pub.DirectX
import Pub.freeaudio
endrem 


It works fine. In other words, The frame rate only drops when I have the framework in and the audio code. If I comment out the audio code, the fps is 380ish, if i remove the framework, the fps is 380ish.


Regular K(Posted 2006) [#9]
Run through all the modules you need to import again, make sure you have them ALL.

Import a bunch of modules your not sure you need, but you might (like all of the sound modules).

Worth a shot?


Dreamora(Posted 2006) [#10]
just realized that there is even a brl.freeaudioaudio module *waiting for axe.freeaudioaudioaudio ;-)* ... perhaps that helps out?

As this imports pub.freeaudio, you don't need to import that manually anymore after importing brl.freeaudioaudio

there is as well a BRL.AudioSample

*somehow there came some new mods in the last versions I start to think and some disappeared or were molded into different ones*


gellyware(Posted 2006) [#11]
thanks dreamora for continuing to look into this. Is the brl.freeaudioaudio part of the latest release? I haven't upgraded to 1.18 because I read that ETNA was broken with the latest version and I need ETNA for high scores.


EOF(Posted 2006) [#12]
Don't know if you have tried my Framework Assistant ?
It might help here.


Dreamora(Posted 2006) [#13]
gellyware: Have no idea if it was added with the newest but as you don't seem to have it, I assume so. In that case something else would be needed, but as mentioned by Jim Brown, the Framework Assistant theoretically should help.


gellyware(Posted 2006) [#14]
Thanks Dreamora and Jim Brown!

The framework assistant is a wonderful tool, great job on that on Jim. The only two imports that it missed were

Import Pub.Win32 'ETNA required this
Import BRL.Retro 'needed for the mid command

It seems the problem was that I was trying to import Pub.freeaudioaudio instead of BRL.freeaudioaudio

Way to be confusing BRL!!!! Seriously, that needs some attention.

The framework assistant should be an integral part of the bmax ide.

Would it be too dificult for the compiler to intelligently slim and trim the program by having an auto-framework option? (if command isn't working, search mods and insert an import??)


Chris C(Posted 2006) [#15]
Auto framework is *long* overdue! I cant off hand think of a compiler that automatically includes all libs it can possibly find...!


Dreamora(Posted 2006) [#16]
Autoframework has a problem with the media part. On auto, it would include all image type loaders as well as all audio type loaders, no mather if you only use PNG, as the media is not known by the compiler (or better linker, the compiler does not know of anything actually)


gellyware(Posted 2006) [#17]
Why couldn't the linker then look at any commands that load media and search backwards from from the string until a valid media type is found. g....n....p ok, png found. if not already imported, Import BRL.PNGloader


Dreamora(Posted 2006) [#18]
Because you can load files from a file with strings in. There is no possibility to do that effectively on buildtime, which is why media imports need to be done manually.
I'm not even mentioning user modules. There any automatic would definitely break ... the precompiler would be needed to be tought for any module existing in your installation and thats definitely more work that use.

And just to mentioned: C / C++ / C# etc do not do it automatically as well, so no real problem with that.

PB and some others might do it, but they have no fully module based approach, they have their core modules that have their predefined build.

But I agree, the Framework Assistant should become a default tool attached or integrated to the BM IDE at best.
How about getting it into the community build of the IDE? (its superior anyway)


Chris C(Posted 2006) [#19]
The compiler could just do what framework assistant already does... FA can pickup custom mods no problem

then its just up to the user to manually whatever imports they need for the media they are using.

To be honest what we have currently just looks like a cludge and one I'd kinda assumed BRL would resolve...


Moogles(Posted 2006) [#20]
yes. jim should get in and help with the max community ide and help perturbatio and others implement this. :)


gellyware(Posted 2006) [#21]
I've upgraded to the latest version of bmax after hearing a few people tell me that the music is cutting in and out on their system. The cutting in and out is still an issue... is anyone else having problems with ogg's??


Hm... maybe this is what you were talking about earlier Dreamora with the ogg headers.