当前位置: 首页>>代码示例>>C++>>正文


C++ MessageManagerLock类代码示例

本文整理汇总了C++中MessageManagerLock的典型用法代码示例。如果您正苦于以下问题:C++ MessageManagerLock类的具体用法?C++ MessageManagerLock怎么用?C++ MessageManagerLock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MessageManagerLock类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: logMessage

        void logMessage (const String& message)
        {
            MessageManagerLock mm (this);

            if (mm.lockWasGained()) // this lock may fail if this thread has been told to stop
                owner.logMessage (message);
        }
开发者ID:AmirooR,项目名称:JUCE,代码行数:7,代码来源:UnitTestsDemo.cpp

示例2: run

    void run()
    {
       #if JUCE_LINUX
        {
            MessageManagerLock mml (this);

            if (! mml.lockWasGained())
                return;

            owner.updateContext();
            owner.updateContextPosition();
        }
       #endif

        while (! threadShouldExit())
        {
            const uint32 startOfRendering = Time::getMillisecondCounter();

            if (! owner.performRender())
                break;

            const int elapsed = (int) (Time::getMillisecondCounter() - startOfRendering);
            Thread::sleep (jmax (1, (1000 / 60) - elapsed));
        }

       #if JUCE_LINUX
        owner.deleteContext();
       #endif
    }
开发者ID:adscum,项目名称:MoogLadders,代码行数:29,代码来源:juce_OpenGLComponent.cpp

示例3: run

    //==============================================================================
    void run()
    {
        {
            // Allow the message thread to finish setting-up the context before using it..
            MessageManagerLock mml (this);
            if (! mml.lockWasGained())
                return;
        }

        nativeContext->makeActive();
        initialiseOnThread();

       #if JUCE_USE_OPENGL_SHADERS && ! JUCE_OPENGL_ES
        shadersAvailable = OpenGLShaderProgram::getLanguageVersion() > 0;
       #endif

        while (! threadShouldExit())
        {
            const uint32 frameRenderStartTime = Time::getMillisecondCounter();

            if (renderFrame())
                waitForNextFrame (frameRenderStartTime);
        }

        shutdownOnThread();
    }
开发者ID:sonic59,项目名称:JuceDirect2D,代码行数:27,代码来源:juce_OpenGLContext.cpp

示例4: mml

void LAudioAppComponent::getNextAudioBlock( const AudioSourceChannelInfo& bufferToFill ) {
    if(stopped
            || !audioOpen
            || !hasCallback("getNextAudioBlock") 
            || (audioOpen && audioSourcePlayer.getCurrentSource()==nullptr) )
    {
        bufferToFill.clearActiveBufferRegion();
        return;
    }
    if(hasCallback("getNextAudioBlock")) {
        MessageManagerLock mml (Thread::getCurrentThread());
            if (! mml.lockWasGained()) {
                DBG("CAN'T GET LOCK");
                return; // another thread is trying to kill us!
            }
        LAudioSampleBuffer audioBuffer(Ls, *bufferToFill.buffer);
        callback("getNextAudioBlock", 0, {
                bufferToFill.startSample,
                bufferToFill.numSamples,
                bufferToFill.buffer->getNumChannels(),
                new LRefBase("AudioSampleBuffer", &audioBuffer)
        });
        if(volume>-1) {
            if(volume) bufferToFill.buffer->applyGain(volume);
            else bufferToFill.clearActiveBufferRegion();
        }
    }
}
开发者ID:peersuasive,项目名称:luce,代码行数:28,代码来源:LAudioAppComponent.cpp

示例5: postLocked

void PostWindowController::postLocked(const String& textToWrite,
                                      const PostLevel pl,
                                      bool isBold)
{
    const MessageManagerLock mmLock;
    if(mmLock.lockWasGained())
        post(textToWrite, pl, isBold);
}
开发者ID:alessandrostone,项目名称:SaM-Designer,代码行数:8,代码来源:PostWindowController.cpp

示例6: mm

