Play List Action

From FSDeveloper Wiki
Revision as of 15:34, 12 November 2007 by BASys (talk | contribs)
Jump to: navigation, search

The play list action will play the specified music items on the adventure music track.

Individual play list items can be set to a random position within the play list.


Warning/Caveats

Some important points to note when implementing playlists.


Files

Supported Filetypes

WAV files are apparently the only type supported.

List known working formats.

Some formats of WAV files will not play correctly.

Microsoft ADPCM 11.025 kHz, 4 Bit, Mono, (hence in the example I've posted, the odd sounding thunder, & speeded up dialog on the second playlist).

PCM 22.050 kHz, 16 Bit, Mono


The following formats are not supported - MP3 WMA

Paths

If any files are incorrectly referenced, the mission will not load.

The soundfile must exist on the specified path.


These only work for audio files located in the path -

Microsoft Flight Simulator X\sound

or subfolders thereof.


They will also work for a path relative to that location.

e.g. ..\Missions\Some_Folder\Mission_Name\Sound\any_audio.wav

Naming Conventions

ENSURE you use an appropriate & unique name for your sound clip, otherwise you'll possibly overwrite someone else's clip.

i.e. Don't use song1.wav, song2.wav, etc.

Prefix the clip with your mission name.

e.g. MyRescueMission_song1.wav, MyRescueMission_song2.wav, etc


Suggest adding a common subfolder, and that we all adopt that as a common standard.

e.g. Microsoft Flight Simulator X\Sound\Mission_Playlists

And that you place your soundfiles in mission specific subfolders.

e.g. Microsoft Flight Simulator X\Sound\Mission_Playlists\MyRescueMission

In six months time, or whenever, a user may find themselves short on diskspace, and don't know which files to delete.

File Sizes

Ensure your soundfile is an appropriate format, (radio quality, as maximum), and of a smallish size.

Nobody wants to download 600MB of your favourite music.  :D

You can play a clip indefinitely by repeating it, using multiple calls in the playlist.

See example clips in Microsoft Flight Simulator X\Sound\UIMusic


Testing your playlists

If you fire a playlist,

then exit or reload the mission,

before the playlist is completed.

The interupted track & remaining playlist tracks will continue to play !


Sample Code

Plays two different short playlists, using sounds & UIMusic which already exist in your FSX.

A 5 second timer activates -

a) the first playlist.

b) a 60 second timer, which then fires the second playlist.

NB

For readability this code is laid out in order of firing, and will work as is.

If added to a mission, and then edited with the OPT, the OPT will re-sequence it.

On screen notices & timers are included for test purposes.

       <SimMission.TimerTrigger InstanceId="{A8498446-0335-4E76-BB37-82B9AEAD1A76}">
           <Descr>_Init_TTimer_S5</Descr>
           <StopTime>5.000</StopTime>
           <OnScreenTimer>True</OnScreenTimer>
           <Actions>
               <ObjectReference id="_Triggered_TTimer_S120_AA_On" InstanceId="{35CE0E66-F666-4E9C-8CCD-929C54BCE3C7}">
               </ObjectReference>
               <ObjectReference id="_First_PLAYLIST_DIALOG_AD" InstanceId="{D3BDAB41-B690-499F-B63D-1ECDAB56C1AA}">
               </ObjectReference>
               <ObjectReference id="_First_PLAYLIST_AP" InstanceId="{6DA689F9-67C1-49BD-AD95-3A633E428709}">
               </ObjectReference>
           </Actions>
       </SimMission.TimerTrigger>
       <SimMission.ObjectActivationAction InstanceId="{35CE0E66-F666-4E9C-8CCD-929C54BCE3C7}">
           <Descr>_Triggered_TTimer_S120_AA_On</Descr>
           <ObjectReferenceList>
               <ObjectReference id="_Triggered_TTimer_S60" InstanceId="{860011FB-F217-4FEF-BE94-C33C4F648AE9}">
               </ObjectReference>
           </ObjectReferenceList>
       </SimMission.ObjectActivationAction>
       <SimMission.DialogAction InstanceId="{D3BDAB41-B690-499F-B63D-1ECDAB56C1AA}">
           <Descr>_First_PLAYLIST_DIALOG_AD</Descr>
           <Text>5 second Timer activated _First_PLAYLIST_AP</Text>
       </SimMission.DialogAction>
       <SimMission.PlayListAction InstanceId="{6DA689F9-67C1-49BD-AD95-3A633E428709}">
           <Descr>_First_PLAYLIST_AP</Descr>
           <PlayListItem>
               <Descr>PlayListItem 1</Descr>
               <SoundFileName>MRSDAHL.wav</SoundFileName>
               <RandomizeInList>True</RandomizeInList>
           </PlayListItem>
           <PlayListItem>
               <Descr>PlayListItem 2</Descr>
               <SoundFileName>backcourse_marker.wav</SoundFileName>
               <RandomizeInList>True</RandomizeInList>
           </PlayListItem>
           <PlayListItem>
               <Descr>PlayListItem 3</Descr>
               <SoundFileName>UIMusic\FSX08.wav</SoundFileName>
           </PlayListItem>
       </SimMission.PlayListAction>



       <SimMission.TimerTrigger InstanceId="{860011FB-F217-4FEF-BE94-C33C4F648AE9}">
           <Descr>_Triggered_TTimer_S60</Descr>
           <StopTime>60.000</StopTime>
	    <Activated>False</Activated>
           <OnScreenTimer>True</OnScreenTimer>
           <Actions>
               <ObjectReference id="_Second_PLAYLIST_DIALOG_AD" InstanceId="{7808D1CE-FFDB-4727-A05E-093DB452DB0C}">
               </ObjectReference>
               <ObjectReference id="_Second_PLAYLIST_AP" InstanceId="{E768BFC8-F32E-450D-B095-C23F819AFD31}">
               </ObjectReference>
           </Actions>
       </SimMission.TimerTrigger>
       <SimMission.DialogAction InstanceId="{7808D1CE-FFDB-4727-A05E-093DB452DB0C}">
           <Descr>_Second_PLAYLIST_DIALOG_AD</Descr>
           <Text>60 second Timer activated _Second_PLAYLIST_AP</Text>
       </SimMission.DialogAction>
       <SimMission.PlayListAction InstanceId="{E768BFC8-F32E-450D-B095-C23F819AFD31}">
           <Descr>_Second_PLAYLIST_AP</Descr>
           <PlayListItem>
               <Descr>PlayListItem 1</Descr>
               <SoundFileName>thunder\xthun4c.wav</SoundFileName>
           </PlayListItem>
           <PlayListItem>
               <Descr>PlayListItem 2</Descr>
               <SoundFileName>lessons\atpding39.wav</SoundFileName>
           </PlayListItem>
           <PlayListItem>
               <Descr>PlayListItem 3</Descr>
               <SoundFileName>UIMusic\FSX03.wav</SoundFileName>
           </PlayListItem>
       </SimMission.PlayListAction>


Related content

Placeholder text

External links

Placeholder text