Exemplo n.º 1
0
bool midiPlayerTick(MIDI_PLAYER* pMidiPlayer) {
  MIDI_PLAYER* pMp = pMidiPlayer;

  if (pMp->pMidiFile == NULL)
    return false;

  pMp->currentTick = (hal_clock() * 1000 - pMp->startTime) / pMp->pMidiFile->usPerTick;
  while (processTracks(pMidiPlayer)); // This loop keeps all tracks synchronized in case of a lag

  return !pMp->allTracksAreFinished; // TODO: close file
}
Exemplo n.º 2
0
DsdiffFileReader::DsdiffFileReader(char* filePath) : DsdSampleReader()
{
	// set some defaults
	ast.hours = 0;
	ast.minutes = 0;
	ast.seconds = 0;
	ast.samples = 0;
	samplesPerChar = 8; // always 8 samples per char (dsd wide not supported by dsdiff).
	sampleBufferLenPerChan = 1024;
	bufferMarker = 0;
	errorMsg = "";
	lsConfig=65535;
	isEm=false;
	// first let's open the file
	file.open(filePath, fstreamPlus::in | fstreamPlus::binary);
	// throw exception if that did not work.
	if (!file.is_open()) {
		errorMsg = "could not open file";
		valid = false;
		return;
	}
	// try and read the header data
	if (!(valid = readHeaders()))
		return;
		
	// find the start and end of the tracks.
	processTracks();
		
	// if DST data, then initialise the decoder
	if (checkIdent(compressionType,const_cast<dsf2flac_int8*>("DST "))) {
		DST_InitDecoder(&dstEbunch, getNumChannels(), getSamplingFreq()/44100);
		dstEbunchAllocated = true;
	}
	
	rewind(); // calls allocateBlockBuffer
	
	return;
}