Chapter 6 Wrapped Class Reference

6.3 Multimedia

Multimedia applications should be thought of as the juxtaposition and presentation of media elements to users through the user interface. The ADL contains two key features which enhance an application designer's ability to manage and control multimedia presentations more efficiently.

1. Multiple presentations of a single media element can be created and controlled independently. This is more efficient than duplicating a media element in order to make and manipulate multiple presentations of it. Each presentation request for a media element returns a special type of handle called a presentationID, which can be passed as an argument to specify which presentation of a media element to control. Each presentation exists as long as the media element that created it exists, or until the particular presentation is removed, at which time the presentationID handle is made invalid. In the media classes, there are frequently two alternative forms of a method. The form without a handle will perform the specified action on all presentations of a media element, while the method (s) named "methodID" with a handle will perform the action on the specified presentationID.

2. The reusability of application interfaces through the interchangeability of multimedia was a key design goal of AM2. The MMbroker adds a subtle capability which helps the ADL programmer to achieve this goal. It allows applications to access media elements without needing to be aware of their actual format. This makes it much easier to construct interchangeable sets of media. For further explanation of the use of MMbroker, see Section 6.3.5, "MMbroker" page 182.

The classes which are essential for supporting the above features are described in the first two sections of this section, followed by descriptions of how the specific media classes take advantage of these capabilities for different forms of media:

The class inheritance tree diagram for the Multimedia (MM) wrapped classes of AM2 appears in Figure 6.31.

Figure 6.31: Multimedia Wrapped Classes Inheritance Tree

6.3.1 MMbase - Abstract

An abstract class can not be directly created within an ADL program or used as a base of a user-defined ADL class, so utilization of the MMbase methods, members and activities must be through the fully-derived wrapped media classes. However, all fully derived media classes inherit from MMbase, so they share the generic methods, members and activities listed below.

Superclasses

Section 6.1.2, "Activity Manager - Abstract" page 116

Section 6.1.3, "Attribute Manager - Abstract" page 118

Methods

Although the "Present" and "Dismiss" methods described below are available to all derived media classes, they exhibit different behavior for different media types. For this reason, these methods are repeated in the more media specific abstract classes (i.e. MMvisual, MMtemporal and MMaudioControl). The "Remove" methods exhibit similar behavior across all classes, so they are only described here and will not be repeated elsewhere.

on Present

Presents all existing presentations for a media element using the current settings for each individual presentation request of the element. The entire element is presented. Activities triggered: Depends on the actual element's Present activities.

on PresentId: handle presentationID

Presents the element's specified presentation request. Activities triggered: Depends on the actual element's Present activities.

on Dismiss

Dismisses all presentation requests for an element. A dismissed presentation is not removed nor is the loaded data destroyed. An element that is dismissed may be thought of as being off-stage ready to be presented again. A visual element's Dismiss method hides the element. Activities triggered: Depends on the actual element's activities.

on DismissId: handle presentationID

Dismisses the element's specified presentation request. Activities triggered: Depends on the actual element's activities.

on Remove

Removes all presentations of an element, which can not be presented again without creating new presentations. Dismiss is called on the element's presentations before they are removed. Activities triggered: Depends on the actual element's activities.

on RemoveId: handle presentationID

Removes the element's specified presentation request. Activities triggered: Depends on the actual element's activities.

Attributes
MMbase Attributes
AttributeTypeDescriptionAccess
namestringa user or application defined element nameCSG

Activities
MMbase Activities
ActivityKeysDescription
DataReadynonemedia data available
Presentnoneelement is presented
Dismissnoneelement is dismissed
Destroyednoneelement is destroyed

Example

None

6.3.2 MMvisual - Abstract

Any visual element type is derived from the MMvisual class.

Superclasses

Section 6.1.2, "Activity Manager - Abstract" page 116

Section 6.1.3, "Attribute Manager - Abstract" page 118

Methods

The following apply to all of the following methods:[15]

on Present

Registers and automatically shows all existing presentations of a media element.

on PresentID: handle presentationID

Present registers and automatically shows the specified presentation.

on PresentOn: handle hVisual return handle presentationID

on PresentAt: handle hVisual, integer x, integer y return handle presentationID

on PresentClipped: handle hVisual, integer x, integer y, integer clipW, integer clipH,

integer offsetX, integer offsetY return handle presentationID

on Register

Registers all existing presentations of the media element but does not show the presentations.

on RegisterID: handle presentationID

Registers the specified presentation but does not show the presentation of specified handle.

on RegisterOn: handle hVisual return handle presentationID

on RegisterAt: handle hVisual, integer x, integer y return handle presentationID

on RegisterClipped: handle hVisual, integer x, integer y, integer clipW, integer clipH,

integer offsetX, integer offsetY return handle presentationID

on Show

Maps all of the elements existing presentations onto their specified XFvisuals.

