|
JukkaKevät
|
 |
« on: April 01, 2008, 07:20:42 AM » |
|
Any IrrKlang users here? I need a little help or confirming. Little bit of problems arising from using looping sounds with irrKlang. The sound I'm using is getting looped 35 times (if in wav format) and 25 (if in ogg format), then it just stops. The test scene is very simple, nothing changes in the scene or sound system, just sound looping and same stuff rendered over again. A shot into the dark: I don't know TrueVison3D, but maybe it is based on D3D, which can change the floating point calculation method which again might influcence how some special file is decoded, causing such an error, but something like this hasn't reported before. Have you experienced any weirdnes using IrrKlang or has everything ran smoothly?
|
|
|
|
« Last Edit: April 01, 2008, 07:29:02 AM by JukkaKevät »
|
Logged
|
|
|
|
ZaPPZion
Community Member

Posts: 323
|
 |
« Reply #1 on: April 01, 2008, 11:39:17 AM » |
|
Well, i'm not using irrKlang, but that shot in the dark could be it. If it's a floating point calculation error, then there's a fix for this;) use: TV.setFPUPrecision(true);
|
|
|
|
|
Logged
|
|
|
|
|
JukkaKevät
|
 |
« Reply #2 on: April 02, 2008, 02:16:24 AM » |
|
Found out what was causing it! It was because of the sound was being read from the hard drive each loop. This was the original which paused until certain amount of loops: FanSound = SoundEngine.Play3D(Basepath + "./data/music/ambient/fan.wav", 0, 6, 0, True, False) Here is the memory buffered one which works as expected: FanSource = SoundEngine.AddSoundSourceFromFile(Basepath + "./data/music/ambient/fan.wav", irrklang.StreamMode.NoStreaming, False) FanSound = SoundEngine.Play3D(FanSource, 0, 6, 0, True, False, False)
|
|
|
|
|
Logged
|
|
|
|
|
Raine
|
 |
« Reply #3 on: April 02, 2008, 05:14:03 AM » |
|
Thanks for posting the solution.  Would you recommend irrKlang over fmod, for instance?
|
|
|
|
|
Logged
|
|
|
|
nadjibus
Community Member

Posts: 97
|
 |
« Reply #4 on: April 02, 2008, 12:57:40 PM » |
|
Thanks for posting the solution.  Would you recommend irrKlang over fmod, for instance? Definitly YEAH. I'm using it and I'm very happy with it 
|
|
|
|
|
Logged
|
|
|
|
|
JukkaKevät
|
 |
« Reply #5 on: April 03, 2008, 03:59:25 AM » |
|
I'd say the FMod is more rich feature wise.
IrrKlang is very good and straightforward once you get around the developers chain of thought as, in my opinion, it has somewhat unique way of handling sources. IrrKlang has all the functionalities you would want from sound API and they are accessed in a simple way. It is perfect for hobby game developement, but if you have intensions to make your project into a bigger commercial product then I'd say use FMod.
|
|
|
|
|
Logged
|
|
|
|
DarkFact
Community Member

Posts: 183
3dsMax Artist
|
 |
« Reply #6 on: April 03, 2008, 10:14:26 PM » |
|
@JukkaKevät: I downloaded it and actually got it to work.  I set a 3d sound at 0,0,0 and set the listener to follow my camera and point back to the emitter using Camera.GetDirection which is updated in the loop. It works as expected except the Maximum and Miminum distances seem to have little effect. The sound volume rises and falls and pans like it should, but when I move several TV units away from the emitter, I can faintly hear the sound still. I set the min to 0.0f and max to 1.0f. In my scene 1 TV unit is approximately 1 meter. Do you know what I could do to make the sound disappear past the maximum distance setting? Cheers,
|
|
|
|
|
Logged
|
|
|
|
WEst
Community Member

Posts: 805
Daniel Martinek
|
 |
