SA-MP Forums Archive
[Plugin] Audio Plugin - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] Audio Plugin (/showthread.php?tid=82162)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34


Audio Plugin - Incognito - 16.06.2009

Audio Plugin v0.5 R2

Note: This project is no longer under active development. Its most useful feature, streaming audio, has been integrated into SA-MP itself, though it can still be used alongside SA-MP. It has been put here mainly for archival purposes.

This plugin creates a TCP server that can communicate with external clients to transfer and play back audio files, stream audio files from the Internet, and control in-game radio stations. It has several features, including:
Changelog

GitHub Commit History (Client)
GitHub Commit History (Server)

Refer to the CHANGES file the server binary package for the full changelog.

Natives
Callbacks
Download

GitHub Releases Page (Client)
GitHub Releases Page (Server)

The client repository can be browsed here, and the server repository can be browsed here. These repositories can also be cloned.

The Windows version requires the Microsoft Visual C++ 2010 Redistributable Package.


Audio Plugin - Incognito - 16.06.2009

Tutorial

Client:

Installation and use of the client plugin is simple. Just run the installer and extract the files to the GTA: San Andreas directory. The ASI plugin detects when SA-MP is loaded and obtains the current player name, server address, and server port automatically. It will then attempt to connect to the TCP server (if there is one) some time after the game has started. By default, there will be a total of ten retry attempts with a delay of ten seconds each. To adjust these numbers, along with a few other settings, audio.ini will need to be edited. To locate this file, go to Start, click Run, and type in the following:

Code:
%APPDATA%\SA-MP Audio Plugin
An Explorer window should open. This directory contains all downloaded audio packs, audio.ini, and audio.txt. Note that these files will only be created once the audio plugin is loaded for the first time.

Server:

Create a directory called "plugins" inside of the server directory if one does not already exist. Place the plugin file (audio.dll or audio.so) inside of this directory.

Add the following line to server.cfg so that the plugin will load the next time the server starts:

Windows:
Code:
plugins audio.dll
Linux:
Code:
plugins audio.so
On Windows, add audio.inc to the pawno\include folder. Include this file in any of the scripts the server is running:

pawn Code:
#include <audio>
Recompile the scripts with any desired natives and callbacks provided by the include file. Start the server.

The server log should indicate that the TCP server was created successfully on the same port that the SA-MP sever is using.

Ensure that both the audiopacks folder and the audio.ini file are in the root directory of the server. Open audio.ini and add a section for the audio pack name. For demonstration purposes, this will be called "default_pack":

Code:
[default_pack]
Navigate to the audiopacks directory and create a folder called "default_pack" within it. This is where all of the local audio files will go. Add an audio file to the "default_pack" folder. This will be called "file.wav". Map it under the section that was just created in audio.ini:

Code:
[default_pack]
1 = file.wav
The number to the left of the file name (1) is the audio ID. It is completely arbitrary. It can be used in Audio_Play like this:

pawn Code:
Audio_Play(playerid, 1);
Remote files that don't need to be in the audiopacks directory can also be mapped. They must start with "http://". Here is an example:

Code:
[default_pack]
1 = file.wav
2 = http://www.website.com/file.wav
Now the audio pack simply needs to be set when the gamemode loads:

pawn Code:
public OnGameModeInit()
{
    Audio_SetPack("default_pack");
}
Alternatively, it is possible to completely ignore audio.ini and stream all of the files with the Audio_PlayStreamed native instead. This will consume more client-side bandwidth, however, if the files are played repeatedly.

More detailed examples of nearly every native and callback can be found in the filterscript.


Re: [REL] Audio Plugin v0.1 Beta - CracK - 16.06.2009

Quote:
Originally Posted by Incognito
  • Support for .wav, .ogg, .mp3, .mod, .it, .s3d, and .xm files (automatic file type filtering is present on both the client and the server)
Haha, just yesterday I thought about Pghpunkid's Scriptplayer that "it would be awesome to play .mod, .it, .s3d, and .xm files(ah dreams)" and today I see this plugin!
Great job!


Re: [REL] Audio Plugin v0.1 Beta - yezizhu - 16.06.2009

Wow,great development!


Re: [REL] Audio Plugin v0.1 Beta - whooper - 16.06.2009

OMG nice job!!!


Re: [REL] Audio Plugin v0.1 Beta - kLx - 16.06.2009

niiiiiiiiiiiiiiiiiiiiice !!!!!


