Beispiel #1
0
void GuiRendererD3D11::PushQuads(NFE_CONTEXT_ARG, const GuiQuad* pQuads, UINT size)
{
    if (mQueuedQuads >= MAX_QUEUED_QUADS)
        FlushQueue(pContext);

    int i = 0;
    while (size)
    {
        mQuads[mQueuedQuads] = pQuads[i];
        i++;
        size--;

        if (mQueuedQuads >= MAX_QUEUED_QUADS)
            FlushQueue(pContext);
    }
}
Beispiel #2
0
Datei: key.c Projekt: paud/d2x-xl
void KeyFlush()
{
	if (EnsureInit ())
	{
		ULONG cElements = INFINITE;
		ULONG kcKey;
//                HRESULT hr =
                               IDirectInputDevice_GetDeviceData (
                        g_lpdidKeybd,
			sizeof (DIDEVICEOBJECTDATA),
			NULL,
                        (int *) &cElements,
			0);

		for (kcKey = 0; kcKey < 256; kcKey ++)
		{
			g_rgtimeElapsed [kcKey] = 0;
			g_rgcDowns [kcKey] = 0;
			g_rgcUps [kcKey] = 0;
			keyd_pressed [kcKey] = 0;
		}

		FlushQueue ();
	}
}
Beispiel #3
0
HRESULT CAMROutputPin::Active()
{
	if (active) {
		return NOERROR;
	}
	
	FlushQueue();
	if (!IsConnected()) {
		return VFW_E_NOT_CONNECTED;
	}

	ev_abort.Reset();

	HRESULT hr = CBaseOutputPin::Active();
	if (FAILED(hr)) {
		active = FALSE;
		return hr;
	}

	// new segment
	DoNewSegment(rtStart, rtStop, rate);

	// vytvorime novu queue
	if (!ThreadExists()) {
		Create();
		CallWorker(CMD_RUN);
	}

	active = TRUE;
	return hr;
}
Beispiel #4
0
void 			
DeleteMonitor(Monitor_t *mon)
{
	FlushQueue(&mon->queue, false);
	Free(GetName(mon));
	Free(mon);
}
Beispiel #5
0
void Timbre::resetArpeggiator() {
    // Reset Arpeggiator
    FlushQueue();
    note_stack.Clear();
    setArpeggiatorClock(params.engineArp1.clock);
    setLatchMode(params.engineArp2.latche);
}
Beispiel #6
0
/*----------------------------------------------------------------------
|   AP4_LinearReader::FlushQueues
+---------------------------------------------------------------------*/
void
AP4_LinearReader::FlushQueues()
{
    for (unsigned int i=0; i<m_Trackers.ItemCount(); i++) {
        FlushQueue(m_Trackers[i]);
    }
}
Beispiel #7
0
void				
DeleteCondition(Condition_t *cond)
{
	FlushQueue(&cond->queue, false);
	Free(GetName(cond));
	Free(cond);
}
Beispiel #8
0
void GuiRendererD3D11::PushQuad(NFE_CONTEXT_ARG, const GuiQuad& quad)
{
    if (mQueuedQuads >= MAX_QUEUED_QUADS)
        FlushQueue(pContext);

    mQuads[mQueuedQuads] = quad;
    mQueuedQuads++;
}
Beispiel #9
0
void
FlushSem(Semaphore_t *sem, bool wait_ok)
{
	bool ints = SetInts(false);
	sem->value = 0;
	FlushQueue(&sem->queue, wait_ok);
	SetInts(ints);
}
Beispiel #10
0
void				
BroadcastCondition(Condition_t *cond)
{
	if ( cond->monitor->owner != mt_curr_task )
		Panic("BroadcastCondition %s: la tarea no posee el monitor %s", GetName(cond), GetName(cond->monitor));

	FlushQueue(&cond->queue, true);
}
Beispiel #11
0
void GuiRendererD3D11::Leave(NFE_CONTEXT_ARG)
{
    auto pCtx = (RenderContextD3D11*)pContext;
    auto pRenderer = pCtx->GetRenderer();
    FlushQueue(pCtx);

    pCtx->ResetShader(ShaderType::Geometry);
    pCtx->D3DContext->OMSetBlendState(pRenderer->defaultBlendState, 0, 0xFFFFFFFF);
}
Beispiel #12
0
void
DeleteSem(Semaphore_t *sem)
{
	bool ints = SetInts(false);
	FlushQueue(&sem->queue, false);
	Free(GetName(sem));
	Free(sem);
	SetInts(ints);
}
//
/// Runs this message thread, returns when the message queue quits. Initializes
/// instances. Runs the thread's message loop. Each of the virtual functions called
/// are expected to throw an exception if there is an error.
/// Exceptions that are not handled, that is, where the status remains non-zero, are
/// propagated out of this function. The message queue is still flushed and
/// TermInstance called.
//
int
TMsgThread::Run()
{
  int status = 0;
  try {
    InitInstance();
    LoopRunning = true;
    status = MessageLoop();
  }
  catch (...) {
    LoopRunning = false;
    FlushQueue();
    TermInstance(status);
    throw;
  }

  LoopRunning = false;
  FlushQueue();
  return TermInstance(status);
}
Beispiel #14
0
void Timbre::setArpeggiatorClock(float clockValue) {
    if (clockValue == CLOCK_OFF) {
        FlushQueue();
        note_stack.Clear();
    }
    if (clockValue == CLOCK_INTERNAL) {
        setNewBPMValue(params.engineArp1.BPM);
    }
    if (clockValue == CLOCK_EXTERNAL) {
        // Let's consider we're running
        running_ = 1;
    }
}
Beispiel #15
0
HRESULT CAMROutputPin::Inactive()
{
	if (!active) {
		return NOERROR;
	}
	active = FALSE;

	// destroy everything
	ev_abort.Set();
	HRESULT hr = CBaseOutputPin::Inactive();
	ASSERT(SUCCEEDED(hr));

	if (ThreadExists()) {
		CallWorker(CMD_EXIT);
		Close();
	}
	FlushQueue();
	ev_abort.Reset();

	return NOERROR;
}
Beispiel #16
0
CEcmtSdkPlugin::~CEcmtSdkPlugin()
{
    if (gEcmtSdkPlugin == this) {
        gEcmtSdkPlugin = NULL;
        CloseHandle(gEcmtSdkPluginThread);
        gEcmtSdkPluginThread = NULL;
    }

    if (iFlags & EWaitThreadCreated) {
        // Gracefully terminate the wait thread
        Emulator::Escape();
        WaitForSingleObject(iMutex, INFINITE);
        iFlags |= EWaitThreadExiting;
        SetEvent(iEvent);
        ReleaseMutex(iMutex);
        Emulator::Reenter();
        User::WaitForRequest(iWaitThreadStatus);
        iWaitThread.Close();
    }

    if (iFlags & EWorkThreadCreated) {
        // Stopper deletes itself when and if it gets chance to run.
        // We can't wait here until the thread is done because it may 
        // be blocked on REcmt.Connect waiting for us to respond. If
        // EcmtCore app is being terminated, the notify thread will 
        // get terminated, so we don't have much to lose anyway.
        TRequestStatus *status = (&iStopper->iStatus);
        iWorkThread.RequestComplete(status, KErrNone);
        iWorkThread.Close();
    } else {
        delete iStopper;
    }

    FlushQueue(ETrue);
    delete iRunner;
    if (iMutex) CloseHandle(iMutex);
    if (iEvent) CloseHandle(iEvent);
    TRACE1("[%08X] destroyed",this);
}
Beispiel #17
0
CPacketMan::~CPacketMan()
{
	// purge send and receive queue
	FlushQueue();
}
Beispiel #18
0
void Timbre::Tick() {
    ++tick_;

    if (note_stack.size()) {
        idle_ticks_ = 0;
    }
    ++idle_ticks_;
    if (idle_ticks_ >= 96) {
        idle_ticks_ = 96;
        if (params.engineArp1.clock == CLOCK_INTERNAL) {
            running_ = 0;
            FlushQueue();
        }
    }

    SendScheduledNotes();

    if (tick_ >= midi_clock_tick_per_step[(int)params.engineArp2.division]) {
        tick_ = 0;
        uint16_t pattern = getArpeggiatorPattern();
        uint8_t has_arpeggiator_note = (bitmask_ & pattern) ? 255 : 0;
        const int num_notes = note_stack.size();
        const int direction = params.engineArp1.direction;

        if (num_notes && has_arpeggiator_note) {
            if ( ARPEGGIO_DIRECTION_CHORD != direction ) {
                StepArpeggio();
                int step, transpose = 0;
                if ( current_direction_ > 0 ) {
                    step = start_step_ + current_step_;
                    if ( step >= num_notes ) {
                        step -= num_notes;
                        transpose = 12;
                    }
                } else {
                    step = (num_notes - 1) - (start_step_ + current_step_);
                    if ( step < 0 ) {
                        step += num_notes;
                        transpose = -12;
                    }
                }
#ifdef DEBUG_ARP_STEP
                lcd.setRealTimeAction(true);
                lcd.setCursor(16,0);
                lcd.print( current_direction_ > 0 ? '+' : '-' );
                lcd.print( step );
                lcd.setRealTimeAction(false);
#endif
                const NoteEntry &noteEntry = ARPEGGIO_DIRECTION_PLAYED == direction
                                             ? note_stack.played_note(step)
                                             : note_stack.sorted_note(step);

                uint8_t note = noteEntry.note;
                uint8_t velocity = noteEntry.velocity;
                note += 12 * current_octave_;
                if ( __canTranspose( direction ) )
                    note += transpose;

                while (note > 127) {
                    note -= 12;
                }

                SendNote(note, velocity);
            } else {
                for (int i = 0; i < note_stack.size(); ++i ) {
                    const NoteEntry& noteEntry = note_stack.sorted_note(i);
                    SendNote(noteEntry.note, noteEntry.velocity);
                }
            }
        }
        bitmask_ <<= 1;
        if (!bitmask_) {
            bitmask_ = 1;
        }
    }
}
Beispiel #19
0
void Timbre::OnMidiStop() {
    if (params.engineArp1.clock == CLOCK_EXTERNAL) {
        running_ = 0;
        FlushQueue();
    }
}
Beispiel #20
0
void CEcmtSdkPlugin::WorkThread()
{
    TRACE1("[%08X] plugin thread started",this);
    CTrapCleanup* cleanupStack = CTrapCleanup::New();
    if (cleanupStack) {

        // Initialize fake ui environment
        CCoeAppUi* ui = NULL;
        CEikonEnv* coe = new CEikonEnv;
        TRAPD(err, coe->ConstructL(EFalse));
        if (err == KErrNone)
        {
            // And fake app ui
            TRAP(err, coe->SetAppUi(ui = CAppUi::NewL()));

            // See private TApaStatus constants in apgwgnam.h
            const TInt ESystem = 0x01;
            const TInt EIsHidden = 0x20;

            // What a hack! See apgwgnam.cpp for details.
            // Note that the caption shows up in Diagnostics.
            _LIT(KCaption, "EcmtSdkPlugin");
            _LIT(KFormatStatus, "%02x");
            _LIT(KFormatUID, "%08x");
            TBuf<28> wgName;  // at least 13 + caption length
            wgName.Format(KFormatStatus, ESystem|EIsHidden);
            wgName.Append(0);
            wgName.AppendFormat(KFormatUID, KSDKPLUGIN_DLL_UID);
            wgName.Append(0);
            wgName.Append(KCaption);
            wgName.Append(0);
            coe->RootWin().SetName(wgName);
        }

        // CEikonEnv installs active scheduler
        CActiveScheduler* as = CActiveScheduler::Current();
        if (!as)
        {
            // Something is wrong with CEikonEnv, create our own
            as = new CActiveScheduler;
            if (as) {
                CActiveScheduler::Install(as);
            }
        }

        // At very least we need a live active scheduler. We can survive
        // without everything else until user picks File -> Open
        if (as)
        {
            CActiveScheduler::Add(iRunner);
            iStopper->Install();
            FlushQueue(EFalse);
            CActiveScheduler::Start();
        }

        // We are not supposed to get here
        delete ui;
        delete coe;
        delete cleanupStack;
    }
    TRACE1("[%08X] plugin thread exiting",this);
}
Beispiel #21
0
/***************************************************************************
 *
 * Waits for next X event, or for an auto-raise timeout.
 *
 ****************************************************************************/
