irrKlang question

BlitzMax Forums/Brucey's Modules/irrKlang question

Tachyon(Posted 2009) [#1]
Brucey:

Why doesn't this work...

SuperStrict

Framework BaH.irrKlangAudio
Import BRL.StandardIO

Local drivers:String[] = AudioDrivers()

Print "Audio Drivers : "
For Local d:Int = 0 Until drivers.length
    Print drivers[d]
Next

SetAudioDriver("irrKlang")

Local sound:TSound = LoadSound("../../irrklang.mod/examples/media/getout.ogg", SOUND_LOOP)
Local channel:TChannel = AllocChannel()
CueSound(sound, channel)
ResumeChannel(channel)

Local i:Int

While i < 300

    Delay(100)
    i:+ 1
Wend


It crashes on the ResumeChannel command.

Also, I am getting an error message when I use your mod...
Warning: The library version of irrKlang (1.1.3) does not match the version the application was compiled with (1.0.4). This may cause problems.


Brucey(Posted 2009) [#2]
It crashes on the ResumeChannel command.

That would be a bug... Fixed in SVN.

I am getting an error message...

If you are building with the latest "release", it includes 1.0.4 of irrKlang. In SVN it is using 1.1.3 (which I think is the latest).
It's just a warning to say that it's possible there may have been API changes between version which may, or may not cause issues. As far as I know, the API hasn't changed - only the internal code.

I suppose I should look at building a new release... ;-)


Tachyon(Posted 2009) [#3]
Thanks Brucey.

One more issue:

SuperStrict

Framework BaH.irrKlangAudio
Import BRL.StandardIO

Local drivers:String[] = AudioDrivers()

Print "Audio Drivers : "
For Local d:Int = 0 Until drivers.length
    Print drivers[d]
Next

SetAudioDriver("irrKlang")

Local sound:TSound = LoadSound("../../irrklang.mod/examples/media/getout.ogg", SOUND_LOOP)
Local channel:TChannel = AllocChannel()

SetChannelVolume(channel, 0.5)

CueSound(sound, channel)
ResumeChannel(channel)

Local i:Int

While i < 300

    Delay(100)
    i:+ 1
Wend


Same code as before, but notice the SetChannelVolume command. This will crash the program will a null reference to the channel. SetChannelRate kills it too. But it'll work if you move it below the CueSound command.

BlitzMax's default sound driver will allow you to set a channel's volume and rate before you Cue it. I am wondering if this is something that can be addressed or not? I'll have to do a lot of changes to my code if I am required to move the SetChannelVolume snd SetChannelRate commands around.


Brucey(Posted 2009) [#4]
Just volume and rate commands? Or are there potentially others too?


Tachyon(Posted 2009) [#5]
SetChannelPan kills it too. Also if you check ChannelPlaying(channel), it dies with null as well.

I haven't checked all the commands, but it appears many Channel commands die if the channel isn't Cued before you use the command.


Brucey(Posted 2009) [#6]
Okay. I've changed it so that the settings are now cached internally, so that when the channel is actually Cued, it will set everything then. The underlying channel doesn't exist until you cue or play it. (not that you care... so long as it works! ;-)


Tachyon(Posted 2009) [#7]
Okay! Cool, I have irrKlang as an audio driver working under Vista. Now to try XP, then Mac, and finally Linux. So far it seems really nice- it loads music about 500% faster than the default audio driver (is it streaming?). Also no pops, clicks, or muffled audio.

Anyway, I also hope to utilize some of irrKlang's audio FX (Reverb, Flange, etc.). Hopefully this is possible! Could irrKlang be the more stable and functional BlitzMax audio driver I have been needing for three years?! =D


Tachyon(Posted 2009) [#8]
Ohh, Brucey....severe Panning issues with irrKlang.

Import  BaH.irrKlangAudio

Graphics 640, 480

SetAudioDriver("irrKlang")

channel = AllocChannel ()
sound = LoadSound ("C:\Program Files\BlitzMax\samples\digesteroids\sounds\fire.wav") ' Use a short sample...

Repeat
	If MouseHit(1) PlaySound sound,channel
	
	pan# = MouseX () / (GraphicsWidth () / 2.0) - 1
	vol# = 1 - MouseY () / 480.0
	SetChannelPan channel, pan
	SetChannelVolume channel, vol*2

	Cls
	DrawText "Click to play...", 240, 200
	DrawText "Pan   : " + pan, 240, 220
	DrawText "Volume: " + vol, 240, 240

	Flip
Until KeyHit (KEY_ESCAPE)

End

Using Vista + Sound Blaster X-Fi (all system drivers up-tp-date)

This is the same code I posted up in the Bug forum regarding panning: http://www.blitzbasic.com/Community/posts.php?topic=80266

What I hear with irrKlang is almost worst- not sure how to explain it, but it sounds like panning is just possibly reversed, and I get little "blip" sounds when it is far to the left or right.

I've been trying to perform a panning test with the irrKlang "helloworld.bmx" example to see if panning works OK when making direct irrKlang calls, but since my brain is so hard-wired into the way BlitzMax handles sound I am having difficulties making this happen. :P


Brucey(Posted 2009) [#9]
Could you mail me a release build of this please, and I'll see if the irrKlang developer can help/has any ideas.
SuperStrict
Framework BaH.irrKlangAudio
Import brl.glmax2d
?win32
Import brl.d3d7max2d
? 

Graphics 640, 480,0

SetAudioDriver("irrKlang")

Local channel:TChannel = AllocChannel ()
Local sound:TSound = LoadSound ("fire.wav") ' Use a short sample...

Repeat
	If MouseHit(1) PlaySound sound,channel
	
	Local pan# = 1 - MouseX () / (GraphicsWidth () / 2.0)
	Local vol# = 1 - MouseY () / 480.0

	SetChannelPan channel, pan
	SetChannelVolume channel, vol*2

	Cls
	DrawText "Click to play...", 240, 200
	DrawText "Pan   : " + pan, 240, 220
	DrawText "Volume: " + vol, 240, 240

	Flip
Until KeyHit (KEY_ESCAPE)

End

(note local dir for file).

In fact, if you can zip up the 3 files (exe + dll + wav), then we'll have everything you're using.

Thanks.


Brucey(Posted 2009) [#10]
it sounds like panning is just possibly reversed

It's strange that. It almost seems like it 1 is left and -1 is right... which is easily fixed, I guess (by me reversing the value).


DannyD(Posted 2009) [#11]
Quick question. I've downloaded the irrKlang module and placed it in the bah.mod/ folder. I've recompiled all libraries and am now attempting to run the 3dsound.bmx example code:


I get the following error:
Building 3dsound
Compiling:3dsound.bmx
Linking:3dsound.debug
Executing:3dsound.debug
dyld: Library not loaded: @executable_path/libirrklang.dylib
  Referenced from: /Applications/BlitzMax/mod/bah.mod/irrklang.mod/examples/3dsound.debug.app/Contents/MacOS/3dsound.debug
  Reason: image not found

Process complete


It appears to be complaining about the library not being found. Any ideas?


DannyD(Posted 2009) [#12]
Ahh it appears this is the reason...
Hi :-)

The .dylib file from the irrklang.mod/lib/macos folder need to be copied into the application bundle.
In your example, it goes into : helloworld.app/Contents/MacOS/

Unfortunately, the current version of BlitzMax doesn't support "post" build options, so unless you were to write a script to copy the file, you will have to do it manually.


Brucey(Posted 2009) [#13]
Did you get it working okay?


DannyD(Posted 2009) [#14]
Yip, Just had to move the lib to the package. Thanks for the good work producing these. Next I'll test the growl framework.