Re: [REL] Audio Plugin v0.1 Beta - NeRoSiS - 16.06.2009

Nice job, but I think I'll use Punk kids when it comes out, I'v supported his project this far.

I'm still going to tets though, sound sinteresting.


Re: [REL] Audio Plugin v0.1 Beta - Correlli - 16.06.2009

This is amazing! Good work.


Re: [REL] Audio Plugin v0.1 Beta - mister-fred - 16.06.2009

It's really cool !!!!!

Small suggestion: add GetPluginVersion to simplify the comparison of the client version and version of plugin


Re: [REL] Audio Plugin v0.1 Beta - CracK - 16.06.2009

Is there a program or some other way to fill audio.inc with names of all the files existed in audiopacks(or only some folders there) folder?
I mean, it's pretty annoying to copy/paste file names, especially if it's about 30 of them..

P.S. Testing, works great


Re: [REL] Audio Plugin v0.1 Beta - Karlip - 16.06.2009

And where did the idea come from?


Anyway,you did it,and it came out good.
While we're at it,why don't you make sounds downloadable from a website?


Re: [REL] Audio Plugin v0.1 Beta - Incognito - 16.06.2009

Thanks for the feedback so far!

Quote:
Originally Posted by MrFredo
It's really cool !!!!!

Small suggestion: add GetPluginVersion to simplify the comparison of the client version and version of plugin
At some point, the plugin version may differ from the client version, making any such comparison irrelvant. Besides, you should always know what your plugin version is.

Quote:
Originally Posted by CrαcK
Is there a program or some other way to fill audio.inc with names of all the files existed in audiopacks(or only some folders there) folder?
I mean, it's pretty annoying to copy/paste file names, especially if it's about 30 of them..

P.S. Testing, works great
I believe one of my testers made a batch file that does this. I will update the reserved post with tutorials and other helpful information when I find time.

Quote:
Originally Posted by Karlip
And where did the idea come from?


Anyway,you did it,and it came out good.
While we're at it,why don't you make sounds downloadable from a website?
I think it is obvious where the idea originated.

Audio packs can already be downloaded from another source and put in the "audiopacks" folder where the client resides. This will circumvent the need to download them from the server. Additionally, as I said in the first post, remote file downloading is a feature I plan to add in the future.


Re: [REL] Audio Plugin v0.1 Beta - Pghpunkid - 16.06.2009

Quote:
Originally Posted by CrαcK
Quote:
Originally Posted by Incognito
  • Support for .wav, .ogg, .mp3, .mod, .it, .s3d, and .xm files (automatic file type filtering is present on both the client and the server)
Haha, just yesterday I thought about Pghpunkid's Scriptplayer that "it would be awesome to play .mod, .it, .s3d, and .xm files(ah dreams)" and today I see this plugin!
Great job!
Mine may not play .mod .it .s3d or .xm, but mine plays .mp3 and .wma.


Re: [REL] Audio Plugin v0.1 Beta - Slice - 16.06.2009

This is awesome.


Re: [REL] Audio Plugin v0.1 Beta - -Sneaky- - 16.06.2009

Good job Incognito, tested yesterday and works really good

Here mirrors for you:

http://files.sneakyhost.net/audio_client_v01.rar
http://files.sneakyhost.net/audio_plugin_v01.rar
http://files.sneakyhost.net/audio_source_v01.rar


Re: [REL] Audio Plugin v0.1 Beta - NigNog1 - 16.06.2009

If you disconnect whilst a sound is playing, a horrible noise will occur. It can be fixed externally by using the audio stop native, but it would be nice if it was fixed internally too.

I'm writing a mini add-on that detects when a player pauses using OnPlayerUpdate, and pauses the audio appropriately. I'll post it here in a moment.

Nice work.


Re: [REL] Audio Plugin v0.1 Beta - mister-fred - 16.06.2009

The plugins do not work on ubuntu.
The sounds are not send to client


Re: [REL] Audio Plugin v0.1 Beta - d0 - 16.06.2009

Quote:
Originally Posted by MrFredo
The plugins do not work on ubuntu.
The sounds are not send to client
try to recompile the pluginsource on ubuntu


Re: [REL] Audio Plugin v0.1 Beta - mister-fred - 16.06.2009

I try but I have errors when I compile: s


Re: [REL] Audio Plugin v0.1 Beta - Luka P. - 16.06.2009

Very nice release