Plugin:MirLua/Module/m sounds: Difference between revisions

From Miranda NG
Jump to navigation Jump to search
No edit summary
(import correct table headers; remove untranslatable colons)
 
(28 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>{{PageLang|en}}
<languages/>
<translate>
<translate>
<!--T:1-->
Allows you to work with sounds.
Allows you to work with sounds.
</translate>
</translate>


Include module: <code>local sounds = require('m_sounds')</code>
{{Ls|MirLua/Modules/include_info}} <code>local sounds = require('m_sounds')</code>


{{Note|Parameters written in '''''bold italics''''' are obligatory.}}
__TOC__
<translate>
== Functions == <!--T:2-->
</translate>
=== AddSound ===
<translate><!--T:3--> Registers a sound.</translate>


==== {{Ls|MirLua/Modules/parameters}} ====
{| class="wikitable"
|-
! scope="col" | {{Ls|MirLua/Modules/param_name}}
! scope="col" | {{Ls|MirLua/Modules/required_param}}
! scope="col" | {{Ls|Content/TableHeaders/type}}
! scope="col" | {{Ls|Content/TableHeaders/description}}
|-
! scope="row" class="MirLuaParametersTable-parameter" | name
| style="text-align:center" | {{Ls|YesNo/yes}}
| style="text-align:center" | <code>string</code>
| <translate><!--T:4--> Unique name.</translate>
|-
! scope="row" class="MirLuaParametersTable-parameter" | description
| style="text-align:center" | {{Ls|YesNo/yes}}
| style="text-align:center" | <code>string</code>
| <translate><!--T:5--> Description.</translate>
|-
! scope="row" class="MirLuaParametersTable-parameter" | section
| style="text-align:center" | {{Ls|YesNo/no}}
| style="text-align:center" | <code>string</code>
| <translate><!--T:6--> Section name in Miranda sound settings. By default plugin name (<tvar|default_name>''MirLua''</>) is used.</translate>
|-
! scope="row" class="MirLuaParametersTable-parameter" | path
| style="text-align:center" | {{Ls|YesNo/no}}
| style="text-align:center" | <code>string</code>
| <translate><!--T:7--> Path to sound file.</translate>
|}


__TOC__
==== {{Ls|MirLua/Modules/result}} ====
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code>


=== AddSound ===
{{nbsp|5}}<translate><!--T:8--> Returns <tvar|return_on_success><code>true</code></> if sound was registered successfully, otherwise <tvar|return_on_fail><code>false</code></>.</translate>
Registers a sound.


;Parameters
==== {{Ls|MirLua/Modules/example}} ====
: '''''name'''''
:: Type: '''string'''
:: Unique name.
: '''''description'''''
:: Type: '''string'''
:: Description.
: ''section''
:: Type: '''string'''
:: Section name in Miranda sound settings. By default plugin name (''MirLua'') is used.
: ''path''
:: Type: '''string'''
:: Path to sound file.
;Result
: Type: '''boolean'''
: Returns '''true''' if sound was registered successfully, otherwise '''false'''.
;Example
{{Content:MirLua/Example|code=local hIcon = sounds.AddSound('soundUniqueName', 'My super icon')}}
{{Content:MirLua/Example|code=local hIcon = sounds.AddSound('soundUniqueName', 'My super icon')}}
----
=== PlaySound ===
<translate><!--T:9--> Plays sound by its unique name.</translate>


==== {{Ls|MirLua/Modules/parameters}} ====
{| class="wikitable"
|-
! scope="col" | {{Ls|MirLua/Modules/param_name}}
! scope="col" | {{Ls|MirLua/Modules/required_param}}
! scope="col" | {{Ls|Content/TableHeaders/type}}
! scope="col" | {{Ls|Content/TableHeaders/description}}
|-
! scope="row" class="MirLuaParametersTable-parameter" | name
| style="text-align:center" | {{Ls|YesNo/yes}}
| style="text-align:center" | <code>string</code>
| <translate><!--T:10--> Unique name.</translate>
|}


=== PlaySound ===
==== {{Ls|MirLua/Modules/result}} ====
Plays sound by its unique name.
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code>
 
{{nbsp|5}}<translate><!--T:11--> Returns <tvar|return_on_success><code>true</code></> if sound was played successfully, otherwise <tvar|return_on_fail><code>false</code></>.</translate>


;Parameters
==== {{Ls|MirLua/Modules/example}} ====
: '''''name'''''
:: Type: '''string'''
:: Unique name.
;Result
: Type: '''boolean'''
: Returns '''true''' if sound was played successfully, otherwise '''false'''.
;Example
{{Content:MirLua/Example|code=sounds.PlaySound('soundUniqueName')}}
{{Content:MirLua/Example|code=sounds.PlaySound('soundUniqueName')}}
----
=== PlayFile ===
<translate><!--T:12--> Plays sound from file.</translate>


==== {{Ls|MirLua/Modules/parameters}} ====
{| class="wikitable"
|-
! scope="col" | {{Ls|MirLua/Modules/param_name}}
! scope="col" | {{Ls|MirLua/Modules/required_param}}
! scope="col" | {{Ls|Content/TableHeaders/type}}
! scope="col" | {{Ls|Content/TableHeaders/description}}
|-
! scope="row" class="MirLuaParametersTable-parameter" | path
| style="text-align:center" | {{Ls|YesNo/yes}}
| style="text-align:center" | <code>string</code>
| <translate><!--T:13--> Path to file.</translate>
|}


=== PlayFile ===
==== {{Ls|MirLua/Modules/result}} ====
Plays sound from file.
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code>
 
{{nbsp|5}}<translate><!--T:14--> Returns <tvar|return_on_success><code>true</code></> if sound was played successfully, otherwise <tvar|return_on_fail><code>false</code></>.</translate>


;Parameters
==== {{Ls|MirLua/Modules/example}} ====
: '''''path'''''
:: Type: '''string'''
:: Path to file.
;Result
: Type: '''boolean'''
: Returns '''true''' if sound was played successfully, otherwise '''false'''.
;Example
{{Content:MirLua/Example|code=sounds.PlayFile('c:\\lambada.wav')}}
{{Content:MirLua/Example|code=sounds.PlayFile('c:\\lambada.wav')}}
[[Category:Tutorials (en)]]

Latest revision as of 13:59, 2 June 2018

Other languages:

Allows you to work with sounds.

Include module: local sounds = require('m_sounds')

Functions

AddSound

Registers a sound.

Parameters

Parameter name Required Type Description
name Yes string Unique name.
description Yes string Description.
section No string Section name in Miranda sound settings. By default plugin name (MirLua) is used.
path No string Path to sound file.

Result

     Type: boolean

     Returns true if sound was registered successfully, otherwise false.

Example

local hIcon = sounds.AddSound('soundUniqueName', 'My super icon')

PlaySound

Plays sound by its unique name.

Parameters

Parameter name Required Type Description
name Yes string Unique name.

Result

     Type: boolean

     Returns true if sound was played successfully, otherwise false.

Example

sounds.PlaySound('soundUniqueName')

PlayFile

Plays sound from file.

Parameters

Parameter name Required Type Description
path Yes string Path to file.

Result

     Type: boolean

     Returns true if sound was played successfully, otherwise false.

Example

sounds.PlayFile('c:\\lambada.wav')