Skip to main content

iRidi API. Sounds

These methods add sound effects to iRidi projects.

Methods​

IR.PlaySound​

Plays an audio file.

Syntax

IR.PlaySound(File_Name,Slot_Number,Volume,Loop);

InputValueDescription
File_Name-type: String
audio filename
Slot_Number-type: Number
slot number
Volume-type: Number
volume level
Loop-type: Boolean
enable or disable looping
Output
-

Example

IR.AddListener(IR.EVENT_START,0,function()
//Событие, которое срабатывает при начале работы приложения
{
IR.PlaySound('ANGELS_F.WAV',0,50,true); //Команда для проигрывания звука
});

IR.StopSound​

Stops audio-file playback.

Syntax

IR.StopSound (File_Name);

InputValueDescription
File_Name-type: String
audio filename
Output
-

Example

IR.AddListener(IR.EVENT_START,0,function()
//Событие, которое срабатывает при начале работы приложения
{
IR.StopSound('ANGELS_F.WAV'); //Команда для остановки проигрывания звука
});

IR.StopSlot​

Stops playback in a slot

Syntax

IR.StopSlot (Slot_Number);

InputValueDescription
Slot_Number-type: Number
slot number
Output
-

Example

IR.AddListener(IR.EVENT_START,0,function()
//Событие, которое срабатывает при начале работы приложения
{
IR.StopSlot(1) //Команда для остановки проигрывания слота номер 1
});

IR.StopAllSounds​

Stops playback of all audio files

Syntax

IR.StopAllSounds ();

InputValueDescription
--type: -
Output
-

Example

IR.AddListener(IR.EVENT_START,0,function()
//Событие, которое срабатывает при начале работы приложения
{
IR.StopAllSounds(); //Команда для остановки проигрывания всех звуковых файлов
});

IR.SetSpeakerMode​

Switches the device's audio output.

Syntax

IR.SetSpeakerMode(status);

InputValueDescription
statustruetype: boolean
enable or disable the speaker
Output
-

Example

IR.AddListener(IR.EVENT_START,0,function()
//Событие, которое срабатывает при начале работы приложения
{
IR.SetSpeakerMode(true); //Включение динамика
});

IR.SetAudioSession​

Controls suppression of sounds outside the application. For example, it can stop background music on an iOS (Android) device. After suppression is disabled, music must be started manually; the application will no longer stop it.

Syntax

IR.SetAudioSession(status);

InputValueDescription
statustruetype: boolean
enable or disable background-sound suppression
Output
-

Example

IR.AddListener(IR.EVENT_START,0,function()
{
// stop all the background sounds at application start
IR.SetAudioSession(true);
});