[directmusic] Re: IDirectMusicPort8::Activate failed with E_FAIL

  • From: Abhijit Patait <abhijit_patait@xxxxxxxxx>
  • To: directmusic@xxxxxxxxxxxxx
  • Date: Mon, 12 Jul 2004 22:48:03 -0700 (PDT)

Here is the code under question:
// Selects the given port for MIDI input. portinf is the DMUS_PORTCAPS 
structure for the desired MIDI input port, obtained via 
IDirectMusic8::EnumPort(...) with class DMUS_PC_INPUTCLASS

HRESULT CSMAudio::SelectInputPort(DMUS_PORTCAPS portinf)
{
 HRESULT hr;
 DMUS_PORTPARAMS8 dmus;
 IDirectMusicPort8 *pInputPort = NULL;

 ZeroMemory(&dmus, sizeof(DMUS_PORTPARAMS8));
 
 // Set the params for this port
 dmus.dwSize = sizeof(DMUS_PORTPARAMS8);
 dmus.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS;
 dmus.dwChannelGroups = 1;
    
 // The midi port is created here 
 if (FAILED(hr = m_pDirectMusic8->CreatePort(portinf.guidPort, &dmus, 
&pInputPort, NULL)))
  return DXTRACE_ERR_MSGBOX(TEXT("InputPort->CreatePort"), hr);

 // We have to activate it (fails here)
 if (FAILED(hr = pInputPort->Activate(TRUE)))
  return DXTRACE_ERR_MSGBOX(TEXT("InputPort->Activate"), hr);

 return S_OK;
}

Thanks
Abhijit
 


Abhijit Patait <abhijit_patait@xxxxxxxxx> wrote:
I am trying to activate a MIDI input port created using 
IDirectMusic8::CreatePort(...) method. However, the method Activate(TRUE) is 
returning E_FAIL. The documentation states that the method can return 
DSERR_NODRIVER in case of an error.

I can't seem to understand why it's returning E_FAIL. I think that E_FAIL is a 
general failure code, so this may be a dead end for me.

Any input will be helpful.

Thank you
Abhijit

---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.



                
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!


Other related posts: