WSJT-X/killbyname.cpp

285 lines
9.5 KiB
C++
Raw Permalink Normal View History

Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
#include <windows.h>
#include <tlhelp32.h>
#include <iostream>
int killbyname(const char *szToTerminate)
// Created: 6/23/2000 (Ravi Kochhar)
// Last modified: 3/10/2002 (RK)
// Please report any problems or bugs to kochhar@physiology.wisc.edu
// The latest version of this routine can be found at:
// http://www.neurophys.wisc.edu/ravi/software/killproc/
// Terminate the process "szToTerminate" if it is currently running
// This works for Win/95/98/ME and also Win/NT/2000/XP
// The process name is case-insensitive, i.e. "notepad.exe" and "NOTEPAD.EXE"
// will both work (for szToTerminate)
// Return codes are as follows:
// 0 = Process was successfully terminated
// 602 = Unable to terminate process for some other reason
// 603 = Process was not currently running
// 604 = No permission to terminate process
// 605 = Unable to load PSAPI.DLL
// 606 = Unable to identify system type
// 607 = Unsupported OS
// 632 = Invalid process name
// 700 = Unable to get procedure address from PSAPI.DLL
// 701 = Unable to get process list, EnumProcesses failed
// 702 = Unable to load KERNEL32.DLL
// 703 = Unable to get procedure address from KERNEL32.DLL
// 704 = CreateToolhelp32Snapshot failed
{
BOOL bResult,bResultm;
DWORD aiPID[1000],iCb=1000,iNumProc; //,iV2000=0;
DWORD iCbneeded,i,iFound=0;
char szName[MAX_PATH],szToTermUpper[MAX_PATH];
HANDLE hProc,hSnapShot,hSnapShotm;
OSVERSIONINFO osvi;
HINSTANCE hInstLib;
// int iLen,iLenP,indx;
int iLenP,indx;
HMODULE hMod;
PROCESSENTRY32 procentry;
MODULEENTRY32 modentry;
// Transfer Process name into "szToTermUpper" and convert to upper case
iLenP=strlen(szToTerminate);
if(iLenP<1 || iLenP>MAX_PATH) return 632;
for(indx=0;indx<iLenP;indx++)
szToTermUpper[indx]=toupper(szToTerminate[indx]);
szToTermUpper[iLenP]=0;
// PSAPI Function Pointers.
BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * );
BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *,
DWORD, LPDWORD );
DWORD (WINAPI *lpfGetModuleBaseName)( HANDLE, HMODULE,
LPTSTR, DWORD );
// ToolHelp Function Pointers.
HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
BOOL (WINAPI *lpfModule32First)(HANDLE,LPMODULEENTRY32) ;
BOOL (WINAPI *lpfModule32Next)(HANDLE,LPMODULEENTRY32) ;
// First check what version of Windows we're in
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
bResult=GetVersionEx(&osvi);
if(!bResult) return 606; // Unable to identify system version
// At Present we only support Win/NT/2000/XP or Win/9x/ME
// Seems to work OK in Win7
if((osvi.dwPlatformId != VER_PLATFORM_WIN32_NT) &&
(osvi.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS)) return 607;
if(osvi.dwPlatformId==VER_PLATFORM_WIN32_NT)
{
// Win/NT or 2000 or XP
// Load library and get the procedures explicitly. We do
// this so that we don't have to worry about modules using
// this code failing to load under Windows 9x, because
// it can't resolve references to the PSAPI.DLL.
hInstLib = LoadLibraryA("PSAPI.DLL");
if(hInstLib == NULL) return 605;
// Get procedure addresses.
2020-06-13 11:04:41 -04:00
lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))(void (*)())
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
GetProcAddress( hInstLib, "EnumProcesses" ) ;
lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *,
2020-06-13 11:04:41 -04:00
DWORD, LPDWORD))(void (*)()) GetProcAddress( hInstLib, "EnumProcessModules" ) ;
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
lpfGetModuleBaseName =(DWORD (WINAPI *)(HANDLE, HMODULE, LPTSTR,
2020-06-13 11:04:41 -04:00
DWORD ))(void (*)()) GetProcAddress( hInstLib, "GetModuleBaseNameA" ) ;
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
if(lpfEnumProcesses == NULL || lpfEnumProcessModules == NULL ||
lpfGetModuleBaseName == NULL) {
FreeLibrary(hInstLib);
return 700;
}
bResult=lpfEnumProcesses(aiPID,iCb,&iCbneeded);
if(!bResult) {
// Unable to get process list, EnumProcesses failed
FreeLibrary(hInstLib);
return 701;
}
// How many processes are there?
iNumProc=iCbneeded/sizeof(DWORD);
// Get and match the name of each process
for(i=0;i<iNumProc;i++) {
// Get the (module) name for this process
strcpy(szName,"Unknown");
// First, get a handle to the process
hProc=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,
aiPID[i]);
// Now, get the process name
if(hProc) {
if(lpfEnumProcessModules(hProc,&hMod,sizeof(hMod),&iCbneeded) ) {
// iLen=lpfGetModuleBaseName(hProc,hMod,szName,MAX_PATH);
lpfGetModuleBaseName(hProc,hMod,szName,MAX_PATH);
}
}
CloseHandle(hProc);
// We will match regardless of lower or upper case
if(strcmp(_strupr(szName),szToTermUpper)==0) {
// Process found, now terminate it
iFound=1;
// First open for termination
hProc=OpenProcess(PROCESS_TERMINATE,FALSE,aiPID[i]);
if(hProc) {
if(TerminateProcess(hProc,0)) {
// process terminated
CloseHandle(hProc);
FreeLibrary(hInstLib);
return 0;
} else {
// Unable to terminate process
CloseHandle(hProc);
FreeLibrary(hInstLib);
return 602;
}
} else {
// Unable to open process for termination
FreeLibrary(hInstLib);
return 604;
}
}
}
}
if(osvi.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
{
// Win/95 or 98 or ME
hInstLib = LoadLibraryA("Kernel32.DLL");
if( hInstLib == NULL )
return 702;
// Get procedure addresses.
// We are linking to these functions of Kernel32
// explicitly, because otherwise a module using
// this code would fail to load under Windows NT,
// which does not have the Toolhelp32
// functions in the Kernel 32.
lpfCreateToolhelp32Snapshot=
2020-06-13 11:04:41 -04:00
(HANDLE(WINAPI *)(DWORD,DWORD))(void (*)())
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
GetProcAddress( hInstLib,
"CreateToolhelp32Snapshot" ) ;
lpfProcess32First=
2020-06-13 11:04:41 -04:00
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))(void (*)())
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
GetProcAddress( hInstLib, "Process32First" ) ;
lpfProcess32Next=
2020-06-13 11:04:41 -04:00
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))(void (*)())
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
GetProcAddress( hInstLib, "Process32Next" ) ;
lpfModule32First=
2020-06-13 11:04:41 -04:00
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))(void (*)())
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
GetProcAddress( hInstLib, "Module32First" ) ;
lpfModule32Next=
2020-06-13 11:04:41 -04:00
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))(void (*)())
Added audio channel support. Audio input can be mono, left of stereo pair or, right of stereo pair. Audio output can be mono, left of stereo pair, right of stereo pair or, both of stereo pair (the same output goes to both channels in both mode). Settings are remembered between sessions. Stream channel suport is implemented mainly in the new AudioDevice class which is now the base class of Modulator and Detector. Audio channels are selected on the configuration screen. Only supported channel configurations per device can be selected. Audio output volume (actually attenuation) is now possible from the GUI. I have added a slider control to the main window; I don't necessarily propose this as a final release location for the widget as I understand that changes to the main screen are sensitive. This location is just a starting suggestion for a trial. The volume (attenuation) setting is remembered between sessions and is not device dependent. This addresses all issues of volume setting on *nix versions since there is no need to use pavucontrol to set audio levels. The volume (attenuation) action is logarithmic. Shaped CW keying has been implemented in Modulator although it is currently disabled as I am not 100% happy wth the implementation. If you want to try it define the C++ preprocessor macro WSJT_SOFT_KEYING in your build. The Modulator instance has been moved to the same thread as the SoundOutput instance as it should have been since the output callback already operates in that thread. Cross thread slots are now correctly called in a thread safe way as a result. A number of files where in the SVN repository with DOS line endings which I have removed. SVN users on Windows need set the config for native line endings so that DOS line endings are automatically stripped on checkin. The DevSetup class now holds it's UI o the heap to reduce imapact on build dependencies. The application settings are now passed to objects from the main.cpp file. Management of settings are moved to the responsible classes (top level windows). This has involved a few settings moving groups so users will see some settings reverting to default values on the first run of an update. Persistance of top level windows geometry and position is now handled in the recommened manner (constructor for load, closeEvent for store in modal windows and, hideEvent for store in modeless dialogs). The MainWindow class now holds its children as members rather than global variables. The LogQSO class now hides its implementation and takes responsibility for its own settings and widows rendering parameters. A new settings file group is implemented to persist the LogQSO class settings. The WideGraph class now hides its implementation and manages its own settings and window rendering parameters. --This line, and those below, will be ignored-- M Modulator.cpp M rigclass.cpp M widegraph.cpp M signalmeter.cpp M soundin.cpp M soundout.cpp M mainwindow.h M main.cpp M meterwidget.h M devsetup.cpp M mainwindow.ui M Detector.cpp M logqso.h M rigclass.h M mainwindow.cpp M meterwidget.cpp M soundin.h M devsetup.ui M wsjtx.pro M devsetup.h M logqso.cpp M Modulator.hpp M psk_reporter.cpp M killbyname.cpp M Detector.hpp M signalmeter.h M widegraph.h M psk_reporter.h M soundout.h M PSKReporter.h M lib/afc65b.f90 M lib/gran.c M lib/usleep.c M lib/afc9.f90 M lib/wrapkarn.c A AudioDevice.hpp git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3542 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2013-08-10 11:29:55 -04:00
GetProcAddress( hInstLib, "Module32Next" ) ;
if( lpfProcess32Next == NULL ||
lpfProcess32First == NULL ||
lpfModule32Next == NULL ||
lpfModule32First == NULL ||
lpfCreateToolhelp32Snapshot == NULL )
{
FreeLibrary(hInstLib);
return 703;
}
// The Process32.. and Module32.. routines return names in all uppercase
// Get a handle to a Toolhelp snapshot of all the systems processes.
hSnapShot = lpfCreateToolhelp32Snapshot(
TH32CS_SNAPPROCESS, 0 ) ;
if( hSnapShot == INVALID_HANDLE_VALUE )
{
FreeLibrary(hInstLib);
return 704;
}
// Get the first process' information.
procentry.dwSize = sizeof(PROCESSENTRY32);
bResult=lpfProcess32First(hSnapShot,&procentry);
// While there are processes, keep looping and checking.
while(bResult)
{
// Get a handle to a Toolhelp snapshot of this process.
hSnapShotm = lpfCreateToolhelp32Snapshot(
TH32CS_SNAPMODULE, procentry.th32ProcessID) ;
if( hSnapShotm == INVALID_HANDLE_VALUE )
{
CloseHandle(hSnapShot);
FreeLibrary(hInstLib);
return 704;
}
// Get the module list for this process
modentry.dwSize=sizeof(MODULEENTRY32);
bResultm=lpfModule32First(hSnapShotm,&modentry);
// While there are modules, keep looping and checking
while(bResultm)
{
if(strcmp(modentry.szModule,szToTermUpper)==0)
{
// Process found, now terminate it
iFound=1;
// First open for termination
hProc=OpenProcess(PROCESS_TERMINATE,FALSE,procentry.th32ProcessID);
if(hProc)
{
if(TerminateProcess(hProc,0))
{
// process terminated
CloseHandle(hSnapShotm);
CloseHandle(hSnapShot);
CloseHandle(hProc);
FreeLibrary(hInstLib);
return 0;
}
else
{
// Unable to terminate process
CloseHandle(hSnapShotm);
CloseHandle(hSnapShot);
CloseHandle(hProc);
FreeLibrary(hInstLib);
return 602;
}
}
else
{
// Unable to open process for termination
CloseHandle(hSnapShotm);
CloseHandle(hSnapShot);
FreeLibrary(hInstLib);
return 604;
}
}
else
{ // Look for next modules for this process
modentry.dwSize=sizeof(MODULEENTRY32);
bResultm=lpfModule32Next(hSnapShotm,&modentry);
}
}
//Keep looking
CloseHandle(hSnapShotm);
procentry.dwSize = sizeof(PROCESSENTRY32);
bResult = lpfProcess32Next(hSnapShot,&procentry);
}
CloseHandle(hSnapShot);
}
if(iFound==0)
{
FreeLibrary(hInstLib);
return 603;
}
FreeLibrary(hInstLib);
return 0;
}