Пример #1
0
pacova::pacova():pagina_atual(0)
{
  cout << "Utilit�rio de Tela Pacova 1.0\n";

  char erro = inicializa_modo_grafico();

  if (erro)
  {
    cout << "Erro ao inicializar modo Gr�fico: " << grapherrormsg(erro) << "\n";
    cout << "Pressione qualquer tecla para finalizar...";
    bip();
    pause();
  }

  setactivepage(0);
  setvisualpage(0);
}
Пример #2
0
// main application code
void main()
{
	u8 counter=0;
	char str[20];
//	TRISBbits.TRISB7=0;

	init_picstar();
	init_buzzer();
	init_bPous;


// Configure Hardware USART 
	OpenUSART( USART_TX_INT_OFF &
		USART_RX_INT_OFF &
		USART_ASYNCH_MODE &
		USART_EIGHT_BIT &
		USART_CONT_RX &
		USART_BRGH_LOW,
		BAUD19200);     //check the uard_baud.h file for available baud rates.

	bip();
// let's wait until we powered the PICKIT2
	delay_ms(2000); 

// print from ROM
    putrsUSART( "\r\nHello World!\r\n" ); 

// main loop
	while(1)
	{
		if(bPous==0)
		{
//	bip();

// print from variable string
	sprintf(str,"counter= %u \r\n", counter++);
	putsUSART(str);

	delay_ms(1000);
		}
	} // end of main loop
}
Пример #3
0
int Song::tick(MidiMessageCollector* pCollector)
{
	int ret = _clock;

	if (_state==SONG_PLAYING ||
		_state==SONG_RECORDING)
	{
		// only pass on ticks if we are not in 'countdown' mode
		bool bTick = false;
		if (_state==SONG_PLAYING)
		{
			bTick = true;
		}
		else if (_state==SONG_RECORDING)
		{
			if (_metronomeBars!=0)
			{
				if (_countInClockPos > _countInClockMax)
				{
					bTick=true;
				}
				else
				{
					printf("pos %d\n",_countInClockPos);
					_countInClockPos++;
				}
			}
			else
			{
				bTick=true;
			}
		}

		if (bTick)
			_pCurrentSection->tick(pCollector);

		ret = _clock;

		// metronome
		if (_metronomeState!=METRONOME_OFF &&
				( (_state==SONG_RECORDING) || (_state==SONG_PLAYING && _metronomeState==METRONOME_PLAY) ) )
		{
			if (_clock % PHRASE_CLOCKS == 0)
			{
				if (_clock == 0)
				{
					MidiMessage bip(0xf2,0x00,Time::getMillisecondCounterHiRes()/1000.0f);
					pCollector->addMessageToQueue(bip);
				}
				else
				{
					MidiMessage bop(0xf2,0x01,Time::getMillisecondCounterHiRes()/1000.0f);
					pCollector->addMessageToQueue(bop);
				}
			}
		}

		// pulse play light in time with beats
		if (_clock % PHRASE_CLOCKS == 0)
		{
			HostEvent h = HostEventFactory::event(HC_OUT_BEAT);
			_pHostEventListener->onHostEvent(h);
		}

		// inc clock
		if (_clock < _currentPatternLengthClocks-1)
		{
			_clock++;
		}
		else
		{
			// should we quantise?
			if (_autoQuant)
			{
				quantisePhrase();
			}

			// we might need to change pattern.
			if (_currentSection != _nextSection)
			{
				_pCurrentSection->stop();

				_currentSection = _nextSection;
				_pCurrentSection = _sections[_nextSection];

				_currentPatternLengthClocks = _pCurrentSection->getLengthClocks();

				HostEvent h = HostEventFactory::event(HC_OUT_SECTION_CHANGE,_currentSection);
				_pHostEventListener->onHostEvent(h);
			}

			_clock=0;
		}

	}

	return ret;
}