void togglesound(AUDIO_t *audio) { if (audio->enabled) { pausesound(audio); } else { playsound(audio); } }
static DWORD CALLBACK SendFileToCalcThread(LPVOID lpParam) { LPCALC lpCalc = (LPCALC) lpParam; LPSENDINFO lpsi = g_SendInfo[lpCalc]; BOOL fRunningBackup = lpCalc->running; BOOL fSoundBackup = FALSE; if (lpCalc->audio) fSoundBackup = lpCalc->audio->enabled; lpCalc->running = FALSE; if (fSoundBackup) { pausesound(lpCalc->audio); } lpsi->Error = LERR_SUCCESS; for (lpsi->iCurrentFile = 0; (UINT)lpsi->iCurrentFile < lpsi->FileList->size(); lpsi->iCurrentFile++) { const TCHAR *filename = lpsi->FileList->at(lpsi->iCurrentFile).c_str(); TIFILE_t *var = importvar(filename, TRUE); if (var != NULL && var->type != ROM_TYPE && var->type != SAV_TYPE) { PostMessage(lpsi->hwndDlg, WM_USER, 0, NULL); } else { lpsi->isRom = true; } lpsi->Error = SendFile(lpCalc, filename, lpsi->DestinationList->at(lpsi->iCurrentFile)); if (lpsi->Error != LERR_SUCCESS) { if (MessageBox(lpsi->hwndDlg, g_szLinkErrorDescriptions[lpsi->Error], _T("Wabbitemu"), MB_OKCANCEL | MB_ICONERROR) == IDCANCEL) { break; } } } if (WaitForSingleObject(lpsi->hFileListMutex, INFINITE) == WAIT_OBJECT_0) { lpsi->FileList->clear(); ReleaseMutex(lpsi->hFileListMutex); } if (lpsi->hwndDlg != NULL) { HWND hwndDlg = lpsi->hwndDlg; lpsi->hwndDlg = NULL; PostMessage(hwndDlg, WM_CLOSE, 0, NULL); } lpCalc->running = fRunningBackup; if (fSoundBackup == TRUE) { playsound(lpCalc->audio); } current_file_sending = NULL; lpsi->DestinationList->clear(); lpsi->iCurrentFile = 0; return 0; }
void togglesound(AUDIO_t *audio) { if (audio->enabled) pausesound(audio); else playsound(audio); }