on ShowID: handle presentationID

Maps the presentation onto the specified XFvisual at the location specified.

on Hide

Hides all presentations of the image, if clearMode is TRUE, the areas are cleared.

on HideID: handle presentationID

Unmaps the specified presentation, the presentationID is not removed, and the media element is not unloaded. Show methods may be called after a Hide method.

on Dismiss

The element stops presenting all presentations of itself, any screen updates are stopped and, if the element is temporal, no new frames are presented. If clearMode is TRUE the images are cleared. The presentationIDs are still valid.

on DismissID: handle presentationID

Screen updates are stopped and, if the element is temporal, no new frames are presented. If clearMode is TRUE the image is cleared. The presentationID is still valid.

Attributes
MMvisual Attributes
AttributeTypeDescriptionAccess
widthintegerwidth of imageG
heightintegerheight of imageG
clearModebooleanclears presentation from the screen automatically if presentation is hidden or removed, default TRUECSG

Activities
MMvisual Activities
ActivityKeysDescription
DataReadynoneAfter a load is complete

Example

None

6.3.3 MMtemporal - Abstract

MMtemporal is a base class for any element that has a temporal or sequential nature. In most cases, positions within the data stream are addressable and the media data is presented as a series of positions. All wrapped classes that are derived from MMtemporal share the same methods, members and activities. For some of the derived classes the methods may have different results or no action, for example currently you may not change the playback rate of digital audio.

Superclasses

Section 6.1.2, "Activity Manager - Abstract" page 116

Section 6.1.3, "Attribute Manager - Abstract" page 118

Methods

Note that some temporal methods behavior depends on the type of the specification provided:

If either side of the interval is open, use the sequence's start or end position.

on Present

"Play"s all current presentations from start to end using the current settings. Activities triggered: Play and RateChange.

on PresentId: handle presentationID

on Play: any specification (only on UNIX)

Behavior of this method is controlled by the type of specification provided (see note above). Activities triggered: Play and RateChange, PositionChange if seek to new location.

on PlayId: handle presentationID, any specification

on PlayAll

on PlayAllId: handle presentationID (only on UNIX)

Play the entire media element at the default or requested rate. Activities triggered: Play and RateChange, PositionChange if seek to new location.

on PlayInterval: interval range

on PlayIntervalId: handle presentationID, interval range (only on UNIX)

Play the range specified within the interval, if either side of the interval is open use the sequence's start or end position. Interval values may be either timestamps or positions and may be mixed. Please note many media types do not support playing backwards. Activities triggered: Play and RateChange, PositionChange if seek to new location.

on PlaySeq: integer start, integer end

on PlaySeqId: handle presentationID, integer start, integer end (only on UNIX)

Play the sequence of positions starting at "start" and stopping at "end" at the default or requested rate. Please note may media types do not support playing backwards. Activities triggered: Play and RateChange, PositionChange if seek to new location.

on PlayUntil: value val (only on UNIX)

on PlayUntil: value val return handle presentationID (only on UNIX)

on Pause

on PauseId: handle presentationID (only on UNIX)

If the element is being presented, it pauses. A paused media element may be resumed. Activities triggered: RateChange.

on Resume

on ResumeId: handle presentationID (only on UNIX)

If the element is paused, presentation continues from where it was paused. Activities triggered: RateChange.

on Stop

on StopId: handle presentationID

If the element is being presented or paused it is stopped, a stopped element may not be
resumed. The element is not unloaded and may receive new presentation or play commands,
but by default it starts at the beginning again. Activities triggered: Stop and RateChange.

on Seek: any location, boolean present

on SeekId: handle presentationID, any location, boolean present (only on UNIX)

Seeks to location specified by the value location. Location is relative to the beginning of the sequence. Location may be either an integer, which is used as a media specific frame or position, or a time value, which is used as the number of milliseconds into the sequence. If present is TRUE and element is a visual type present the frame. Activities triggered: PositionChange

on GoStart

on GoStartId: handle presentationID (only on UNIX)

Seeks to start of sequence. Visual elements display first frame. Triggered: PositionChange

on GoEnd

on GoEndId: handle presentationID (only on UNIX)

Seeks to the end of sequence. Visual elements display last frame. Triggered: PositionChange

on Jump: any location, boolean present

on JumpId: handle presentationID, any location, boolean present (only on UNIX)

Jumps to location (an offset of the number of images from the current position). If present is TRUE and the element is a visual type, present the frame. Triggered: PositionChange

on GoPPS: integer positionsPerSecond

on GoPPSId: handle presentationID, integer positionsPerSecond (only on UNIX)

Presents the media at the specified positions per second. Activities triggered: RateChange

on GoRate: real rate

on GoRateId: handle presentationID, real rate (only on UNIX)

Attempts to present the media at the specified rate based on default PPS = 1.0. Activities triggered: RateChange

on ToPosition: time duration returns integer

