/*----------------------------------------------------------------------------- Name : binkOpen Description : wrapper for opening a Bink video file Inputs : filename - name of the Bink video file to open Outputs : Return : TRUE or FALSE ----------------------------------------------------------------------------*/ static bool binkOpen(char* filename) { char fullname[1024]; char cdname[1024]; char* dir; // get CD path strcpy(cdname,filePathPrepend(filename,FF_CDROM)); dir = getenv("HW_Data"); if (dir == NULL) { // set default path strcpy(fullname, filename); } else { // set HW_Data path strcpy(fullname, dir); strcat(fullname, "\\"); strcat(fullname, filename); } BinkSoundUseDirectSound(NULL); // try default path or HW_Data path bnk = BinkOpen(fullname, BINKNOTHREADEDIO); if (!bnk) { // try filename alone bnk = BinkOpen(filename, BINKNOTHREADEDIO); if (!bnk) { // try CD path bnk = BinkOpen(cdname, BINKNOTHREADEDIO); if (!bnk) { return FALSE; } } } // BinkSetSoundOnOff(bnk, 0); binkFrameRate = (real32)bnk->FrameRate / (real32)bnk->FrameRateDiv; return TRUE; }
void BinkInitialize(HWND hWindow, UINT32 uiWidth, UINT32 uiHeight) { //HDIGDRIVER pSoundDriver = NULL; void* pSoundDriver = NULL; //Get the sound Driver handle pSoundDriver = SoundGetDriverHandle(); //if we got the sound handle, use sound during the intro if( pSoundDriver ) { BinkSoundUseDirectSound( pSoundDriver ); } guiHeight = uiHeight; }
ITextureVideo::ITextureVideo(ITextureManager *manager, IString filename) : ITexture(manager,filename) { #if USE_BINK BinkSoundUseDirectSound( 0 ); Bink = BinkOpen( filename, 0 ); if (Bink) { int width=2; int height=2; while (width<Bink->Width) width*=2; while (height<Bink->Height) height*=2; m_pBuffer.SetImage(width,height); printf("Video loaded\n"); }else printf("Video loading error\n"); #endif }
int PASCAL WinMain( HINSTANCE instance, HINSTANCE previous_instance, LPSTR cmd_line, int cmd_show ) { // // Win32 locals. // HWND window = 0; MSG msg; // // Try to create our window. // window = Build_window_handle( instance, previous_instance ); if ( !window ) { MessageBox( 0, "Error creating window.", "Windows", MB_OK | MB_ICONSTOP ); return( 1 ); } // // Tell Bink to use DirectSound (must be before BinkOpen)! // BinkSoundUseDirectSound( 0 ); // // Try to open the Bink file. // Bink = BinkOpen( cmd_line, 0 ); if ( !Bink ) { MessageBox( window, BinkGetError( ), "Bink Error", MB_OK | MB_ICONSTOP ); DestroyWindow( window ); return( 3 ); } // // Try to open the Bink buffer. // Bink_buffer = BinkBufferOpen( window, Bink->Width, Bink->Height, 0 ); if ( !Bink_buffer ) { MessageBox( window, BinkBufferGetError( ), "Bink Error", MB_OK | MB_ICONSTOP ); DestroyWindow( window ); BinkClose( Bink ); return( 4 ); } // // Size the window such that its client area exactly fits our Bink movie. // SetWindowPos( window, 0, 0, 0, Bink_buffer->WindowWidth, Bink_buffer->WindowHeight, SWP_NOMOVE ); // // Now display the window and start the message loop. // ShowWindow( window, cmd_show ); for ( ; ; ) { // // Are there any messages to handle? // if ( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) ) { // // Yup, handle them. // if ( msg.message == WM_QUIT ) break; TranslateMessage( &msg ); DispatchMessage( &msg ); } else { // // Is it time for a new Bink frame? // if ( !BinkWait( Bink ) ) { // // Yup, draw the next frame. // Show_next_frame( Bink, Bink_buffer, window ); } else { // // Nope, give the rest of the system a chance to run (500 MICROseconds). // Good_sleep_us( 500 ); } } } // // Close the Bink file. // if ( Bink ) { BinkClose( Bink ); Bink = 0; } // // Close the Bink buffer. // if ( Bink_buffer ) { BinkBufferClose( Bink_buffer ); Bink_buffer = 0; } // // And exit. // return( 0 ); }