bool LMRecorder::getCurrentFrame(GestureFrame &gestureFrame)
{
	{
	      MessageManagerLock mm (Thread::getCurrentThread());
	      if (! mm.lockWasGained())
		      return false;
	}
	
	ScopedLock frameLock(frameMutex);
	if (currentFrame != NULL) {
		gestureFrame = *currentFrame;
		return true;
	}
	return false;
}
开发者ID:Belial2010,项目名称:LeapGesture-library,代码行数:15,代码来源:LMRecorder.cpp

示例7: paintComponent

    void paintComponent()
    {
        if (needsUpdate)
        {
            MessageManagerLock mm (this);
            if (! mm.lockWasGained())
                return;

            needsUpdate = false;

            // you mustn't set your own cached image object when attaching a GL context!
            jassert (get (component) == this);

            const Rectangle<int> bounds (component.getLocalBounds());
            if (! ensureFrameBufferSize (bounds.getWidth(), bounds.getHeight()))
                return;

            RectangleList invalid (bounds);
            invalid.subtract (validArea);
            validArea = bounds;

            if (! invalid.isEmpty())
            {
                clearRegionInFrameBuffer (invalid);

                {
                    ScopedPointer<LowLevelGraphicsContext> g (createOpenGLGraphicsContext (context, cachedImageFrameBuffer));
                    g->clipToRectangleList (invalid);
                    paintOwner (*g);
                    JUCE_CHECK_OPENGL_ERROR
                }

                if (! context.isActive())
                    context.makeActive();
            }

            JUCE_CHECK_OPENGL_ERROR
        }
开发者ID:alessandrostone,项目名称:scumbler,代码行数:38,代码来源:juce_OpenGLContext.cpp

示例8: sl

bool OpenGLComponent::performRender()
{
    const ScopedLock sl (contextLock);

   #if JUCE_LINUX
    updateContext();
   #endif

    if (context != nullptr)
    {
        if (! makeCurrentRenderingTarget())
            return false;

        if (needToUpdateViewport)
        {
            needToUpdateViewport = false;
            glViewport (0, 0, getWidth(), getHeight());
        }

        renderOpenGL();

        if (needToRepaint && (flags & allowSubComponents) != 0)
        {
            needToRepaint = false;

            contextLock.exit(); // (MM must be locked before the context lock)
            MessageManagerLock mmLock (renderThread);
            contextLock.enter();

            if (! mmLock.lockWasGained())
                return false;

            // you mustn't set your own cached image object for an OpenGLComponent!
            jassert (dynamic_cast<OpenGLCachedComponentImage*> (getCachedComponentImage()) == cachedImage);

            const Rectangle<int> bounds (getLocalBounds());
            OpenGLFrameBuffer& frameBuffer = cachedImage->getFrameBuffer (bounds.getWidth(), bounds.getHeight());

            {
                RectangleList invalid (bounds);
                invalid.subtract (cachedImage->validArea);
                cachedImage->validArea = bounds;

                if (! invalid.isEmpty())
                {
                    jassert (getCurrentContext() != nullptr);

                    {
                        OpenGLGraphicsContext g (*getCurrentContext(), frameBuffer);
                        g.clipToRectangleList (invalid);

                        g.setFill (Colours::transparentBlack);
                        g.fillRect (bounds, true);
                        g.setFill (Colours::black);

                        paintSelf (g);
                    }

                    makeCurrentRenderingTarget();
                }
            }

            glEnable (GL_TEXTURE_2D);
            context->extensions.glActiveTexture (GL_TEXTURE0);
            glBindTexture (GL_TEXTURE_2D, frameBuffer.getTextureID());

            context->copyTexture (bounds, Rectangle<int> (bounds.getWidth(),
                                                          bounds.getHeight()));
            glBindTexture (GL_TEXTURE_2D, 0);
        }

        swapBuffers();
    }

    return true;
}
开发者ID:adscum,项目名称:MoogLadders,代码行数:76,代码来源:juce_OpenGLComponent.cpp


注:本文中的MessageManagerLock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。