示例#1
0
CON Music::~Music()
{
	if (this)
	{
		DeletePortList();
		CleanUpMusic();
	}
}
示例#2
0
//////////////////////////////////////////////////////////////////////
//
// Function:    EnumPorts
// Date:		20/10/99
// Author:		Macca
//
//Description:	Enumerate all devices that can be used for music and put
//				them into a list
//
//////////////////////////////////////////////////////////////////////
void Music::EnumPorts()
{
	HRESULT res;
	DWORD PortNum=0; // begin at zero and increment each time a port is successfully found
	DMUS_PORTCAPS caps;
	wchar_t name[DMUS_MAX_DESCRIPTION];
	bool error=false;

	DeletePortList();

	while (!error)
	{
		bool dls,soft,dsound;

		dls=false;
		soft=false;
		dsound=false;

		caps.dwSize=sizeof(DMUS_PORTCAPS);

		res=gpDMusic->EnumPort(PortNum,&caps);

		if (res!=S_OK)
			break;

// check out caps

		if (caps.dwClass==DMUS_PC_OUTPUTCLASS)
		{
			if (caps.dwFlags&DMUS_PC_DLS)
				dls=true;

			if (caps.dwFlags&DMUS_PC_SOFTWARESYNTH)
				soft=true;

			if (caps.dwFlags&DMUS_PC_DIRECTSOUND)
				dsound=true;

// if port has features we need then add it to the selectable list

			if (true)
			{
				LPDMPORTINFO portinfo=new DMPORTINFO;

				WideCharToMultiByte(CP_ACP,
									0,
									caps.wszDescription,
									-1,
									portinfo->device,
									sizeof(portinfo->device)/sizeof(portinfo->device[0]),
									0,
									0);


				portinfo->port=caps.guidPort;
				portinfo->next=PortInfo;
				portinfo->ChannelGroups=caps.dwMaxChannelGroups;
				PortInfo=portinfo;
				portinfo=NULL;
			}
		}

		PortNum++;
	}

// default will be the same as one of the enumerated ports

	AddDefaultPortToList();
}
示例#3
0
CInterfaceBase::~CInterfaceBase()
{
    DeleteGateway();
    DeletePortList();
    DeleteErrorHandling();
}