Does not affect the media element but converts a time value into an element specific native position, or number of positions. Positions are calculated using the default PPS.

on ToTime: integer position returns time

Does not affect the media element but converts an integer position, into an element specific timestamp or duration. Time is calculated using the default PPS.

Attributes
MMtemporal Attributes
AttributeTypeDescriptionAccess
startPositionintegerstart position relative to start of media dataCSG
endPositionintegerend position relative to start of mediaCSG
positionintegercurrent position relative to start of sequenceSG
timestamptimecurrent position from start of sequence calculated using default data rateSG
PPSintegercurrent Positions per Second, native media frameSG
raterealcurrent rate calculated using default data rate

1.0 is the default rate.

SG
lengthintegerlength of the sequence in positionsCSG
durationtimelength of the sequence in time, calculated based on default rateCSG
requestPPSintegerrequest presentation rate, does not start the media. May have no effectCGS
requestRaterealrequest presentation rate as multiplier of default

Positions Per Second (PPS)

CGS

Activities
MMtemporal Activities
ActivityKeysDescription
Playsee footnoteplaying started
Startsee footnoteelement starts, also on resume
Stopsee footnotestopped, also on pause
RateChangesee footnoteon any rate change
StartChangesee footnoteafter creation if the beginning location is changed
EndChangesee footnoteafter creation if the end of sequence is changed
PositionChangesee footnoteseek, not called during normal movement
PositionReachedmust be subscribed for prior to start
Periodicsets timer, notify every clock 'tick'
NextSamplemore data available
LateSamplesample expected, is not ready
EndOfSequencemust be subscribed for before sequence starts
DroppedSampleelement has skipped a sample

6.3.4 MMaudioControl - Abstract

MMaudioControl deals with audio gain, channel selection, and input/output selection. All wrapped classes that are derived from MMaudioControl share the same methods, members and activities. For some of the derived classes, the methods have different results or no action.

Superclasses

Section 6.1.2, "Activity Manager - Abstract" page 116

Section 6.1.3, "Attribute Manager - Abstract" page 118

Methods

on Present

on PresentId: handle presentationId

Presents the entire sound element using the current output gain and device. Activities triggered: Play and RateChange.

on PresentSequence: integer start, integer end, real volume return handle presentationID

Creates, registers ad presents an audio presentation request. The start position, end position and volume are set to the specified lvalues. The presentationID is returned.

on PresentVolume: real volume return handle presentationID (only on UNIX)

Creates, registers and presents an audio presentation request. The volume is set to the specified level, the start and end positions default to beginning and end of data, and the presentationID is returned.

on RegisterSequence: integer start, integer end, real volume return handle presentationID

Creates and registers an audio presentation request. The start position, end position and volume are set to the specified lvalues. The presentationID is returned.

on RegisterVolume: real volume return handle presentationID (only on UNIX)

Creates and registers an audio presentation request. The volume is set to the specified level, the start and end positions default to beginning and end of data, and the presentationID is returned.

on Seek: any location, boolean present

Seeks to the location specified by the value location, the specified position is relative to the beginning of the sequence. Location may be either a integer which is used as a media specific frame or position, or a UTtime which is used as the number of milliseconds into the sequence. Note: An audio position is not presented upon Seek since a single sample is not useful. Activities triggered: PositionChange.

Attributes
MMaudioControl Attributes
AttributeTypeDescriptionAccess
numChannelsintegernumber of channel currently supportedCSG
gainrealsets output gain for all channelsCSG
gainArealsets output gain for channel A (left)CSG
gainBrealsets output gain for channel B (right)CSG
levelreallevel is the current signal value for all channelsG
levelAreallevel is the current signal value for channel A (left)G
levelBreallevel is the current signal value for channel B (right)G
outputstringspecifies the local output deviceS
recordbooleanrecord mode CG
inputstring selects input deviceCGS

Activities
MMaudioControl Activities
ActivityKeysDescription
AudioChangednonegain for any channel changed
AudioAChangednonegain for channel A changed (left)
AudioBChangednonegain for channel B changed (right)

Example

None

6.3.5 MMbroker

The multimedia broker acts as a media object factory. It isolates the ADL from having to declare and call a specific constructor for the actual data format of the requested media element. The ADL deals with abstract element types (such as image, audio, and movie) but the actual object created by the wrapper must be the fully derived media element class that supports the specific data type (MEgif, MEtiff, MEjpeg, etc.). The MMbroker, if given a generic element type, tests the media data to determine the actual C++ class that must be constructed. Since the broker may construct any media type, specification of the media element type may be supplied by external or run-time data. The MMbroker parses media object descriptor lists. These lists define media elements and the element's internal objects. The format of an object descriptor list is as follows:

An argument list has the following format:

File access may be specified through an MAfile descriptor list, MAfile descriptor lists follow the same format as any other object descriptor list, but in addition support a short list form:

