Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.
Close

Snowmix Libraries - Scenes 2

Peter Maersk-Moller

Snowmix Libraries - scenes.slib part 2

As of version 0.4.4 of Snowmix, the following applies. Updated for version 0.5.1

Scenes part 1.
Scenes part 2 is this page.

The scenes.slib library introduces the concept of Scenes for Snowmix. It offers advanced functions for creating simple as well as complex layouts and offers methods for switching between the layouts. The library depends on the system.slib and basic-shapes.slib. These libraries MUST be included in the ini file before the scenes.slib is included. Otherwise it will fail. Please read more about Scenes in the first part.

Variables

Please see the section Variables in the first part.

The library, when included, offers the following global variables in the Tcl interpreter:

TBD

It is not recommended that these variables are changed manually once the library has been loaded/included.

Functions Overview

Please see the section Functions Overview in the first part.

The library, when included, offers the following functions in the Tcl Interpreter:

Frame commands

  • SceneSetFrameSource : Set a feed/image/graph/radar source for a frame (front or back)

  • SceneFrameBack2Front : Fade/Cut front source and back source up and switch source.

  • SceneFrameFade : Fade up/down a Frame for a Scene.
  • SceneFrameText : Get/set frame text (name, time) for Frame.
  • ScenePlaceFrame : Replace/resize added Frame for a Scene.
  • SceneSetFrameActive : Set the active/passive state for a Frame.

Get/Set Scene Info and Scene Commands
- SceneAddFrameType : Add a new SceneFrameType.
- SceneFrameTypesList : List added frame types.
- SceneFrameTypeInfoProc : List the Info Procedure for a given frame type.
- ScenesUpdate : To be called for every main mixer frame to draw active scene with frame(s). Setup by SceneInit


SceneSetFrameSource

Name

SceneSetFrameSource - Set a source for a Frame (front or back)

Synopsis

SceneSetFrameSource scene_id frame_id type type_id front active args

Description

This function can be used to set a front or a back source for a Frame within a Scene. The positve integer argument scene_id identifies a Scene, the positive integer argument frame_id identifies a Frame within the Scene. Both the Scene and the Frame must exist. Otherwise the function will fail.

The argument type is a string specifying the type of the source such as 'feed', 'image' and so on. Available source types can be listed with the function SceneFrameTypeList. The positive integer argument type_id identifies the ID of the type. If the source is video feed 2, then the type argument would be 'feed' and the type_id would be '2'.

The front argument specifies the front or the back where 1=front and 0=back

The active argument specifies whether the Frame's front or back should be active where 0=inactive and 1=active. This can later be changed with the command SceneSetFrameActive.

The extra arguments args are optional and not yet used.

The function will call SceneSetFrameActive with its argument active if the argument front is 1.

Example

This example sets the front source to image loaded 5 and the back to feed 3 for Scene 2 Frame 4. The front and back is set active.

SceneSetFrameSource 2 3 image 5 1 1
SceneSetFrameSource 2 3 image 5 0 1

The example can be executed directly from the Snowmix command line prepending the commands with 'tcl eval '.

See Also

SceneCreate, SceneAddFrame, SceneFrameTypesList, SceneAddFrameType, SceneSetFrameActive


SceneFrameBack2Front

Name

SceneFrameBack2Front - Fade/Cut front source and back source up and switch source.

Synopsis

SceneFrameBack2Front scene_id frame_id fade

Description

This function can be used to switch the front and the back source of a Frame for a Scene. The Scene is specified by the scene_id argument and the Frame for that Scene is specified by the frame_id argument. Both arguments are positive integers. If the Scene or the Frame for the Scene do not exist, the function will fail.

The fade argument can be either 0 or 1. If the fade argument is 0, the alpha value for the new back source will be set to 0 and the alpha value of the new front source will be set to 1. If the fade argument is 1, then the alpha of the new back source will fade down from what ever value it has to 0 according the fade down speed for that frame. The new front source alpha value will be set 0 and after a fade pause, it will fade up accoding to the fade up speed for that frame. The fade up, pause and down speed can be inspected and set with the SceneFadeSpeed function. If the Scene is not active, the switch and the fade down and up will still happen, but be invisible.

Example

SceneFrameBack2Front 2 3 1

tcl evalSceneFrameBack2Front 2 3 1

The first example will switch the front and back source of Scene 2 Frame 3 and it will fade the new back source down and fade the new front source up from 0.

The second example shows the same, but is executed directly on the Snowmix command line.

See Also

SceneSetFrameSource, SceneFadeSpeed.


SceneFrameText

Name

SceneFrameText : Get/set Frame text (name, time) for Frame.

Synopsis

SceneFrameText scene_id frame_id name [ order value ]
SceneFrameText scene_id frame_id time [ order value ]

Description