int My_XNextEvent(Display *dpy, XEvent *event)
{
  extern int fd_width, x_fd;
  fd_set in_fdset, out_fdset;
  Window targetWindow;
  int i;

  DBUG("My_XNextEvent","Routine Entered");

  /* Do this IMMEDIATELY prior to select, to prevent any nasty
   * queued up X events from just hanging around waiting to be
   * flushed */
  XFlush(dpy);
  if(XPending(dpy))
    {
      DBUG("My_XNextEvent","taking care of queued up events & returning");
      XNextEvent(dpy,event);
      StashEventTime(event);
      return 1;
    }

  DBUG("My_XNextEvent","no X events waiting - about to reap children");
  /* Zap all those zombies! */
  /* If we get to here, then there are no X events waiting to be processed.
   * Just take a moment to check for dead children. */
  ReapChildren();

  FD_ZERO(&in_fdset);
  FD_SET(x_fd,&in_fdset);
  FD_ZERO(&out_fdset);
  for(i=0; i<npipes; i++)
    {
      if(readPipes[i]>=0)
	{
	  FD_SET(readPipes[i], &in_fdset);
	}
      if(pipeQueue[i]!= NULL)
	{
	  FD_SET(writePipes[i], &out_fdset);
	}
    }

  DBUG("My_XNextEvent","waiting for module input/output");
  XFlush(dpy);
  if (select((SELECT_TYPE_ARG1)fd_width,
             SELECT_TYPE_ARG234 &in_fdset,
             SELECT_TYPE_ARG234 &out_fdset,
             SELECT_TYPE_ARG234 0,
             SELECT_TYPE_ARG5   NULL) > 0)
  {

  /* Check for module input. */
  for(i=0;i<npipes;i++)
    {
      if(readPipes[i] >= 0)
	{
	  if(FD_ISSET(readPipes[i], &in_fdset))
	    {
	      if( read(readPipes[i],&targetWindow, sizeof(Window)) >0 )
		{
                  DBUG("My_XNextEvent","calling HandleModuleInput");
		  HandleModuleInput(targetWindow,i);
		}
              else
		{
                  DBUG("My_XNextEvent","calling KillModule");
		  KillModule(i,10);
		}
	    }
	}
      if(writePipes[i] >= 0)
	{
	  if(FD_ISSET(writePipes[i], &out_fdset))
	    {
              DBUG("My_XNextEvent","calling FlushQueue");
	      FlushQueue(i);
	    }
	}
    } /* for */
  }
  DBUG("My_XNextEvent","leaving My_XNextEvent");
  return 0;
}