コード例 #1
0
bool QAudioDeviceInfoInternal::isFormatSupported(
                                 const QAudioFormat &format) const
{
    getSupportedFormats();
    const bool supported =
            m_codecs.contains(format.codec())
        &&  m_frequencies.contains(format.frequency())
        &&  m_channels.contains(format.channels())
        &&  m_sampleSizes.contains(format.sampleSize())
        &&  m_byteOrders.contains(format.byteOrder())
        &&  m_sampleTypes.contains(format.sampleType());

    return supported;
}
コード例 #2
0
bool QAudioDeviceInfoInternal::isFormatSupported(
                                 const QAudioFormat &format) const
{
    getSupportedFormats();
    bool supported = false;
    if (m_capabilities.contains(format.codec())) {
        const Capabilities &codecCaps = m_capabilities[format.codec()];
        supported = codecCaps.m_frequencies.contains(format.frequency())
                &&  codecCaps.m_channels.contains(format.channels())
                &&  codecCaps.m_sampleSizes.contains(format.sampleSize())
                &&  codecCaps.m_byteOrders.contains(format.byteOrder())
                &&  codecCaps.m_sampleTypes.contains(format.sampleType());
    }
    return supported;
}
コード例 #3
0
OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
	assert(_transactionMode == kTransactionActive);

	uint transactionError = OSystem::kTransactionSuccess;

	bool setupNewGameScreen = false;
	if (   _oldState.gameWidth  != _currentState.gameWidth
	    || _oldState.gameHeight != _currentState.gameHeight) {
		setupNewGameScreen = true;
	}

#ifdef USE_RGB_COLOR
	if (_oldState.gameFormat != _currentState.gameFormat) {
		setupNewGameScreen = true;
	}

	// Check whether the requested format can actually be used.
	Common::List<Graphics::PixelFormat> supportedFormats = getSupportedFormats();
	// In case the requested format is not usable we will fall back to CLUT8.
	if (Common::find(supportedFormats.begin(), supportedFormats.end(), _currentState.gameFormat) == supportedFormats.end()) {
		_currentState.gameFormat = Graphics::PixelFormat::createFormatCLUT8();
		transactionError |= OSystem::kTransactionFormatNotSupported;
	}
#endif

	do {
		uint requestedWidth  = _currentState.gameWidth;
		uint requestedHeight = _currentState.gameHeight;
		const uint desiredAspect = getDesiredGameScreenAspect();
		requestedHeight = intToFrac(requestedWidth) / desiredAspect;

		if (!loadVideoMode(requestedWidth, requestedHeight,
#ifdef USE_RGB_COLOR
		                   _currentState.gameFormat
#else
		                   Graphics::PixelFormat::createFormatCLUT8()
#endif
		                  )
		   // HACK: This is really nasty but we don't have any guarantees of
		   // a context existing before, which means we don't know the maximum
		   // supported texture size before this. Thus, we check whether the
		   // requested game resolution is supported over here.
		   || (   _currentState.gameWidth  > (uint)Texture::getMaximumTextureSize()
		       || _currentState.gameHeight > (uint)Texture::getMaximumTextureSize())) {
			if (_transactionMode == kTransactionActive) {
				// Try to setup the old state in case its valid and is
				// actually different from the new one.
				if (_oldState.valid && _oldState != _currentState) {
					// Give some hints on what failed to set up.
					if (   _oldState.gameWidth  != _currentState.gameWidth
					    || _oldState.gameHeight != _currentState.gameHeight) {
						transactionError |= OSystem::kTransactionSizeChangeFailed;
					}

#ifdef USE_RGB_COLOR
					if (_oldState.gameFormat != _currentState.gameFormat) {
						transactionError |= OSystem::kTransactionFormatNotSupported;
					}
#endif

					if (_oldState.aspectRatioCorrection != _currentState.aspectRatioCorrection) {
						transactionError |= OSystem::kTransactionAspectRatioFailed;
					}

					if (_oldState.graphicsMode != _currentState.graphicsMode) {
						transactionError |= OSystem::kTransactionModeSwitchFailed;
					}

					// Roll back to the old state.
					_currentState = _oldState;
					_transactionMode = kTransactionRollback;

					// Try to set up the old state.
					continue;
				}
			}

			// DON'T use error(), as this tries to bring up the debug
			// console, which WON'T WORK now that we might no have a
			// proper screen.
			warning("OpenGLGraphicsManager::endGFXTransaction: Could not load any graphics mode!");
			g_system->quit();
		}

		// In case we reach this we have a valid state, yay.
		_transactionMode = kTransactionNone;
		_currentState.valid = true;
	} while (_transactionMode == kTransactionRollback);

	if (setupNewGameScreen) {
		delete _gameScreen;
		_gameScreen = nullptr;

#ifdef USE_RGB_COLOR
		_gameScreen = createTexture(_currentState.gameFormat);
#else
		_gameScreen = createTexture(Graphics::PixelFormat::createFormatCLUT8());
#endif
		assert(_gameScreen);
		if (_gameScreen->hasPalette()) {
			_gameScreen->setPalette(0, 256, _gamePalette);
		}

		_gameScreen->allocate(_currentState.gameWidth, _currentState.gameHeight);
		_gameScreen->enableLinearFiltering(_currentState.graphicsMode == GFX_LINEAR);
		// We fill the screen to all black or index 0 for CLUT8.
		if (_currentState.gameFormat.bytesPerPixel == 1) {
			_gameScreen->fill(0);
		} else {
			_gameScreen->fill(_gameScreen->getSurface()->format.RGBToColor(0, 0, 0));
		}
	}

	// Update our display area and cursor scaling. This makes sure we pick up
	// aspect ratio correction and game screen changes correctly.
	recalculateDisplayArea();
	recalculateCursorScaling();

	// Something changed, so update the screen change ID.
	++_screenChangeID;

	// Since transactionError is a ORd list of TransactionErrors this is
	// clearly wrong. But our API is simply broken.
	return (OSystem::TransactionError)transactionError;
}
コード例 #4
0
QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::sampleTypeList()
{
    getSupportedFormats();
    return m_unionCapabilities.m_sampleTypes;
}
コード例 #5
0
QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::byteOrderList()
{
    getSupportedFormats();
    return m_unionCapabilities.m_byteOrders;
}
コード例 #6
0
QList<int> QAudioDeviceInfoInternal::sampleSizeList()
{
    getSupportedFormats();
    return m_unionCapabilities.m_sampleSizes;
}
コード例 #7
0
QList<int> QAudioDeviceInfoInternal::channelsList()
{
    getSupportedFormats();
    return m_unionCapabilities.m_channels;
}
コード例 #8
0
QList<int> QAudioDeviceInfoInternal::frequencyList()
{
    getSupportedFormats();
    return m_unionCapabilities.m_frequencies;
}
コード例 #9
0
QStringList QAudioDeviceInfoInternal::codecList()
{
    getSupportedFormats();
    return m_capabilities.keys();
}
コード例 #10
0
QStringList QAudioDeviceInfoInternal::codecList()
{
    getSupportedFormats();
    return m_codecs;
}