Sound Manager Package

Morfik Sound Manager Package


The Morfik Sound Manager package contains two widgets (mfk_SoundManager and mfk_PlayLink) that add the ability to playback audio files to a Morfik web application.

A Quick Walkthrough

To use the Morfik Sound Manager package simply add the package to the project by utilizing the “Used Packages” command on the project ribbon (see Figure 1 Used Packages Command), or simply drag the package file onto the application main client area.

Figure 1: Used Packages Command

Once added two widgets will appear on the home ribbon when the form designer is active (see Figure 2 Widgets List). These widgets can be placed on an application form and provide immediate functionality with minimal coding.

Figure 2: Widgets List

How to Use the Widget

To use mfk_PlayLink widget, you must drop a mfk_SoundManager widget on a form (and you can use only one mfk_SoundManager widget no matter how many mfk_PlayLink widgets you use on the form).

The mfk_PlayLink widget is also a horizontal playback control that combines a label with a start button which can be used to initiate playing a sound file, however the mfk_PlayLink widget does not include a progress indicator. After dropping an mfk_PlayLink widget on a form, you can use the property inspector to configure the widget. You can set the title property for the label that is displayed and the Hyperlink property which points to the sound file to be played. To play a file from the Repository, just enter the name of the file in the Hyperlink field.

The soundManager Object

The mfk_SoundManager module declares a browser global object soundManager that is used by mfk_PlayLink widget. The soundManager object is based upon the SoundManager 2 javascript project that can be found at You can find documentation for the SoundManager 2 object at

Mfk_SoundManager can use Flash for playback but does not require it and does support HTML5 for sound file playback (so it will work on iPad and iPhone) and also supports the following sound compression formats: mp3, mp4, ogg and wav (some support is browser dependent).

The sample code below demonstrates how the soundManager object can be used to playback a sound file without using either mfk_PlayLink widget.

FX Code

    { Private declarations }
    Sound : TSMSound;
Procedure  Form1.btnPlayClick(Event: TDOMEvent);
Var Opts    : TDefaultOptions;
    sURL    : String;
    sURL := ‘MySoundFile.mp3’;
    If (soundManager.canPlayURL(sURL)) Then
        Opts := CreateDefaultOptions(); := 'mySound';
        Opts.url := sURL;
        Opts.Volume := 80;
        Opts."type" := 'audio/mp3';
        Sound := soundManager.createSound(Opts);;
Procedure  Form1.btnStopClick(Event: TDOMEvent);
    If Sound <> nil Then

Notice that the first step is to create a TDefaultOptions object and assign some of the properties (the TDefaultOptions class is defined and commented in the mfk_SoundManager module). The next step is to create a TSMSound object based upon the TDefaultOptions using the global SoundManager object (the TSMSound class is also defined and well commented in the mfk_SoundManager module). The TMSSound object can then be used to playback and otherwise control the sound file.

The properties and methods of the TSoundManager class are well commented in the mfk_SoundManager module.

See Also

Back to top