For playing the CD, we use the REXX multimedia support currently supplied with OS/2. We want to "wrap" the support with REXX methods so that we can take advantage of REXX concurrency support.
The wrapping involves four methods: INIT, UNKNOWN, MCIRXSENDSTRING, and FREE. The INIT method initializes the REXX multimedia support and opens whatever device is passed to it. CDNOTES will pass `cdaudio' to it so that the audio CD device is opened.
FREE is a class method. We'll use it at the end of CDNOTES to free the multimedia resources.
The most interesting method is UNKNOWN. UNKNOWN is like an "otherwise" clause for a class. If you send an object a message and there isn't a method by that name, the UNKNOWN method is invoked.
In the CDNOTES "play and display" file, we'll be using the MCI string verbs STATUS, SET, PLAY, and CLOSE for the CD. The MCI string command format for those verbs is symmetrical: verb, followed by items, followed by 'WAIT' (required for REXX). We haven't defined these verbs as methods of our Multimedia class. So if we send these verbs as messages to an instance of our Multimedia class, the UNKNOWN method will be invoked.
When REXX invokes the UNKNOWN method, it passes the name of the method as the first argument, and any arguments that were specified as the second argument. This second argument is an array of arguments. Our UNKNOWN method builds an MCI command string from the arguments and then uses the MCIRXSENDSTRING method to process the string.
The MCIRXSENDSTRING method calls the mciRxSendString function and returns RETSTR to the caller.