当前位置: 首页>>代码示例>>C++>>正文


C++ MusicDevices类代码示例

本文整理汇总了C++中MusicDevices的典型用法代码示例。如果您正苦于以下问题:C++ MusicDevices类的具体用法?C++ MusicDevices怎么用?C++ MusicDevices使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MusicDevices类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getDevices

MusicDevices AlsaMusicPlugin::getDevices() const {
	MusicDevices devices;
	AlsaDevices::iterator d;

	AlsaDevices alsaDevices = getAlsaDevices();

	// Since the default behavior is to use the first device in the list,
	// try to put something sensible there. We used to have 17:0 and 65:0
	// as defaults.

	for (d = alsaDevices.begin(); d != alsaDevices.end();) {
		const int client = d->getClient();

		if (client == 17 || client == 65) {
			devices.push_back(MusicDevice(this, d->getName(), d->getType()));
			d = alsaDevices.erase(d);
		} else {
			++d;
		}
	}

	// 128:0 is probably TiMidity, or something like that, so that's
	// probably a good second choice.

	for (d = alsaDevices.begin(); d != alsaDevices.end();) {
		if (d->getClient() == 128) {
			devices.push_back(MusicDevice(this, d->getName(), d->getType()));
			d = alsaDevices.erase(d);
		} else {
			++d;
		}
	}

	// Add the remaining devices in the order they were found.

	for (d = alsaDevices.begin(); d != alsaDevices.end(); ++d)
		devices.push_back(MusicDevice(this, d->getName(), d->getType()));

	return devices;
}
开发者ID:Akz-,项目名称:residual,代码行数:40,代码来源:alsa.cpp

示例2: getDeviceString

Common::String MidiDriver::getDeviceString(DeviceHandle handle, DeviceStringType type) {
	if (handle) {
		const MusicPlugin::List p = MusicMan.getPlugins();
		for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); m++) {
			MusicDevices i = (**m)->getDevices();
			for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
				if (handle == d->getHandle()) {
					if (type == kDriverName)
						return d->getMusicDriverName();
					else if (type == kDriverId)
						return d->getMusicDriverId();
					else if (type == kDeviceId)
						return d->getCompleteId();
					else
						return Common::String("auto");
				}
			}
		}
	}

	return Common::String("auto");
}
开发者ID:tiqpit,项目名称:scummvm,代码行数:22,代码来源:mididrv.cpp

示例3: getDeviceHandle


//.........这里部分代码省略.........
			if (type != MT_NULL) {
				if (type == MT_INVALID) {
					// If the preferred (expressly requested) selected driver or device cannot be found (no longer compiled in, turned off, etc.)
					// we display a warning and continue. Don't warn about the missing device if we did already (this becomes relevant if the
					// missing device is selected as preferred device and also as GM or MT-32 device).
					if (failedDevStr != devStr) {
						Common::String warningMsg = Common::String::format(_("The preferred audio device '%s' was not found (e.g. might be turned off or disconnected)."), devStr.c_str()) + " " + _("Attempting to fall back to the next available device...");
						GUI::MessageDialog dialog(warningMsg);
						dialog.runModal();
					}
				} else if (type != MT_AUTO) {
					if (checkDevice(hdl)) {
						if (flags & MDT_PREFER_MT32)
							// If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h).
							_forceTypeMT32 = true;
						return hdl;
					} else {
						// If the preferred (expressly requested) device cannot be used we display a warning and continue.
						// Don't warn about the failing device if we did already (this becomes relevant if the failing
						// device is selected as preferred device and also as GM or MT-32 device).
						if (failedDevStr != getDeviceString(hdl, MidiDriver::kDeviceName)) {
							Common::String warningMsg = Common::String::format(_("The preferred audio device '%s' cannot be used. See log file for more information."), getDeviceString(hdl, MidiDriver::kDeviceName).c_str()) + " " + _("Attempting to fall back to the next available device...");
							GUI::MessageDialog dialog(warningMsg);
							dialog.runModal();
						}
					}
				}

				// If no specific device is selected (neither in the scummvm nor in the game domain)
				// and there is no preferred MT32 or GM device selected either or if the detected device is unavailable we arrive here.
				// If MT32 is preferred we try for the first available device with music type 'MT_MT32' (usually the mt32 emulator).
				if (flags & MDT_PREFER_MT32) {
					for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {
						MusicDevices i = (**m)->getDevices();
						for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
							if (d->getMusicType() == MT_MT32) {
								hdl = d->getHandle();
								if (checkDevice(hdl))
									return hdl;
							}
						}
					}
				}

				// Now we default to the first available device with music type 'MT_GM' if not
				// MT-32 is preferred or if MT-32 is preferred but all other devices have failed.
				if (!(flags & MDT_PREFER_MT32) || flags == (MDT_PREFER_MT32 | MDT_MIDI)) {
					for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {
						MusicDevices i = (**m)->getDevices();
						for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
							if (d->getMusicType() == MT_GM || d->getMusicType() == MT_GS) {
								hdl = d->getHandle();
								if (checkDevice(hdl))
									return hdl;
							}
						}
					}
					// Detection flags get removed after final detection attempt to avoid further attempts.
					flags &= ~(MDT_MIDI | MDT_PREFER_GM | MDT_PREFER_MT32);
				}
			}
		}

		// The order in this list is important, since this is the order of preference
		// (e.g. MT_ADLIB is checked before MT_PCJR and MT_PCSPK for a good reason).
		// Detection flags get removed after detection attempt to avoid further attempts.
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:67,代码来源:mididrv.cpp

