bool CTXVirtQueue::Create(UINT Index,
    VirtIODevice *IODevice,
    NDIS_HANDLE DrvHandle,
    ULONG MaxBuffers,
    ULONG HeaderSize,
    PPARANDIS_ADAPTER Context)
{
    if (!CVirtQueue::Create(Index, IODevice, DrvHandle)) {
        return false;
    }

    m_MaxBuffers = MaxBuffers;
    m_HeaderSize = HeaderSize;
    m_Context = Context;

    m_SGTableCapacity = m_Context->bUseIndirect ? virtio_get_indirect_page_capacity() : GetRingSize();

    auto SGBuffer = ParaNdis_AllocateMemoryRaw(m_DrvHandle, m_SGTableCapacity * sizeof(m_SGTable[0]));
    m_SGTable = static_cast<struct VirtIOBufferDescriptor *>(SGBuffer);

    if (m_SGTable == nullptr)
    {
        return false;
    }

    return PrepareBuffers();
}
Example #2
0
VOID CSoundRecDlg::StartRecording()
{	
	MMRESULT mRes;
	SetStatus("Recording...");

	try
	{
		OpenDevice();
		PrepareBuffers();
		mRes=waveInStart(m_hWaveIn);
		if(mRes!=0)
		{
			StoreError(mRes,FALSE,"File: %s ,Line Number:%d",__FILE__,__LINE__);
			throw m_csErrorText;
		}
		while(m_bRun)
		{
			SleepEx(100,FALSE);
		}
	}
	catch(PCHAR pErrorMsg)
	{
		AfxMessageBox(pErrorMsg);
	}
	CloseDevice();
	CloseHandle(m_hThread);
	m_hThread=NULL;
	SetStatus("Recording stopped...");
}
void clAudioSource_OpenAL::Play()
{
	if ( this->IsPlaying() ) return;

	if ( !m_DataProvider ) return;

	PrepareBuffers();

	alSourcePlay( m_SourceID );
}
	void StartRecording()
	{
		OpenDevice();
		
		m_dp.Init( SAMPLES_PER_SEC );
		
		PrepareBuffers();
		MMRESULT mRes=waveInStart(m_hWaveIn);
		if(mRes!=0)
			FAIL_M("bad");
	}
Example #5
0
HX_RESULT
CDecoder::SetData(UINT32 ulOffset, const char* pBuf, UINT32 ulCount)
{
    HX_RESULT hResult = HXR_OK;

    if (!m_bStarted)
    {
	m_bStarted = TRUE;
	hResult = Reset();

	if (FAILED(hResult))
	{
	    return hResult;
	}
    }

    if (SUCCEEDED(hResult))
    {
	// Make sure all of our buffers are big enough 
	// and copy the undecoded data to the input queue
	hResult = PrepareBuffers(pBuf, ulCount);

	if (SUCCEEDED(hResult))
	{
	    // Decode as much data as possible 
	    // and send it to the output sink
	    hResult = DecodeData();
	}
	else if (HXR_INCOMPLETE == hResult)
	{
	    // We failed simply because we don't yet have
	    // enough data to begin decompression. We'll
	    // just try again when the next chunk comes in.
            SetSeenIncomplete(TRUE);
	    hResult = HXR_OK;
	}
    }

    return hResult;
}
Example #6
0
bool TMD5Renderer::Create()
{
    
    shaderProgram = glCreateProgram();
    assert( 0!=shaderProgram );
    
    vertexShader = glCreateShader(GL_VERTEX_SHADER);
    assert( 0!=vertexShader );
    
    fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
    assert( 0!=fragmentShader );
    
    const std::string& root = TGremlinsFramework::GetInstance()->GetAssetRoot();
    
    
    
    char vertexShaderPath[1024];
    char fragmentShaderPath[1024];
    
#ifdef GL_ES_VERSION_2_0
    sprintf(vertexShaderPath, "%s%s",root.c_str(), "media/shaders/FlatShading.vs");
    sprintf(fragmentShaderPath, "%s%s",root.c_str(), "media/shaders/FlatShading.fs");
#else
    sprintf(vertexShaderPath, "%s%s",root.c_str(), "media/shaders/SkinnedMeshGL4.vs");
    sprintf(fragmentShaderPath, "%s%s",root.c_str(), "media/shaders/SkinnedMeshGL4.fs");
    
  //  sprintf(vertexShaderPath, "%s%s",root.c_str(), "EngineMedia/Shaders/SkinnedMeshGL4.vs");
   // sprintf(fragmentShaderPath, "%s%s",root.c_str(), "EngineMedia/Shaders/SkinnedMeshGL4.fs");
    
#endif
    
    
    bool loadVSOK = TGraphicsUtils::LoadShaderSource(vertexShader, vertexShaderPath);
    assert(loadVSOK);
    
    
    
    bool loadFSOK = TGraphicsUtils::LoadShaderSource(fragmentShader, fragmentShaderPath);
    assert(loadFSOK);
    
    glCompileShader(vertexShader);
    GLint status;
    glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &status);
    
    
    glCompileShader(fragmentShader);
    
    
    
    
    glAttachShader(shaderProgram, vertexShader);
    
    glAttachShader(shaderProgram, fragmentShader);
    assert( glGetError() == GL_NO_ERROR);
    
    
    glBindAttribLocation(shaderProgram, 0, "vertex");
    glBindAttribLocation(shaderProgram, 1, "normal");
    glBindAttribLocation(shaderProgram, 2, "tangent");
    glBindAttribLocation(shaderProgram, 3, "uv");
    glBindAttribLocation(shaderProgram, 4, "boneIndices");
    glBindAttribLocation(shaderProgram, 5, "weights");
    
    assert( glGetError() == GL_NO_ERROR);
    
    glLinkProgram(shaderProgram);
    
    if( ! TGraphicsUtils::CheckProgramStatus(shaderProgram, GL_LINK_STATUS))
    {
        TGraphicsUtils::DumpProgramInfoLog(shaderProgram);
    }

    assert( glGetError() == GL_NO_ERROR);
    
    
    assert( glGetError() == GL_NO_ERROR);
    
    
#ifdef GL_ES_VERSION_2_0
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glEnableVertexAttribArray(2);
    glEnableVertexAttribArray(3);
    glEnableVertexAttribArray(4);
    glEnableVertexAttribArray(5);
  
#else
    // use VAO and VBO in GLSL 4.1
    
       
   
    PrepareBuffers(md5Model);
    
    
    
    
    
    
#endif
    
    
    
    diffuseLocation = glGetUniformLocation(shaderProgram, "diffuse");
    assert( diffuseLocation != -1 );
    
    
    
    
    glValidateProgram(shaderProgram);
    
    if( ! TGraphicsUtils::CheckProgramStatus(shaderProgram, GL_VALIDATE_STATUS) )
    {
        TGraphicsUtils::DumpProgramInfoLog(shaderProgram);
    }
    else
    {
        TGraphicsUtils::PrintInBlock("Shader validation OK!");
    }

    assert( glGetError() == GL_NO_ERROR);
    
    
  
    
    glBindTexture(GL_TEXTURE_2D, 0);
    glUseProgram(0);
    
    viewMatrix = Matrix4::IDENTITY;
    projectionMatrix = Matrix4::IDENTITY;
    worldMatrix = Matrix4::IDENTITY;
    
    UpdateMatrix();
    SetLightPosition(Vector3(1.0f, 1.0f, 1.0f));
    SetEyePosition(Vector3(0.0f, 0.0f, 100.0f));
    nearPlane = 0.1f;
    farPlane = 1000.0f;
    
    
    return true;
}