コード例 #1
0
void    plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength )
{
    ST::string segName = GetSegmentName();
    bool isEntire = ( segName.is_empty() || segName.compare( ENTIRE_ANIMATION_NAME ) == 0 );

    if( isEntire )
    {
        convert.SetBegin( 0 );
        convert.SetEnd( maxLength );
    }
    else
    {
        SegmentSpec *spec = IGetSegmentSpec();
        convert.SetBegin( ( spec != nil ) ? spec->fStart : 0.f );
        convert.SetEnd( ( spec != nil ) ? spec->fEnd : 0.f );
    }

    // Even if we're not looping, set the loop points. (A responder
    // could tell us later to start looping.)
    if( isEntire )
        convert.SetLoopPoints( 0, maxLength );
    else
    {
        float loopStart, loopEnd;
        GetLoopPoints( loopStart, loopEnd );
        convert.SetLoopPoints( loopStart, loopEnd );
    }   
    convert.Loop( GetLoop() );

    // Auto-start
    if( GetAutoStart() )
        convert.Start( 0 );
    else
        convert.Stop( true );

    // Stuff stop points
    GetAllStopPoints( convert.GetStopPoints() );

    // Ease curve stuff
    if( GetEaseInType() != plAnimEaseTypes::kNoEase )
    {
        convert.SetEase( true, GetEaseInType(), GetEaseInMin(), GetEaseInMax(), GetEaseInLength() );
    }
    if( GetEaseOutType() != plAnimEaseTypes::kNoEase )
    {
        convert.SetEase( false, GetEaseOutType(), GetEaseOutMin(), GetEaseOutMax(), GetEaseOutLength() );
    }
}
コード例 #2
0
ファイル: uv++-tcp.cpp プロジェクト: LiTianjue/uvpp
int Tcp::Accept(/* [out] */ Stream **conn)
{
    assert(IsOpened());
    assert(conn && ! * conn);

    Tcp *newConn = New(GetLoop());
    if(! newConn) {
        return UV_ENOMEM;
    }

    int result = uv_accept(*this, *newConn);
    if(! result) {
        *conn = newConn;
    }
    else {
        newConn->Unref();
    }

    return result;
}
コード例 #3
0
ファイル: LocationDlg.cpp プロジェクト: kamalsirsa/vtp
void LocationDlg::UpdateEnabling()
{
	GetAnimPos()->Enable(m_iAnim != -1);
	GetSaveAnim()->Enable(m_iAnim != -1);
	GetActive()->Enable(m_iAnim != -1);
	GetSpeed()->Enable(m_iAnim != -1);
	GetReset()->Enable(m_iAnim != -1);
	GetPlay()->Enable(m_iAnim != -1);
	GetRecord1()->Enable(m_iAnim != -1);
	GetStop()->Enable(m_iAnim != -1);
	GetLoop()->Enable(m_iAnim != -1);
	GetContinuous()->Enable(m_iAnim != -1);
	GetSmooth()->Enable(m_iAnim != -1 && GetAnim(m_iAnim)->NumPoints() > 2);
	GetPosOnly()->Enable(m_iAnim != -1);

	GetRecordInterval()->Enable(m_iAnim != -1);
	GetRecordLinear()->Enable(m_iAnim != -1);

	GetRecordSpacing()->Enable(m_bRecordInterval);
	GetPlayToDisk()->Enable(m_iAnim != -1);
}
コード例 #4
0
ファイル: Music.cpp プロジェクト: freemaul/SFML
////////////////////////////////////////////////////////////
/// Tell whether or not a music is looping
////////////////////////////////////////////////////////////
sfBool sfMusic_GetLoop(sfMusic* Music)
{
    CSFML_CALL_RETURN(Music, GetLoop(), sfFalse);
}
コード例 #5
0
        _ParallelLoop(procInfo, idx, videochannels)
        {
            if (Codec[idx]) {

                // Seek (if needed) to frame that needs to be extracted
                pos = Codec[idx]->GetPos();
                Position[idx] = pos;

                if (UseRange[idx]) {
                    // Check if position is outside of the playback segment
                    if (pos < Range[idx][0]) {
                        Codec[idx]->SetPos(Range[idx][0]);
                        ResetTimer = true;
                    }
                    else if (pos > Range[idx][1]) {
                        if (!GetLoop()) {
                            ret = SVL_STOP_REQUEST;
                            break;
                        }
                        else {
                            Codec[idx]->SetPos(Range[idx][0]);
                            ResetTimer = true;
                        }
                    }
                }

                // Extract frame
                ret = Codec[idx]->Read(0, *OutputImage, idx, true);

                // Manage looped playback and errors
                if (ret == SVL_VID_END_REACHED) {
                    if (!GetLoop()) {
                        ret = SVL_STOP_REQUEST;
                        break;
                    }
                    else {
                        // Loop around
                        ret = Codec[idx]->Read(0, *OutputImage, idx, true);
                    }
                }
                if (ret != SVL_OK) {
                    CMN_LOG_CLASS_INIT_ERROR << "Process: failed to read video frame on channel: " << idx << std::endl; 
                    break;
                }

                // Run timer based in the first video channel
                if (idx == 0) {

                    // Get timestamp stored in the video file
                    timestamp = Codec[idx]->GetTimestamp();
                    if (timestamp > 0.0) {

                        if (!IsTargetTimerRunning()) {

                            // Try to keep orignal frame intervals
                            if (ResetTimer || Codec[idx]->GetPos() == 1) {
                                FirstTimestamp = timestamp;
                                Timer.Reset();
                                Timer.Start();
                                ResetTimer = false;
                            }
                            else {
                                timespan = (timestamp - FirstTimestamp) - Timer.GetElapsedTime();
                                if (timespan > 0.0) osaSleep(timespan);
                            }
                        }
                    }

                    OutputImage->SetTimestamp(timestamp);
                }
            }
        }
