SanAndreasUnity icon indicating copy to clipboard operation
SanAndreasUnity copied to clipboard

Playing radio stations

Open in0finite opened this issue 6 years ago • 7 comments

TODO:

  • sync radio across clients
  • don't play sounds in the order they are stored
  • async loading of sounds - some sounds can take 300 ms to load
  • make sure code works fine when there is no audio in game installation - probably done

in0finite avatar Aug 30 '19 17:08 in0finite

Radio stations can be large (> 100 MB), so they can't be loaded at once. Only the part of the station which is currently played, should be loaded.

in0finite avatar Aug 30 '19 17:08 in0finite

The code is structured well and thus clear to me. However due to my inexperience both in GTA game and Unity, I still have some extra work to do. Here is a todo list.

  • [ ] Play game to check input keys relevant to radio stations and whether the radio station still be playing after the player get off the car without switch off radio.

  • [ ] I think I have to read some doc and play with mirror a bit. (Btw, why you choose mirror? Are there some special considerations or you just pick it random?)

lexnewgate avatar Aug 30 '19 19:08 lexnewgate

Are all stream sounds with 2chars radio stations(except AA)? image Other names such as cutscene or beats do not belong to radio stations. Am I correct?

lexnewgate avatar Aug 30 '19 19:08 lexnewgate

Play game to check input keys relevant to radio stations

We don't have to use the same keys. The original game uses mouse scroll (which can be read from Ped.MouseScrollInput), but this is not available on mobile platforms. So for now, we can use the same buttons which are used for switching weapons (E and Q on a PC, arrows at bottom of screen when using touch input). These buttons invoke OnNextWeaponButtonPressed()/OnPreviousWeaponButtonPressed() on current ped state. So you can override these 2 methods in VehicleSittingState class, and switch radio station.

whether the radio station still be playing after the player get off the car without switch off radio.

It's switched off in original game. This should be configurable. It would be cool to hear radio sound in 3D, when ped is not in the vehicle. But, for the sake of simplicity, we can switch off radio for now.

I think I have to read some doc and play with mirror a bit. (Btw, why you choose mirror? Are there some special considerations or you just pick it random?)

I choose Mirror because it seems like the best networking solution to me. You don't need to make it networked. I can do it, if it's a problem for you.

in0finite avatar Aug 30 '19 19:08 in0finite

Other names such as cutscene or beats do not belong to radio stations. Am I correct?

I think you are correct.

I forgot to mention this. You can download SAAT, extract it, and open metadata-generic.ini. There you will find all info about radio stations.

in0finite avatar Aug 30 '19 20:08 in0finite

arrows at bottom of screen when using touch input

Is there any art resource to show these arrows? Or I just use button named < and >.

It would be cool to hear radio sound in 3D

Yeah. Thats what I am thinking about.

But, for the sake of simplicity, we can switch off radio for now.

Sure.

I choose Mirror because it seems like the best networking solution to me. You don't need to make it networked. I can do it, if it's a problem for you.

No. It will be no problem for me. I am also interested in it.

I forgot to mention this. You can download SAAT, extract it, and open metadata-generic.ini. There you will find all info about radio stations.

I have checked the files. It seems they are all raido stations. (They are all in a form of station=xx)

lexnewgate avatar Aug 31 '19 08:08 lexnewgate

Is there any art resource to show these arrows?

Touch input is already implemented. You can turn it on in Options => Misc => Use touch input.

in0finite avatar Aug 31 '19 14:08 in0finite