Jump to content

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

Recommended Comments

There are no comments to display.

Create an account or sign in to comment

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

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
×
×
  • Create New...