Esempio n. 1
0
MP3::~MP3()
{
	if(m_hVideo !=NULL)
	{
		MCIWndDestroy(m_hVideo);
	}
}
Esempio n. 2
0
MCIOBJ::~MCIOBJ()
	  {
		if (m_video) {	
			MCIWndStop(m_video); 	
			MCIWndClose(m_video); 
			Sleep(1000);
			MCIWndDestroy(m_video); }
	  }  
Esempio n. 3
0
void CServerConnect::EndShowLogoAVI()
{
	if( m_hWndAVI )
	{
		MCIWndClose(m_hWndAVI);
		MCIWndDestroy(m_hWndAVI);
		m_hWndAVI = NULL;
	}
	MAINGAME->PauseRender( FALSE );
	m_bShowingLogoAVI = FALSE;
}
Esempio n. 4
0
BOOL MP3::Stop()
{
	MCIWndStop(m_hVideo);
	if(m_hVideo !=NULL)
	{
		MCIWndDestroy(m_hVideo);
	
	}

	return TRUE;
}
Esempio n. 5
0
static javacall_result audio_close(javacall_handle handle){

    audio_handle* pHandle = (audio_handle*)handle;

    if (NULL != pHandle->hWnd) {
        MCIWndClose(pHandle->hWnd);
        MCIWndDestroy(pHandle->hWnd);
        pHandle->hWnd = NULL;
    }

    if (handle) {
        FREE(handle);
    }

    return JAVACALL_OK;
}
Esempio n. 6
0
int main(int argc, char *argv[])
{
	MSG msg;
	HWND hWnd;
	int deviceID, result;

   	hWnd = MCIWndCreate(NULL, NULL,
		   	WS_OVERLAPPED | WS_CAPTION | WS_BORDER | WS_SYSMENU |
		   	WS_VISIBLE | MCIWNDF_RECORD | MCIWNDF_SHOWALL, NULL);

	MCIWndNew(hWnd, "waveaudio");
	MCI_WAVE_SET_PARMS set_parms;
	set_parms.wFormatTag      = WAVE_FORMAT_PCM;
	set_parms.wBitsPerSample  = 16;
	set_parms.nChannels       = 1;
	set_parms.nBlockAlign     = (set_parms.nChannels*set_parms.wBitsPerSample)/8;
	set_parms.nSamplesPerSec  = 44100;
	set_parms.nAvgBytesPerSec = ((set_parms.wBitsPerSample) *
		   	set_parms.nChannels *
			set_parms.nSamplesPerSec) / 8;

	// now send the format changes with MCI_SET
	deviceID = MCIWndGetDeviceID(hWnd);
	result = mciSendCommand(deviceID, MCI_SET,
			MCI_WAIT
			| MCI_WAVE_SET_FORMATTAG
			| MCI_WAVE_SET_BITSPERSAMPLE
			| MCI_WAVE_SET_CHANNELS
			| MCI_WAVE_SET_SAMPLESPERSEC
			| MCI_WAVE_SET_AVGBYTESPERSEC
			| MCI_WAVE_SET_BLOCKALIGN,
			(DWORD)(LPVOID)&set_parms);
	MCIWndRecord(hWnd);  //开始录制

	while (GetMessage(&msg, NULL, 0, 0)) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	MCIWndStop(hWnd);  //录制完毕
	MCIWndSave(hWnd, L"abc.wav");   //保存
	MCIWndClose(hWnd);
	MCIWndDestroy(hWnd);
	return 0;
}
Esempio n. 7
0
LRESULT CALLBACK MCIDlgHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	char szFileName[MAX_PATH];
	MCIOBJ * st;
	
	st = (MCIOBJ *) actobject;
    if ((st==NULL)||(st->type!=OB_MCIPLAYER)) return(FALSE);

	switch( message ) 
	{
	case WM_INITDIALOG:
			SetDlgItemText(hDlg, IDC_MCIFILE, st->mcifile);
			SCROLLINFO lpsi;
		    lpsi.cbSize=sizeof(SCROLLINFO);
			lpsi.fMask=SIF_RANGE|SIF_POS;
			lpsi.nMin=4; lpsi.nMax=5000;
			SetScrollInfo(GetDlgItem(hDlg,IDC_SPEEDUPDATEBAR),SB_CTL,&lpsi, TRUE);
			SetScrollPos(GetDlgItem(hDlg,IDC_SPEEDUPDATEBAR), SB_CTL,st->upd_speed, TRUE);
			SetDlgItemInt(hDlg, IDC_UPDATESPEED, st->upd_speed, FALSE);
			SetDlgItemInt(hDlg, IDC_POS_CENTER, st->pos_center, FALSE);
			CheckDlgButton(hDlg, IDC_PLAY_ONCE, st->play_once);
		return TRUE;
        
	case WM_CLOSE:
		 EndDialog(hDlg, LOWORD(wParam));
		break;
    case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		  case IDC_OPEN:
			  if (!(strcmp(st->mcifile,"none")))
			  {
				strcpy(szFileName,GLOBAL.resourcepath);
				strcat(szFileName,"MOVIES\\*.avi");
			  } else strcpy (szFileName,st->mcifile);

			if (open_file_dlg(hDlg, szFileName, FT_AVI, OPEN_LOAD)) 
			{

				st->playing=FALSE;
				strcpy(st->mcifile,szFileName);
				SetDlgItemText(hDlg, IDC_MCIFILE, st->mcifile); 
			}
			InvalidateRect(hDlg,NULL,FALSE);
			break;
		  case IDC_PLAY_ONCE:
			  st->play_once=IsDlgButtonChecked(hDlg,IDC_PLAY_ONCE);
			  break;
		    case IDC_LOAD:
				if (st->m_video) {	MCIWndStop(st->m_video); 	MCIWndDestroy(st->m_video); }
				
				st->m_video = MCIWndCreate(ghWndMain, hInst,WS_VISIBLE|WS_THICKFRAME|MCIWNDF_NOERRORDLG,st->mcifile);

				if (!st->m_video)  report_error ("Cannot open MCI File");
				else
				{
					RECT prc;

					MCIWndSetZoom(st->m_video,100);
					MCIWndGetSource(st->m_video,&prc);
					MCIWndSetTimeFormat(st->m_video ,"ms");
					MCIWndSetActiveTimer(st->m_video,500);
					if ((!strstr(st->mcifile,".mp3")) && (!strstr(st->mcifile,".wav"))) 
						SetWindowPos(st->m_video,HWND_TOPMOST,st->left,st->top,st->left+prc.right-prc.left,st->top+prc.bottom-prc.top,SWP_SHOWWINDOW);
					else ShowWindow(st->m_video,FALSE);
					
				}
				break;
			case IDC_MCIPLAY:
					
				if (st->m_video)
				{
					MCIWndSetSpeed(st->m_video,st->speed);
					MCIWndPlay(st->m_video);
					st->playing=TRUE;
				}
		 		break;
				case IDC_MCISTOP:
					if (st->m_video) {	MCIWndStop(st->m_video);}  //	MCIWndDestroy(st->m_video); }
					st->playing=FALSE;
					break;

				case IDC_MCIPLUS:
					st->speed+=50;
					if (st->m_video) { 
						MCIWndSetSpeed(st->m_video,st->speed); //MCIWndStep(st->m_video,2); 
						MCIWndPlay(st->m_video); }
					break;

				case IDC_MCIMINUS:
					st->speed-=50;
					if (st->m_video) 	{  MCIWndSetSpeed(st->m_video,st->speed); 		//MCIWndStep(st->m_video,2); 
					MCIWndPlay(st->m_video);
					}
					break;
				case IDC_POS_CENTER:
					st->pos_center=GetDlgItemInt(hDlg,IDC_POS_CENTER,0,FALSE);

					break;

		}
		break;
	
		case WM_HSCROLL:
		{
			int nNewPos; 
			nNewPos = get_scrollpos(wParam,lParam);
			if (lParam == (long) GetDlgItem(hDlg,IDC_SPEEDUPDATEBAR))  
			{
					SetDlgItemInt(hDlg, IDC_UPDATESPEED, nNewPos, TRUE);
                    st->upd_speed=nNewPos;
			}
			break;
		}

		case WM_SIZE:
		case WM_MOVE:  update_toolbox_position(hDlg);
		break;

	}
   return FALSE;
}