コード例 #1
0
ファイル: Cassette.cpp プロジェクト: vcc6809/VCC
void SetTapeCounter(unsigned int Count)
{
	TapeOffset=Count;
	if (TapeOffset>TotalSize)
		TotalSize=TapeOffset;
	UpdateTapeCounter(TapeOffset,TapeMode);
	return;
}
コード例 #2
0
ファイル: Cassette.cpp プロジェクト: vcc6809/VCC
void LoadCassetteBuffer(unsigned char *CassBuffer)
{
	unsigned long BytesMoved=0;
	if (TapeMode!=PLAY)
		return;
	switch (FileType)
	{
	case WAV:
		SetFilePointer(TapeHandle,TapeOffset+44,0,FILE_BEGIN);
		ReadFile(TapeHandle,CassBuffer,TAPEAUDIORATE/60,&BytesMoved,NULL);
		TapeOffset+=BytesMoved;
		if (TapeOffset>TotalSize)
			TapeOffset=TotalSize;
	break;

	case CAS:
		CastoWav(CassBuffer,TAPEAUDIORATE/60,&BytesMoved);
	break;
	}

	UpdateTapeCounter(TapeOffset,TapeMode);
	return;
}
コード例 #3
0
ファイル: Cassette.cpp プロジェクト: vcc6809/VCC
void FlushCassetteBuffer(unsigned char *Buffer,unsigned int Lenth)
{
	if (TapeMode!=REC) 
		return;

	switch(FileType)
	{
	case WAV:
		SetFilePointer(TapeHandle,TapeOffset+44,0,FILE_BEGIN);
		WriteFile(TapeHandle,Buffer,Lenth,&BytesMoved,NULL);
		if (Lenth!=BytesMoved)
			return;
		TapeOffset+=Lenth;
		if (TapeOffset>TotalSize)
			TotalSize=TapeOffset;
	break;

	case CAS:
		WavtoCas(Buffer, Lenth);
		break;
	}
	UpdateTapeCounter(TapeOffset,TapeMode);
	return;
}
コード例 #4
0
ファイル: Cassette.cpp プロジェクト: vcc6809/VCC
void SetTapeMode(unsigned char Mode)	//Handles button pressed from Dialog
{
	TapeMode=Mode;
	switch (TapeMode)
	{
		case STOP:

		break;

		case PLAY:
			if (TapeHandle==NULL)
				if (!LoadTape())
					TapeMode=STOP;
				else
					TapeMode=Mode;

			if (MotorState)
				Motor(1);
		break;

		case REC:
			if (TapeHandle==NULL)
				if (!LoadTape())
					TapeMode=STOP;
				else
					TapeMode=Mode;
		break;

		case EJECT:
			CloseTapeFile();
			strcpy(TapeFileName,"EMPTY");
		break;
	}
	UpdateTapeCounter(TapeOffset,TapeMode);
	return;
}
コード例 #5
0
ファイル: config.c プロジェクト: VCCE/VCC
LRESULT CALLBACK TapeConfig(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
//	HWND hCounter=NULL;
	CounterText.cbSize = sizeof(CHARFORMAT);
	CounterText.dwMask = CFM_BOLD | CFM_COLOR ;
	CounterText.dwEffects = CFE_BOLD;
	CounterText.crTextColor=RGB(255,255,255);

	ModeText.cbSize = sizeof(CHARFORMAT);
	ModeText.dwMask = CFM_BOLD | CFM_COLOR ;
	ModeText.dwEffects = CFE_BOLD;
	ModeText.crTextColor=RGB(255,0,0);

	switch (message)
	{
		case WM_INITDIALOG:
			hDlgTape = hDlg;
			TapeCounter=GetTapeCounter();
			sprintf(OutBuffer,"%i",TapeCounter);
			SendDlgItemMessage(hDlg,IDC_TCOUNT,WM_SETTEXT,strlen(OutBuffer),(LPARAM)(LPCSTR)OutBuffer);
			SendDlgItemMessage(hDlg,IDC_MODE,WM_SETTEXT,strlen(Tmodes[Tmode]),(LPARAM)(LPCSTR)Tmodes[Tmode]);
			
			UpdateTapeCounter(TapeCounter, STOP);
			
//			hCounter=GetDlgItem(hDlg,IDC_TCOUNT);
//			SendMessage (hCounter, EM_SETBKGNDCOLOR, 0, (LPARAM)RGB(0,0,0));
			SendDlgItemMessage(hDlg,IDC_TCOUNT,EM_SETBKGNDCOLOR ,0,(LPARAM)RGB(0,0,0)); 
			SendDlgItemMessage(hDlg,IDC_TCOUNT,EM_SETCHARFORMAT ,SCF_ALL,(LPARAM)&CounterText);
			SendDlgItemMessage(hDlg,IDC_MODE,EM_SETBKGNDCOLOR ,0,(LPARAM)RGB(0,0,0)); 
			SendDlgItemMessage(hDlg,IDC_MODE,EM_SETCHARFORMAT ,SCF_ALL,(LPARAM)&CounterText);
//			SendDlgItemMessage(hDlg,IDC_MODE,EM_SETCHARFORMAT ,SCF_ALL,(LPARAM)&ModeText);			
		break;

		case WM_COMMAND:
			switch (LOWORD (wParam))
			{
				case IDC_PLAY:
					Tmode=PLAY;
					SetTapeMode(Tmode);
				break;
				case IDC_REC:
					Tmode=REC;
					SetTapeMode(Tmode);
				break;
				case IDC_STOP:
					Tmode=STOP;
					SetTapeMode(Tmode);
				break;

				case IDC_EJECT:
					Tmode=EJECT;
					SetTapeMode(Tmode);
				break;

				case IDC_RESET:
					TapeCounter=0;
					SetTapeCounter(TapeCounter);
				break;

				case IDC_TBROWSE:
					LoadTape();
					TapeCounter=0;
					SetTapeCounter(TapeCounter);
				break;

			}
		break;	//End WM_COMMAND
	}
	return(0);
}