« Reply #7 on: April 04, 2008, 01:47:07 PM » |
|
The Min-MaxDistance in IrrKlang is a bit strange: ISound.MinDistance Property:
Sets the minimal distance if this is a 3D sound. Specify the distances at which 3D sounds stop getting louder or quieter. This works like this: As a listener approaches a 3D sound source, the sound gets louder. Past a certain point, it is not reasonable for the volume to continue to increase. Either the maximum (zero) has been reached, or the nature of the sound source imposes a logical limit. This is the minimum distance for the sound source. Similarly, the maximum distance for a sound source is the distance beyond which the sound does not get any quieter. The default minimum distance is 1, the default max distance is a huge number nearly to infinite. So you have to set the maximum to a big number (else it won't get quieter after 1m) and the minimum distance to something small. About IrrKlang: I use it in every of my project that uses sound. It is very easy to use, is cross-platform and cpp and .net usable. And also its features are growing steadily, e.g. the latest update brought new recording features.
|
|
|
|
« Last Edit: April 04, 2008, 01:49:34 PM by WEst »
|
Logged
|
Greetings
Daniel Martinek Lead Programmer Roaming Nova Studios
|
|
|
DarkFact
Community Member

Posts: 183
3dsMax Artist
|
 |
« Reply #8 on: April 04, 2008, 02:08:03 PM » |
|
Thanks WEst, but I still don't get it. No matter what I set the maximum distance to, there's no change. I set it to 1. Logic says it should not be heard past 1 unit from the source. I set it to .1: Same thing.
However, the sound does fade away as I go away from it, but it's never 100% silent.
My logical thought is that if I set the sound source at 0,0,0, Min: 0 Max: 1 and I move to 0,0,2, then I shouldn't hear any sound. I guess my logic doesn't work with their reality.
I'll keep at it. Thanks again.
|
|
|
|
|
Logged
|
|
|
|
WEst
Community Member

Posts: 805
Daniel Martinek
|
 |
« Reply #9 on: April 05, 2008, 04:32:21 AM » |
|
I know it's really complicated, I think that in irrKlang the distance at what you hear a sound is determined by the volume and the rolloff factor of the sound. The min and max values are only additional borders.
Imagine if you come from 100 units towards your source. Then the Minimum Value determines when the sound doesn't get louder (e.g. 1m = if you go from 2 to 1m then it will get louder but not beyond 1m, it will keep the same volume from 1 to 0m). If you now leave the source the maximum value determines when it won't get any quieter (e.g. max = 1000m the sound will get quieter until 1000m are reached, BUT this doesn't mean that it is still audible in 1000m, if you use min=1m and max=2m then it will only get quieter between 1m and 2m, and if your sound is too loud it won't get totally quiet at 2m and it will still be audible everywhere around.
This is very complicated and I hope that I have unterstand it right, but it always worked for me when I set the min distance to a small value (maybe even 0) and the max to something huge (1000 or even Single.MaxValue if you use .NET).
|
|
|
|
|
Logged
|
Greetings
Daniel Martinek Lead Programmer Roaming Nova Studios
|
|
|
DarkFact
Community Member

Posts: 183
3dsMax Artist
|
 |
« Reply #10 on: April 05, 2008, 09:52:58 AM » |
|
Wow, that sounds so backwards to me. LOL Thanks again, WEst. I'll give it a go longer then. BTW, I tried OpenGL.Net last night and there's so many dependencies that I found IrrKlang even more desirable now. Even the "Full" cost is only 10% of commercial FMOD. 
|
|
|
|
|
Logged
|
|
|
|
DarkFact
Community Member

Posts: 183
3dsMax Artist
|
 |
« Reply #11 on: April 05, 2008, 10:17:57 PM » |
|
Well I got it now.  The best I can understand it is that the SetRolloffFactor parameter has to be set to a larger number. It still doesn't make sense to me, but I can work with it. For example, a Single value of 10 makes it attenuate almost instantly.  m3dMusic = New ISoundEngine saw = m3dMusic.AddSoundSourceFromFile("Models\saw.wav", StreamMode.AutoDetect) Race1 = m3dMusic.AddSoundSourceFromFile("Models\twisted.ogg") m3dMusic.Play3D(saw, 0, 1, 0, True, False, False) m3dMusic.SetRolloffFactor(3) ' m3dMusic.Play2D(Race1, True, False, False)
|
|
|
|
|
Logged
|
|
|
|
|
JukkaKevät
|
 |
« Reply #12 on: April 10, 2008, 05:08:39 AM » |
|
I'm currently checking this sound distance thing too. Had to refactor my sound handling code and other things a bit.
Even changing the setrollofffactor doesn't make the sound disappear at the distance. I think it just changes the curvature between min and max distance.
This is kinda puzzling, since I too have to stop sounds when the player is moving from level area to another and any sort of sudden stop will be noticable.
I'll look into this...
|
|
|
|
|
Logged
|
|
|
|
|
JukkaKevät
|
 |
« Reply #13 on: April 10, 2008, 05:23:00 AM » |
|
Yes the problem is changing the max distance. In another case, maximum distance can mean the point in which the sample reaches a relative volume of 0.0. This is rarely used, as it doesn't account for real life situations. You must leave the max distance to be a huge number (default is fine). The min distance and volume of the sound is all that matters. This article covers it all, actually it also teaches a little bit about sound theory. http://www.devmaster.net/wiki/Attenuation_By_Distance
|
|
|
|
« Last Edit: April 10, 2008, 05:28:25 AM by JukkaKevät »
|
Logged
|
|
|
|
|