Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need Help Playing Multiple Audio Files in a String (One after another)

Featured Replies

Spoiler

Alright so I made a bunch of custom audio clips, short clips kind of like the default scanner sounds in the LSPDFR Scanner folder. I assumed I could string them together much the same as you can the default ones with Functions.PlayScannerAudio("one two three"); etc. Well I saw another post where someone was claiming you could use that function to route to your custom files via a path and it would work but so far I have found that to not be accurate. I can play a single custom sound file no problem, worst case scenario I will manually combine the clips I need into one file in davinci resolve and just do that. I have been able to play audio files with System.Media and it seems to work well. The only way I've been able to play clips one after another in my OnBeforeCalloutDisplayed() is by using sounds.PlaySync(); however that freezes your whole script for the duration of the audio files soooo nooooo bueno.

 

I tried using ManagedBass.dll with no luck, LSPDFR log kept saying it could not find the file for it basically and from what I could tell I didn't need to include another .dll or anything in the GTA directory for it to work? I decided it must not be compatible? Tried a few other 3rd party plugins with no luck. I honestly have been working on this part for a few days now trying to figure it out for myself and I've had absolutely no success. Just wanted to see if there are any other options before I get busy splicing audio files, thanks for any help.

                       	/*A GREAT EXAMPLE OF WHAT CODE NOT TO USE*/

						List<string> audioPaths = new List<string>
                        {
                            "plugins/lspdfr/my-callouts/audio/1.wav",
                            "plugins/lspdfr/my-callouts/audio/2.wav",
                            "plugins/lspdfr/my-callouts/audio/3.wav",
                            "plugins/lspdfr/my-callouts/audio/4.wav",
                            "plugins/lspdfr/my-callouts/audio/5.wav",
                            "plugins/lspdfr/my-callouts/audio/6.wav",
                            "plugins/lspdfr/my-callouts/audio/7.wav"
                        };
                        SoundPlayer sounds = new SoundPlayer();
                        foreach (string path in audioPaths)
                        {

                            sounds.SoundLocation = path;
                            sounds.Load();
                            sounds.PlaySync();

                        }

						/*A GREAT EXAMPLE OF WHAT CODE NOT TO USE*/

Alright so I made a bunch of custom audio clips, short clips kind of like the default scanner sounds in the LSPDFR Scanner folder. I assumed I could string them together much the same as you can the default ones with Functions.PlayScannerAudio("one two three"); etc. Well I saw another post where someone was claiming you could use that function to route to your custom files via a path and it would work but so far I have found that to not be accurate. I can play a single custom sound file no problem, worst case scenario I will manually combine the clips I need into one file in davinci resolve and just do that. I have been able to play audio files with System.Media and it seems to work well. The only way I've been able to play clips one after another in my OnBeforeCalloutDisplayed() is by using sounds.PlaySync(); however that freezes your whole script for the duration of the audio files soooo nooooo bueno.

 

I tried using ManagedBass.dll with no luck, LSPDFR log kept saying it could not find the file for it basically and from what I could tell I didn't need to include another .dll or anything in the GTA directory for it to work? I decided it must not be compatible? Tried a few other 3rd party plugins with no luck. I honestly have been working on this part for a few days now trying to figure it out for myself and I've had absolutely no success. Just wanted to see if there are any other options before I get busy splicing audio files, thanks for any help.

 

OH I also tried NAudio but I couldn't get it to properly find my files I don't believe. 

Edited by BlueLineAviator
Text was in a spoiler

18 hours ago, BlueLineAviator said:

Functions.PlayScannerAudio("one two three");

Interesting..
I have never thought about how that scanner file system worked. I need to do some experiments, but it looks like some semi clever trickery is done with file/folders combo-name

--------

I experimented and its like woooo..
The real mystery is what takes place in the folders
s_f_y_cop_*

s_m_y_cop_*
Those are simply weird, and perhaps be explained through some alias-naming under the hood
Wont touch those...

The other ones seems to use some parsing of folder+file-name

I think using scannerAudio imply that the files are to be found in that part of the installation, the files 1.wav 2.wav ..n.wav should be inside the folder

..GTAV\lspdfr\audio\scanner\myOwn_ScannerFolder.

But with the names

myOwn_ScannerFolder_1.wav

myOwn_ScannerFolder_2.wav

myOwn_ScannerFolder_3.wav

:

myOwn_ScannerFolder_<n>.wav

 

I made the experiment where i duplicated the folder ON_FOOT and renamed it ON_FOOD : )
I also renamed both files inside to ON_FOOD_01   & ON_FOOD_02"
                                 

Then i made the a key-opp method:

Spoiler

  if (Game.IsKeyDown(System.Windows.Forms.Keys.D3))
                                {
                                    Functions.PlayScannerAudioUsingPosition(
                                    "ON_FOOD_01   ON_FOOD_02"
                                    , Game.LocalPlayer.Character.Position);
                                }

 

Activating d3 played both soundfiles chained!
That is equivalent to making your own folder and own files and to have them played chained. Maby this is because All files in the library Scanner has both the subfolder-name as well as an own file-name as concatenated full name!
If we look at the name of one file
VEHICLE_CATEGORY_SERVICE_VEHICLE_01.wav
Then that one file is inside a folder named

scanner\VEHICLE_CATEGORY

So it looks like the engine passes the folder name out of the file-name, makes the folder operation, select the file, and plays it, or if several files are used, play them all chained!

So what would make that fail.
1) Audio-codex!

The wavefiles must be correct sample-sized!
2) file-folder errors

The path is determined to be

..GTAV\lspdfr\audio\scanner\
Then the folder-name should be identical to part of the file-name, and the type wav should be omitted

That does work!
Maby i am over-thinking something, especially the  s_f_y_cop_ thing.. but the bottomline is That it does work!

Edited by GTAbear
more info

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

  • Author
Quote

 

You are definitely onto something there GTAbear! I made a folder with the name TCA_Callouts Audio in the scanner folder and placed a .wav file called TCA_domesticcallout in the folder.

 

Using the line in my OnBeforeCalloutDisplayed():

Functions.PlayScannerAudioUsingPosition("TCA_domesticcallout IN_OR_ON_POSITION", MSpawnpoint);

 

It played the audio file and gave the area correctly when I started the callout. I guess it must have something to do with the naming as you suggest 🤔

 

 

EDIT: So ok, now that I have been experimenting I am not so sure about the name mattering at all, I must have just been totally screwing my code up somehow or another. So I have renamed my folder in scanner 'TCA Callouts Audio' it has a bunch of subfolders inside of it such as 'Calls' 'Directions' where all of audio files are sorted out in. I don't think the name matters at all as long as it isn't the same name as another audio file.

 

Functions.PlayScannerAudioUsingPosition("all_units_be_advised We_have_reports_of domestic_assault IN_OR_ON_POSITION", MSpawnpoint);

 

I just put in the exact name of the audio files and it is playing them flawlessly. I don't think it matters at all what folder they are in as long as they are somewhere within "GTAV\lspdfr\audio\scanner\" at least that is the assumption I have come to. I appreciate your help because I was wasting all of my time in Visual Studio looking for other audio solutions when all I needed to do was make sure my files were correct inside of "GTAV\lspdfr\audio\scanner\". I will update if I run into any other further issues with this!

 

I found a great explanation on the github LSPDFR API page I found. See the attached image, in case anyone else has an issue.

Could contain: text, screenshot, font, document

Edited by BlueLineAviator
Documentation About the Issue (Solved)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.