Click here to Skip to main content
15,895,142 members
Articles / Artificial Intelligence

Developing MIDI applications with DirectMusic

Rate me:
Please Sign up or sign in to vote.
4.91/5 (45 votes)
11 Apr 2008LGPL325 min read 613.2K   9.5K   147  
A wrapper class library for the DirectMusic MIDI.
// Record.cpp: interface for the CRecord class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Record.h"
#include "time.h"

CRecord::CRecord()
{
	nTotal = TOTAL_MEMORY;	//Initializes the total memory counter
}

CRecord::~CRecord()
{
}


CRecord::GetStartTime()		// Stores the record start time
{
	GetSystemTime(&Start);
	nIndex = 0;
}


CRecord::StoreMidiMsg(DWORD dwMsg)	// Stores the current message
{
	DWORD dwdiff;
	
	GetSystemTime(&Current);		// Calculates the elapsed time
	dwdiff = (Current.wMilliseconds+Current.wSecond*1000+Current.wMinute*60000+Current.wHour*3600000)-
			(Start.wMilliseconds+Start.wSecond*1000+Start.wMinute*60000+Start.wHour*3600000);
	
	if (Start.wHour>Current.wHour) // In case 0:0:0:0 hours UTC
		dwdiff = 86400000+dwdiff;

	NoteArray[nIndex].dwTime = dwdiff;			// Stores the time when message was generated
	NoteArray[nIndex].dwMsg = dwMsg;			// Stores the message
	nIndex++;									// Incrments the message counter
}



	

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer
Spain Spain
I obtained my PhD degree in Computer Graphics at the National Distance Education University (UNED) in October 2019. I also hold a Ms. degree in Software Engineering and Computer Systems and a Bs. degree in Computer Science from the National Distance Education University (UNED).
I have been employed as a C++ software developer in several companies since year 2000.
I currently work as a Tutor-Professor of Symbolic Logic, Discrete Math and Java Object-Oriented Programming at UNED-Cartagena (Spain) since 2015.

Comments and Discussions