CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
Data: Simple cross-fading of music

Description of the sample

Overview

This sample project for CRI Atom Craft configures a simple music cross-fade in the data.

cri4u_samples_criatom_script_data_music_main.png

Data information


Middleware CRI ADX (CRI Atom)
Sample Sample data: Simple music cross-fade
Location /CRIWARE/SDK/unity/samples/AtomCraftProject/AtomCraftWork_MusicCrossfade
Project file MusicCrossfade.atmcproj
Work unit WorkUnit_MusicCrossfade


Attention
The CueSheet of this sample project is managed in the "WorkUnit_MusicCrossfade" work unit.
To edit and preview a Cue, right-click on "WorkUnit_MusicCrossfade" in the project tree, and select "Edit work unit".
cri4u_samples_criatom_script_data_music_workunit.png

Description of the data

The data is configured for a simple cross-fading of music.
The restriction on playback is to play only one musical Cue at a time.
The following steps are followed on the data side.
Step (1) Create the MUSIC category and register a music Cue.
Step (2) Enable a Cue limit for the MUSIC category, and set that limit to 1.
Step (3) Set an envelope (attack and release) for the music waveform.
If this is done, when the game script triggers the music playback, cross-fading is automatically performed for a smooth transition.
The following sections describe the configuration steps in more details.

Setting a Cue limit for the category

Create the MUSIC category, and drag and drop music Cues to register them.
When you select the MUSIC category in the project tree, the category parameters are shown in the right pane.
Select the Cue limit option, and enter 1 in the Limit field.
Then only one Cue in the MUSIC category can be played at one time.

cri4u_samples_criatom_script_data_music_category.png

Setting an envelope for the waveveform

Select a music Cue, then its waveform.
When a waveform is selected, you can set an envelope in the FX2 tab on the FX/AISAC pane (in the lower part of the tool, in the center).
For this sample we set 500 ms for the attack and 1000 ms for the release.
Doing that, the volume of this Cue will increase over the first 500 ms when its playback is started, and will decrease over 1000 msec when the playback is stopped.
Although the Cue limit of the category is one, cross-fading is provided, because the release after stopping playback is enabled.

cri4u_samples_criatom_script_data_music_envelope.png

Checking the cross-fading

You can check the cross-fading by playing the Cue in the tool.
It is recommended that you build a CueSheet, because no small building during preview interrupts music.
You can play a Cue by selecting it in the project tree. You can also play it from the Cue list that appears on the right when you select the MUSIC category. Selecting the MUSIC category may be convenient, because it shows only music Cues.

Tips: Setting an envelope for multiple waveforms at once

The envelope setting we described above must be applied to all music waveforms.
Setting it to each waveform can take time, especially if there are many of them. Use the following steps to set it all at once.
(1) Select a CueSheet (CueSheet_0 in this sample) in the project tree at the left of the tool. The Cue information and the Cue list are shown on the right.
(2) Click "Filter" at the top of the Cue list tab on the right. Then you can select the icons next to it.
(3) Click an icon in the filter field to show only the waveform.
(4) Scroll the Cue list tab to the right to show the EG attack and EG release columns.
(5) Select multiple waveforms in the Cue list. Then change the value for the selected waveforms. You can enter a value directly or drag the mouse up or down to change it.
When you enter a value, it will be assigned to all the waveforms.
When you drag the mouse up or down, the various values of the waveforms are changed relatively.

cri4u_samples_criatom_script_data_music_cuelist.png