示例#1
0
文件: TreeView.c 项目: Bremma/pinmame
void CreateSoundFolders(int parent_index)
{
	int i,jj;
	int nGames = GetNumGames();
	int nFolder = numFolders;
	LPTREEFOLDER lpFolder = treeFolders[parent_index];
	LPTREEFOLDER map[SOUND_COUNT];

	// no games in top level folder
	SetAllBits(lpFolder->m_lpGameBits,FALSE);

	for (i=1;i<SOUND_COUNT;i++)
	{
		// Defined in sndintrf.c
		struct snd_interface
		{
			unsigned sound_num;										/* ID */
			const char *name;										/* description */
			int (*chips_num)(const struct MachineSound *msound);	/* returns number of chips if applicable */
			int (*chips_clock)(const struct MachineSound *msound);	/* returns chips clock if applicable */
			int (*start)(const struct MachineSound *msound);		/* starts sound emulation */
			void (*stop)(void);										/* stops sound emulation */
			void (*update)(void);									/* updates emulation once per frame if necessary */
			void (*reset)(void);									/* resets sound emulation */
		};
		extern struct snd_interface sndintf[];

		LPTREEFOLDER lpTemp;

		for (jj = 1; jj < i; jj++)
			if (!strcmp(soundtype_name(i), soundtype_name(jj)))
				break;

		if (i != jj)
		{
			map[i] = map[jj];
			continue;
		}

		lpTemp = NewFolder(sndintf[i].name, next_folder_id++, parent_index, IDI_CPU,
						   GetFolderFlags(numFolders));
		AddFolder(lpTemp);
		map[i] = treeFolders[nFolder++];
	}

	for (jj = 0; jj < nGames; jj++)
	{
		int n;
		struct InternalMachineDriver drv;
		expand_machine_driver(drivers[jj]->drv,&drv);
		
		for (n = 0; n < MAX_SOUND; n++)
			if (drv.sound[n].sound_type != SOUND_DUMMY)
			{
				// sound type #'s are one-based
				AddGame(map[drv.sound[n].sound_type],jj);
			}
	}
}
示例#2
0
const char *sound_name(const struct MachineSound *msound)
{
	return soundtype_name(msound->sound_type);
}