示例4: getDeviceHandle


//.........这里部分代码省略.........
	case MT_GM:
	case MT_GS:
	case MT_MT32:
		if (flags & MDT_MIDI)
			return hdl;
		break;

	case MT_NULL:
		return hdl;

	default:
		break;
	}

	// If the selected driver did not match the flags setting,
	// we try to determine a suitable and "optimal" music driver.
	const MusicPlugin::List p = MusicMan.getPlugins();
	// If only MDT_MIDI but not MDT_PREFER_MT32 or MDT_PREFER_GM is set we prefer the other devices (which will always be
	// detected since they are hard coded and cannot be disabled.
	for (int l = (flags & (MDT_PREFER_GM | MDT_PREFER_MT32)) ? 1 : 0; l < 2; ++l) {
		if ((flags & MDT_MIDI) && (l == 1)) {
			// If a preferred MT32 or GM device has been selected that device gets returned.
			if (flags & MDT_PREFER_MT32)
				hdl = getDeviceHandle(ConfMan.get("mt32_device"));
			else if (flags & MDT_PREFER_GM)
				hdl = getDeviceHandle(ConfMan.get("gm_device"));
			else
				hdl = getDeviceHandle("auto");

			const MusicType type = getMusicType(hdl);

			// If we have a "Don't use GM/MT-32" setting we skip this part and jump
			// to AdLib, PC Speaker etc. detection right away.
			if (type != MT_NULL) {
				if (type != MT_AUTO && type != MT_INVALID) {
					if (flags & MDT_PREFER_MT32)
						// If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h).
						_forceTypeMT32 = true;

					return hdl;
				}

				// If no specific device is selected (neither in the scummvm nor in the game domain)
				// and there is no preferred MT32 or GM device selected either we arrive here.
				// If MT32 is preferred we try for the first available device with music type 'MT_MT32' (usually the mt32 emulator).
				if (flags & MDT_PREFER_MT32) {
					for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {
						MusicDevices i = (**m)->getDevices();
						for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
							if (d->getMusicType() == MT_MT32)
								return d->getHandle();
						}
					}
				}

				// Now we default to the first available device with music type 'MT_GM'
				for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {
					MusicDevices i = (**m)->getDevices();
					for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
						if (d->getMusicType() == MT_GM || d->getMusicType() == MT_GS)
							return d->getHandle();
					}
				}
			}
		}

		MusicType tp = MT_AUTO;
		if (flags & MDT_TOWNS)
			tp = MT_TOWNS;
		else if (flags & MDT_PC98)
			tp = MT_PC98;
		else if (flags & MDT_ADLIB)
			tp = MT_ADLIB;
		else if (flags & MDT_PCJR)
			tp = MT_PCJR;
		else if (flags & MDT_PCSPK)
			tp = MT_PCSPK;
		else if (flags & MDT_C64)
			tp = MT_C64;
		else if (flags & MDT_AMIGA)
			tp = MT_AMIGA;
		else if (flags & MDT_APPLEIIGS)
			tp = MT_APPLEIIGS;
		else if (l == 0)
			// If we haven't tried to find a MIDI device yet we do this now.
			continue;
		else
			tp = MT_AUTO;

		for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {
			MusicDevices i = (**m)->getDevices();
			for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
				if (d->getMusicType() == tp)
					return d->getHandle();
			}
		}
	}

	return 0;
}
开发者ID:tiqpit,项目名称:scummvm,代码行数:101,代码来源:mididrv.cpp

示例5: getDevices

MusicDevices CMSMusicPlugin::getDevices() const {
	MusicDevices devices;
	devices.push_back(MusicDevice(this, "", MT_CMS));
	return devices;
}
开发者ID:Bundesdrucker,项目名称:scummvm,代码行数:5,代码来源:cms.cpp

示例6: getDevices

MusicDevices AppleIIGSMusicPlugin::getDevices() const {
	MusicDevices devices;
	devices.push_back(MusicDevice(this, "", MT_APPLEIIGS));
	return devices;
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:5,代码来源:appleiigs.cpp

示例7: getDevices

MusicDevices NullMusicPlugin::getDevices() const {
    MusicDevices devices;
    // TODO: return a different music type?
    devices.push_back(MusicDevice(this, "", MT_GM));
    return devices;
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:6,代码来源:null.cpp


注:本文中的MusicDevices类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。