void OpenGLES30FormatTest::LoadResources()
{
	Font *font = FTFont::Create("~res:/Fonts/korinna.ttf");
    DVASSERT(font);
	font->SetSize(20);

	UIButton *testButton = new UIButton(Rect(0, 0, 300, 30));
	testButton->SetStateFont(0xFF, font);
	testButton->SetStateText(0xFF, L"Finish Test");
 	testButton->SetStateFontColor(0xFF, Color::White);
	testButton->SetDebugDraw(true);
	testButton->AddEvent(UIControl::EVENT_TOUCH_UP_INSIDE, Message(this, &OpenGLES30FormatTest::ButtonPressed));
	AddControl(testButton);
    testButton->Release();

    formatName = new UIStaticText(Rect(0, 30, 300, 30));
    formatName->SetFont(font);
    formatName->SetTextColor(Color::White);
    AddControl(formatName);
    
    source = new UIControl(Rect(0, 60, 256, 256));
    AddControl(source);

    decodedSource = new UIControl(Rect(0, 330, 256, 256));
    AddControl(decodedSource);
    
    encodedSource = new UIControl(Rect(300, 330, 256, 256));
    AddControl(encodedSource);
    
    LoadFormat("RG11");
}
//
//  Initialize the capturer.
//
bool CWASAPICapture::Initialize(UINT32 EngineLatency)
{
    //
    //  Create our shutdown event - we want auto reset events that start in the not-signaled state.
    //
    _ShutdownEvent = CreateEventEx(NULL, NULL, 0, EVENT_MODIFY_STATE | SYNCHRONIZE);
    if (_ShutdownEvent == NULL)
    {
        printf_s("Unable to create shutdown event: %d.\n", GetLastError());
        return false;
    }    

    //
    //  Now activate an IAudioClient object on our preferred endpoint and retrieve the mix format for that endpoint.
    //
    HRESULT hr = _Endpoint->Activate(__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, reinterpret_cast<void **>(&_AudioClient));
    if (FAILED(hr))
    {
        printf_s("Unable to activate audio client: %x.\n", hr);
        return false;
    }

    hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&_DeviceEnumerator));
    if (FAILED(hr))
    {
        printf_s("Unable to instantiate device enumerator: %x\n", hr);
        return false;
    }

    //
    // Load the MixFormat.  This may differ depending on the shared mode used
    //
    if (!LoadFormat())
    {
        printf_s("Failed to load the mix format \n");
        return false;
    }

    //
    //  Remember our configured latency
    //
    _EngineLatencyInMS = EngineLatency;

    if (!InitializeAudioEngine())
    {
        return false;
    }

    return true;
}
Beispiel #3
0
//
//  Initialize the capturer.
//
bool CWASAPICapture::Initialize(UINT32 EngineLatency)
{
    //
    //  Create our shutdown event - we want auto reset events that start in the not-signaled state.
    //
    _ShutdownEvent = CreateEventEx(NULL, NULL, 0, EVENT_MODIFY_STATE | SYNCHRONIZE);
    PersistentAssert(_ShutdownEvent != NULL, "CreateEventEx failed");
    
    //
    //  Create our stream switch event- we want auto reset events that start in the not-signaled state.
    //  Note that we create this event even if we're not going to stream switch - that's because the event is used
    //  in the main loop of the capturer and thus it has to be set.
    //
    _StreamSwitchEvent = CreateEventEx(NULL, NULL, 0, EVENT_MODIFY_STATE | SYNCHRONIZE);
    PersistentAssert(_StreamSwitchEvent != NULL, "CreateEventEx failed");
    
    //
    //  Now activate an IAudioClient object on our preferred endpoint and retrieve the mix format for that endpoint.
    //
    HRESULT hr = _Endpoint->Activate(__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, reinterpret_cast<void **>(&_AudioClient));
    PersistentAssert(SUCCEEDED(hr), "_Endpoint->Activate failed");

    hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&_DeviceEnumerator));
    PersistentAssert(SUCCEEDED(hr), "CoCreateInstance failed");

    //
    // Load the MixFormat.  This may differ depending on the shared mode used
    //
    LoadFormat();
    
    //
    //  Remember our configured latency in case we'll need it for a stream switch later.
    //
    _EngineLatencyInMS = EngineLatency;

    InitializeAudioEngine();
    return true;
}
void OpenGLES30FormatTest::TestFunction(TestTemplate<OpenGLES30FormatTest>::PerfFuncData *data)
{
    LoadFormat(FORMAT_NAMES[currentFormatIndex]);
    
    currentFormatIndex = Clamp((uint32)(onScreenTime / TEST_TIME), 0u, FORMATS_COUNT - 1);
}