void
moMasterEffectMasterChannel::Interaction(moIODeviceManager *IODeviceManager) {
	//aqui se parsean los codisp
	moDeviceCode *temp;
	MOuint e;
	MOint did,cid,state,valor;

	if(devicecode!=NULL)
	for(int i=0; i<ncodes;i++) {
		temp = devicecode[i].First;
		while(temp!=NULL) {
			did = temp->device;
			cid = temp->devicecode;
			state = IODeviceManager->IODevices().Get(did)->GetStatus(cid);
			valor = IODeviceManager->IODevices().Get(did)->GetValue(cid);
			if(state)
			switch(i) {
				case MO_ACTION_SYNCHRONIZE_ALL:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL)
							m_pEffectManager->AllEffects().Get(e)->state.synchronized = MO_ACTIVATED;
					}
					break;
				case MO_ACTION_TEMPO_DELTA_SUB_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tempo.delta+=0.005;
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.delta>2.0)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.delta = 2.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.delta<0.005)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.delta = 0.005;
						}
					}
					consolestate->tempo.delta+=0.005;
					if(consolestate->tempo.delta>2.0)
						consolestate->tempo.delta = 2.0;
					else
					if(consolestate->tempo.delta<0.005)
						consolestate->tempo.delta = 0.005;
					break;
				case MO_ACTION_TEMPO_DELTA_BMO_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tempo.delta-=0.005;
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.delta>2.0)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.delta = 2.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.delta<0.005)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.delta = 0.005;
						}
					}
					consolestate->tempo.delta-=0.005;
					if(consolestate->tempo.delta>2.0)
						consolestate->tempo.delta = 2.0;
					else
					if(consolestate->tempo.delta<0.005)
						consolestate->tempo.delta = 0.005;
					break;
				case MO_ACTION_TEMPO_PITCH_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tempo.delta+=((float) valor /(float) 256.0);
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.delta>2.0)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.delta = 2.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.delta<0.005)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.delta = 0.005;
						}
					}
					consolestate->tempo.delta+=((float) valor /(float) 256.0);
					if(consolestate->tempo.delta>2.0)
						consolestate->tempo.delta = 2.0;
					else
					if(consolestate->tempo.delta<0.005)
						consolestate->tempo.delta = 0.005;
					break;
				case MO_ACTION_TEMPO_FACTOR_SUB_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tempo.factor+=1.0;
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.factor>50.0)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.factor = 50.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.factor<1.0)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.factor = 1.0;
						}
					}
					consolestate->tempo.factor+=1.0;
					if(consolestate->tempo.factor>50.0)
						consolestate->tempo.factor = 50.0;
					else
					if(consolestate->tempo.factor<1.0)
						consolestate->tempo.factor = 1.0;
					break;
				case MO_ACTION_TEMPO_FACTOR_BMO_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tempo.factor-=1.0;
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.factor>50.0)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.factor = 50.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tempo.factor<1.0)
								m_pEffectManager->AllEffects().Get(e)->state.tempo.factor = 1.0;
						}
					}
					consolestate->tempo.factor-=1.0;
					if(consolestate->tempo.factor>50.0)
						consolestate->tempo.factor = 50.0;
					else
					if(consolestate->tempo.factor<1.0)
						consolestate->tempo.factor = 1.0;
					break;
				case MO_ACTION_ALPHA_SUB_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.alpha+=0.05;
							if(m_pEffectManager->AllEffects().Get(e)->state.alpha>1.0)
								m_pEffectManager->AllEffects().Get(e)->state.alpha = 1.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.alpha<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.alpha = 0.0;
						}
					}
					break;
				case MO_ACTION_ALPHA_BMO_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.alpha-=0.05;
							if(m_pEffectManager->AllEffects().Get(e)->state.alpha>1.0)
								m_pEffectManager->AllEffects().Get(e)->state.alpha = 1.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.alpha<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.alpha = 0.0;
						}
					}
					break;
				case MO_ACTION_WHEEL_ALPHA_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.alpha+=((float) valor /(float) 256.0);
							//m_pEffectManager->AllEffects().Get(e)->state.alpha =((float) valor /(float) 127.0);
							if(m_pEffectManager->AllEffects().Get(e)->state.alpha>1.0)
							m_pEffectManager->AllEffects().Get(e)->state.alpha=1.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.alpha<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.alpha=0.0;
						}
					}
					break;
				case MO_ACTION_AMPLITUDE_SUB_MASTER:
					//niente por ahora
					break;
				case MO_ACTION_AMPLITUDE_BMO_MASTER:
					//niente por ahora
					break;
				case MO_ACTION_WHEEL_AMPLITUDE_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.amplitude+=((float) valor /(float) 256.0);
							if(m_pEffectManager->AllEffects().Get(e)->state.amplitude>1.0)
							m_pEffectManager->AllEffects().Get(e)->state.amplitude=1.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.amplitude<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.amplitude=0.0;
						}
					}
					break;
				case MO_ACTION_MAGNITUDE_SUB_MASTER:
					//niente por ahora
					break;
				case MO_ACTION_MAGNITUDE_BMO_MASTER:
					//niente por ahora
					break;
				case MO_ACTION_WHEEL_MAGNITUDE_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.magnitude-=((float) valor /(float) 256.0);
							if(m_pEffectManager->AllEffects().Get(e)->state.magnitude>1.0)
							m_pEffectManager->AllEffects().Get(e)->state.magnitude=1.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.magnitude<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.magnitude=0.0;
						}
					}
					break;
				case MO_ACTION_TINT_SUB_MASTER:
					//niente por ahora
					break;
				case MO_ACTION_TINT_BMO_MASTER:
					//niente por ahora
					break;
				case MO_ACTION_WHEEL_TINT_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tint-=((float) valor /(float) 256.0);
							m_pEffectManager->AllEffects().Get(e)->state.CSV2RGB();
							if(m_pEffectManager->AllEffects().Get(e)->state.tint>1.0)
							m_pEffectManager->AllEffects().Get(e)->state.tint=1.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tint<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.tint=0.0;
						}
					}
					break;
				case MO_ACTION_WHEEL_CHROMANCY_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tintc-=((float) valor /(float) 1024.0);
							m_pEffectManager->AllEffects().Get(e)->state.CSV2RGB();
							if(m_pEffectManager->AllEffects().Get(e)->state.tintc>1.0)
							m_pEffectManager->AllEffects().Get(e)->state.tintc=0.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tintc<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.tintc=1.0;
						}
					}
					break;
				case MO_ACTION_WHEEL_SATURATION_MASTER:
					for(e=0;e<m_pEffectManager->AllEffects().Count();e++) {
						if(m_pEffectManager->AllEffects().Get(e)!=NULL) {
							m_pEffectManager->AllEffects().Get(e)->state.tints-=((float) valor /(float) 512.0);
							m_pEffectManager->AllEffects().Get(e)->state.CSV2RGB();
							if(m_pEffectManager->AllEffects().Get(e)->state.tints>1.0)
							m_pEffectManager->AllEffects().Get(e)->state.tints=1.0;
							else
							if(m_pEffectManager->AllEffects().Get(e)->state.tints<0.0)
								m_pEffectManager->AllEffects().Get(e)->state.tints=0.0;
						}
					}
					break;
				case MO_ACTION_BEAT_PULSE_MASTER:
					consolestate->tempo.BeatPulse(moGetTicksAbsolute());
					break;
				default:
					break;
			}
		temp = temp->next;
		}
	}
}
示例#2
0
void moEffect::BeatPulse() {
    this->m_EffectState.synchronized = MO_DEACTIVATED;
    this->m_EffectState.tempo.BeatPulse(moGetTicksAbsolute());
}
void moPostEffectDebug::Draw( moTempo* tempogral,moEffectState* parentstate)
{

	//calculamos ticks y frames x seg
	moTextArray TextArray;
    MOulong timecodeticks;
    int w;
    int h;

    BeginDraw( tempogral, parentstate);

    if (m_pResourceManager) {
        w = m_pResourceManager->GetRenderMan()->ScreenWidth();
        h = m_pResourceManager->GetRenderMan()->ScreenHeight();
    }




	ticksprevious = ticks;
	ticks = moGetTicksAbsolute();
	tickselapsed = ticks - ticksprevious;

	fps_current = 1000.0 / tickselapsed;
	fps_mean += fps_current;

	fps_count++;
	if (fps_count % 10 == 0)
	{
		fps_mean /= 10;
		fps_text = moText("FPS = ") + (moText)FloatToStr(fps_mean);
		fps_mean = 0;
		fps_count = 0;
	}
	TextArray.Add(fps_text);



/*
    for(int g=560;g>=80 ;g-=20) {
        //glPrint(0,g,MODebug2->Pop(),0,1.0,1.0);
        //glPrint(0,g,moText("test"),0,1.0,1.0);

    }
*/


	/*
	moText state_datos;
	moText state_luminosidad;
	moText state_colorido;
	moText state_magnitude;

	state_datos+= "SINC: ";
	state_datos+= IntToStr(state.synchronized);
	state_datos+= " FAC: ";
	state_datos+= FloatToStr(m_EffectState.tempo.factor,4);
	state_datos+= " SYNCRO: ";
	state_datos+= FloatToStr(m_EffectState.tempo.syncro,4);

	state_luminosidad+="ALPHA:";
	state_luminosidad+= FloatToStr(state.alpha,4);
	state_luminosidad+="LUM:";
	state_luminosidad+= FloatToStr(state.tint,4);

	state_colorido+="ALPHA:";
	state_colorido+= FloatToStr(state.tintc,4);
	state_colorido+="SAT:";
	state_colorido+= FloatToStr(state.tints,4);

	state_magnitude+="DELTA:";
	state_magnitude+= FloatToStr(m_EffectState.tempo.delta,4);
	state_magnitude+="AMP:";
	state_magnitude+= FloatToStr(state.amplitude,4);


	MODebug2->Push(state_datos);
	MODebug2->Push(state_luminosidad);
	MODebug2->Push(state_colorido);
	MODebug2->Push(state_magnitude);
*/


    moFont mFont = m_Config.Font( moR(DEBUG_FONT) );

    PreDraw( tempogral, parentstate);

    // Cambiar la proyeccion para una vista ortogonal //
	glDisable(GL_DEPTH_TEST);							// Disables Depth Testing
	glMatrixMode(GL_PROJECTION);						// Select The Projection Matrix
	glLoadIdentity();									// Reset The Projection Matrix
	glOrtho(0,w,0,h,-1,1);                              // Set Up An Ortho Screen
    glMatrixMode(GL_MODELVIEW);                         // Select The Modelview Matrix
	glLoadIdentity();									// Reset The View


    glEnable(GL_BLEND);

    //color
    SetColor( m_Config[moR(DEBUG_COLOR)], m_Config[moR(DEBUG_ALPHA)], m_EffectState );

    moText Texto = moText("");


    int minutes;
    int seconds;
    int frames;

    //if (mFont) {
        /*
        pFont->Draw(    0.0,
                        0.0,
                        Texto,
                        m_Config[moR(DEBUG_FONT)][MO_SELECTED][2].Int(),
                        0 );
                        */

        Texto+= fps_text;

        timecodeticks = moGetTicks();
        minutes = timecodeticks / (1000*60);
        seconds = (timecodeticks - minutes*1000*60) / 1000;
        frames = (timecodeticks - minutes*1000*60 - seconds*1000 ) * 25 / 1000;

        Texto+= moText(" ticks: ") + (moText)IntToStr(timecodeticks,10) +
                moText(" ang: ") + (moText)FloatToStr((float)tempogral->ang) +
                moText(" timecode: ") + (moText)IntToStr(minutes, 2) + moText(":") + (moText)IntToStr(seconds,2) + moText(":") + (moText)IntToStr(frames,2);

        //glTranslatef( 0.0, 2.0, 0.0 );
        mFont.Draw(    0.0,
                        0.0,
                        Texto,
                        m_Config[moR(DEBUG_FONT)][MO_SELECTED][2].Int(),
                        0 );


        moText  Final;

        int cint = 0;
        //Final = moText("Debug ");
        //for( int i=0; i<MODebug2->Count(); i++ ) {
        //    cint++;
            //Final = MODebug2->GetMessages().Get(i);
        //}

        cint = MODebug2->Count();
        //Final = Final + moText("(")+IntToStr( cint ) + moText("):");
        //if (cint>0) Final = Final + (moText)MODebug2->GetLast();


        /*
        for( int i=0; i<(cint-1); i++ ) {
            Final = MODebug2->Pop();
        }
        */
        mFont.Draw( 0.0, 48.0, Final );

        //moText infod = moText("screen width:")+IntToStr(w)+moText(" screen height:")+IntToStr(h);
        //pFont->Draw( 0, 0, infod, m_Config[moR(TEXT_FONT)][MO_SELECTED][2].Int(), 0, 2.0, 2.0, 0.0);
    //}

	glMatrixMode(GL_MODELVIEW);							// Select The Modelview Matrix
	glPopMatrix();										// Restore The Old Projection Matrix
	glMatrixMode(GL_PROJECTION);						// Select The Projection Matrix
	glPopMatrix();										// Restore The Old Projection Matrix

}