It's time to add sound system to my RPG-project..

So, I checked this forum area and I decided that probably that OpenAL would be nice. Thought, now I got new problem:

There's very interesting system with those lakes I have added to the game: they are square areas with few (30-50 etc.) waterparticles. Particles just flies in that area randomly: every time they hit the lake's "wall", it bounces. And that's good place to play "water sound" :twisted: <- playing the sound won't happen always, just randomly..

.....^-> though that bounce-and-play-sound- system won't work now since particles now moves way too slow for that because of that randomizing..

But, the problem itself: I got OpenAL working etc. now in the game, and there are Playsound- methods etc. So, it should just work with sounds.play(waterparticle.sound); but it won't work: the sound just bursts some ear-killing sounds, you know.. so the original sound wont hear :P

Well, I thinked that probably it's true that one sound can play only once at time; if it's playing arleady and you try to play it, it stops, and restarts.. but no. I made little testprogram which plays this same sound every time I click the form; it played smoothly and well; many times at once, producing nice "I'm at lake"- feeling.. :D

But.. why it won't then work in the game..?

Little sample code.. (uhh, I never like to show my codes in public :( )

Code:
&#123;
  xs is vertical speed and ys is horizontical..
  pq is quantity of lake particles and g&#91;&#93; is array of particles
&#125;
  for i &#58;= 0 to pq do begin
    if random&#40;25&#41;=0 then begin
      g&#91;i&#93;.x &#58;= g&#91;i&#93;.x + g&#91;i&#93;.xs;
      g&#91;i&#93;.y &#58;= g&#91;i&#93;.y + g&#91;i&#93;.ys;
      if g&#91;i&#93;.x > self.lp.x-16 then begin g&#91;i&#93;.xs &#58;= -g&#91;i&#93;.xs; e&#58;=true;  end;
      if g&#91;i&#93;.x <self> self.lp.y-16 then begin  g&#91;i&#93;.ys &#58;= -g&#91;i&#93;.ys; e&#58;=true; end;
      if g&#91;i&#93;.y < self.ap.y+16 then begin  g&#91;i&#93;.ys &#58;= -g&#91;i&#93;.ys; e&#58;=true;  end;
    end;
    if random&#40;500&#41;=0 then sounds.find&#40;g&#91;i&#93;.sound&#41;.play;

    can.Draw&#40;Asphyreimage.Image&#91;g&#91;i&#93;.grf&#93;, extrax+g&#91;i&#93;.x, extray+g&#91;i&#93;.y, 0, fxBlend&#41;;
  end;
I already tried to add each g[] their own sound.. same result :/ didn't helpo. And ate lot of memory ;D


..by the way.. is it very dump to use random() function like that? It reduces usage of CPU and makes lakes look a bit more slow, like in nature.. :D I'm using very peculiar methods in this game though :)


Ahh.. what an messy message.. sorry for that. Hope someone gots it. I'm a bit tired right now, and head full of stuff :)