Re: How can I get two threads to run simultaneously in a single process?
Originally Posted by Mike Pliam
Any idea how this might be accomplished ?
See your modified sample attached.
Code:
case SPEI_VISEME :
// Viseme was determined by synthesis engine. The high word of wParam is the duration, in milliseconds,
// of the current viseme. The low word is for the next viseme of type SPVISEMES. The high word of lParam
// is the viseme feature defined in SPVFEATURE. This value will be zero if the current viseme is not primary
// stress or emphasis. The low word of lParam is the current viseme being synthesized.
// wmId = LOWORD(wParam);
// wmEvent = HIWORD(wParam);
//_RPT1(0, "wmId = %d\n", wmId);
//_RPT1(0, "wmEvent = %d\n", wmEvent);
pVoice->GetStatus( &eventStatus, NULL );
ULONG viseme;
viseme = eventStatus.VisemeId;
_RPT1(0, "viseme = %d\n", viseme);
// now you know what viseme to render
// animation goes here below
// decide what bitmap to draw
bmpIdx = (viseme > 11); // simple animation:
// consonants are above 11,
// vowels are up to, therefore,
// mouth4.bmp will go for vowels,
// and test.bmp for consonants
// make your window to re-paint the sprite region
InvalidateRect(hWnd, NULL /* in fact you need your sprite rect here*/, FALSE);
break;
default:
break;
}
SpClearEvent( &eventItem );
}
break;
case WM_CREATE:
// pre-load sprite images
hBitmap[0] = (HBITMAP)LoadImage(hInst, L"mouth4.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
hBitmap[1] = (HBITMAP)LoadImage(hInst, L"test.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
break;
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc;
BITMAP bitmap;
HDC hdcMem;
HGDIOBJ oldBitmap;
hdc = BeginPaint(hWnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
oldBitmap = SelectObject(hdcMem, hBitmap[bmpIdx]);
GetObject(hBitmap[bmpIdx], sizeof(bitmap), &bitmap);
BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, oldBitmap);
DeleteDC(hdcMem);
EndPaint(hWnd, &ps);
break;
Last edited by Igor Vartanov; July 19th, 2012 at 05:48 AM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.