| HTINews Article - Apr98 - [HTI Home Page] |
Read All About It News Announcements - Updated Hourly [Click Message To Learn More] |
"From a home automation perspective MediaCenter is a great way to get started because you dont need a lot of fancy, expensive equipment to use it. If you have a PC with a sound card and a modem (odds are that you do, since youre reading this) then you have all the equipment you need." |
When he is
not debugging the voicemail system at his house, Jonathan Somers is either enjoying a
quiet life with his wife Jan and their |
In the Domisilica research group at Georgia Tech, one of our challenges is finding ways in which students can explore home automation when "home" is little more than a dorm room. When the lighting, climate control, and security are completely out of your hands, what can you do?
It turns out that you can do some of the most interesting applications in this limited space. We created the MediaCenter for exactly this purpose. MediaCenter is a simple application that combines a CD player, a wave player, and a speech synthesizer. There are no fancy features in these three components; most commercial programs offer much greater functionality. What MediaCenter offers is programmability. You dont like the way it behaves? Get inside and write some code to change its behavior. With a few simple lines of Visual Basic or Visual C++, or just about any programming tool you choose you can tailor the MediaCenter to suit your own tastes.
From a home automation perspective MediaCenter is a great way to get started because you dont need a lot of fancy, expensive equipment to use it. If you have a PC with a sound card and a modem (odds are that you do, since youre reading this) then you have all the equipment you need. This is the appeal in the student population, because while students at Tech dont have fancy houses, they are all required to own computers. Once you get your feet wet, youll be thinking of new ways you can use your PC by adding just one or two little components at a time. Before you know it, youll have an automated home making your neighbors green with envy.
About the application
If you do not already have the Microsoft runtime libraries on your machine, MediaCenter will complain and tell you exactly what is missing. You can download these from my site as well, at www.mindspring.com/~jons/downloads/mfc.zip. These need to be unZipped into one of two places: the directory where MediaCenter lives (okay) or your windows\system directory (much better for sharing amongst one and all). MediaCenter is a Win32 program and, as such, requires Windows 95. It should work on 98 and Windows NT as well, since I dont use any OS-specific features but I havent tried it. If you do and you encounter problems, let me know Ill try to put it straight for you.

