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


C++ Playlist::playAdjacent方法代码示例

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


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

示例1: doCommand

bool doCommand(char *command) {
	// new commands always turn off immediate autoplay
	immediateAutoplayStop();

	int length = strlen(command);
	if(length == 0) {
		return true;
	}

	char commandChar = toupper(command[0]);
	char *parameters = &command[1];
	bool noParameters = length == 1;
	char firstParameterChar = noParameters ? '\0' : toupper(*parameters);

	Serial.println(command);
	Playlist *playlist = Playlists::currentPlaylist();

	switch(commandChar) {
		case '+': // see also default at end of switch for making chirps without preceding with +
			if( ! noParameters) {
				return makeNewChirp(parameters);
			}
			break;

		case ']':
		case ')':
			if(noParameters) {
				Serial.println(F("next"));
				playlist->playAdjacent(1, commandChar == ')'); // ] wraps, ) chains
			}
			break;

		case '[':
		case '(':
			if(noParameters) {
				Serial.println(F("back"));
				playlist->playAdjacent(-1, commandChar == '('); // [ wraps, ( chains
			}
			break;

		case ',':
			if(noParameters) {
				Serial.println(F("step"));
				playlist->playSequenced();
			}
			break;

		case '@': // select playlist by index number..
			if(noParameters) {
				playlist->setPlayIndex(0); // ..or reset play index to 0 in current playlist
			}
			else {
				playlist = Playlists::usePlaylist(number(parameters, playlist->playlistIndex));
			}
			break;

		case '}':
		case '{':
			if(noParameters) {
				playlist = Playlists::useAdjacentPlaylist(commandChar == '}' ? 1 : -1);
			}
			break;

		case '!': // play current or supplied code
			if(noParameters) {
				playlist->play();
			}
			else if(isAChirpCode(parameters)) {
				playlist->playChirpCode(parameters);
			}
			else {
				playlist->playIndexed(number(parameters, playlist->playIndex));
			}
			break;

		case '?':
			if(noParameters) {
				Serial.println(F("lookup"));
				return ! playerLink.fetchChirpContent(playlist);
			}
			break;

		case '~': // clearing
			Serial.println(F("clear"));
			if(noParameters) {
				playlist->clear(CLEAR_LIST);
			}
			else if(firstParameterChar == '#') {
				playlist->clear(CLEAR_SCRIPT_URL);
			}
			else if(strcmp(parameters, "!") == 0) {
				Playlists::clearAll();
			}
			else {
				playlist->clear(number(parameters));
			}
			break;

		case '.': // autoplay order & chirping interval
			if( ! noParameters && strchr("FBRS", firstParameterChar)) {
//.........这里部分代码省略.........
开发者ID:RobertLeyland,项目名称:chirpino,代码行数:101,代码来源:Commands.cpp


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