Author Topic: 4 speaker rehearsals  (Read 2429 times)

0 Members and 1 Guest are viewing this topic.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
4 speaker rehearsals
« on: December 16, 2021, 03:03:21 pm »
Hi !

I want to ask for a little help!
I want to do the car game with good sounds, engine noise, etc.…
I tried adjusting the balance. The rehearsal works with 2 speakers, so in stereo.
Unfortunately I only have a 2 speaker system.
I would like someone to test with 4 speakers to see if it works that way.
Just enter an mp3 music at the beginning of the program and then the position of the mouse in the circle will give the sound.
Does it work this way with 4 speakers?
Thanks for trying!

Code: QB64: [Select]
  1. sn = _SNDOPEN("engine_01.wav")
  2.  
  3.  
  4. monx = 600
  5.  
  6. cent = monx / 2
  7. rad = monx * .9 / 2
  8.  
  9. mon = _NEWIMAGE(monx, monx, 32): SCREEN mon
  10. CIRCLE (cent, cent), rad
  11. CIRCLE (cent, cent), 5
  12.  
  13.  
  14.  
  15.     IF _SNDPLAYING(sn) = 0 THEN _SNDPLAY sn
  16.  
  17.     'volume
  18.     dis = SQR((cent - _MOUSEX) ^ 2 + (cent - _MOUSEY) ^ 2)
  19.     IF dis > rad THEN dis = rad
  20.     volume = 1 - 1 / rad * dis
  21.     _SNDVOL sn, volume
  22.  
  23.     'balance (left-right)
  24.     disx = cent - _MOUSEX
  25.     IF ABS(disx) > rad THEN disx = rad * SGN(disx)
  26.     disx = -1 / rad * disx
  27.  
  28.     'balance (reae-front)
  29.     disy = cent - _MOUSEY
  30.     IF ABS(disy) > rad THEN disy = rad * SGN(disy)
  31.     disy = -1 / rad * disy
  32.  
  33.  
  34.     _SNDBAL sn, disx, disy, , 1 'left
  35.     _SNDBAL sn, disx, disy, , 2 'right
  36.  
  37.  
  38.  

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 4 speaker rehearsals
« Reply #1 on: December 16, 2021, 03:37:24 pm »
I have never been able to get sound from the QB64 to the rear speakers, but it is possible that I will have a mistake because the rear speakers usually play very quietly. In your program, I rotate the mouse sound left, center, and then right. The front / rear doesn't work, but as I say, it wants someone else to try it as well. I have Logitech 5.1 speakers and it also depends a lot on whether I have a dolby digital switch and a switch on the speaker driver. When I switch that switch, my subwoofer gains and weakens when I move the mouse in the Y axis, but the rear speakers still nothing.

So - please test it also someone else with 4.0 / 4.1 / 5.1 / 7.1 speakers

I would also be interested in someone else's result.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 4 speaker rehearsals
« Reply #2 on: December 16, 2021, 06:04:39 pm »
thanks Petr for trying it! it's a shame it doesn't work, even though it would have been interesting.