audio.createSound: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
|return = Sound a sound object | |return = Sound a sound object | ||
|freturn = void | |freturn = void | ||
|notes = You'll need to load the audio file into a file stream using [[openFile|openFile]] before you can create a sound object with it. | |notes = You'll need to load the audio file into a file stream using [[openFile|openFile]] before you can create a sound object with it. | ||
The only supported audio file types are MP3 and Ogg Vorbis (ogg). | The only supported audio file types are MP3 and Ogg Vorbis (ogg). | ||
Due to an inherit bug with MP3's appending a small gap at the end of the file, you may experience a slight delay after each play of the audio file. This is especially noticeable when looping the audio. The only workaround for this is to convert the audio file to Ogg Vorbis (ogg) before using it in GTA Connected. | Due to an inherit bug with MP3's appending a small gap at the end of the file, you may experience a slight delay after each play of the audio file. This is especially noticeable when looping the audio. The only workaround for this is to convert the audio file to Ogg Vorbis (ogg) before using it in GTA Connected. | ||
}} | }} |
Revision as of 21:50, 21 March 2025
Function
Client Only
Online and Offline
Available since Client 1.0.0
Sound audio.createSound(Stream audioData, bool loop)
The audio.createSound function is used to add a sound that optionally loops.
Parameters
1) | Stream | audioData | The stream of audio data. |
2) | bool | loop | Whether to play the sound repeatedly. |
Return
Sound | A sound object. |
Notes
- You'll need to load the audio file into a file stream using openFile before you can create a sound object with it. The only supported audio file types are MP3 and Ogg Vorbis (ogg). Due to an inherit bug with MP3's appending a small gap at the end of the file, you may experience a slight delay after each play of the audio file. This is especially noticeable when looping the audio. The only workaround for this is to convert the audio file to Ogg Vorbis (ogg) before using it in GTA Connected.
Examples
There aren't any examples for this function.
Compatibility
There isn't any compatibility information for this function.