This is an archive. | |
See the new ClickWiki at https://clickwiki.github.io. This version is just an archive for the purposes of migrating content to the new structure. |
Sound Object
Author | |
Status | Released |
Release Date | 1998 |
Last Updated | 2006 |
Available for | |
Supported Runtimes | |
License | Free |
Download | |
---|---|
Includes Examples | No |
Includes Help Files | Yes |
Links | Included with Fusion. |
Alternates | DirectShow, Sound Player |
The Sound object plays different sound files in your Clickteam Fusion 2.5 applications. The formats supported depend on your version of Clickteam Fusion 2.5 and on the sound filters installed. All the versions of Clickteam Fusion 2.5 support at least .WAV, .MOD and .MID files. Samples and music can be started, stopped, and looped using this object. The Sound object can also detect if a sound or music is not playing, should you want to trigger an action at the end of a particular sound effect. It is always available so you don't need to add an object to a frame to play sounds.
The sounds played by the Play Sample and Play Music actions of the Sound object are integrated into the application's file, you do not need to redistribute them with your application. The sounds played by the Play Sample File and Play Music File actions are not embedded into your application and should be redistributed with your stand-alone application.
The Sound object is a system object: it is only available in the event editor.
Contents
- 1 Formats Supported
- 2 Internal vs External
- 3 Features
- 4 Conditions
- 5 Actions
- 5.1 Samples
- 5.1.1 Play Sample
- 5.1.2 Play sample on a specific channel
- 5.1.3 Play sample file on a specific channel
- 5.1.4 Play And Loop Sample
- 5.1.5 Play and loop sample on a specific channel
- 5.1.6 Play and loop sample file on a specific channel
- 5.1.7 Pause sample
- 5.1.8 Pause channel
- 5.1.9 Pause all sounds
- 5.1.10 Resume sample
- 5.1.11 Resume channel
- 5.1.12 Resume all sounds
- 5.1.13 Stop a specific sample
- 5.1.14 Stop Channel
- 5.1.15 Stop any sample playing
- 5.1.16 Set main volume
- 5.1.17 Set sample volume
- 5.1.18 Set channel volume
- 5.1.19 Set main pan
- 5.1.20 Set sample pan
- 5.1.21 Set channel pan
- 5.1.22 Set sample position
- 5.1.23 Set channel position
- 5.1.24 Set sample frequency
- 5.1.25 Set channel frequency
- 5.1.26 Lock Channel
- 5.1.27 Unlock Channel
- 5.2 Music
- 5.1 Samples
- 6 Tips & Tricks
Formats Supported
Internal vs External
Depending on the platform you are building for, you will have to face a choice of whether you want your audio to be internal to your application, or as external files elsewhere on the system.
Internal
Files that are internal are saved within the application itself. This is the case with many mobile runtimes (such as iOS and Android). For the Windows runtime, this packs the audio inside the executable itself, making it difficult for hackers to steal assets.
External
External files are stored outside of the application, so it is important that you check they exist prior to trying to play such file (otherwise nothing will play with no error). These files could be relative to the application's working directory (by using 'Apppath ) or played based on the user's system (for instance, they have selected their own audio file in a Fusion-built media player)
Features
The Fusion runtime can use up to 32 channels for samples as well as offer additional features for its playback. Do note that some of these features are not available in all exporters.
- Loop samples a number of times or forever.
- Pause and resume specific samples or channels.
- Stop a specific sample or channel altogether.
- Pan (set the position with stereo speakers) of specific samples or channels.
- Rearrange the position of a specific sample or channel.
- Set the frequency of a specific sample or channel.
- Lock and unlock channels.
Conditions
Samples
The Samples conditions test for sound samples being played or paused. The Samples conditions are
Is a sample not playing?
Tests to see if any sound sample is not playing.
Is a specific sample not playing?
Tests to see if a specific sound sample is not playing.
Is a specific channel not playing?
Tests to see if a specific channel is not playing.
Is a specific sample paused?
Test to see if a specific sound sample is paused.
Is a specific channel paused?
Test to see if a specific sound channel is paused.
Music
The Music conditions test for MIDI music files not being played. The Music conditions are
Is music not playing?
Tests to see if any MIDI music file is not playing.
Is music paused?
Tests to see if a music is currently paused.
Is specific music not playing?
Tests to see if a specific MIDI music file is not playing.
Has music just finished?
Tests to see if any MIDI music file has finished playing.
Actions
Samples
Play Sample
The Play Sample action plays a specific sound sample.
Play sample on a specific channel
Plays a sound on one of the 32 different sound channels available.
Play sample file on a specific channel
Plays an external sample file on one of the 32 different sound channels available.
Play And Loop Sample
The Play And Loop Sample action plays a sound sample and replays the sample the number of times you specify. If the number of loops is equal to 0, the sample will continuously loop.
Play and loop sample on a specific channel
Plays a sound on one of the 32 different sound channels available and replays the sample the number of times you specify. If the number of loops is equal to 0, the sample will continuously loop.
Play and loop sample file on a specific channel
Plays an external sample file on one of the 32 different sound channels available and replays the sample the number of times you specify. If the number of loops is equal to 0, the sample will continuously loop.
Pause sample
Interrupts the sound being played.
Pause channel
Interrupts the sound played on a specific channel only (1-32). All other channels will continue to play.
Pause all sounds
Interrupts all the sounds being played.
Resume sample
Resumes a paused sample.
Resume channel
Resumes the playing of a specific channel (1-32). Does not interfere with the other channels.
Resume all sounds
Resumes all the paused samples.
Stop a specific sample
Stops a sound being played at the moment.
Stop Channel
Stops the sound being played on a specific channel (1-32). Does not interfere with the other channels.
Stop any sample playing
Stop any sound sample playing.
Set main volume
Changes the main volume level. The volume is indicated by a number from 0 (quiet) to 100 (loud).
Set sample volume
Changes the volume level of a specific sample. The volume is indicated by a number from 0 (quiet) to 100 (loud).
Set channel volume
Changes the volume level on a specific channel (1-32). The volume is indicated by a number from 0 (quiet) to 100 (loud).
Set main pan
Sets the main pan. The pan is indicated by a number from -100 (all the sound on the left, no sound on the right) to 100 (all the sound on the right, no sound on the left), 0 being in the middle.
Set sample pan
Sets the pan of a specific sample. The pan is indicated by a number from -100 (all the sound on the left, no sound on the right) to 100 (all the sound on the right, no sound on the left), 0 being in the middle.
Set channel pan
Sets the pan of a specific channel (1-32). The pan is indicated by a number from -100 (all the sound on the left, no sound on the right) to 100 (all the sound on the right, no sound on the left), 0 being in the middle.
Set sample position
This action changes the position in the sample. It asks for the name of the sample to change, and the index to start playing at, in milliseconds.
Set channel position
Same action as above, but for a specific channel (1-32).
Set sample frequency
Changes the frequency of a specific sample. 0 to use the original frequency of the sound.
Set channel frequency
Changes the frequency of a specific channel (1-32). 0 to use the original frequency of the sounds played on this channel.
Lock Channel
Locks a channel. Locked channels are ignored by the Play Sample action when it looks for an available channel to play a sound on.
Unlock Channel
Unlocks a channel.
Music
Play Music
This action plays a specific MIDI music file.
Play Music File
This action plays an external MIDI music file.
Play And Loop Music
This action plays a MIDI music file and replays the music file the number of times you specify. If the number of loops is equal to 0, the music will continuously loop.
Play And Loop Music File
This action plays a MIDI music file and replays the music file the number of times you specify. If the number of loops is equal to 0, the music will continuously loop.
Pause music
Temporary stops the music.
Resume music
Resumes a paused music.
Stop any music playing
Stops the music playing.
Tips & Tricks
Play different samples one after the other
There is no condition to check when a specific sample has finished playing, therefore, this can be worked around by using a form of counter. In this example, we will be using a global variable.
|
||||
1 | • Start of Frame | |||
2 | • No sample is playing
• Global Variable A = 0 |
|||
3 | • No sample is playing
• Global Variable A = 1 |
|||
4 | • No sample is playing
• Global Variable A = 2 |
|||
5 | • New condition |