{"MAfile","pathname"} The short form must be a list of two strings.

Superclasses

Section 6.1.2, "Activity Manager - Abstract" page 116

Section 6.1.3, "Attribute Manager - Abstract" page 118

Methods

on MakeElement: list mediaDescription return handle

The "mediaDescription" is a list which matches the format specified above. A media element is created and a handle to it is returned.

on LoadColorNames: string filePath

Loads colors defined within the file as the color database colors. Deletes all colors currently in the default color database. See /usr/lib/rgb.txt for file format.

on AppendColorNames: string filePath

Appends colors defined in the file to the color database. All colors currently in the default color database remain. Multiple entries may have the same name and or color values, searches of the database usually return the first 'match' found. See /usr/lib/rgb.txt for file format.

Attributes

None

Activities

None

Example

None

6.3.6 MMcolor

MMcolor allows a user to define and control either RGB or HVS colors.

Superclasses

None

Methods

on construct

Default constructor. Name is 'none', color is all zeros ( Black).

on createName: string colorname

Creates a color name. If the default color database contains the name of the RGB, values are set to match the name's values, else they are set to zero ( Black ).

on createRGB: integer green, integer red, integer blue

Creates a color of the specified RGB settings. If the default color database contains a color with matching RGB values, name is set to match the found color name, else is set to 'none'.

on createHVS: real hue, real value, real saturation

Creates a color of the specified HVS settings. If the default color database contains a color with matching RGB values name is set to match the found color name, else is set to 'none'.

on createNamedRGB: string colorname, integer green, integer red, integer blue

Creates a color of the specified name with the specified RGB settings. Color database is not checked.

on createNamedHVS: string colorname, real hue, real value, real saturation

Creates a color of the specified name with the specified HVS settings.

Attributes
MMcolor Attributes
AttributeTypeDescriptionAccess
colorhandleA representation of the packed RGB values in a 32 bit integerCSG
redintegerThis sets the level of red in a RGB color specification.CSG
greenintegerThis sets the level of green in a RGB color specification. CSG
blueintegerThis sets the level of blue in a RGB color specification.CSG
huerealThis sets the hue in an HVS color specification. Range is 0.0 to 360.0CSG
valuerealThis sets the brightness in an HVS color specification. Range is 0.0 to 100.0CSG
saturationrealThis sets the saturation in an HVS color specification. Range is 0.0 to 100.0CSG
namestringSpecifies a user or applicaiton defined color.CSG

Activities

None

Example

None

6.3.7 MMimage

Any type of image that is not a sequence of images that may be controlled, or indexed. Currently supported image classes; MEpbm, MEgif, MEtiff, MEjpeg, MExbm and MEphotoCD only on the Sun platform. In addition a special image class MEvideo supports a live analog video stream. The MEvideo class is supported by MMimage since the only controls for the video stream are its placement and visible state.

Superclasses

Section 6.3.1, "MMbase - Abstract" page 173

Section 6.3.2, "MMvisual - Abstract" page 174

Methods

upon Construct: list description

