Init function snippet (edited):
m_pMJ.Attach((IMJAutomation *) d, TRUE);
// Get a mixer object
m_pMixer = m_pMJ->GetMJMixer();
m_pMixer->PutEQOn(TRUE); // triggers event (except not advised yet)
// Get a playlist object
m_pCurPlayList = m_pMJ->GetCurPlaylist();
UpdateMixerSetting(); // calls GetEQBand
hr = DispEventAdvise(m_pMJ, &DIID_IMJAutomationEvents);
Matching log file (edited):
0012484: 29232: SDK: CMJAutomation::CMJAutomation: Global Count: 4, Main 0, 2a4eae8
QIThunk - 18 AddRef : Object = 0x056662E0 Refcount = 1 CEQdbCtrl - IDispatch
0012484: 29232: SDK: CMJMixerAutomation::CMJMixerAutomation: Global Count: 2
HereHereHereHere
0012484: 29232: SDK: CMJCurPlaylistAutomation::CMJCurPlaylistAutomation: Global Count: 1
0012484: 29232: SDK: CMJMixerAutomation::GetEQBand: Start
0012484: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 0/31(O)
0012484: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 13/27(K)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning -18/37(U)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning -31/41(Y)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning -18/37(U)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 3/30(N)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 13/27(K)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
0012500: 29232: SDK: CMJMixerAutomation::GetEQBand: Finish (0 ms)
QIThunk - 19 AddRef : Object = 0x05666384 Refcount = 1 IDispEventImpl - IMJAutomationEvents
So my Automation pointer is global count 4, my MixerAutomation pointer is global count 2.
The "HereHereHereHere" seems to be emitted by Windows (?) -- it occurs even when MC debug strings are off and it's not in my code.
The PlaylistAutomation is mine, global count 1.
The first GetEQBand calls (from my function UpdateMixerSetting) work as expected ("Rock" preset).
The final QueryInterface Thunk 19 is when I advise the sink (IMJAutomationEvents interface).
So that all appears to be normal.
Next, I click the DSP studio button to bring up the mixer. I get this in my log (normal).
'Media Center 12.exe': Loaded 'C:\Program Files\J River\Media Center 12\Plugins\dsp_MJMain.dll', Binary was not built with debug information.
So then I click the preset to select "Live". Here's the log (edited). Note that a new mixer object (3) was created and the GetEQBand calls in my event handler returned the same as the above calls, which is the "Rock" preset. The DSP studio has, in fact, changed to the "Live" preset. I suspect Mixer object #2 has the right settings.
Also note the "HereHereHereHere" again which seems to be associated with the new MixerAutomation object.
1158297: 29232: SDK: CMJMixerAutomation::CMJMixerAutomation: Global Count: 3
HereHereHereHere
EQdbCtrl::MJEvent(MJEvent type: MCCommand, MCC: NOTIFY_EQ_CHANGED, -1)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Start
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 0/31(O)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 13/27(K)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning -18/37(U)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning -31/41(Y)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning -18/37(U)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 3/30(N)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 13/27(K)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Returning 39/19(C)
1158312: 29232: SDK: CMJMixerAutomation::GetEQBand: Finish (0 ms)
1158312: 29232: SDK: CMJMixerAutomation::OnFinalRelease: All objects released
1158312: 29232: SDK: CMJMixerAutomation::~CMJMixerAutomation: Global Count: 2
'Media Center 12.exe': Unloaded 'C:\WINDOWS\system32\cewmdm.dll'
My event handler that goes with the above log looks like this (edited):
BEGIN_SINK_MAP(CEQdbCtrl)
SINK_ENTRY_EX(1, DIID_IMJAutomationEvents, 1, MJEvent)
END_SINK_MAP()
STDMETHODIMP_(void) CEQdbCtrl::MJEvent(LPCTSTR strType, LPCTSTR strParam1, LPCTSTR strParam2)
{
log << "EQdbCtrl::MJEvent(" << strType << ", " << strParam1 << ", " << strParam2 << ")" << endl;
CString e = strParam1;
if(e.CompareNoCase(_T("MCC: NOTIFY_EQ_CHANGED")) == 0)
UpdateMixerSetting();
}