コード例 #6
0
int svlFilterSourceVideoFile::Process(svlProcInfo* procInfo, svlSample* &syncOutput)
{
    syncOutput = OutputImage;

    // Try to keep target frequency
    _OnSingleThread(procInfo) WaitForTargetTimer();

    unsigned int idx, videochannels = OutputImage->GetVideoChannels();
    double timestamp, timespan;
    int pos, ret = SVL_OK;

    // TO DO: add a little more sophisticated logic here
    if (Codec[0]->IsMultithreaded()) {
        // Codecs are multithreaded, so it's worth
        // splitting work between all threads

        for (idx = 0; idx < videochannels; idx ++) {

            if (Codec[idx]) {

                // Seek (if needed) to frame that needs to be extracted
                _OnSingleThread(procInfo)
                {
                    pos = Codec[idx]->GetPos();
                    Position[idx] = pos;

                    if (UseRange[idx]) {
                        // Check if position is outside of the playback segment
                        if (pos < Range[idx][0]) {
                            Codec[idx]->SetPos(Range[idx][0]);
                            ResetTimer = true;
                        }
                        else if (pos > Range[idx][1]) {
                            if (!GetLoop()) {
                                ret = SVL_STOP_REQUEST;
                                break;
                            }
                            else {
                                Codec[idx]->SetPos(Range[idx][0]);
                                ResetTimer = true;
                            }
                        }
                    }

                    Status = SVL_OK;
                }

                _SynchronizeThreads(procInfo);

                // Extract frame
                ret = Codec[idx]->Read(procInfo, *OutputImage, idx, true);

                if (ret != SVL_OK) Status = ret;
                if (ret == SVL_VID_END_REACHED && !GetLoop()) Status = SVL_STOP_REQUEST;

                _SynchronizeThreads(procInfo);

                if (Status == SVL_STOP_REQUEST) {
                    ret = SVL_STOP_REQUEST;
                    break;
                }

                // Manage looped playback and frame timing
                _OnSingleThread(procInfo)
                {
                    if (Status == SVL_VID_END_REACHED || Status == SVL_VID_RETRY) {
                        // Loop around
                        Status = Codec[idx]->Read(0, *OutputImage, idx, true);
                    }
                    if (Status != SVL_OK) {
                        CMN_LOG_CLASS_INIT_ERROR << "Process: failed to read video frame on channel: " << idx << std::endl; 
                        break;
                    }

                    // Run timer based in the first video channel
                    if (idx == 0) {

                        // Get timestamp stored in the video file
                        timestamp = Codec[idx]->GetTimestamp();
                        if (timestamp > 0.0) {

                            if (!IsTargetTimerRunning()) {

                                // Try to keep orignal frame intervals
                                if (ResetTimer || Codec[idx]->GetPos() == 1) {
                                    FirstTimestamp = timestamp;
                                    Timer.Reset();
                                    Timer.Start();
                                    ResetTimer = false;
                                }
                                else {
                                    timespan = (timestamp - FirstTimestamp) - Timer.GetElapsedTime();
                                    if (timespan > 0.0) osaSleep(timespan);
                                }
                            }
                        }

                        OutputImage->SetTimestamp(timestamp);
                    }
                }
            }
        }
    }
    else {
コード例 #7
0
ファイル: Interpreter.cpp プロジェクト: Aura15/OpenJK
int CInterpreter::GetID( char *id_name )
{
	int		id;

	id = FindSymbol( id_name, m_IDKeywords );

	if ( id == -1 )
		return Error("'%s' : unknown identifier", id_name);

	//FIXME: Function pointers would be awfully nice.. but not inside a class!  Weee!!

	switch (id)
	{
	
	//Affect takes control of an entity

	case ID_AFFECT:
		return GetAffect();
		break;

	//Wait for a specified amount of time

	case ID_WAIT:
		return GetWait();
		break;

	//Generic set call

	case ID_SET:
		return GetSet();
		break;

	case ID_LOOP:
		return GetLoop();
		break;

	case ID_PRINT:
		return GetPrint();
		break;

	case ID_USE:
		return GetUse();
		break;

	case ID_FLUSH:
		return GetFlush();
		break;
		
	case ID_RUN:
		return GetRun();
		break;

	case ID_KILL:
		return GetKill();
		break;

	case ID_REMOVE:
		return GetRemove();
		break;

	case ID_CAMERA:
		return GetCamera();
		break;

	case ID_SOUND:
		return GetSound();
		break;

	case ID_MOVE:
		return GetMove();
		break;

	case ID_ROTATE:
		return GetRotate();
		break;

	case ID_IF:
		return GetIf();
		break;

	case ID_ELSE:
		//return Error("syntax error : else without matching if");
		return GetElse();	//FIXME: Protect this call so that floating else's aren't allowed
		break;

	case ID_GET:
		return Error("syntax error : illegal use of \"get\"");
		break;

	case ID_TAG:
		return Error("syntax error : illegal use of \"tag\"");
		break;

	case ID_TASK:
		return GetTask();
		break;

	case ID_DO:
		return GetDo();
		break;

	case ID_DECLARE:
		return GetDeclare();
		break;

	case ID_FREE:
		return GetFree();
		break;

	case ID_REM:
		GetRem();
		break;

	case ID_DOWAIT:
		GetDoWait();
		break;

	case ID_SIGNAL:
		GetSignal();
		break;

	case ID_WAITSIGNAL:
		GetWaitSignal();
		break;

	case ID_PLAY:
		GetPlay();	//Bad eighties slang joke...  yeah, it's not really funny, I know...
		break;

		//Local variable types
	case TK_FLOAT:
	case TK_INT:
	case TK_STRING:
	case TK_VECTOR:
		GetVariable( id );
		break;

	//Unknown ID

	default:
	case -1:
		return Error("'%s' : unknown identifier", id_name);
		break;
	}

	return true;
}