Default constructor. Requires access descriptor to image. Description should be of the form {<type>, {'MAfile, <filename>}}, where <type> is the type of the image (one of: 'MEgif, 'MEjpeg, 'MEpbm, 'MEphotoCD, 'MEtiff, 'MExbm, or 'MEimage to auto-detect), and <filename> is the name of the image file. An example of a constructor follows:

	'Construct, { 'MEimage, { 'MAfile, "bigcat.gif"}}
on List: returns list

Returns an object descriptor list, which may be used to re-create the object. The returned list is formatted to be used as the list argument to the MMbroker to MakeElement or to the class's Construct method which has a list argument.

on Load: return integer

Loads the image into memory. Returns zero on success.

on Unload: return boolean

Unloads any media data, closes the elements data file, stops the refreshing of the image and returns TRUE when complete. The media element is not deleted or destroyed so it is possible to redisplay the image with another present command. Note: all existing presentations are removed and made invalid. If you plan on hiding and showing the image this is not the method to call since the media data will have to be reloaded and a new presentation requested.

on SetSize: integer width, integer height

Set the image to a new size.

on Zoom: real scaleX, real scaleY

Zoom changes the size of all presentations created from this element, currently the image must be Zoomed before the image is presented. To present the same image with different scale factors, another instance of the MMimage is required. This will change in the future. If a clip region is not specified, the presented image is the size of the image after the Zoom.

Attributes
MMimage Attributes
AttributeTypeDescriptionAccess
widthintegerwidth of imageG
heightintegerheight of imageG
clearModebooleanclear on remove sink automatically, default falseCSG

Activities
MMimage Activities
ActivityKeysDescription
DataReadynoneafter a load is complete

Example

1 global assets

2 {

3 {'SetLibrary, "Examples", "/usr/lib/Examples"} => self;

4 }

5 anonymous: XFtop

6 {

7 XFvisual visual { x=10; y=10; width = 640; height = 480;

8 background="black";

9 };

10 XFbutton bimg1 { x=200; y=500; width= 100; height = 30;

11 label="Image 1";

12 background="white"; foreground="black";

13 };

14 XFbutton bimg2 { x=350; y=500; width= 100; height = 30;

15 label="Image 2";

16 background="white"; foreground="black";

17 };

18 XFbutton bQuit { x=620; y=500; width= 50; height = 30;

19 background="white"; foreground="black"; label="Quit";

20 fontRequest={"Helvetica", 12,{"bold","italic"}, "roman"};

21 };

22

23 handle hImage;

24 upon Construct

25 {

26 bimg1.Pressed = { 'Img1, self};

27 bimg2.Pressed = { 'Img2, self};

28 bQuit.Pressed = { 'Quit, self};

29 hImage = NULL;

30 }

31 on Img1

32 {

33 if (hImage != NULL) { delete hImage; }

34 hImage = new {'Construct, { "MEimage",

35 { "MAfile", "bigcat.gif"@"Examples" }}} =>

36 MMimage;

37 {"PresentAt", &visual, 0, 0} => hImage;

38 }

39 on Img2

40 {

41 if (hImage != NULL) { delete hImage; }

42 hImage = new {'Construct, { "MEimage",

43 { "MAfile", "dragon.gif"@"Examples" }}}

44 => MMimage;

45 {"PresentAt", &visual, 0, 0} => hImage;

46 }

47 on Quit

48 {

49 delete hImage;

50 'Exit => theApp;

51 }

52 }top {x=20; y=20; width=680; height=540; background='SlateBlue;};

6.3.8 MMdigitalAudio

Any type of digital audio, supported file formats include WAV, Sun au, and .SND. MMdigitalAudio is derived from the abstract classes MMbase, MMtemporal, and MMaudioControl. All base class methods and activities are supported.

Superclasses

Section 6.3.1, "MMbase - Abstract" page 173

Section 6.3.3, "MMtemporal - Abstract" page 176

Section 6.3.4, "MMaudioControl - Abstract" page 180

Methods

upon Construct: list description

Default constructor; Description list should follow this format where <filename> is the name of the data file:

   'Construct {'MEdigitalAudio, {'MAfile, 'filename},
         {'arguments,{'gainA, 1.0}, {'gainB,0.0}}}

on List: returns list

Returns an object descriptor list, which may be used to re-create the object. The returned list is formatted to be used as the list argument to the MMbroker to MakeElement or to the class's Construct method which has a list argument.

on Load: return boolean

Loads the media data and confirms that audio services are connected. Activities triggered: DataReady.

Attributes
MMdigitalAudio Attributes
AttributeTypeDescriptionAccess
namestringsymbolic name associated with the elementCGS
sourcestringaccess path, must be set prior to loadingCGS
masterGainrealsets system output gain for all channelsGS
fileFormat

(only on UNIX)

stringreturns the current file format

when recording is supported it may be set

CGS
outputstringspecifies the local output deviceS
recordbooleanrecord mode CG
inputstring selects input deviceCGS

Activities

None

Example

1 global assets

2 {

3 {'SetLibrary, "Examples", "/usr/lib/Examples"} => self;

4 }

5

6 anonymous: XFtop

7 {

8 XFbutton bimg1 { x=10; y=10;

9 width= 100; height = 30;

10 label="Sound 1";

11 background="black"; foreground="white";

12 };

13

14 XFbutton bimg2 { x=130; y=10;

15 width= 100; height = 30;

16 label="Sound 2";

17 background="black"; foreground="white";

18 };

19

20 XFbutton bQuit { x=300; y=10;

21 width= 50; height = 30;

22 background="black"; foreground="white";

23 label="Quit";

24 fontRequest = {"Helvetica", 12, {"bold",

25 "italic"}, "roman"};

26 };

27

28 handle hAudio;

29

30 upon Construct

31 {

32 bimg1.Pressed = { 'Sound1, self};

33 bimg2.Pressed = { 'Sound2, self};

34 bQuit.Pressed = { 'Quit, self};

35 hAudio = NULL;

36 }

37

38 on Sound1

39 {

40 if (hAudio != NULL) { delete hAudio; }

41 hAudio = new {'Construct, {'MEdigitalAudio,

42 { 'MAfile,

43 "Violin_Concerto_in_E_Major.au"@"audioDir"},

44 { 'arguments, {'gainA, 1.0}}

45 }} => MMdigitalAudio;

46 {'PresentVolume, 1.0} => hAudio;

47 }

48 on Sound2

49 {

50 if (hAudio != NULL) { delete hAudio; }

51 hAudio = new {'Construct, {'MEdigitalAudio,

52 { 'MAfile, "wolf-2.au"@"audioDir"},

53 { 'arguments, {'gainA, 1.0}}

54 }} => MMdigitalAudio ;

55 {'PresentVolume, 1.0} => hAudio;

56 }

57 on Quit

58 {

59 delete hAudio;

60 'Exit => theApp;

61 }

62 }top {x=20; y=20; width=360; height=50; background='SlateBlue;};

6.3.9 AVwaveForm

AVwaveForm is a specialized class which visually represents a sound wave form, which may be presented as an image.

Superclasses

Section 6.3.1, "MMbase - Abstract" page 173

Section 6.3.2, "MMvisual - Abstract" page 174

Section 6.3.3, "MMtemporal - Abstract" page 176

Section 6.3.4, "MMaudioControl - Abstract" page 180

Section 6.3.7, "MMimage" page 184

Section 6.3.8, "MMdigitalAudio" page 187

Methods

on SetRecord: handle hAudioPresID, integer rate, integer mseconds return handle

Initializes the audio stream.The audio PresentationId defines the audio stream to be recorded. The frequency is set. Returns an audio presentationID.

on Process: handle hAudioPresID

Begins the recording process. Audio stream, duration and frequency are set within the presentation ID.

on MakeFreqImage: handle hAudioPresID, integer width, integer height return handle

If the Process method has not been called it is started, after Process complets the recorded audio is converted into an image.Sound represented as a frequency graphic of given width and height. Handle returned is a MMimage.

on MakeWaveImage: handle hAudioPresID, integer width, integer height return handle

If the Process method has not been called it is started, after Process complets the recorded audio is converted into an image. Sound represented as an amplitude wave of given width and height. Handle returned is an MMimage.

on BlankProcess: handle hAudioPresID

Calls Process, but no image is produced.

Attributes
AVwaveForm Attributes
AttributeTypeDescriptionAccess
numberToSumintegerdefault valueCSG
xJumpintegersets the height of wave to be represented visuallyCSG
freqJumpintegersets the width of wave to be represented visuallyCSG
minConsecutiveintegersets the minimum consecutive points to be represented as a smooth curveCSG
tooCloseintegerx value of height too small to be registered visuallyCSG
yTooCloseintegery value of width too small to be registered visuallyCSG
minVolintegerthe minimum volume of sound to be registered visuallyCSG

Activities

None

Example

None

6.3.10 MMmovie

MMmovie provides the interface to all animated visual elements. If a movie element does not support audio, the audio methods perform no functions.

Superclasses

Section 6.3.1, "MMbase - Abstract" page 173

Section 6.3.2, "MMvisual - Abstract" page 174

Section 6.3.3, "MMtemporal - Abstract" page 176

Section 6.3.4, "MMaudioControl - Abstract" page 180

Section 6.3.7, "MMimage" page 184

Section 6.3.8, "MMdigitalAudio" page 187

Methods

upon Construct: list description

Default constructor. Requires access descriptor to image. Description should be of the form {<type>, {'MAfile, <filename>}}, where <type> is the type of the movie (one of: 'MEmpeg, 'MEavi, 'MEjpeg, 'MEfli, 'MEqt or 'MEmovie to auto-detect), and <filename> is the name of the image file. The following is an example of a construction for an MMmovie:

'Construct, {'MEanim, {'arguments, {'gain, 0.3}}, {'MAfile, "claylzrd.avi"}}
on List: return list

Returns an object descriptor list, which may be used to re-create the object. The returned list is formatted to be used as the list argument to the MMbroker to MakeElement or to the class's Construct method which has a list argument.

on Load: return integer

Loads the image into memory; returns zero on success.

Attributes

None

Activities

None

Example

1 global assets

2 {

3 {'SetLibrary, "Examples", "/usr/lib/Examples"} => self;

4 }

5 anonymous: XFtop

6

7 {

8 XFvisual visual { x=10; y=10;

9 width = 640; height = 480;

10 background="black";

11 };

12

13 XFbutton bStart { x=200; y=500;

14 width= 50; height = 30;

15 label="Start";

16 background="white"; foreground="black";

17 };

18

19 XFbutton bQuit { x=620; y=500;

20 width= 50; height = 30;

21 background="white"; foreground="black";

22 label="Quit";

23 fontRequest = {"Helvetica", 12, {"bold","italic"}, "roman"};

24 };

25

26 handle hMovie;

27

28 upon Construct

29 {

30 bStart.Pressed = { 'Start, self};

31 bQuit.Pressed = { 'Quit, self};

32 hMovie = NULL;

33 }

34

35 on Init

36 {

37 hMovie = new {'Construct, { "MEanim", {"arguments", {"gain", 0.3}},

38 { "MAfile", "claylzrd.avi"@"movieDir" }}} =>

39 MMmovie;

40 }

41

42 on Start

43 {

44 {"PresentAt", &visual, 0, 0} => hMovie;

45 }

46

47 on Quit

48 {

49 delete hMovie;

50 'Exit => theApp;

51 }

52 }top {x=20; y=20; width=680; height=540; background='SlateBlue;};

6.3.11 MMvidDiscPlayer (only on UNIX)

MMvidDiscPlayer is a class that controls a generic video disc device. While some of its methods are similar to those of MMmovie, the class is not a media element but a device controller.

The media class model expects that devices are managed by the media elements requesting their services. The player was made available to ADL mainly for testing and to allow run time specification of configuration information via the asset manager.

Note: The video disc player does not display the video, but only makes the analog signal available. The media element MEvideo provides an interface to show a 'live video stream' the
MEvideo class is represented in the ADL as a type of MMimage since there is no control of the video stream but only its placement and mapping.

Superclasses

Section 6.3.1, "MMbase - Abstract" page 173

Section 6.3.2, "MMvisual - Abstract" page 174

Section 6.3.4, "MMaudioControl - Abstract" page 180

Methods

upon Construct: list objectdescriptor

Constructs the MMvidDiscPlayer object from an object descriptor list. For the video player, this requires device type information, serial line specification and configuration, and an optional video disc specification.

on List: returns list

Returns an video disc object descriptor list, which may be used to re-create the object. The returned list is formatted to be used as the list argument to the MMbroker to MakeElement or to the class's Construct method which has a list argument. The following is an example:

list objectList = 
{'MEvidDiscSeq, 
  {'arguments,{'start, 12345},{'end, 14500},{'gainA,1.0},{'gainB,0.0}},
  {'MAvidDiscVol, {'arguments,{'volName,'Louvre_2}}}
};
on Load

If a disc is in the drive, it spins up the drive and positions the head to frame 1.

on Unload

Spins down the drive and, if supported, ejects the video disc.

on Mount

Unmounts any current disc, if it is not busy, loads the current disc, and updates the
videoDiscAgents volume list.

on Unmount

Removes the disc from the videoDiscAgent's volume table.

on PlaySeq: integer position1, integer position2, real rate

Plays the disc from position1 to position2, at a frame rate calculated based on the default rate (30 PPS). Depending on the state of video, audio1 & audio2 each analog signal may be output.

on Pause: time duration

Stops the disc and ignores duration.

on Scan: integer speed

on Seek: integer offset, integer relativeTo

on Step: integer size

on Stop

Attributes
MMvidDiscPlayer Attributes
AttributeTypeDescriptionAccess
positionanySet: integer, real or UTtime Get: integerSG
PPSintegercurrent Positions per Second, native media frameSG
ratereal SG
videoboolean video output enabledCSG
audio1booleanaudio 1 output on/offCSG
audio2booleanaudio 2 output on/offCSG
indexbooleanframe index displayed on video CSG

Activities

Note: These activities are normally only reported to the media element which may broadcast a notify event.
MMvidDiscPlayer Activities
ActivityKeysDescription
DataReadyloaded
RateChange disc current speedchanged
Start special rate change
Stop special rate change
AudioAChanged channel's state changed
AudioBChanged channel's state changed

Example

None

6.3.12 MMhtml

An HTML media object.

Superclasses

Section 6.3.1, "MMbase - Abstract" page 173

Methods

upon Construct: list description

Default constructor. Description is of the form {'MEhtml, {'MAfile, <filename>}} or {'MEhtml, {'URL, <url>}}, where <filename> is the name of the HTML file and <url> is the URL address of the HTML document.

upon ConstructFromString: string text (only on UNIX)

Constructs an HTML object using the given text.

upon ConstructFromStream: handle hStream (only on UNIX)

Constructs an HTML object using the data extracted from hStream. As of the current release, hStream must be a handle to an instance of an IOwebStream subclass.

on Load: return integer

Loads the HTML document into memory; returns zero on success.

on Unload: return boolean

Unloads the HTML document from memory; returns TRUE on success.

on AddSink: handle hSink

Adds a sink on which the HTML document should be displayed; hSink should be a handle to an XFhtml or a subclass thereof.

on RemoveSink: handle hSink

Stops displaying the HTML document on a sink.

on Show

Displays the HTML document on whichever sinks have been added using AddSink.

on Hide

Stops displaying the HTML document on all sinks.

on GoToAnchor: string anchor_name return boolean

Displays the part of the HTML document referenced by anchor_name at the top of the HTML display surface; returns TRUE on success.

on GetHTMLSrc: return string

Returns the HTML document as an HTML formatted string. Please note that the HTML document must be loaded before this method is called, otherwise an empty string is returned.

on GetURL: return string

Returns the URL address of this HTML document. If this HTML document contains a BASE tag with an HREF attribute value, this method returns the URL contained in the BASE tag.

on GetTitle: return string

Returns the title for this HTML document; if there is no title, this method returns an empty string.

Attributes

None

Activities

None

Example

1 uses "nro.adl"@"StdLib";

2 anonymous: XFtop

3 {

4 handle hdoc = NULL;

5 XFhtml hyper

6 {

7 width = 700; height=650;

8 borderColor = "SlateGray";

9 borderWidth = 2;

10 }

11 upon Construct

12 {

13 handle h = &hyper;

14 width = 700;

15 height = 650;

16 background = "gray";

17 {'Set_Current, "http:///test-map.html"} => self;

18 }

19 on Init

20 {

21 {'Subscribe, new {'Create, 'AnchorPressed, self,

22 'AnchorSelected, {}} => nro} => hyper;

23 {'Subscribe, new {'Create, 'ImageMapPressed, self,

24 'MapSelected, {}} => nro} => hyper;

25 }

26 //--------------------------------------------------------------

27 //Given a new href, get the corresponding html text from

28 //the array, and display it in the XFhtml

29 //--------------------------------------------------------------

30 on Set_Current: string newCurrent

31 {

32 if (! (hdoc == NULL))

33 {

34 delete hdoc;

35 }

36 hdoc=new {'Construct, {'MEhtml, {'URL, newCurrent}}} => MMhtml;

37 {'AddSink, &hyper} => hdoc;

38 'Show => hdoc;

39 }

40 //-------------------------------------------------------------

41 //AnchorPressed activity handler

42 //--------------------------------------------------------------

43 on AnchorSelected: list clientData, list keys, list values

44 {

45 nro mynro;

46 string hRef = {'Lookup, 'href, keys, values} => mynro;

47 string refText = {'Lookup, 'text, keys, values} => mynro;

48 string anchor_name={'Lookup,'anchor_name,keys,values}=> mynro;

49

50 echo ("\nAnchorPressed Activity invoked!!!\n");

51 echo ("anchor_name is " + anchor_name + "\n");

52 echo ("href is " + hRef + "\n");

53 echo ("reftext is " + refText + "\n");

54 if (anchor_name == "quit")

55 { echo ("Good-Bye.\n");

56 'Exit => theApp;

57 }

58 }

59 //--------------------------------------------------------------

60 //ImageMapPressed activity handler

61 //--------------------------------------------------------------

62 on MapSelected: list clientData, list keys, list values

63 {

64 nro mynro;

65 string image_src={'Lookup, 'image_src, keys, values }=> mynro;

66 string anchor_name={'Lookup,'anchor_name,keys,values}=> mynro;

67 string hRef = {'Lookup, 'href, keys, values} => mynro;

68 string refText = {'Lookup, 'text, keys, values} => mynro;

69 integer x = {'Lookup, 'x, keys, values } => mynro;

70 integer y = {'Lookup, 'y, keys, values } => mynro;

71 echo ("\nImageMapPressed activity invoked!!!\n");

72 echo ("image_src is " + image_src + "\n");

73 echo ("x is " + toString (x) + "\n");

74 echo ("y is " + toString (y) + "\n");

75 echo ("anchor_name is " + anchor_name + "\n");

76 echo ("href is " + hRef + "\n");

77 echo ("reftext is " + refText + "\n");

78 }

79 } top


[15] The newer PresentID, RegisterID and RemoveID methods should be used instead of "on AddSink: handle hXFvisual return handle presentationID" (where image is placed at 0.0, no clipping) and "on RemoveSink: handle hXFvisual" (stops the XFvisual from displaying all presentations of the image, if clearMode is TRUE the image is cleared). While these older methods remain available to older applications, it is highly recommended that the newer and more powerful methods be used whenever possible.
Figure 6.31: - Multimedia Wrapped Classes Inheritance Tree
6.3.1 - MMbase - Abstract
Superclasses
Methods
Attributes
Activities
Example
6.3.2 - MMvisual - Abstract
Superclasses
Methods
Attributes
Activities
Example
6.3.3 - MMtemporal - Abstract
Superclasses
Methods
Attributes
Activities
6.3.4 - MMaudioControl - Abstract
Superclasses
Methods
Attributes
Activities
Example
6.3.5 - MMbroker
Superclasses
Methods
Attributes
Activities
Example
6.3.6 - MMcolor
Superclasses
Methods
Attributes
Activities
Example
6.3.7 - MMimage
Superclasses
Methods
Attributes
Activities
Example
6.3.8 - MMdigitalAudio
Superclasses
Methods
Attributes
Activities
Example
6.3.9 - AVwaveForm
Superclasses
Methods
Attributes
Activities
Example
6.3.10 - MMmovie
Superclasses
Methods
Attributes
Activities
Example
6.3.11 - MMvidDiscPlayer (only on UNIX)
Superclasses
Methods
Attributes
Activities
Example
6.3.12 - MMhtml
Superclasses
Methods
Attributes
Activities
Example

AM2 Documentation - 19 NOV 1996

Generated with Harlequin WebMaker