亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? midi.cpp

?? 經(jīng)典的一款俄羅斯方塊-源程序.java.~
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
	if( !m_bPlaying )
		return;

	m_Volumes[dwChannel] = (dwPercent > 100) ? 100 : dwPercent;
	DWORD dwEvent = MIDI_CTRLCHANGE | dwChannel | ((DWORD)MIDICTRL_VOLUME << 8) | ((DWORD)(m_Volumes[dwChannel]*VOLUME_MAX/100) << 16);
	MMRESULT mmrRetVal;
	if(( mmrRetVal = midiOutShortMsg((HMIDIOUT)m_hStream, dwEvent)) != MMSYSERR_NOERROR ) {
		MidiError(mmrRetVal);
		return;
	}
}


DWORD CMIDI :: GetChannelVolume(DWORD dwChannel) const {
	ASSERT(dwChannel < GetChannelCount());
	return m_Volumes[dwChannel];
}

//////////////////////////////////////////////////////////////////////
// CMIDI -- implementation
//////////////////////////////////////////////////////////////////////

// This function converts MIDI data from the track buffers setup by a
// previous call to ConverterInit().  It will convert data until an error is
// encountered or the output buffer has been filled with as much event data
// as possible, not to exceed dwMaxLength. This function can take a couple
// bit flags, passed through dwFlags. Information about the success/failure
// of this operation and the number of output bytes actually converted will
// be returned in the CONVERTINFO structure pointed at by lpciInfo.
int CMIDI :: ConvertToBuffer(DWORD dwFlags, CONVERTINFO * lpciInfo) {
	int	    nChkErr;

	lpciInfo->dwBytesRecorded = 0;

	if( dwFlags & CONVERTF_RESET ) {
		m_dwProgressBytes = 0;
		m_dwStatus = 0;
		memset( &m_teTemp, 0, sizeof(TEMPEVENT));
		m_ptsTrack = m_ptsFound = 0;
	}

	// If we were already done, then return with a warning...
	if( m_dwStatus & CONVERTF_STATUS_DONE ) {
		if( m_bLooped ) {
			Rewind();
			m_dwProgressBytes = 0;
			m_dwStatus = 0;
		} else
			return CONVERTERR_DONE;
	} else if( m_dwStatus & CONVERTF_STATUS_STUCK ) {
		// The caller is asking us to continue, but we're already hosed because we
		// previously identified something as corrupt, so complain louder this time.
		return( CONVERTERR_STUCK );
	} else if( m_dwStatus & CONVERTF_STATUS_GOTEVENT ) {
		// Turn off this bit flag
		m_dwStatus ^= CONVERTF_STATUS_GOTEVENT;

		// The following code for this case is duplicated from below, and is
		// designed to handle a "straggler" event, should we have one left over
		// from previous processing the last time this function was called.

		// Don't add end of track event 'til we're done
		if( m_teTemp.byShortData[0] == MIDI_META && m_teTemp.byShortData[1] == MIDI_META_EOT ) {
			if( m_dwMallocBlocks ) {
				delete [] m_teTemp.pLongData;
				--m_dwMallocBlocks;
			}
		} else if(( nChkErr = AddEventToStreamBuffer( &m_teTemp, lpciInfo )) != CONVERTERR_NOERROR ) {
			if( nChkErr == CONVERTERR_BUFFERFULL ) {
				// Do some processing and tell caller that this buffer's full
				m_dwStatus |= CONVERTF_STATUS_GOTEVENT;
				return CONVERTERR_NOERROR;
			} else if( nChkErr == CONVERTERR_METASKIP ) {
				// We skip by all meta events that aren't tempo changes...
			} else {
				TRACE0("Unable to add event to stream buffer.\n");
				if( m_dwMallocBlocks ) {
					delete [] m_teTemp.pLongData;
					m_dwMallocBlocks--;
				}
				return( TRUE );
			}
		}
	}

	for(;;) {
		m_ptsFound = 0;
		m_tkNext = 0xFFFFFFFFL;
		// Find nearest event due
		for( register DWORD idx = 0; idx < m_Tracks.size(); ++idx ) {
			m_ptsTrack = &m_Tracks[idx];
			if( !(m_ptsTrack->fdwTrack & ITS_F_ENDOFTRK) && (m_ptsTrack->tkNextEventDue < m_tkNext) ) {
				m_tkNext = m_ptsTrack->tkNextEventDue;
				m_ptsFound = m_ptsTrack;
			}
		}

		// None found?  We must be done, so return to the caller with a smile.
		if( !m_ptsFound ) {
			m_dwStatus |= CONVERTF_STATUS_DONE;
			// Need to set return buffer members properly
			return CONVERTERR_NOERROR;
		}

		// Ok, get the event header from that track
		if( !GetTrackEvent( m_ptsFound, &m_teTemp )) {
			// Warn future calls that this converter is stuck at a corrupt spot
			// and can't continue
			m_dwStatus |= CONVERTF_STATUS_STUCK;
			return CONVERTERR_CORRUPT;
		}

		// Don't add end of track event 'til we're done
		if( m_teTemp.byShortData[0] == MIDI_META && m_teTemp.byShortData[1] == MIDI_META_EOT ) {
			if( m_dwMallocBlocks ) {
				delete [] m_teTemp.pLongData;
				--m_dwMallocBlocks;
			}
			continue;
		}

		if(( nChkErr = AddEventToStreamBuffer( &m_teTemp, lpciInfo )) != CONVERTERR_NOERROR ) {
			if( nChkErr == CONVERTERR_BUFFERFULL ) {
				// Do some processing and tell somebody this buffer is full...
				m_dwStatus |= CONVERTF_STATUS_GOTEVENT;
				return CONVERTERR_NOERROR;
			} else if( nChkErr == CONVERTERR_METASKIP ) {
				// We skip by all meta events that aren't tempo changes...
			} else {
				TRACE0("Unable to add event to stream buffer.\n");
				if( m_dwMallocBlocks ) {
					delete [] m_teTemp.pLongData;
					m_dwMallocBlocks--;
				}
				return TRUE;
			}
		}
	}	

	return CONVERTERR_NOERROR;
}