This function can be used to enable or disable either a name or a time placed on top of a Frame's front or back source for a specific Scene. The Scene is specified by the scene_id argument. The Frame is specified by the frame_id argument. The function will fail if the Scene or the Frame for that Scene do not exist. The argument 'name' or 'time' decides whether it will be a name or time that is enabled or disabled. The argument order when set to 1 specifies the front source and 0 for for the back source. If the argument value is 1, the name or time will be enabled and disabled if 0.

If the function is used without the order and value arguments, the function will return the current settings for the specified Frame for the specified Scene.

The function only works when a Frame source is a feed. The text that the name will enable to be shown is currently of the form 'Feed #N' where N is the feed ID. The name is center placed at the top of the Frame. The text that time will enable is the running time of the feed. The time text is placed in the lower right side of the feed.

Example

tcl eval snowmix message [SceneFrameText 2 3 name]

may return the following line:

MSG: 1 0

This tells us that for Scene 2 Frame 3 the name text for the front is enabled and disabled for the back.

If we want to enable the time text for the front source of Frame 3 for Scene 2, we can execute the following command

SceneFrameText 2 3 time 1 1

The command shown is expected to be part of a Tcl script executed by Snowmix. If the command was to executed directly on the Snowmix command line, it will need to be prepended the string 'tcl eval '.

See Also

SceneFrameSource.


ScenePlaceFrame

Name

ScenePlaceFrame : Move/resize added Frame for a Scene.

Synopsis

ScenePlaceFrame scene_id frame_id xoff yoff width height

Description

This function can be used to move and/or resize a Frame already added to a Scene. The arguments scene_id and frame_id specifies uniquely the Frame that is to be moved and/or resized. The arguments xoff and yoff are integers specifying the Frame's offset in pixels within the Scene. The positive integer arguments width and height specifies in pixels the width and height of the Frame. The Scene and the Frame must exist. Otherwise the function will fail.

The existing position of Frames within a Scene can be inspected with the function SceneList.

Example

The following example will move and/or resize Frame 3 in Scene 2 to 100,50 and give it the width and height 320x240:

ScenePlaceFrame 2 3 100 50 320 240

The command can be executed from the Snowmix command line by prepending the text 'tcl eval '.

See Also

SceneCreate, SceneAddFrame, SceneList.


SceneSetFrameActive

Name

SceneSetFrameActive - Set the active/passive state for a Frame.

Synopsis

SceneSetFrameActive [ scene_id [ frame_id [ active silent ] ] ]

Description

This function can be used to set a Frame specified by the positive integer argument frame_id within a Scene specified by the positive argument scene_id active or inactive. If the argument active is 1, then the Frame will be set active and its front source will have its alpha value set to 1. When a Scene is overlayed, only Frames that are active will be overlayed. If the active argument is set to 0, then the Frame is set to inactive and it will not be overlayed when its Scene is active and overlayed. If the active argument is -1, the Frame is set to active, but the alpha value for the Frames front source is left unchanged. If the the argument silent is 0, the function will print a single line with a message about which Frame is being set active or inactive. Otherwise the function will be silent. The function will fail if the Frame or the Scene do not exist.

  • Used without arguments, it will list the all frame states for all scenes.
  • Used with scene_id as argument, it will list all frame state for that scene
  • Used with scene_id and frame_id as argument, it will list frame state for that scene and that frame
  • Used with acive=1 frame is set active and alpha is set to 1
  • Used with active=0 frame is set to passive
  • Used with active=-1 frame is set to active, but alpha is left unchanged

The function SceneSetFrameSource will call SceneSetFrameActive with its argument active if the source being set is for the front.

Example

The following example will set the Scene 2 Frame 3 active and be silent about it:

SceneSetFrameActive 2 3 1 1

The command can be executed from the Snowmix command line by prepending the text 'tcl eval '.

See Also

SceneCreate, SceneSetState, SceneAddFrame, SceneSetFrameSource.


ScenesUpdate

Name

ScenesUpdate - Update settings for Scenes and overlay Scenes.

Synopsis

ScenesUpdate

Description

This function is setup, when the library is loaded, to be called every frame period by including a call to ScenesUpdate in the command macro that is set with the command overlay finish. It all happens automatically and nothing needs to be done manually.

However the command macro set with the overlay finish is only executed every frame period when a process is connected with a GStreamer shmsrc like interface requesting Snowmix to output mixed frames.

If the command macro set for overlay finish is later changed or deleted, a new command macro must be established containing the line

tcl eval ScenesUpdate

and that command macro must be set for overlay finish.

Example

There are no examples.

See Also


Something

Name

Something - Set a

Synopsis

Something scene_id frame_id

Description

Example

The second example shows the same, but executed directly on the Snowmix command line.

See Also


Related

Wiki: Snowmix Libraries - Scenes 2
Wiki: Snowmix Libraries - Scenes
Wiki: Snowmix Libraries