New audio stuff ]|[
BlitzMax Forums/BlitzMax Module Tweaks/New audio stuff ]|[
| ||
Whew! There's yet another new audio driver now available via syncmods (win32 only). This one is called plain old "DirectSound", and although it uses direct sound it doesn't do it's own mixing - as opposed to "FreeAudio DirectSound" which does. I am now pretty much convinced that doing your own mixing under Vista is a big no-no. Anyway, the new driver works very well for me on Vista, so give it a blast and let me know how you go. Mac/Linux users: OpenAL stuff should be up tomorrow. |
| ||
After doing a syncmods, I now get the following error when compiling anything: Compile Error - Identifier 'IDirectSoundBuffer' not found No matter how simple the program. Print "TEST" even gives it. I'm recompiling modules now to see if that makes any difference, but since not everyone has MinGW installed... |
| ||
FreeAudio Default and FreeAudio DirectSound seem to work well. I was able to launch my game and play with no issues at at. But plain old DirectSound didn't work at all for me. My game craps out instantly with a null error when trying to play the very first sound at my game's "launch window". This doesn't seem to be quite the same error that Skid had help me with earlier, because with that one I was able to actually get into the game a bit before getting an exception. |
| ||
Update: Nope, rebuilding modules fails too. Gets stuck in directsoundaudio.bmx, at the line: Field _buffer:IDirectSoundBuffer,_seq,_paused So... the latest syncmods completely broke blitzmax for me, I can't compile any program at the moment. |
| ||
Everyone: try syncmods again - you may have just missed the pub.directx bit |
| ||
Tachyon, what are your system specs? |
| ||
Everyone: try syncmods again - you may have just missed the pub.directx bit Looks like that was it, it's working now. Thanks! |
| ||
Windows XP, BlitzMax 1.24 fully sync'd (just sync'd again for good measure) Hardware: AMD64, 4GB RAM, SoundBlaster X-Fi Platinum, GeForce 7800 GTX video. My Computer and drivers are usually kept up-to-date, though it's been a couple months since I checked for new drivers. I'll do that and try again.... [edit] Nope, everything is up to date. I'll try another test and see if I can pinpoint anything. |
| ||
Hmm...not sure what the problem is. This code fails for me:SuperStrict If SetAudioDriver("DirectSound") Print "Ok!" Local Sound:TSound = LoadSound("C:/Program Files/BlitzMax/samples/digesteroids/sounds/teleport.wav") Local Channel:TChannel = PlaySound(Sound) Delay 1000 I am getting an "Ok!" so the driver seems to be getting set. I just get a null error on the PlaySound line (null channel, null sound). If I REM out the SetAudioDriver line it plays fine. |
| ||
Okay, there'a fair bit stuffed: looping, volume, pitch! |
| ||
This might be of interest?Function VolumeToDecibels:Int(vol#) If vol=>1 Then Return 0 'DSBVOLUME_MAX If vol=<0 Then Return -10000 'DSBVOLUME_MIN Return Log10(vol)*3321.928094887 EndFunction ' little tester Local n,vol# For n=0 To 1000 vol = (1.0/1000)*n Print vol+": "+VolumeToDecibels(vol) Next |
| ||
Hmm...lots to fix and it's getting late. So it's probably best not to try "DirectSound" driver just yet! |
| ||
First batch of fixes up! Actually tested on XP this time! |
| ||
Awesome, that one seems to work good. |
| ||
Yeah, I forget BytesPerSample[format] is pre-multiplied by #channels! Dunno how Vista worked at all... REDi, that algo looks good, but it produces values < -10000 when vol gets very small - should I just clamp? My effort is just a hack: (vol^.1)*10000-10000 |
| ||
oh yeah, so it does! i dont think dsound minds to much tho, does it? otherwise, yeah clamp it, i dont think it'll notice at those levels. |
| ||
Don't know why, the DSound stuff still sounds crackle on my 2 test machines, the Default one is OK. Do we need to do manual buffer tweaking? |
| ||
yoko, did you try SetAudioDriver("DirectSound")? (not "FreeAudio DirectSound") |
| ||
Doh. The "DirectSound" one works well.. it seems FreeAudio DirectSound got broken now... I should examine the drivers first, my fault :| |
| ||
FreeAudio DirectSound is still scuppered here. DirectSound works fine. Tested in XP - don't have Vista. Just a small note of caution to anybody testing this or getting errors. If you're using Framework/Import in your code, then you need to add Import brl.directsoundaudio atop your code, otherwise you won't be able to set the driver correctly. |
| ||
Results on XP: FreeAudio Default - Ok, no delay DirectSound - Ok, no delay FreeAudio DirectSound - crackly sound, no delay Results on Vista: FreeAudio Default - Ok, delay DirectSound - Ok, no delay FreeAudio DirectSound - Ok, delay |
| ||
Early tests show all fixed here. |
| ||
Nope...sorry guys...I found another bad bug somewhere in the new audio code. It appears to be similar to the bug we had in the "New audio stuff ][" thread: I am getting unhandled exceptions that seem to be possibly related to playing a local sample and then the channel going out of scope. However, unlike that bug I have not been able to duplicate it outside my game yet. The bug is definitely associated with "FreeAudio Default" and "FreeAudio DirectSound", because plain "DirectSound" works fine (no crashes where the other two drivers are failing within the game.) |
| ||
Okay, this sample that I had posted in the "New audio stuff ][" thread does in fact crash my computer with the latest updates...it appears to be the exact same problem that Skid *had* fixed:SuperStrict Graphics 640,480 While Not KeyHit( KEY_ESCAPE) Play_Local_Sound() Delay 100 Flip Wend Function Play_Local_Sound() Local Sound:TSound = LoadSound("C:/Program Files/BlitzMax/samples/digesteroids/sounds/teleport.wav") Local Channel:TChannel = PlaySound(Sound) End Function [edit]: Oops, I just thought of something. Skid had me apply a small change to 'freeaudioglue.ccp" to fix this problem and I had since re-installed BlitzMax to fix another error caused by MaxIDE. I guess I need to "reapply" his fix, right? |
| ||
Okay... reapplied the fix that Skid gave my in the previous thread and it looks to be fixed. Is his fix going to be made official? |
| ||
Don't know if simpilfy the sound drivers is good or not as these: FreeAudio (as default?) DirectSound (optional) OpenAL (can be manually enabled) seems FreeAudio DS have some problems on some systems, and need to be fixed (or disabled...) and we can toggle OpenAL as SW or HW mode with some function, should be good for a casual game. |
| ||
Don't know if simpilfy the sound drivers is good or not as these: FreeAudio (as default?) DirectSound (optional) OpenAL (can be manually enabled) seems FreeAudio DS have some problems on some systems, and need to be fixed (or disabled...) and we can toggle OpenAL as SW or HW mode with some function, should be good for a casual game. I think this is a good idea. Separate driver specific commands can be used to specify 'subsystems' if necessary. Everyone agree? |
| ||
This test crackles on my xp32 setup, i'd say it is my asus driver, freeaudio drivers are both fine and i tried shutting down skype just in case...' createaudiosample.bmx SetAudioDriver "DirectSound" Local sample:TAudioSample=CreateAudioSample( 32,11025,SF_MONO8 ) For Local k=0 Until 32 sample.samples[k]=Sin(k*360/32)*127.5+127.5 Next Local sound:TSound=LoadSound( sample,True ) Local channel:TChannel=PlaySound(sound) Local r#=1 While True Delay 5 SetChannelRate channel,r r=r+.01 Wend re subsystems, i would prefer the single enumeration of all audiodrivers for my game menu requirements, although as far as the user is concerned i'll probably go with the following for windows players: AudioDriver DirectSound Hardware (default) DirectSound Software OpenAL Hardware OpenAL Software MultiMedia Software |
| ||
This test crackles on my xp32 setup Yuck - does here too. Can you try removing the DSBCAPS_LOCSOFTWARE from TDirectSoundSound.Create? This sort of fixes it here, but there's still some weird 'beating' going on in the background. I guess this suggests DirectSound driver is gonna have to know where the sample should go. But we're gonna have to deal with that eventually with OpenAL anyway. I suggest we extend 'loop_flag' of LoadSound for this purpose, eg: 1=loop 2=hardware 4=3D ...etc... i would prefer the single enumeration of all audiodrivers for my game menu requirements Yeah, I guess so. It's just all a little confusing right now, and I think we can do a better job of picking a sensible driver. How about: Each audio module (directsoundaudio, freeaudioaudio, openalaudio) publishes a 'auto detect' driver with the same name as the module - ie: "DirectSound", "FreeAudio", "OpenAL". This driver then attempts to open the best sub-driver - eg: OpenAL can try the default driver (which doesn't work on my Vista!) and if it craps out try "Generic Hardware" or something; FreeAudio could do a 'vista detect' and use DirectSound etc. Audio modules can also add more specific drivers as they are now. What it all means is that apps can present a simple "OpenAL","FreeAudio","DirectSound" menu and have a pretty good chance of working properly! Sound good/better? |
| ||
Yes- the more automated the process of driver selection is, the better. Most gamers don't want to have to pick from 6 different drivers just to get the sound working properly on their computer- they just want to play the game. |
| ||
Mark, it needs clamping! LOL |
| ||
I realise the new audio stuff is windows only at the moment but it seems to have broken the freeaudio mod on the Mac too. I've just done a synmods and build all and got the following compilation error.. Compiling:freeaudio.cpp Compiling:freeaudioglue.cpp Compiling:coreaudiodevice.cpp Compiling:freeaudio.bmx Archiving:freeaudio.debug.macos.ppc.a Compiling:freeaudioaudio.bmx Compile Error: Missing function parameter 'deviceid' [/Applications/BlitzMax/mod/brl.mod/freeaudioaudio.mod/freeaudioaudio.bmx;134;1] Build Error: failed to compile /Applications/BlitzMax/mod/brl.mod/freeaudioaudio.mod/freeaudioaudio.bmx Process complete Any clues? |
| ||
Skid posted a message in the BlitzMax Bug Report forum saying that there were problems with the FreeAudio Mac code that he is currently working on. I'm sure your error is related. |
| ||
seem to be having problems freeing sound channels in 1.24? Once I reach 4092 allocated sound channels I can no longer allocate any additional channels. The following code seems like it is being called: Local pTChannel:TChannel For pTChannel = EachIn g_TChannelList If (pTChannel.Playing() = False) 'Print "Removing" StopChannel(pTChannel) g_TChannelList.Remove(pTChannel) pTChannel = Null End If Next Does anyone know if there is a bug? Thanks |
| ||
This needs EAX effects. |
| ||
Sorted it with a tiny tweek in freeaudio.bmx Just set the default deviceid in the function dec. Function fa_Init( deviceid =0 ) Local device ?Win32 If deviceid device=OpenDirectSoundDevice() Else device=OpenMultiMediaDevice() EndIf ?Linux Select deviceid Case 0 device=OpenOSSDevice() ' Case 1 ' device=OpenALSADevice() EndSelect ?MacOS device=OpenCoreAudioDevice() ? Local res=-1 If device res=fa_Reset(device) Return res End Function |
| ||
Since I've synced modules, I get an error when using the same old sound-code. http://www.blitzbasic.com/Community/posts.php?topic=67630 An Idea, anyone? |
| ||
Im still stuck on the OPENAL ,stuff, I downloaded openal installed it, synced modules, I just get an undefined identifer error? |
| ||
latest audio thread is here |