// GetTrackEvent
//
// Fills in the event struct with the next event from the track
//
// pteTemp->tkEvent will contain the absolute tick time of the event
// pteTemp->byShortData[0] will contain
//  MIDI_META if the event is a meta event;
//   in this case pteTemp->byShortData[1] will contain the meta class
//  MIDI_SYSEX or MIDI_SYSEXEND if the event is a SysEx event
//  Otherwise, the event is a channel message and pteTemp->byShortData[1]
//   and pteTemp->byShortData[2] will contain the rest of the event.
//
// pteTemp->dwEventLength will contain
//  The total length of the channel message in pteTemp->byShortData if
//   the event is a channel message
//  The total length of the paramter data pointed to by
//   pteTemp->pLongData otherwise
//
// pteTemp->pLongData will point at any additional paramters if the 
//  event is a SysEx or meta event with non-zero length; else
//  it will contain NULL
//
// Returns TRUE on success or FALSE on any kind of parse error
// Prints its own error message ONLY in the debug version
//
// Maintains the state of the input track (i.e. 
// ptsTrack->pTrackPointers, and ptsTrack->byRunningStatus).
//
BOOL CMIDI :: GetTrackEvent(TRACK * ptsTrack, TEMPEVENT * pteTemp) {
	DWORD   idx;
	UINT    dwEventLength;

	// Clear out the temporary event structure to get rid of old data...
	memset( pteTemp, 0, sizeof(TEMPEVENT));

	// Already at end of track? There's nothing to read.
    if( ptsTrack->fdwTrack & ITS_F_ENDOFTRK )
		return FALSE;

	// Get the first byte, which determines the type of event.
	BYTE byByte;
	if( !GetTrackByte(ptsTrack, &byByte) )
		return FALSE;

	// If the high bit is not set, then this is a channel message
	// which uses the status byte from the last channel message
	// we saw. NOTE: We do not clear running status across SysEx or
	// meta events even though the spec says to because there are
	// actually files out there which contain that sequence of data.
	if( !(byByte & 0x80) ) {
		// No previous status byte? We're hosed.
		if( !ptsTrack->byRunningStatus ) {
			TrackError(ptsTrack, gteBadRunStat);
			return FALSE;
		}

		pteTemp->byShortData[0] = ptsTrack->byRunningStatus;
		pteTemp->byShortData[1] = byByte;

		byByte = pteTemp->byShortData[0] & 0xF0;
		pteTemp->dwEventLength = 2;

		// Only program change and channel pressure events are 2 bytes long;
		// the rest are 3 and need another byte
		if(( byByte != MIDI_PRGMCHANGE ) && ( byByte != MIDI_CHANPRESS )) {
			if( !GetTrackByte( ptsTrack, &pteTemp->byShortData[2] ))
				return FALSE;
			++pteTemp->dwEventLength;
		}
	} else if(( byByte & 0xF0 ) != MIDI_SYSEX ) {
		// Not running status, not in SysEx range - must be
		// normal channel message (0x80-0xEF)
		pteTemp->byShortData[0] = byByte;
		ptsTrack->byRunningStatus = byByte;

		// Strip off channel and just keep message type
		byByte &= 0xF0;

		dwEventLength = ( byByte == MIDI_PRGMCHANGE || byByte == MIDI_CHANPRESS ) ? 1 : 2;
		pteTemp->dwEventLength = dwEventLength + 1;

		if( !GetTrackByte( ptsTrack, &pteTemp->byShortData[1] ))
			return FALSE;
		if( dwEventLength == 2 )
			if( !GetTrackByte( ptsTrack, &pteTemp->byShortData[2] ))
				return FALSE;
	} else if(( byByte == MIDI_SYSEX ) || ( byByte == MIDI_SYSEXEND )) {
		// One of the SysEx types. (They are the same as far as we're concerned;
		// there is only a semantic difference in how the data would actually
		// get sent when the file is played. We must take care to put the proper
		// event type back on the output track, however.)
		//
		// Parse the general format of:
		//  BYTE 	bEvent (MIDI_SYSEX or MIDI_SYSEXEND)
		//  VDWORD 	cbParms
		//  BYTE   	abParms[cbParms]
		pteTemp->byShortData[0] = byByte;
		if( !GetTrackVDWord( ptsTrack, &pteTemp->dwEventLength )) {
			TrackError( ptsTrack, gteSysExLenTrunc );
			return FALSE;
		}

		// Malloc a temporary memory block to hold the parameter data
		pteTemp->pLongData = new BYTE [pteTemp->dwEventLength];
		if( pteTemp->pLongData == 0 ) {
			TrackError( ptsTrack, gteNoMem );
			return FALSE;
		}
		// Increment our counter, which tells the program to look around for
		// a malloc block to free, should it need to exit or reset before the
		// block would normally be freed
		++m_dwMallocBlocks;

		// Copy from the input buffer to the parameter data buffer
		for( idx = 0; idx < pteTemp->dwEventLength; idx++ )
			if( !GetTrackByte( ptsTrack, pteTemp->pLongData + idx )) {
				TrackError( ptsTrack, gteSysExTrunc );
				return FALSE;
			}
	} else if( byByte == MIDI_META ) {
		// It's a meta event. Parse the general form:
		//  BYTE	bEvent	(MIDI_META)
		//  BYTE	bClass
		//  VDWORD	cbParms
		//  BYTE	abParms[cbParms]
		pteTemp->byShortData[0] = byByte;

		if( !GetTrackByte( ptsTrack, &pteTemp->byShortData[1] ))
			return FALSE;

		if( !GetTrackVDWord( ptsTrack, &pteTemp->dwEventLength )) {	
			TrackError( ptsTrack, gteMetaLenTrunc );
			return FALSE;
		}

		// NOTE: It's perfectly valid to have a meta with no data
		// In this case, dwEventLength == 0 and pLongData == NULL
		if( pteTemp->dwEventLength ) {		
			// Malloc a temporary memory block to hold the parameter data
			pteTemp->pLongData = new BYTE [pteTemp->dwEventLength];
			if( pteTemp->pLongData == 0 ) {
				TrackError( ptsTrack, gteNoMem );
				return FALSE;
			}
			// Increment our counter, which tells the program to look around for
			// a malloc block to free, should it need to exit or reset before the
			// block would normally be freed
			++m_dwMallocBlocks;

			// Copy from the input buffer to the parameter data buffer
			for( idx = 0; idx < pteTemp->dwEventLength; idx++ )
				if( !GetTrackByte( ptsTrack, pteTemp->pLongData + idx )) {
					TrackError( ptsTrack, gteMetaTrunc );
					return FALSE;
				}
		}

		if( pteTemp->byShortData[1] == MIDI_META_EOT )
			ptsTrack->fdwTrack |= ITS_F_ENDOFTRK;
	} else {
		// Messages in this range are system messages and aren't supposed to
		// be in a normal MIDI file. If they are, we've either misparsed or the
		// authoring software is stupid.
		return FALSE;
	}

	// Event time was already stored as the current track time
	pteTemp->tkEvent = ptsTrack->tkNextEventDue;

	// Now update to the next event time. The code above MUST properly
	// maintain the end of track flag in case the end of track meta is
	// missing.  NOTE: This code is a continuation of the track event
	// time pre-read which is done at the end of track initialization.
	if( !( ptsTrack->fdwTrack & ITS_F_ENDOFTRK )) {
		DWORD	tkDelta;

		if( !GetTrackVDWord( ptsTrack, &tkDelta ))
			return FALSE;

		ptsTrack->tkNextEventDue += tkDelta;
	}

	return TRUE;
}


