Jump to content

[Real 3D] Server-side Sound API 1.1.0

   (4 reviews)

1 Screenshot

About This File

Description:

This resources provides the ability to create/control sound in 3D via custom API.
A slightly redesigned version of the Sound API, with real synced 3d effect.

API:

// Client-side

mp.game.audio.playSound3D(veh_id, url, range, volume, track_length)

/*
* veh_id: int(Required) [Vehicle RemoteID]
* url: string (Required) [Links and local package:// protocol are supported]
* range: int (Optional, Default: 60)
* volume: int (Optional, Default: 1) [Range: 0 to 1]
* track_length: int (Optional, Default: 180) [Current track length in seconds]
*/

/// EVENTS:
// (Client)

/*
* EventName: audioFinish
* params: soundID (Vehicle's RemoteID that is finished Playing)
*/

/*
* EventName: audioError
* params: soundID (Vehicle's RemoteID that had error), errorObject {code: 'error code', error: 'error description'}
*/

// (Server)

/*
* EventName: sound:create
* params: 
	id, (Vehicle's RemoteID)
    	url,
    	range,
    	volume,
    	track_length
*/

/*
* EventName: sound:destroy
* params: id (Vehicle's RemoteID)
*/

/*
* EventName: sound:pause
* params: id (Vehicle's RemoteID)
*/

/*
* EventName: sound:resume
* params: id (Vehicle's RemoteID)
*/

/*
* EventName: sound:setVolume
* params: id (Vehicle's RemoteID), volume
*/


// Example
let vehicleId = mp.players.local.vehicle.remoteId;
mp.game.audio.playSound3D(vehicleId, 'http://rfcmedia.streamguys1.com/MusicPulse.mp3', 20, 1, 60);
mp.events.callRemote('sound:pause', vehicleId);
mp.events.callRemote('sound:resume', vehicleId);
mp.events.callRemote('sound:destroy', vehicleId);

If you have any issues or suggestions, you know the usual routine.

Credits:

- Thanks to Captien for his 3D sound API.

Media:

 

Edited by fakeskill

  • Like 6

User Feedback

Create an account or sign in to leave a review

You need to be a member in order to leave a review

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Phill___

· Edited by Phill___

   1 of 2 members found this review helpful 1 / 2 members

is it possible to use it in C#?

Response from the author:

 
Yes. You can check the client files and find the geometric expression. I think it won't be difficult to rewrite it in c#
Link to review
CrepperBoyHD

   1 of 3 members found this review helpful 1 / 3 members

how to use .ogg files

 

Response from the author:

 
 
Y can use any type of music supported by Howler lib.
Important! The audio must be non-streaming in order for the 3d effect to work(html5 doesnt support it)
Link to review
offsetx

   2 of 11 members found this review helpful 2 / 11 members

horrible panner lol 

Response from the author:

Ok, then suggest your version of panner

  • Confused 1
Link to review
×
×
  • Create New...