Beispiel #1
0
uint32 VisualAudioLab::getRemainingTimeOfCurrentTrack()
{
    if (theVisualAudioLab->totalTimeOfTrack == 0) {
        return 0;
    }

    VisualPlayerState* theVisualPlayerState = VisualPlayerState::getInstance();
    uint32 elapsedTime = theVisualPlayerState->getElapsedAudioTime();
    if (theVisualAudioLab->totalTimeOfTrack < elapsedTime) {
        return 0;
    }
    return theVisualAudioLab->totalTimeOfTrack - elapsedTime;
}
Beispiel #2
0
void monitorRenderMessageProcess() {
	
	static float framesPerSecond = 0.0f;
	static uint16 frameCount = 0;
	uint32 elapsedMilliseconds = 0;
	uint32 remainingMilliseconds = 0;
	VisualPlayerState* theVisualPlayerState = NULL;
	VisualGraphics* theVisualGraphics = NULL;
	uint8 playState;
	char cStr64[64];
	
	theVisualPlayerState = VisualPlayerState::getInstance();
	
    elapsedMilliseconds = VisualTiming::getElapsedMilliSecsSinceReset("fps");
    
    if (elapsedMilliseconds > 1000) {
        framesPerSecond = (float)frameCount / (float)elapsedMilliseconds * 1000.0f;
        frameCount = 0;
        VisualTiming::resetTimestamp("fps");
    }
	frameCount++;
    
    sprintf(cStr64, "%.2f",  framesPerSecond);
    setProcessInfo("FramesPerSecond", cStr64);
	
	theVisualGraphics = VisualGraphics::getInstance();
	
	setProcessInfo("RendererName",theVisualGraphics->getRendererName());
	
	setProcessInfo("RendererVendor",theVisualGraphics->getRendererVendor());
	
	setProcessInfo("RendererVersion",theVisualGraphics->getRendererVersion());
	
	sprintf(cStr64, "%#x", theVisualGraphics->getGLVersion());
	setProcessInfo("GLVersion", cStr64);
	
	sprintf(cStr64, "%ld", theVisualGraphics->getMaxTextureSize());
	setProcessInfo("Maximum Texture Size", cStr64);
	
	// screen measurements
	PixelRect screenRect = theVisualGraphics->getScreenRect();
	sprintf(cStr64, "width: %d, height: %d, refreshRate: %d", screenRect.width, screenRect.height, theVisualGraphics->getRefreshRateOfScreen());
	setProcessInfo("Screen", cStr64);
	
	sprintf(cStr64, "%d", theVisualGraphics->getBitsPerPixelOfScreen());
	setProcessInfo("BitsPerPixel", cStr64);
	
	sprintf(cStr64, "%d", theVisualGraphics->getCanvasPixelHeight());
	setProcessInfo("CanvasPixelHeight", cStr64);
	
	sprintf(cStr64, "%d", theVisualGraphics->getCanvasPixelWidth());
	setProcessInfo("CanvasPixelWidth", cStr64);
	
	BottomLeftPositionedPixelRect theCanvasRect;
	theCanvasRect = theVisualGraphics->getCanvasRect();
	sprintf(cStr64, "bottom: %d, left: %d", theCanvasRect.bottomLeftPixel.y, theCanvasRect.bottomLeftPixel.x);
	setProcessInfo("CanvasRectTopLeft", cStr64);
	sprintf(cStr64, "width: %d, height: %d", theCanvasRect.pixelRect.width, theCanvasRect.pixelRect.height);
	setProcessInfo("CanvasRectWidthHeight", cStr64);
	
	/*
	 sprintf(cStr64, "top: %.2f, left: %.2f", theVisualGraphics->getMaxTopCoordOfCanvas(), theVisualGraphics->getMaxLeftCoordOfCanvas());
	 setProcessInfo("CoordMaxTopLeft", cStr64);
	 sprintf(cStr64, "bottom: %.2f, right: %.2f", theVisualGraphics->getMaxBottomCoordOfCanvas(), theVisualGraphics->getMaxRightCoordOfCanvas());
	 setProcessInfo("CoordMaxBottomRight", cStr64);
	 sprintf(cStr64, "near: %.2f, far: %.2f", theVisualGraphics->getMaxNearCoordOfCanvas(), theVisualGraphics->getMaxFarCoordOfCanvas());
	 setProcessInfo("CoordMaxNearFar", cStr64);
	 */
	
	BottomLeftPositionedPixelRect bottomLeftPositionedPixelRect = theVisualGraphics->getViewportRect();
	sprintf(cStr64, "bottom: %d, left: %d, width: %d, height: %d",  bottomLeftPositionedPixelRect.bottomLeftPixel.y, bottomLeftPositionedPixelRect.bottomLeftPixel.x, bottomLeftPositionedPixelRect.pixelRect.width, bottomLeftPositionedPixelRect.pixelRect.height);
	setProcessInfo("ViewportRect", cStr64);
	
	playState = theVisualPlayerState->getAudioPlayState();
	switch (playState) {
		case kAudioIsPlaying:
			sprintf(cStr64, "kAudioIsPlaying");
			break;
		case kAudioPlayStarted:
			sprintf(cStr64, "kAudioPlayStarted");
			break;		
		case kAudioPlayResumed:
			sprintf(cStr64, "kAudioPlayResumed");
			break;
		case kAudioPlayPaused:
			sprintf(cStr64, "kAudioPlayPaused");
			break;
		case kAudioIsNotPlaying:
			sprintf(cStr64, "kAudioIsNotPlaying");
			break;
		default:
			sprintf(cStr64, "unknown");
	}
	setProcessInfo("AudioPlayState", cStr64);
	
	elapsedMilliseconds = theVisualPlayerState->getElapsedAudioTime();
	sprintf(cStr64, "%d", elapsedMilliseconds);
	setProcessInfo("TrackTimeElapsed", cStr64);
	
	remainingMilliseconds = theVisualPlayerState->getRemainingAudioTime();
	sprintf(cStr64, "%d", remainingMilliseconds);
	setProcessInfo("TrackTimeRemaining", cStr64);
	
}