As mentioned, MediaCenter is a three-part application. The top third of the window is devoted to a CD player. The CD lacks some of the more esoteric features like shuffle play or named tracks, but it gives you the basic functions everyone needs: play, pause, track forward and reverse. I sometimes get frustrated with the track reverse button on most other CD players, so I changed the behavior slightly in MediaCenter. If you are within the first few seconds of the beginning of a track, the track-reverse button still takes you to the previous track. Once you are well within a track, track reverse takes you to the beginning of the current track. A small detail, perhaps, but very convenient.
MediaCenter does offer a disc loop. Most people will use it for music playback, but we also wanted to experiment with ambient sonic environments. The disc loop lets us play endless rounds of ocean waves, rainforests, and other ambient sounds. More on this in a moment.
The center third of the display represents the wave player. MediaCenter lets you browse and play any Windows .WAV file. Again there is a loop capability, so that long wave files can be played endlessly. Wave files can be used several different ways in home automation. They can be used to replace conventional sounds in the domicile; for example, you can turn off the ringers in your real telephones and watch your modems ring-indicate signal to play a custom phone "bell" file (which you can change with your mood, the time of day, or whatever). Furthermore, wave files can be used to signal interesting events such as the arrival of email or the presence of virtual visitors. This last application is very useful when combined with ambient CDs; I will discuss this in the programming section.
The lower third of the display is a speech synthesizer interface. If present, MediaCenter will make use of the Monologue for Windows speech synthesizer, which shipped with the original generation of Sound Blaster 16s. This lets us substitute generated speech for audio icons when an interruption is required. If you have more current hardware, and if you are willing to register your copy of MediaCenter, you can get an enhanced version which also supports the TextAssist voice synthesizer shipping with today's Sound Blasters.
A few words about OLE Automation
My house is automated with a number of Windows programs Ive written. All of them support external programming via Microsofts OLE technology (in one form or another). The simplest form of program control is OLE Automation, which is what MediaCenter uses making it an ideal first project for your custom home automation programming.
A note on case: It is very inconvenient for us home automators that Microsoft has chosen the name "OLE Automation" for it's programming control technology. Microsofts marketing geniuses love to change names just to make yesterdays tools sound like the latest gee-whiz feature; we used to deal with OCX controls, which then became OLE controls, which then became ActiveX controls Unfortunately for us, OLE Automation missed out on this fad and still goes by its original name. So, now and henceforth, if I use the lower-case "automation", Im referring to the craft of controlling ones home. If I capitalize it to "Automation", Im referring to OLE Automation.
Basically, OLE Automation is a means through which one program can "drive" another. Depending on how the driven program (the Automation "server") is written, the driving program (the Automation "container") may be able to press every button, choose every menu, and operate every control it pleases.
The nice thing about OLE Automation is that many, many tools can use it. You can use Visual Basic, Visual C++, and most any other Win32 programming language. (C++ programmers will need to create a proxy class from a Type Library file - the .TLB file I provided in the original ZIP. VB folks can ignore it, however.) You can also use the scripting language in many commercial programs. For the sample program I describe in this article, Ill use VB; in future articles I will use other tools.
MediaCenter lends itself to Automation because it is simply taking dictation. It has a very simple server interface that lets you "press its buttons" from other applications. Other types of programs, such as X-10 controllers, may not be great choices for OLE Automation; a controlling program may want to get notifications of interesting events which originate from the controlled program (such as an incoming X-10 command from a controller elsewhere in the house). ActiveX controls support this functionality, and well talk about them in upcoming articles.
Programming the MediaCenter
By itself, MediaCenter is an unremarkable program. Its main virtue is its ability to be controlled by other programs. Ive already mentioned one possible application: replacing your telephone ringers. You can change wave files based on time of day or the mood youre in. The time of day feature is a nice way to get a feature usually present only in homes with expensive PBXs: automatic night mode, so you wont be disturbed while youre asleep. If your modem supports Caller*ID, or if you have a Caller*ID box with an RS-232 output, you can have the voice synthesizer announce who is calling. If you have an X-10 TW523 controller on your PC and you put a dry contact sensor on your doorbell, you can play various .WAV files for your doorbell (again based on your mood or on the time of day). And so on.
The reason for adding .WAV support is to superimpose sonic icons onto an ambient environment. If MediaCenter is playing an ocean waves CD, for example, and an email arrives, you can program MediaCenter to announce the incoming email with the wave file for a foghorn. If youre not paying close attention, the foghorn blends directly into the overall ocean soundscape. Normal priority emails could produce foghorn "icons" while a high-priority email could trigger speech announcing the sender and subject. You could also write filters to signal the arrival of messages from certain individuals (perhaps those in your address book) with a spoken announcement. The distinction between awareness and attention is useful when trying to reduce the number of interruptions in our daily lives.
Lets walk through a very simple application program that always gets the "wows" from guests: pausing the CD player whenever the phone rings. Just a dozen or so lines of VB code is all it takes. Im no VB whiz, but I whipped up this sample application using VB 5.0 in a few hours and you should be able to duplicate it in a lot less, since Ive already made the mistakes for you. If youre using a different version of VB, MediaCenter should still work, but you may need to follow a different sequence of steps to get there.
Private
Sub Modem_OnComm()
Select Case Modem.CommEvent
Case
comEvReceive ' Received RThreshold # of chars
Instring =
Modem.Input
If InStr(Instring, "RING") >
0 Then
MsgBox
("RING")
End If
End Select
End Sub
Wrap-up
Its true that MediaCenter alone is a very uninteresting application. I view it as a valuable springboard. Folks who are just getting started in programming can find life very difficult and not particularly rewarding. Tools like MediaCenter let you get very fast results and some well-deserved gratification. More importantly, they let you work towards the dream automation system that does everything you want it to do.
I havent closed the book on MediaCenter. It is a constantly evolving program. Do you find that it still doesnt do exactly what you like? Drop me an email at jons@mindspring.com and let me know. You may find that badly-needed feature in the next release, and if your request is a new and useful one, you may just wind up with a registered copy at no charge. If you come up with a really interesting use, email me and let me know Id love to describe it on my Web site, and if you want to share your code with others, Im happy to add a pointer to your files as well.
What if what you really want to do is control real CD players or radio tuners, televisions, VCRs, and so on? Take heart. I was in the same boat once upon a time, and so I wrote an infrared remote application which you can also program via OLE automation. Thats my topic for the next issue.
© 1996 - 2008, Home Toys Inc. - All Rights Reserved
Powered by LJB Management Inc.