uint32_t SoundPipe::Seek(double dTime) { if ((m_msgPipeInStatus == MUS_STATUS_WAITING_FOR_SONG) || (m_msgPipeOutStatus == MUS_STATUS_WAITING_FOR_SONG)) { return -1; } SDL_LockAudio(); m_msgPipeInStatus = MUS_STATUS_WAITING_FOR_SONG; m_msgPipeOutStatus = MUS_STATUS_WAITING_FOR_SONG; SDL_UnlockAudio(); m_cbBuf.Flush(); m_cbBuf.SetBuffClock(dTime); ResetFilters(); ReportError1("About to call FFmpeg seek with %f", dTime); uint32_t retVal = m_FFmpegDecoder.Seek(dTime); m_msgPipeInStatus = MUS_STATUS_INITIAL_BUFFERING; m_msgPipeOutStatus = MUS_STATUS_PLAYING; return retVal; }
MUS_MESSAGE SoundPipe::Flush() { m_msgPipeInStatus = MUS_STATUS_WAITING_FOR_SONG; m_msgPipeOutStatus = MUS_STATUS_WAITING_FOR_SONG; //ReportError("Flushing Pipe"); m_cbBuf.Flush(); m_cstrCurSongPath[0] = 0; m_dResampConvFactor = 1.0; m_iFadeHelper = 0; m_BPMDetect.Init(); memset(m_iTicks, 0, BPM_TICK_HIST); m_iCurrentTick = 0; m_FFmpegDecoder.Close(); ResetFilters(); m_msgPipeInStatus = MUS_STATUS_WAITING_FOR_SONG; m_msgPipeOutStatus = MUS_STATUS_WAITING_FOR_SONG; //ReportError("Finished Flushing Pipe"); return MUS_STATUS_WAITING_FOR_SONG; }
void OnAddFilter(wxCommandEvent&) { wxTextEntryDialog dlg(this,L"Please enter a wildcard filter:",L"Filter Added Files",L"*.*"); if (dlg.ShowModal()!=wxID_OK) return; wxCheckBox* f=new wxCheckBox(m_FiltersPanel,CTRLID_FILTER+m_Filters.size(),dlg.GetValue(),wxPoint(-1,-1),wxSize(-1,-1),wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER); m_Filters.push_back(f); m_FiltersSizer->Add(f); f->Set3StateValue(wxCHK_UNDETERMINED); m_FiltersSizer->FitInside(m_FiltersPanel); ResetFilters(); }
void OnFiles(wxCommandEvent& e) { wxArrayInt Sel; int i,j,len=m_Files->GetSelections(Sel); for (i=0; i<len; i++) { if (Sel[i]==e.GetInt()) break; } if (i<len) { for (j=0; j<len; j++) { if (j!=i) m_Files->Check(Sel[j],m_Files->IsChecked(Sel[i])); } } ResetFilters(); }
/* * Init call */ ALDeviceList::ALDeviceList() { ALDEVICEINFO ALDeviceInfo; char *devices; s32 index; const char *defaultDeviceName = NULL; const char *actualDeviceName = NULL; // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support vDeviceInfo.empty(); vDeviceInfo.reserve(10); defaultDeviceIndex = 0; // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices //if (LoadOAL10Library(NULL, &ALFunction) == TRUE) { if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) while (devices != NULL && strlen(devices) > 0) { if (strcmp(defaultDeviceName, devices) == 0) { defaultDeviceIndex = index; } ALCdevice *device = alcOpenDevice(devices); if (device) { ALCcontext *context = alcCreateContext(device, NULL); if (context) { alcMakeContextCurrent(context); // if new actual device name isn't already in the list, then add it... actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER); bool bNewName = true; for (s32 i = 0; i < GetNumDevices(); i++) { if (strcmp(GetDeviceName(i), actualDeviceName) == 0) { bNewName = false; } } if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) { ALDeviceInfo.bSelected = true; ALDeviceInfo.strDeviceName = actualDeviceName; alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(s32), &ALDeviceInfo.iMajorVersion); alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(s32), &ALDeviceInfo.iMinorVersion); ALDeviceInfo.pvstrExtensions = new vector<string>; // Check for ALC Extensions if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_CAPTURE"); if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_EFX"); // Check for AL Extensions if (alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_OFFSET"); if (alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_LINEAR_DISTANCE"); if (alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_EXPONENT_DISTANCE"); if (alIsExtensionPresent("EAX2.0") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("EAX2.0"); if (alIsExtensionPresent("EAX3.0") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("EAX3.0"); if (alIsExtensionPresent("EAX4.0") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("EAX4.0"); if (alIsExtensionPresent("EAX5.0") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("EAX5.0"); if (alIsExtensionPresent("EAX-RAM") == AL_TRUE) ALDeviceInfo.pvstrExtensions->push_back("EAX-RAM"); // Get Source Count ALDeviceInfo.uiSourceCount = GetMaxNumSources(); vDeviceInfo.push_back(ALDeviceInfo); } alcMakeContextCurrent(NULL); alcDestroyContext(context); } alcCloseDevice(device); } devices += strlen(devices) + 1; index += 1; } } //} ResetFilters(); }
void ALDeviceList::Enumerate() { char *devices; int major, minor, index; const char *actualDeviceName; Msg("SOUND: OpenAL: enumerate devices..."); // have a set of vectors storing the device list, selection status, spec version #, and XRAM support status // -- empty all the lists and reserve space for 10 devices m_devices.clear (); CoUninitialize(); // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { Msg("SOUND: OpenAL: EnumerationExtension Present"); devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); Msg ("devices %s",devices); m_defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); Msg("SOUND: OpenAL: system default SndDevice name is %s", m_defaultDeviceName.c_str()); // ManowaR // "Generic Hardware" device on software AC'97 codecs introduce // high CPU usage ( up to 30% ) as a consequence - freezes, FPS drop // So if default device is "Generic Hardware" which maps to DirectSound3D interface // We re-assign it to "Generic Software" to get use of old good DirectSound interface // This makes 3D-sound processing unusable on cheap AC'97 codecs // Also we assume that if "Generic Hardware" exists, than "Generic Software" is also exists // Maybe wrong if(0==stricmp(m_defaultDeviceName.c_str(),AL_GENERIC_HARDWARE)) { m_defaultDeviceName = AL_GENERIC_SOFTWARE; Msg("SOUND: OpenAL: default SndDevice name set to %s", m_defaultDeviceName.c_str()); } index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) while (*devices != NULL) { ALCdevice *device = alcOpenDevice(devices); if (device) { ALCcontext *context = alcCreateContext(device, NULL); if (context) { alcMakeContextCurrent(context); // if new actual device name isn't already in the list, then add it... actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER); if ( (actualDeviceName != NULL) && xr_strlen(actualDeviceName)>0 ) { alcGetIntegerv (device, ALC_MAJOR_VERSION, sizeof(int), &major); alcGetIntegerv (device, ALC_MINOR_VERSION, sizeof(int), &minor); m_devices.push_back (ALDeviceDesc(actualDeviceName,minor,major)); m_devices.back().xram = (alIsExtensionPresent("EAX-RAM") == TRUE); m_devices.back().eax = (alIsExtensionPresent("EAX2.0") == TRUE); // KD: disable unwanted eax flag to force eax on all devices m_devices.back().eax_unwanted = 0;/*((0==xr_strcmp(actualDeviceName,AL_GENERIC_HARDWARE))|| (0==xr_strcmp(actualDeviceName,AL_GENERIC_SOFTWARE)));*/ ++index; } alcDestroyContext(context); } else Msg("SOUND: OpenAL: cant create context for %s",device); alcCloseDevice(device); } else Msg("SOUND: OpenAL: cant open device %s",devices); devices += xr_strlen(devices) + 1; } } else Msg("SOUND: OpenAL: EnumerationExtension NOT Present"); ResetFilters(); if(0!=GetNumDevices()) Msg("SOUND: OpenAL: All available devices:"); int majorVersion, minorVersion; for (int i = 0; i < GetNumDevices(); i++) { GetDeviceVersion (i, &majorVersion, &minorVersion); Msg ("%d. %s, Spec Version %d.%d %s", i+1, GetDeviceName(i).c_str(), majorVersion, minorVersion, (GetDeviceName(i)==m_defaultDeviceName)? "(default)":"" ); } CoInitializeEx (NULL, COINIT_MULTITHREADED); }
INT_PTR CALLBACK ResetDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { BOOL resetFilters = FALSE; BOOL resetGames = FALSE; BOOL resetUI = FALSE; BOOL resetDefaults = FALSE; switch (Msg) { case WM_INITDIALOG: return TRUE; case WM_HELP: /* User clicked the ? from the upper right on a control */ HelpFunction((HWND)((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP, HH_TP_HELP_WM_HELP, GetHelpIDs()); break; case WM_CONTEXTMENU: HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs()); break; case WM_COMMAND : switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDOK : resetFilters = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_FILTERS)); resetGames = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_GAMES)); resetDefaults = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_DEFAULT)); resetUI = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_UI)); if (resetFilters || resetGames || resetUI || resetDefaults) { TCHAR temp[400]; _tcscpy(temp, TEXT(MAMEUINAME)); _tcscat(temp, TEXT(" will now reset the following\n")); _tcscat(temp, TEXT("to the default settings:\n\n")); if (resetDefaults) _tcscat(temp, TEXT("Global game options\n")); if (resetGames) _tcscat(temp, TEXT("Individual game options\n")); if (resetFilters) _tcscat(temp, TEXT("Custom folder filters\n")); if (resetUI) { _tcscat(temp, TEXT("User interface settings\n\n")); _tcscat(temp, TEXT("Resetting the User Interface options\n")); _tcscat(temp, TEXT("requires exiting ")); _tcscat(temp, TEXT(MAMEUINAME)); _tcscat(temp, TEXT(".\n")); } _tcscat(temp, TEXT("\nDo you wish to continue?")); if (MessageBox(hDlg, temp, TEXT("Restore Settings"), IDOK) == IDOK) { if (resetFilters) ResetFilters(); if (resetGames) ResetAllGameOptions(); if (resetDefaults) ResetGameDefaults(); // This is the only case we need to exit and restart for. if (resetUI) { ResetGUI(); EndDialog(hDlg, 1); return TRUE; } else { EndDialog(hDlg, 0); return TRUE; } } else { // Give the user a chance to change what they want to reset. break; } } // Nothing was selected but OK, just fall through case IDCANCEL : EndDialog(hDlg, 0); return TRUE; } break; } return 0; }
/* * Init call */ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) { VECTOR_SET_ASSOCIATION( vDeviceInfo ); ALDEVICEINFO ALDeviceInfo; char *devices; int index; const char *defaultDeviceName; const char *actualDeviceName; dMemcpy( &ALFunction, &oalft, sizeof( OPENALFNTABLE ) ); // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support vDeviceInfo.clear(); vDeviceInfo.reserve(10); defaultDeviceIndex = 0; // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER); defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) while (*devices != 0) { if (dStrcmp(defaultDeviceName, devices) == 0) { defaultDeviceIndex = index; } ALCdevice *device = ALFunction.alcOpenDevice(devices); if (device) { ALCcontext *context = ALFunction.alcCreateContext(device, NULL); if (context) { ALFunction.alcMakeContextCurrent(context); // if new actual device name isn't already in the list, then add it... actualDeviceName = ALFunction.alcGetString(device, ALC_DEVICE_SPECIFIER); bool bNewName = true; for (int i = 0; i < GetNumDevices(); i++) { if (dStrcmp(GetDeviceName(i), actualDeviceName) == 0) { bNewName = false; } } if ((bNewName) && (actualDeviceName != NULL) && (dStrlen(actualDeviceName) > 0)) { dMemset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); ALDeviceInfo.bSelected = true; dStrncpy(ALDeviceInfo.strDeviceName, actualDeviceName, sizeof(ALDeviceInfo.strDeviceName)); ALFunction.alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); ALFunction.alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); ALDeviceInfo.iCapsFlags = 0; // Check for ALC Extensions if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALCapture; if (ALFunction.alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEFX; // Check for AL Extensions if (ALFunction.alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALOffset; if (ALFunction.alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALLinearDistance; if (ALFunction.alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALExponentDistance; if (ALFunction.alIsExtensionPresent("EAX2.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX2; if (ALFunction.alIsExtensionPresent("EAX3.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX3; if (ALFunction.alIsExtensionPresent("EAX4.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX4; if (ALFunction.alIsExtensionPresent("EAX5.0") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAX5; if (ALFunction.alIsExtensionPresent("EAX-RAM") == AL_TRUE) ALDeviceInfo.iCapsFlags |= SFXALEAXRAM; // Get Source Count ALDeviceInfo.uiSourceCount = GetMaxNumSources(); vDeviceInfo.push_back(ALDeviceInfo); } ALFunction.alcMakeContextCurrent(NULL); ALFunction.alcDestroyContext(context); } ALFunction.alcCloseDevice(device); } devices += dStrlen(devices) + 1; index += 1; } } ResetFilters(); }
void Setup(bool all) { int i,j; m_fp.Create(CIwTheApp->MakeAbsoluteFilename(L"{viewer}FilterTemp.ast")); for (i=0; i<(int)m_Expands.size(); i++) { m_Expands[i]->SetValue(true); } if (m_fp.Exists() && m_fp.Open() && m_fp.GetLineCount()>0) { for (i=0; i<(int)m_fp.GetLineCount(); i++) { std::vector<wxString> args; if (SuperSplit(m_fp[i],args,L" \t\n")<3) continue; if (args[0].IsSameAs(L"filter",false)) { wxCheckBox* f=new wxCheckBox(m_FiltersPanel,CTRLID_FILTER+m_Filters.size(),args[1],wxPoint(-1,-1),wxSize(-1,-1),wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER); m_Filters.push_back(f); m_FiltersSizer->Add(f); if (args[2].IsSameAs(L"true",false)) f->Set3StateValue(wxCHK_CHECKED); else if (args[2].IsSameAs(L"false",false)) f->Set3StateValue(wxCHK_UNCHECKED); else f->Set3StateValue(wxCHK_UNDETERMINED); } else if (args[0].IsSameAs(L"expand",false)) { for (j=0; j<(int)m_Expands.size(); j++) { if (m_Expands[j]->GetLabel().IsSameAs(args[1],false)) { m_Expands[j]->SetValue(args[2].IsSameAs(L"true",false)); m_ExpandTypes[m_ExpandOffsets[j]].m_Checked=m_Expands[j]->GetValue(); break; } } if (j==(int)m_Expands.size()) { m_ExtraExpands.push_back(args[1]); m_ExpandChecks.push_back(args[2].IsSameAs(L"true",false)); } } } m_fp.Clear(); } for (i=0; i<(int)m_Files->GetCount(); i++) { m_Files->Check(i,true); if (all) continue; for (j=0; j<(int)m_Filters.size(); j++) { if (m_Files->GetString(i).Lower().Matches(m_Filters[j]->GetLabel().Lower())) { switch (m_Filters[j]->Get3StateValue()) { case wxCHK_CHECKED: m_Files->Check(i,true); break; case wxCHK_UNCHECKED: m_Files->Check(i,false); break; case wxCHK_UNDETERMINED: break; } } } } ResetFilters(); m_FiltersSizer->FitInside(m_FiltersPanel); }
INT_PTR CALLBACK ResetDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) { switch (Msg) { case WM_INITDIALOG: CenterWindow(hDlg); hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON)); SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); hBrush = CreateSolidBrush(RGB(240, 240, 240)); DisableVisualStylesReset(hDlg); return true; case WM_CTLCOLORDLG: return (LRESULT) hBrush; case WM_CTLCOLORSTATIC: case WM_CTLCOLORBTN: hDC = (HDC)wParam; SetBkMode(hDC, TRANSPARENT); SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT)); return (LRESULT) hBrush; case WM_COMMAND: switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDOK: { bool resetFilters = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_FILTERS)); bool resetGames = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_GAMES)); bool resetDefaults = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_DEFAULT)); bool resetUI = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_UI)); bool resetInternalUI = Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_MAME_UI)); if (resetFilters || resetGames || resetUI || resetDefaults || resetInternalUI) { char temp[512]; strcpy(temp, MAMEUINAME); strcat(temp, " will now reset the following\n"); strcat(temp, "to the default settings:\n\n"); if (resetDefaults) strcat(temp, "Global games options\n"); if (resetInternalUI) strcat(temp, "Internal MAME interface options\n"); if (resetGames) strcat(temp, "Individual game options\n"); if (resetFilters) strcat(temp, "Custom folder filters\n"); if (resetUI) { strcat(temp, "User interface settings\n\n"); strcat(temp, "Resetting the user interface options\n"); strcat(temp, "requires exiting "); strcat(temp, MAMEUINAME); strcat(temp, ".\n"); } strcat(temp, "\nDo you wish to continue?"); if (win_message_box_utf8(hDlg, temp, "Restore settings", MB_ICONQUESTION | MB_YESNO) == IDYES) { DestroyIcon(hIcon); DeleteObject(hBrush); if (resetFilters) ResetFilters(); if (resetGames) ResetAllGameOptions(); if (resetDefaults) ResetGameDefaults(); if (resetInternalUI) ResetInternalUI(); // This is the only case we need to exit and restart for. if (resetUI) { ResetInterface(); EndDialog(hDlg, 1); return true; } else { EndDialog(hDlg, 0); return true; } } else // Give the user a chance to change what they want to reset. break; } } // Nothing was selected but OK, just fall through case IDCANCEL: DeleteObject(hBrush); DestroyIcon(hIcon); EndDialog(hDlg, 0); return true; } break; } return false; }