Difference between revisions of "love.audio.newSource (Français)"

m
(Arguments)
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Créer un nouvel objet Source à partir d'un fichier de son.
 
Créer un nouvel objet Source à partir d'un fichier de son.
 
Les objet Sources créés à partir d'objet [[SoundData]] sont toujours 'static'.
 
Les objet Sources créés à partir d'objet [[SoundData]] sont toujours 'static'.
 +
{{newobjectnotice}}
 +
 
== Fonction ==
 
== Fonction ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
source = love.audio.newSource( file, type )
+
source = love.audio.newSource( filename, type )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|string|file|Le fichier contenant les données du son.}}
+
{{param|string|filename|Le fichier contenant les données du son.}}
{{param|SourceType|type|Type de source (Streaming ou 'static').}}
+
{{param|SourceType|type|Type de source (streaming ou 'static').}}
 +
 
 
=== Retour ===
 
=== Retour ===
 
{{param|Source|source|Un nouvel objet Source qui peut modifier ou jouer le son.}}
 
{{param|Source|source|Un nouvel objet Source qui peut modifier ou jouer le son.}}
Line 53: Line 56:
 
</source>
 
</source>
 
== Voir Aussi ==
 
== Voir Aussi ==
* [[parent::love.audio]]
+
* [[parent::love.audio (Français)]]
 
* [[Constructs::Source (Français)]]
 
* [[Constructs::Source (Français)]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Revision as of 20:55, 10 August 2017

Créer un nouvel objet Source à partir d'un fichier de son. Les objet Sources créés à partir d'objet SoundData sont toujours 'static'.

O.png This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!  



Fonction

Synopsis

source = love.audio.newSource( filename, type )

Arguments

string filename
Le fichier contenant les données du son.
SourceType type
Type de source (streaming ou 'static').

Retour

Source source
Un nouvel objet Source qui peut modifier ou jouer le son.

Function

Synopsis

source = love.audio.newSource( data )

Arguments

SoundData data
The SoundData to create a Source from.

Returns

Source source
A new Source that can play the specified audio. The SourceType of the returned audio is "static".

Function

Synopsis

source = love.audio.newSource( decoder, type )

Arguments

Decoder decoder
The Decoder to create a Source from.
SourceType type
Streaming or static source.

Returns

Source source
A new Source that can play the specified audio.

Examples

Load background music and play it

bgm = love.audio.newSource("bgm.ogg", "stream")
love.audio.play(bgm)

Load a sound effect and play it

sfx = love.audio.newSource("sfx.wav", "static")
love.audio.play(sfx)

Load SoundData and create a Source

data = love.sound.newSoundData("sfx.wav")
sfx = love.audio.newSource(data)

Load SoundData and create a Source

decoder = love.sound.newDecoder("bgm.ogg")
bgm = love.audio.newSource(decoder)

Voir Aussi

Autres Langues