I'm writing my app in VB first, then when it's tuned, I'll switch it over to C++ but this is faster for me. I got this working in a couple hours after getting the SDK today actually (just shows how damn simple VB is :-)
Here's how you call it ...
' -- Call the entire file name, with extension (MP3 files allowed later)
PlayBackgroundSoundFile("Alert_FrontFoyerLightAction.wav")
Here's what does the work
Sub PlayBackgroundSoundFile(ByVal strFile2Play As String)
' -- Give me the name of the file to be sure of file not found issues debugging
Console.WriteLine("NOTE: Sound file: " + strFile2Play + " about to be played")
' -- Build the string with the exact path to the WAVs directory
strFile2Play = "c:\AHPFiles\wavs\" + strFile2Play
' -- Let the system to the work, no need to call WMPlayer, etc.
My.Computer.Audio.Play(strFile2Play, AudioPlayMode.Background)
End Sub
Now WHERE you put the logic to decide on calling this of course, is another matter. You'll have to test the vParm1 and vParm2 values to see if you are in a condition to play the file. Such as ...
If LCase(vParm1) = "m4" and LCase(vParm2) = "off" Then
ActiveHome_SendCommand("m4 bright 80")
PlayBackgroundSoundFile("Notice_RaisingFamilyLights.wav")
End If
My problem at present is I am getting 3-7 signals on the code for an event. I get so many transmissions, I can't act on each one, not sure but I think the end units are eating up the extra but the computer app wants to deal with each one! Very frustrating ... so this code above, for example, would fire 3 or more times because I am getting many transmissions for a single push of a button as shown in my log below from events.
When I press the M4 off button for example, I get this in my readout ...
ACTION->recvrf CODE->m4 CMD->Off PAR3-> 0 PAR4-> 12/28/2008 9:50:45 AM PAR5->
------------------------------------------------------------------------------
ACTION->recvrf CODE->m4 CMD->Off PAR3-> 0 PAR4-> 12/28/2008 9:50:45 AM PAR5->
------------------------------------------------------------------------------
ACTION->recvrf CODE->m4 CMD->Off PAR3-> -1 PAR4-> 12/28/2008 9:50:45 AM PAR5->
------------------------------------------------------------------------------
ACTION->recvrf CODE->m4 CMD->Off PAR3-> 0 PAR4-> 12/28/2008 9:50:45 AM PAR5->
------------------------------------------------------------------------------
ACTION->recvrf CODE->m4 CMD->Off PAR3-> -1 PAR4-> 12/28/2008 9:50:45 AM PAR5->
------------------------------------------------------------------------------
ACTION->recvrf CODE->m4 CMD->Off PAR3-> -1 PAR4-> 12/28/2008 9:50:46 AM PAR5->
------------------------------------------------------------------------------
ACTION->RecvPlc CODE->m4 CMD->Off PAR3-> PAR4-> PAR5->
------------------------------------------------------------------------------
ACTION->RecvPlc CODE->m4 CMD->Off PAR3-> PAR4-> PAR5->
------------------------------------------------------------------------------
ACTION->RecvPlc CODE->m4 CMD->Off PAR3-> PAR4-> PAR5->
------------------------------------------------------------------------------
I have NO idea why, I have everything unplugged except for my computer and one EE and two modules for wireless keypad and a lamp controller. I guess the receivers eat up the extra codes or something. Let me know if you come across this, I'm trying to find it in a topic somwhere, but no luck!!