main function
stringlengths 8
40
| chunks
stringlengths 41
8.32k
| repo_name
stringclasses 1
value |
---|---|---|
love.conf | love.conf
If a file called conf.lua is present in your game folder (or .love file), it is run before the LÖVE modules are loaded. You can use this file to overwrite the love.conf function, which is later called by the LÖVE 'boot' script. Using the love.conf function, you can set some configuration options, and change things like the default size of the window, which modules are loaded, and other stuff.
love.conf( t )
t table The love.conf function takes one argument: a table filled with all the default values which you can overwrite to your liking. If you want to change the default window size, for instance, do: function love.conf(t) t.window.width = 1024 t.window.height = 768 end If you don't need the physics module or joystick module, do the following. function love.conf(t) t.modules.joystick = false t.modules.physics = false end Setting unused modules to false is encouraged when you release your game. It reduces startup time slightly (especially if the joystick module is disabled) and reduces memory usage (slightly). Note that you can't disable love.filesystem; it's mandatory. The same goes for the love module itself. love.graphics needs love.window to be enabled.
t.identity (nil) string This flag determines the name of the save directory for your game. Note that you can only specify the name, not the location where it will be created: t.identity = "gabe_HL3" -- Correct t.identity = "c:/Users/gabe/HL3" -- Incorrect Alternatively love.filesystem.setIdentity can be used to set the save directory outside of the config file.
t.appendidentity (false) boolean This flag determines if game directory should be searched first then save directory (true) or otherwise (false)
t.version ("11.5") string t.version should be a string, representing the version of LÖVE for which your game was made. It should be formatted as "X.Y.Z" where X is the major release number, Y the minor, and Z the patch level. It allows LÖVE to display a warning if it isn't compatible. Its default is the version of LÖVE running.
t.console (false) boolean Determines whether a console should be opened alongside the game window (Windows only) or not. Note: On OSX you can get console output by running LÖVE through the terminal.
t.accelerometerjoystick (true) boolean Sets whether the device accelerometer on iOS and Android should be exposed as a 3-axis Joystick. Disabling the accelerometer when it's not used may reduce CPU usage.
t.externalstorage (false) boolean Sets whether files are saved in external storage (true) or internal storage (false) on Android.
t.gammacorrect (false) boolean Determines whether gamma-correct rendering is enabled, when the system supports it.
t.audio table Audio options.
t.audio.mic (false) boolean Request microphone permission from the user. When user allows it, love.audio.getRecordingDevices will lists recording devices available. Otherwise, love.audio.getRecordingDevices returns empty table and a message is shown to inform user when called.
t.audio.mixwithsystem (true) boolean Sets whether background audio / music from other apps should play while LÖVE is open. See love.system.hasBackgroundMusic for more details.
t.window table It is possible to defer window creation until love.window.setMode is first called in your code. To do so, set t.window = nil in love.conf (or t.screen = nil in older versions.) If this is done, LÖVE may crash if any function from love.graphics is called before the first love.window.setMode in your code. The t.window table was named t.screen in versions prior to 0.9.0. The t.screen table doesn't exist in love.conf in 0.9.0, and the t.window table doesn't exist in love.conf in 0.8.0. This means love.conf will fail to execute (therefore it will fall back to default values) if care is not taken to use the correct table for the LÖVE version being used.
t.window.title ("Untitled") string Sets the title of the window the game is in. Alternatively love.window.setTitle can be used to change the window title outside of the config file.
t.window.icon (nil) string A filepath to an image to use as the window's icon. Not all operating systems support very large icon images. The icon can also be changed with love.window.setIcon.
t.window.width (800) number Sets the window's dimensions. If these flags are set to 0 LÖVE automatically uses the user's desktop dimensions.
t.window.height (600) number Sets the window's dimensions. If these flags are set to 0 LÖVE automatically uses the user's desktop dimensions.
t.window.borderless (false) boolean Removes all border visuals from the window. Note that the effects may wary between operating systems.
t.window.resizable (false) boolean If set to true this allows the user to resize the game's window.
t.window.minwidth (1) number Sets the minimum width and height for the game's window if it can be resized by the user. If you set lower values to window.width and window.height LÖVE will always favor the minimum dimensions set via window.minwidth and window.minheight.
t.window.minheight (1) number Sets the minimum width and height for the game's window if it can be resized by the user. If you set lower values to window.width and window.height LÖVE will always favor the minimum dimensions set via window.minwidth and window.minheight.
t.window.fullscreen (false) boolean Whether to run the game in fullscreen (true) or windowed (false) mode. The fullscreen can also be toggled via love.window.setFullscreen or love.window.setMode.
t.window.fullscreentype ("desktop") string Specifies the type of fullscreen mode to use (normal or desktop). Generally the desktop is recommended, as it is less restrictive than normal mode on some operating systems.
t.window.usedpiscale (true) boolean Sets whetever to enable or disable automatic DPI scaling.
t.window.vsync (true) number Enables or deactivates vertical synchronization. Vsync tries to keep the game at a steady framerate and can prevent issues like screen tearing. It is recommended to keep vsync activated if you don't know about the possible implications of turning it off. Before LÖVE 11.0, this value was boolean (true or false). Since LÖVE 11.0, this value is number (1 to enable vsync, 0 to disable vsync, -1 to use adaptive vsync when supported). Note that in iOS, vertical synchronization is always enabled and cannot be changed.
t.window.depth (nil) number The number of bits per sample in the depth buffer (16/24/32, default nil)
t.window.stencil (nil) number Then number of bits per sample in the depth buffer (generally 8, default nil)
t.window.msaa (0) number The number of samples to use with multi-sampled antialiasing.
t.window.display (1) number The index of the display to show the window in, if multiple monitors are available.
t.window.highdpi (false) boolean See love.window.getPixelScale, love.window.toPixels, and love.window.fromPixels. It is recommended to keep this option disabled if you can't test your game on a Mac or iOS system with a Retina display, because code will need tweaking to make sure things look correct.
t.window.x (nil) number Determines the position of the window on the user's screen. Alternatively love.window.setPosition can be used to change the position on the fly.
t.window.y (nil) number Determines the position of the window on the user's screen. Alternatively love.window.setPosition can be used to change the position on the fly.
t.modules table Module options.
t.modules.audio (true) boolean Enable the audio module.
t.modules.event (true) boolean Enable the event module.
t.modules.graphics (true) boolean Enable the graphics module.
t.modules.image (true) boolean Enable the image module.
t.modules.joystick (true) boolean Enable the joystick module.
t.modules.keyboard (true) boolean Enable the keyboard module.
t.modules.math (true) boolean Enable the math module.
t.modules.mouse (true) boolean Enable the mouse module.
t.modules.physics (true) boolean Enable the physics module.
t.modules.sound (true) boolean Enable the sound module.
t.modules.system (true) boolean Enable the system module.
t.modules.timer (true) boolean Enable the timer module.
t.modules.touch (true) boolean Enable the touch module.
t.modules.video (true) boolean Enable the video module.
t.modules.window (true) boolean Enable the window module.
t.modules.thread (true) boolean Enable the thread module. | love2d-community.github.io/love-api |
love.directorydropped | love.directorydropped
Callback function triggered when a directory is dragged and dropped onto the window.
love.directorydropped( path )
path string The full platform-dependent path to the directory. It can be used as an argument to love.filesystem.mount, in order to gain read access to the directory with love.filesystem. | love2d-community.github.io/love-api |
love.displayrotated | love.displayrotated
Called when the device display orientation changed, for example, user rotated their phone 180 degrees.
love.displayrotated( index, orientation )
index number The index of the display that changed orientation.
orientation DisplayOrientation The new orientation. | love2d-community.github.io/love-api |
love.draw | love.draw
Callback function used to draw on the screen every frame.
love.draw() | love2d-community.github.io/love-api |
love.errorhandler | love.errorhandler
The error handler, used to display error messages.
mainLoop = love.errorhandler( msg )
msg string The error message.
mainLoop function Function which handles one frame, including events and rendering, when called. If this is nil then LÖVE exits immediately. | love2d-community.github.io/love-api |
love.filedropped | love.filedropped
Callback function triggered when a file is dragged and dropped onto the window.
love.filedropped( file )
file DroppedFile The unopened File object representing the file that was dropped. | love2d-community.github.io/love-api |
love.focus | love.focus
Callback function triggered when window receives or loses focus.
love.focus( focus )
focus boolean True if the window gains focus, false if it loses focus. | love2d-community.github.io/love-api |
love.gamepadaxis | love.gamepadaxis
Called when a Joystick's virtual gamepad axis is moved.
love.gamepadaxis( joystick, axis, value )
joystick Joystick The joystick object.
axis GamepadAxis The virtual gamepad axis.
value number The new axis value. | love2d-community.github.io/love-api |
love.gamepadpressed | love.gamepadpressed
Called when a Joystick's virtual gamepad button is pressed.
love.gamepadpressed( joystick, button )
joystick Joystick The joystick object.
button GamepadButton The virtual gamepad button. | love2d-community.github.io/love-api |
love.gamepadreleased | love.gamepadreleased
Called when a Joystick's virtual gamepad button is released.
love.gamepadreleased( joystick, button )
joystick Joystick The joystick object.
button GamepadButton The virtual gamepad button. | love2d-community.github.io/love-api |
love.joystickadded | love.joystickadded
Called when a Joystick is connected.
love.joystickadded( joystick )
joystick Joystick The newly connected Joystick object. | love2d-community.github.io/love-api |
love.joystickaxis | love.joystickaxis
Called when a joystick axis moves.
love.joystickaxis( joystick, axis, value )
joystick Joystick The joystick object.
axis number The axis number.
value number The new axis value. | love2d-community.github.io/love-api |
love.joystickhat | love.joystickhat
Called when a joystick hat direction changes.
love.joystickhat( joystick, hat, direction )
joystick Joystick The joystick object.
hat number The hat number.
direction JoystickHat The new hat direction. | love2d-community.github.io/love-api |
love.joystickpressed | love.joystickpressed
Called when a joystick button is pressed.
love.joystickpressed( joystick, button )
joystick Joystick The joystick object.
button number The button number. | love2d-community.github.io/love-api |
love.joystickreleased | love.joystickreleased
Called when a joystick button is released.
love.joystickreleased( joystick, button )
joystick Joystick The joystick object.
button number The button number. | love2d-community.github.io/love-api |
love.joystickremoved | love.joystickremoved
Called when a Joystick is disconnected.
love.joystickremoved( joystick )
joystick Joystick The now-disconnected Joystick object. | love2d-community.github.io/love-api |
love.keypressed | love.keypressed
Callback function triggered when a key is pressed.
love.keypressed( key, scancode, isrepeat )
key KeyConstant Character of the pressed key.
scancode Scancode The scancode representing the pressed key.
isrepeat boolean Whether this keypress event is a repeat. The delay between key repeats depends on the user's system settings.
love.keypressed( key, isrepeat )
key KeyConstant Character of the key pressed.
isrepeat boolean Whether this keypress event is a repeat. The delay between key repeats depends on the user's system settings.
Callback function triggered when a key is pressed.
love.keypressed( key, scancode, isrepeat )
key KeyConstant Character of the pressed key.
scancode Scancode The scancode representing the pressed key.
isrepeat boolean Whether this keypress event is a repeat. The delay between key repeats depends on the user's system settings.
love.keypressed( key, isrepeat )
key KeyConstant Character of the key pressed.
isrepeat boolean Whether this keypress event is a repeat. The delay between key repeats depends on the user's system settings. | love2d-community.github.io/love-api |
love.keyreleased | love.keyreleased
Callback function triggered when a keyboard key is released.
love.keyreleased( key, scancode )
key KeyConstant Character of the released key.
scancode Scancode The scancode representing the released key. | love2d-community.github.io/love-api |
love.load | love.load
This function is called exactly once at the beginning of the game.
love.load( arg, unfilteredArg )
arg table Command-line arguments given to the game.
unfilteredArg table Unfiltered command-line arguments given to the executable (see #Notes). | love2d-community.github.io/love-api |
love.lowmemory | love.lowmemory
Callback function triggered when the system is running out of memory on mobile devices.
Mobile operating systems may forcefully kill the game if it uses too much memory, so any non-critical resource should be removed if possible (by setting all variables referencing the resources to '''nil'''), when this event is triggered. Sounds and images in particular tend to use the most memory.
love.lowmemory() | love2d-community.github.io/love-api |
love.mousefocus | love.mousefocus
Callback function triggered when window receives or loses mouse focus.
love.mousefocus( focus )
focus boolean Whether the window has mouse focus or not. | love2d-community.github.io/love-api |
love.mousemoved | love.mousemoved
Callback function triggered when the mouse is moved.
love.mousemoved( x, y, dx, dy, istouch )
x number The mouse position on the x-axis.
y number The mouse position on the y-axis.
dx number The amount moved along the x-axis since the last time love.mousemoved was called.
dy number The amount moved along the y-axis since the last time love.mousemoved was called.
istouch boolean True if the mouse button press originated from a touchscreen touch-press. | love2d-community.github.io/love-api |
love.mousepressed | love.mousepressed
Callback function triggered when a mouse button is pressed.
love.mousepressed( x, y, button, istouch, presses )
x number Mouse x position, in pixels.
y number Mouse y position, in pixels.
button number The button index that was pressed. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.
istouch boolean True if the mouse button press originated from a touchscreen touch-press.
presses number The number of presses in a short time frame and small area, used to simulate double, triple clicks | love2d-community.github.io/love-api |
love.mousereleased | love.mousereleased
Callback function triggered when a mouse button is released.
love.mousereleased( x, y, button, istouch, presses )
x number Mouse x position, in pixels.
y number Mouse y position, in pixels.
button number The button index that was released. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.
istouch boolean True if the mouse button release originated from a touchscreen touch-release.
presses number The number of presses in a short time frame and small area, used to simulate double, triple clicks | love2d-community.github.io/love-api |
love.quit | love.quit
Callback function triggered when the game is closed.
r = love.quit()
r boolean Abort quitting. If true, do not close the game. | love2d-community.github.io/love-api |
love.resize | love.resize
Called when the window is resized, for example if the user resizes the window, or if love.window.setMode is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size.
love.resize( w, h )
w number The new width.
h number The new height. | love2d-community.github.io/love-api |
love.run | love.run
The main function, containing the main loop. A sensible default is used when left out.
mainLoop = love.run()
mainLoop function Function which handlers one frame, including events and rendering when called. | love2d-community.github.io/love-api |
love.textedited | love.textedited
Called when the candidate text for an IME (Input Method Editor) has changed.
The candidate text is not the final text that the user will eventually choose. Use love.textinput for that.
love.textedited( text, start, length )
text string The UTF-8 encoded unicode candidate text.
start number The start cursor of the selected candidate text.
length number The length of the selected candidate text. May be 0. | love2d-community.github.io/love-api |
love.textinput | love.textinput
Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard layout, the text '@' will be generated.
love.textinput( text )
text string The UTF-8 encoded unicode text. | love2d-community.github.io/love-api |
love.threaderror | love.threaderror
Callback function triggered when a Thread encounters an error.
love.threaderror( thread, errorstr )
thread Thread The thread which produced the error.
errorstr string The error message. | love2d-community.github.io/love-api |
love.touchmoved | love.touchmoved
Callback function triggered when a touch press moves inside the touch screen.
love.touchmoved( id, x, y, dx, dy, pressure )
id light userdata The identifier for the touch press.
x number The x-axis position of the touch inside the window, in pixels.
y number The y-axis position of the touch inside the window, in pixels.
dx number The x-axis movement of the touch inside the window, in pixels.
dy number The y-axis movement of the touch inside the window, in pixels.
pressure number The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1. | love2d-community.github.io/love-api |
love.touchpressed | love.touchpressed
Callback function triggered when the touch screen is touched.
love.touchpressed( id, x, y, dx, dy, pressure )
id light userdata The identifier for the touch press.
x number The x-axis position of the touch press inside the window, in pixels.
y number The y-axis position of the touch press inside the window, in pixels.
dx number The x-axis movement of the touch press inside the window, in pixels. This should always be zero.
dy number The y-axis movement of the touch press inside the window, in pixels. This should always be zero.
pressure number The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1. | love2d-community.github.io/love-api |
love.touchreleased | love.touchreleased
Callback function triggered when the touch screen stops being touched.
love.touchreleased( id, x, y, dx, dy, pressure )
id light userdata The identifier for the touch press.
x number The x-axis position of the touch inside the window, in pixels.
y number The y-axis position of the touch inside the window, in pixels.
dx number The x-axis movement of the touch inside the window, in pixels.
dy number The y-axis movement of the touch inside the window, in pixels.
pressure number The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1. | love2d-community.github.io/love-api |
love.update | love.update
Callback function used to update the state of the game every frame.
love.update( dt )
dt number Time since the last update in seconds. | love2d-community.github.io/love-api |
love.visible | love.visible
Callback function triggered when window is minimized/hidden or unminimized by the user.
love.visible( visible )
visible boolean True if the window is visible, false if it isn't. | love2d-community.github.io/love-api |
love.wheelmoved | love.wheelmoved
Callback function triggered when the mouse wheel is moved.
love.wheelmoved( x, y )
x number Amount of horizontal mouse wheel movement. Positive values indicate movement to the right.
y number Amount of vertical mouse wheel movement. Positive values indicate upward movement. | love2d-community.github.io/love-api |
Data:clone | Data:clone
Creates a new copy of the Data object.
clone = Data:clone()
clone Data The new copy. | love2d-community.github.io/love-api |
Data:getFFIPointer | Data:getFFIPointer
Gets an FFI pointer to the Data.
This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.
pointer = Data:getFFIPointer()
pointer cdata A raw void* pointer to the Data, or nil if FFI is unavailable. | love2d-community.github.io/love-api |
Data:getPointer | Data:getPointer
Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
pointer = Data:getPointer()
pointer light userdata A raw pointer to the Data. | love2d-community.github.io/love-api |
Data:getSize | Data:getSize
Gets the Data's size in bytes.
size = Data:getSize()
size number The size of the Data in bytes. | love2d-community.github.io/love-api |
Data:getString | Data:getString
Gets the full Data as a string.
data = Data:getString()
data string The raw data. | love2d-community.github.io/love-api |
Object:release | Object:release
Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread.
This method can be used to immediately clean up resources without waiting for Lua's garbage collector.
success = Object:release()
success boolean True if the object was released by this call, false if it had been previously released. | love2d-community.github.io/love-api |
Object:type | Object:type
Gets the type of the object as a string.
type = Object:type()
type string The type as a string. | love2d-community.github.io/love-api |
Object:typeOf | Object:typeOf
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
b = Object:typeOf( name )
name string The name of the type to check for.
b boolean True if the object is of the specified type, false otherwise. | love2d-community.github.io/love-api |
love.audio.getActiveEffects | love.audio.getActiveEffects
Gets a list of the names of the currently enabled effects.
effects = love.audio.getActiveEffects()
effects table The list of the names of the currently enabled effects. | love2d-community.github.io/love-api |
love.audio.getActiveSourceCount | love.audio.getActiveSourceCount
Gets the current number of simultaneously playing sources.
count = love.audio.getActiveSourceCount()
count number The current number of simultaneously playing sources. | love2d-community.github.io/love-api |
love.audio.getDistanceModel | love.audio.getDistanceModel
Returns the distance attenuation model.
model = love.audio.getDistanceModel()
model DistanceModel The current distance model. The default is 'inverseclamped'. | love2d-community.github.io/love-api |
love.audio.getDopplerScale | love.audio.getDopplerScale
Gets the current global scale factor for velocity-based doppler effects.
scale = love.audio.getDopplerScale()
scale number The current doppler scale factor. | love2d-community.github.io/love-api |
love.audio.getEffect | love.audio.getEffect
Gets the settings associated with an effect.
settings = love.audio.getEffect( name )
name string The name of the effect.
settings table The settings associated with the effect. | love2d-community.github.io/love-api |
love.audio.getMaxSceneEffects | love.audio.getMaxSceneEffects
Gets the maximum number of active effects supported by the system.
maximum = love.audio.getMaxSceneEffects()
maximum number The maximum number of active effects. | love2d-community.github.io/love-api |
love.audio.getMaxSourceEffects | love.audio.getMaxSourceEffects
Gets the maximum number of active Effects in a single Source object, that the system can support.
maximum = love.audio.getMaxSourceEffects()
maximum number The maximum number of active Effects per Source. | love2d-community.github.io/love-api |
love.audio.getOrientation | love.audio.getOrientation
Returns the orientation of the listener.
fx, fy, fz, ux, uy, uz = love.audio.getOrientation()
fx, fy, fz number Forward vector of the listener orientation.
ux, uy, uz number Up vector of the listener orientation. | love2d-community.github.io/love-api |
love.audio.getPosition | love.audio.getPosition
Returns the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources.
x, y, z = love.audio.getPosition()
x number The X position of the listener.
y number The Y position of the listener.
z number The Z position of the listener. | love2d-community.github.io/love-api |
love.audio.getRecordingDevices | love.audio.getRecordingDevices
Gets a list of RecordingDevices on the system.
The first device in the list is the user's default recording device. The list may be empty if there are no microphones connected to the system.
Audio recording is currently not supported on iOS.
devices = love.audio.getRecordingDevices()
devices table The list of connected recording devices. | love2d-community.github.io/love-api |
love.audio.getVelocity | love.audio.getVelocity
Returns the velocity of the listener.
x, y, z = love.audio.getVelocity()
x number The X velocity of the listener.
y number The Y velocity of the listener.
z number The Z velocity of the listener. | love2d-community.github.io/love-api |
love.audio.getVolume | love.audio.getVolume
Returns the master volume.
volume = love.audio.getVolume()
volume number The current master volume | love2d-community.github.io/love-api |
love.audio.isEffectsSupported | love.audio.isEffectsSupported
Gets whether audio effects are supported in the system.
supported = love.audio.isEffectsSupported()
supported boolean True if effects are supported, false otherwise. | love2d-community.github.io/love-api |
love.audio.newQueueableSource | love.audio.newQueueableSource
Creates a new Source usable for real-time generated sound playback with Source:queue.
source = love.audio.newQueueableSource( samplerate, bitdepth, channels, buffercount )
samplerate number Number of samples per second when playing.
bitdepth number Bits per sample (8 or 16).
channels number 1 for mono or 2 for stereo.
buffercount (0) number The number of buffers that can be queued up at any given time with Source:queue. Cannot be greater than 64. A sensible default (~8) is chosen if no value is specified.
source Source The new Source usable with Source:queue. | love2d-community.github.io/love-api |
love.audio.newSource | love.audio.newSource
Creates a new Source from a filepath, File, Decoder or SoundData.
Sources created from SoundData are always static.
source = love.audio.newSource( filename, type )
filename string The filepath to the audio file.
type SourceType Streaming or static source.
source Source A new Source that can play the specified audio.
source = love.audio.newSource( file, type )
file File A File pointing to an audio file.
type SourceType Streaming or static source.
source Source A new Source that can play the specified audio.
source = love.audio.newSource( decoder, type )
decoder Decoder The Decoder to create a Source from.
type SourceType Streaming or static source.
source Source A new Source that can play the specified audio.
source = love.audio.newSource( data, type )
data FileData The FileData to create a Source from.
type SourceType Streaming or static source.
source Source A new Source that can play the specified audio.
source = love.audio.newSource( data )
data SoundData The SoundData to create a Source from.
source Source A new Source that can play the specified audio. The SourceType of the returned audio is 'static'. | love2d-community.github.io/love-api |
love.audio.pause | love.audio.pause
Pauses specific or all currently played Sources.
Sources = love.audio.pause()
Sources table A table containing a list of Sources that were paused by this call.
love.audio.pause( source, ... )
source Source The first Source to pause.
... Source Additional Sources to pause.
love.audio.pause( sources )
sources table A table containing a list of Sources to pause. | love2d-community.github.io/love-api |
love.audio.play | love.audio.play
Plays the specified Source.
love.audio.play( source )
source Source The Source to play.
love.audio.play( sources )
sources table Table containing a list of Sources to play.
love.audio.play( source1, source2, ... )
source1 Source The first Source to play.
source2 Source The second Source to play.
... Source Additional Sources to play. | love2d-community.github.io/love-api |
love.audio.setDistanceModel | love.audio.setDistanceModel
Sets the distance attenuation model.
love.audio.setDistanceModel( model )
model DistanceModel The new distance model. | love2d-community.github.io/love-api |
love.audio.setDopplerScale | love.audio.setDopplerScale
Sets a global scale factor for velocity-based doppler effects. The default scale value is 1.
love.audio.setDopplerScale( scale )
scale number The new doppler scale factor. The scale must be greater than 0. | love2d-community.github.io/love-api |
love.audio.setEffect | love.audio.setEffect
Defines an effect that can be applied to a Source.
Not all system supports audio effects. Use love.audio.isEffectsSupported to check.
success = love.audio.setEffect( name, settings )
name string The name of the effect.
settings table The settings to use for this effect, with the following fields:
settings.type EffectType The type of effect to use.
settings.volume number The volume of the effect.
settings.... number Effect-specific settings. See EffectType for available effects and their corresponding settings.
success boolean Whether the effect was successfully created.
success = love.audio.setEffect( name, enabled )
name string The name of the effect.
enabled (true) boolean If false and the given effect name was previously set, disables the effect.
success boolean Whether the effect was successfully disabled. | love2d-community.github.io/love-api |
love.audio.setMixWithSystem | love.audio.setMixWithSystem
Sets whether the system should mix the audio with the system's audio.
success = love.audio.setMixWithSystem( mix )
mix boolean True to enable mixing, false to disable it.
success boolean True if the change succeeded, false otherwise. | love2d-community.github.io/love-api |
love.audio.setOrientation | love.audio.setOrientation
Sets the orientation of the listener.
love.audio.setOrientation( fx, fy, fz, ux, uy, uz )
fx, fy, fz number Forward vector of the listener orientation.
ux, uy, uz number Up vector of the listener orientation. | love2d-community.github.io/love-api |
love.audio.setPosition | love.audio.setPosition
Sets the position of the listener, which determines how sounds play.
love.audio.setPosition( x, y, z )
x number The x position of the listener.
y number The y position of the listener.
z number The z position of the listener. | love2d-community.github.io/love-api |
love.audio.setVelocity | love.audio.setVelocity
Sets the velocity of the listener.
love.audio.setVelocity( x, y, z )
x number The X velocity of the listener.
y number The Y velocity of the listener.
z number The Z velocity of the listener. | love2d-community.github.io/love-api |
love.audio.setVolume | love.audio.setVolume
Sets the master volume.
love.audio.setVolume( volume )
volume number 1.0 is max and 0.0 is off. | love2d-community.github.io/love-api |
love.audio.stop | love.audio.stop
Stops currently played sources.
love.audio.stop()
love.audio.stop( source )
source Source The source on which to stop the playback.
love.audio.stop( source1, source2, ... )
source1 Source The first Source to stop.
source2 Source The second Source to stop.
... Source Additional Sources to stop.
love.audio.stop( sources )
sources table A table containing a list of Sources to stop. | love2d-community.github.io/love-api |
RecordingDevice:getBitDepth | RecordingDevice:getBitDepth
Gets the number of bits per sample in the data currently being recorded.
bits = RecordingDevice:getBitDepth()
bits number The number of bits per sample in the data that's currently being recorded. | love2d-community.github.io/love-api |
RecordingDevice:getChannelCount | RecordingDevice:getChannelCount
Gets the number of channels currently being recorded (mono or stereo).
channels = RecordingDevice:getChannelCount()
channels number The number of channels being recorded (1 for mono, 2 for stereo). | love2d-community.github.io/love-api |
RecordingDevice:getData | RecordingDevice:getData
Gets all recorded audio SoundData stored in the device's internal ring buffer.
The internal ring buffer is cleared when this function is called, so calling it again will only get audio recorded after the previous call. If the device's internal ring buffer completely fills up before getData is called, the oldest data that doesn't fit into the buffer will be lost.
data = RecordingDevice:getData()
data SoundData The recorded audio data, or nil if the device isn't recording. | love2d-community.github.io/love-api |
RecordingDevice:getName | RecordingDevice:getName
Gets the name of the recording device.
name = RecordingDevice:getName()
name string The name of the device. | love2d-community.github.io/love-api |
RecordingDevice:getSampleCount | RecordingDevice:getSampleCount
Gets the number of currently recorded samples.
samples = RecordingDevice:getSampleCount()
samples number The number of samples that have been recorded so far. | love2d-community.github.io/love-api |
RecordingDevice:getSampleRate | RecordingDevice:getSampleRate
Gets the number of samples per second currently being recorded.
rate = RecordingDevice:getSampleRate()
rate number The number of samples being recorded per second (sample rate). | love2d-community.github.io/love-api |
RecordingDevice:isRecording | RecordingDevice:isRecording
Gets whether the device is currently recording.
recording = RecordingDevice:isRecording()
recording boolean True if the recording, false otherwise. | love2d-community.github.io/love-api |
RecordingDevice:start | RecordingDevice:start
Begins recording audio using this device.
success = RecordingDevice:start( samplecount, samplerate, bitdepth, channels )
samplecount number The maximum number of samples to store in an internal ring buffer when recording. RecordingDevice:getData clears the internal buffer when called.
samplerate (8000) number The number of samples per second to store when recording.
bitdepth (16) number The number of bits per sample.
channels (1) number Whether to record in mono or stereo. Most microphones don't support more than 1 channel.
success boolean True if the device successfully began recording using the specified parameters, false if not. | love2d-community.github.io/love-api |
RecordingDevice:stop | RecordingDevice:stop
Stops recording audio from this device. Any sound data currently in the device's buffer will be returned.
data = RecordingDevice:stop()
data SoundData The sound data currently in the device's buffer, or nil if the device wasn't recording. | love2d-community.github.io/love-api |
Source:clone | Source:clone
Creates an identical copy of the Source in the stopped state.
Static Sources will use significantly less memory and take much less time to be created if Source:clone is used to create them instead of love.audio.newSource, so this method should be preferred when making multiple Sources which play the same sound.
source = Source:clone()
source Source The new identical copy of this Source. | love2d-community.github.io/love-api |
Source:getActiveEffects | Source:getActiveEffects
Gets a list of the Source's active effect names.
effects = Source:getActiveEffects()
effects table A list of the source's active effect names. | love2d-community.github.io/love-api |
Source:getAirAbsorption | Source:getAirAbsorption
Gets the amount of air absorption applied to the Source.
By default the value is set to 0 which means that air absorption effects are disabled. A value of 1 will apply high frequency attenuation to the Source at a rate of 0.05 dB per meter.
amount = Source:getAirAbsorption()
amount number The amount of air absorption applied to the Source. | love2d-community.github.io/love-api |
Source:getAttenuationDistances | Source:getAttenuationDistances
Gets the reference and maximum attenuation distances of the Source. The values, combined with the current DistanceModel, affect how the Source's volume attenuates based on distance from the listener.
ref, max = Source:getAttenuationDistances()
ref number The current reference attenuation distance. If the current DistanceModel is clamped, this is the minimum distance before the Source is no longer attenuated.
max number The current maximum attenuation distance. | love2d-community.github.io/love-api |
Source:getChannelCount | Source:getChannelCount
Gets the number of channels in the Source. Only 1-channel (mono) Sources can use directional and positional effects.
channels = Source:getChannelCount()
channels number 1 for mono, 2 for stereo. | love2d-community.github.io/love-api |
Source:getCone | Source:getCone
Gets the Source's directional volume cones. Together with Source:setDirection, the cone angles allow for the Source's volume to vary depending on its direction.
innerAngle, outerAngle, outerVolume = Source:getCone()
innerAngle number The inner angle from the Source's direction, in radians. The Source will play at normal volume if the listener is inside the cone defined by this angle.
outerAngle number The outer angle from the Source's direction, in radians. The Source will play at a volume between the normal and outer volumes, if the listener is in between the cones defined by the inner and outer angles.
outerVolume number The Source's volume when the listener is outside both the inner and outer cone angles. | love2d-community.github.io/love-api |
Source:getDirection | Source:getDirection
Gets the direction of the Source.
x, y, z = Source:getDirection()
x number The X part of the direction vector.
y number The Y part of the direction vector.
z number The Z part of the direction vector. | love2d-community.github.io/love-api |
Source:getDuration | Source:getDuration
Gets the duration of the Source. For streaming Sources it may not always be sample-accurate, and may return -1 if the duration cannot be determined at all.
duration = Source:getDuration( unit )
unit ('seconds') TimeUnit The time unit for the return value.
duration number The duration of the Source, or -1 if it cannot be determined. | love2d-community.github.io/love-api |
Source:getEffect | Source:getEffect
Gets the filter settings associated to a specific effect.
This function returns nil if the effect was applied with no filter settings associated to it.
filtersettings = Source:getEffect( name, filtersettings )
name string The name of the effect.
filtersettings ({}) table An optional empty table that will be filled with the filter settings.
filtersettings table The settings for the filter associated to this effect, or nil if the effect is not present in this Source or has no filter associated. The table has the following fields:
filtersettings.volume number The overall volume of the audio.
filtersettings.highgain number Volume of high-frequency audio. Only applies to low-pass and band-pass filters.
filtersettings.lowgain number Volume of low-frequency audio. Only applies to high-pass and band-pass filters. | love2d-community.github.io/love-api |
Source:getFilter | Source:getFilter
Gets the filter settings currently applied to the Source.
settings = Source:getFilter()
settings table The filter settings to use for this Source, or nil if the Source has no active filter. The table has the following fields:
settings.type FilterType The type of filter to use.
settings.volume number The overall volume of the audio.
settings.highgain number Volume of high-frequency audio. Only applies to low-pass and band-pass filters.
settings.lowgain number Volume of low-frequency audio. Only applies to high-pass and band-pass filters. | love2d-community.github.io/love-api |
Source:getFreeBufferCount | Source:getFreeBufferCount
Gets the number of free buffer slots in a queueable Source. If the queueable Source is playing, this value will increase up to the amount the Source was created with. If the queueable Source is stopped, it will process all of its internal buffers first, in which case this function will always return the amount it was created with.
buffers = Source:getFreeBufferCount()
buffers number How many more SoundData objects can be queued up. | love2d-community.github.io/love-api |
Source:getPitch | Source:getPitch
Gets the current pitch of the Source.
pitch = Source:getPitch()
pitch number The pitch, where 1.0 is normal. | love2d-community.github.io/love-api |
Source:getPosition | Source:getPosition
Gets the position of the Source.
x, y, z = Source:getPosition()
x number The X position of the Source.
y number The Y position of the Source.
z number The Z position of the Source. | love2d-community.github.io/love-api |
Source:getRolloff | Source:getRolloff
Returns the rolloff factor of the source.
rolloff = Source:getRolloff()
rolloff number The rolloff factor. | love2d-community.github.io/love-api |
Source:getType | Source:getType
Gets the type of the Source.
sourcetype = Source:getType()
sourcetype SourceType The type of the source. | love2d-community.github.io/love-api |
Source:getVelocity | Source:getVelocity
Gets the velocity of the Source.
x, y, z = Source:getVelocity()
x number The X part of the velocity vector.
y number The Y part of the velocity vector.
z number The Z part of the velocity vector. | love2d-community.github.io/love-api |
Source:getVolume | Source:getVolume
Gets the current volume of the Source.
volume = Source:getVolume()
volume number The volume of the Source, where 1.0 is normal volume. | love2d-community.github.io/love-api |
Source:getVolumeLimits | Source:getVolumeLimits
Returns the volume limits of the source.
min, max = Source:getVolumeLimits()
min number The minimum volume.
max number The maximum volume. | love2d-community.github.io/love-api |
Source:isLooping | Source:isLooping
Returns whether the Source will loop.
loop = Source:isLooping()
loop boolean True if the Source will loop, false otherwise. | love2d-community.github.io/love-api |
Source:isPlaying | Source:isPlaying
Returns whether the Source is playing.
playing = Source:isPlaying()
playing boolean True if the Source is playing, false otherwise. | love2d-community.github.io/love-api |
Source:isRelative | Source:isRelative
Gets whether the Source's position, velocity, direction, and cone angles are relative to the listener.
relative = Source:isRelative()
relative boolean True if the position, velocity, direction and cone angles are relative to the listener, false if they're absolute. | love2d-community.github.io/love-api |