// GetTrackVDWord
//
// Attempts to parse a variable length DWORD from the given track. A VDWord
// in a MIDI file
//  (a) is in lo-hi format 
//  (b) has the high bit set on every byte except the last
//
// Returns the DWORD in *lpdw and TRUE on success; else
// FALSE if we hit end of track first.
BOOL CMIDI :: GetTrackVDWord(TRACK * ptsTrack, LPDWORD lpdw) {
	ASSERT(ptsTrack != 0);
	ASSERT(lpdw != 0);

	if( ptsTrack->fdwTrack & ITS_F_ENDOFTRK )
		return FALSE;

	BYTE	byByte;
	DWORD	dw = 0;

	do {
		if( !GetTrackByte( ptsTrack, &byByte ))
			return FALSE;

		dw = ( dw << 7 ) | ( byByte & 0x7F );
	} while( byByte & 0x80 );

	*lpdw = dw;

	return TRUE;
}


// AddEventToStreamBuffer
//
// Put the given event into the given stream buffer at the given location
// pteTemp must point to an event filled out in accordance with the
// description given in GetTrackEvent
//
// Handles its own error notification by displaying to the appropriate
// output device (either our debugging window, or the screen).
int CMIDI :: AddEventToStreamBuffer( TEMPEVENT * pteTemp, CONVERTINFO *lpciInfo ) {
	MIDIEVENT * pmeEvent = (MIDIEVENT *)( lpciInfo->mhBuffer.lpData
							+ lpciInfo->dwStartOffset
							+ lpciInfo->dwBytesRecorded );

	// When we see a new, empty buffer, set the start time on it...
	if( !lpciInfo->dwBytesRecorded )
		lpciInfo->tkStart = m_tkCurrentTime;

	// Use the above set start time to figure out how much longer we should fill
	// this buffer before officially declaring it as "full"
	if( m_tkCurrentTime - lpciInfo->tkStart > m_dwBufferTickLength )
		if( lpciInfo->bTimesUp ) {
			lpciInfo->bTimesUp = FALSE;
			return CONVERTERR_BUFFERFULL;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一二三四在线| 粉嫩aⅴ一区二区三区四区| 欧美大肚乱孕交hd孕妇| 国内久久婷婷综合| 国产精品麻豆99久久久久久| 一本色道久久综合精品竹菊| 日韩一区在线看| 日韩午夜三级在线| 国产精品一区二区在线看| 亚洲视频小说图片| 4438成人网| caoporn国产精品| 五月天欧美精品| 国产精品无人区| 欧美一二三区在线| 99久久综合99久久综合网站| 亚洲高清一区二区三区| 国产性色一区二区| 欧美日韩国产大片| 99久久精品99国产精品 | 久久尤物电影视频在线观看| 成人福利视频网站| 久久精品国产精品青草| 亚洲精品日日夜夜| 国产女人18水真多18精品一级做| 精品婷婷伊人一区三区三| 不卡一区中文字幕| 国产成人精品一区二区三区四区 | 精品动漫一区二区三区在线观看| 99精品在线免费| 国产精品77777竹菊影视小说| 天天综合色天天| 一区二区久久久| 亚洲天堂成人网| 中文字幕一区免费在线观看| 亚洲精品一区二区在线观看| 日韩一二三区视频| 7777精品伊人久久久大香线蕉经典版下载 | 午夜在线电影亚洲一区| 亚洲免费观看高清完整版在线| 国产视频不卡一区| 国产日韩欧美精品在线| 亚洲精品一区二区三区99| 日韩精品一区在线| 久久久综合网站| 日韩精品一区二区三区swag| 欧美一级日韩免费不卡| 欧美一级黄色片| 精品国产乱码久久久久久老虎| 国产精品久久久久久久岛一牛影视 | 欧美日本不卡视频| 777午夜精品免费视频| 91精品国产综合久久久久久| 91精品国产综合久久福利| 日韩欧美成人一区| 国产清纯在线一区二区www| 国产精品剧情在线亚洲| 亚洲天堂2014| 日韩vs国产vs欧美| 国内精品免费在线观看| 国产成人在线视频网址| av电影在线观看完整版一区二区| 色综合色狠狠综合色| 欧美麻豆精品久久久久久| 欧美成人r级一区二区三区| 久久久久久亚洲综合影院红桃| 国产精品国模大尺度视频| 亚洲国产一二三| 国产毛片精品视频| 欧美在线一二三| 精品欧美久久久| 亚洲欧洲成人自拍| 视频一区二区中文字幕| 国产成人鲁色资源国产91色综| 色综合久久综合中文综合网| 这里只有精品99re| 亚洲私人黄色宅男| 久久99热国产| 在线观看日韩毛片| 中文字幕av一区二区三区免费看 | 亚洲女性喷水在线观看一区| 亚洲成人av资源| 处破女av一区二区| 91精品国产综合久久婷婷香蕉| 中文字幕精品三区| 日韩高清中文字幕一区| av在线播放成人| 精品成人免费观看| 水蜜桃久久夜色精品一区的特点| 成人动漫精品一区二区| 精品国产一区二区三区忘忧草| 夜夜精品视频一区二区 | 日韩av一二三| 欧美日韩激情一区二区三区| ●精品国产综合乱码久久久久| 九一九一国产精品| 欧美精品乱人伦久久久久久| 国产精品国产a| 成人午夜看片网址| 精品第一国产综合精品aⅴ| 亚洲成av人片在线| 欧美性三三影院| 伊人一区二区三区| 在线一区二区三区四区五区 | 日韩精品每日更新| 色综合一区二区| 天堂成人国产精品一区| 2020国产精品自拍| 色婷婷一区二区| 国产一区在线观看麻豆| 亚洲视频一区在线| 久久综合av免费| 国产成人在线视频网址| 成人黄色小视频在线观看| 国产亚洲婷婷免费| 精品国产乱码久久久久久蜜臀| 成人网男人的天堂| 日本中文字幕一区二区视频| 亚洲国产精品精华液2区45| 欧美日韩在线免费视频| 国产精品99久久久久久似苏梦涵| 一区二区三区免费| 久久久久9999亚洲精品| 欧美三电影在线| 波多野洁衣一区| 国内成人自拍视频| 无码av免费一区二区三区试看 | 成人永久看片免费视频天堂| 亚洲图片欧美色图| 中文字幕在线视频一区| 国产精品美女久久久久aⅴ| 91在线视频观看| 成人一区二区三区中文字幕| 美日韩黄色大片| 亚洲第四色夜色| 亚洲综合免费观看高清完整版在线 | 99热精品国产| 久久国产精品99精品国产| 有码一区二区三区| 中文字幕在线免费不卡| 日韩免费视频线观看| 欧美日韩综合色| 在线观看国产一区二区| 菠萝蜜视频在线观看一区| 国内久久精品视频| 免费在线观看不卡| 天天影视涩香欲综合网| 亚洲一区二区三区四区五区中文| 国产精品美女www爽爽爽| 国产调教视频一区| 久久精品亚洲精品国产欧美| 精品国产乱码久久久久久久久| 日韩欧美一级特黄在线播放| 欧美猛男男办公室激情| 欧美日本乱大交xxxxx| 欧美视频精品在线观看| 一本一道久久a久久精品综合蜜臀| www.欧美日韩| 欧美最新大片在线看| 在线观看欧美日本| 欧美日韩一二三| 日韩精品一区二区三区四区| 久久人人爽爽爽人久久久| 日韩欧美亚洲国产精品字幕久久久| 精品国产乱子伦一区| 2017欧美狠狠色| 国产精品久久久久久久久果冻传媒| 依依成人综合视频| 日韩激情视频网站| 国产精品一级二级三级| 成人av免费在线观看| 欧美综合一区二区三区| 日韩三级伦理片妻子的秘密按摩| 久久免费视频一区| 亚洲三级免费观看| 日韩国产欧美在线播放| 国产精品综合在线视频| 91麻豆高清视频| 日韩精品在线网站| 亚洲美女一区二区三区| 蜜臀av一区二区| 色94色欧美sute亚洲13| 日韩欧美不卡在线观看视频| 中文字幕一区二区三区色视频| 亚洲一区二区三区视频在线播放 | 中文av字幕一区| 日韩精品福利网| www.亚洲精品| 日韩视频免费观看高清完整版在线观看| 中文字幕av资源一区| 日本一道高清亚洲日美韩| 一本色道久久综合亚洲aⅴ蜜桃| 欧美v日韩v国产v| 亚洲电影在线播放| 成人av免费在线| 日本一区二区三级电影在线观看| 三级欧美韩日大片在线看| av不卡在线播放| 久久久影视传媒| 免费成人在线影院|