[ Previous | Next | Contents | Glossary | Home | Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference

UMSAudioFileMClass Class

The UMSAudioFileMClass class is a metaclass. It defines the class methods for children of the UMSAudioFile base class. In particular, UMSAudioFileMClass specifies creation methods for UMSAudioFile objects.

The metaclass provides a method to construct a specific audio file based on data in the configuration file and either an application supplied alias or a pathname to a file with audio data. This allows an application to be ported to a new type of audio file by adding information in the configuration file. This is the preferred construction technique for applications.

To learn more about the UMSAudioFileMClass class, see:

For introductory information, see MetaClass Objects.

Enumeration Lists

To avoid name collision on defines, integer values have been captured as enumeration lists. The set of valid values from an enumerated list can vary with the application. The detailed method descriptions describe the valid or possible values for the specific use. The enumerated lists that are defined for this object are listed as follows:

enum ReturnCode {
   Success, 
   Failure, 
   FatalUMSError, 
   NoConfigObject,
   AliasNotFound, 
   PropertyNotFound,
   InvalidClassName,
   NotAChild, 
   UnsupportedFormat,
   FilePermissions,
   FileNotFound
    };

Method Descriptions

UMSAudioFile make_by_pathname(in string pathname, inout ErrorCode error, out string error_string, out string audio_file_alias)

Description

This method returns an instantiated child of the UMSAudioFile class that is capable of processing the file indicated by the pathname. The child returned depends upon interaction with a UMSConfig object.

Arguments
in string pathname Specifies the pathname of the file that the instantiated UMSAudioFile object is required to process.
inout ErrorCode error Provides success or reason for failure. If a failure occurred, a null pointer is returned instead of an instantiated object.
out string error_string If an error occurred, this string contains detailed information about the point of failure.
out string audio_file_alias This is the alias in the configuration file for the particular object returned. This allows applications to determine detailed information about the particular UMSAudioFile class returned from the configuration file stanza.
Error Codes

For certain Error Codes, more specific information can be obtained from the error_string parameter.

Error Code error_string
FileNotFound The specified file does not exist.

UMSAudioFile make_by_alias(in string alias, inout ErrorCode error, out string error_string)

Description

This method returns an instantiated child of the UMSAudioFile class as determined by the alias parameter. The child returned depends upon interaction with a UMSConfig object.

Arguments
in string alias Specifies the alias to seek using the UMSConfig object.
inout ErrorCode error Provides success or reason for failure. If a failure occurred, a null pointer is returned instead of an instantiated object.
out string error_string If an error occurred, this string contains more detailed information about the point of failure.
Error Codes

For certain Error Codes, more specific information can be obtained from the error_string parameter.

Error Code error_string
Failure Name of the class that failed to be created.
AliasNotFound Alias that could not be found by the UMSConfig object.
PropertyNotFound Property that could not be found by the UMSConfig object.
InvalidClassName Name of the class that could not be found by the SOM runtime.
NotAChild Name of the class that is not a child of the UMSAudioFile base class.

UMSAudioFileMClass Usage

The AudioFileMClass methods use the configuration file to determine that particular subclass of the AudioFile class to instantiate. The make_by_pathname method first uses the FiletypeDetector object and the Detector.audio stanza to run a series of detectors on the file indicated by the pathname parameter. This process yields a file_type_alias.

Once the AudioFileMClass class has a file_type_alias (whether through the FiletypeDetector or through direct invocation of the make_by_alias method), it uses the Config object to look up that particular AudioFile subclass to instantiate.

detector.audio:
        detection_module         "d_WAVE"
        file_type_alias          "WAVE"
*NEXT:
        detection_module         "d_SND"
        file_type_alias          "SND"
*NEXT:
        detection_module         "d_RAW"
        file_type_alias          "RAW"
WAVE:
        CLASS_UMSAudioFile       "UMSWavFile"
        audio_formats_alias      "UMSAudioFormats"

For introductory information, see MetaClass Objects.


[ Previous | Next | Contents | Glossary | Home | Search ]