update
This commit is contained in:
parent
6b16e3b676
commit
208e6fca8d
Binary file not shown.
Binary file not shown.
|
@ -43,12 +43,13 @@ void cap_write_fifo(float sample);
|
||||||
int pb_fifo_freespace(int nolock);
|
int pb_fifo_freespace(int nolock);
|
||||||
void init_pipes();
|
void init_pipes();
|
||||||
|
|
||||||
#define CHANNELS 1 // no of channels used
|
|
||||||
|
|
||||||
HRECORD rchan = 0; // recording channel
|
HRECORD rchan = 0; // recording channel
|
||||||
BASS_INFO info;
|
BASS_INFO info;
|
||||||
HSTREAM stream = 0;
|
HSTREAM stream = 0;
|
||||||
|
|
||||||
|
int openpbdev = -1;
|
||||||
|
int opencapdev = -1;
|
||||||
|
|
||||||
/*void showDeviceInfo(BASS_DEVICEINFO info)
|
/*void showDeviceInfo(BASS_DEVICEINFO info)
|
||||||
{
|
{
|
||||||
if (info.flags & BASS_DEVICE_ENABLED) printf("%s\n","BASS_DEVICE_ENABLED ");
|
if (info.flags & BASS_DEVICE_ENABLED) printf("%s\n","BASS_DEVICE_ENABLED ");
|
||||||
|
@ -69,77 +70,132 @@ HSTREAM stream = 0;
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
#define MAXDEVSTRLEN 2000
|
|
||||||
uint8_t devstring[MAXDEVSTRLEN +100];
|
uint8_t devstring[MAXDEVSTRLEN +100];
|
||||||
char PBdevs[100][256]; // stores the device names, just for diagnosis, has no real fuction
|
char PBdevs[100][256]; // stores the device names, just for diagnosis, has no real fuction
|
||||||
char CAPdevs[100][256];
|
char CAPdevs[100][256];
|
||||||
|
|
||||||
// build string of audio devices, to be sent to application as response to Broadcast search
|
// audio device description table
|
||||||
void enumerateAudioDevices()
|
typedef struct {
|
||||||
|
int bassdev; // bass (basswasapi) dev no
|
||||||
|
char name[256]; // DEV name
|
||||||
|
} AUDIODEVS;
|
||||||
|
|
||||||
|
// index is enumerated number, 0=default
|
||||||
|
AUDIODEVS audioPBdevs[100];
|
||||||
|
AUDIODEVS audioCAPdevs[100];
|
||||||
|
int pbanz = 0, capanz = 0;
|
||||||
|
|
||||||
|
// populate audio device list
|
||||||
|
void readAudioDevs()
|
||||||
{
|
{
|
||||||
memset(devstring, 0, sizeof(devstring));
|
|
||||||
devstring[0] = 3; // ID for this UDP message
|
|
||||||
|
|
||||||
// playback devices
|
|
||||||
int a;
|
int a;
|
||||||
int idx = 0;
|
|
||||||
|
// enter default device manually
|
||||||
|
audioPBdevs[pbanz].bassdev = -1;
|
||||||
|
strcpy(audioPBdevs[pbanz].name, "Default");
|
||||||
|
pbanz++;
|
||||||
|
|
||||||
|
audioCAPdevs[capanz].bassdev = -1;
|
||||||
|
strcpy(audioCAPdevs[capanz].name, "Default");
|
||||||
|
capanz++;
|
||||||
|
|
||||||
|
#ifdef _LINUX_
|
||||||
BASS_DEVICEINFO info;
|
BASS_DEVICEINFO info;
|
||||||
|
|
||||||
strcat((char*)(devstring + 1), "System Default");
|
|
||||||
strcat((char*)(devstring + 1), "~");
|
|
||||||
strcpy(PBdevs[idx++], "System Default");
|
|
||||||
|
|
||||||
for (a = 1; BASS_GetDeviceInfo(a, &info); a++)
|
for (a = 1; BASS_GetDeviceInfo(a, &info); a++)
|
||||||
{
|
{
|
||||||
printf("PB device:%d = %s\n", a, info.name);
|
|
||||||
if (strlen((char*)(devstring+1)) > MAXDEVSTRLEN) break;
|
|
||||||
if (info.flags & BASS_DEVICE_ENABLED)
|
if (info.flags & BASS_DEVICE_ENABLED)
|
||||||
{
|
{
|
||||||
strncpy(PBdevs[idx], info.name, 255);
|
if (!strstr(info.name, "HDMI") && !strstr(info.name, "hdmi") && !strstr(info.name, "efault"))
|
||||||
PBdevs[idx][255] = 0;
|
{
|
||||||
idx++;
|
audioPBdevs[pbanz].bassdev = a;
|
||||||
strcat((char*)(devstring + 1), info.name);
|
strncpy(audioPBdevs[pbanz].name, info.name, 255);
|
||||||
strcat((char*)(devstring + 1), "~"); // audio device separator
|
audioPBdevs[pbanz].name[255] = 0;
|
||||||
|
pbanz++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (a = 1; BASS_RecordGetDeviceInfo(a, &info); a++)
|
||||||
|
{
|
||||||
|
if (info.flags & BASS_DEVICE_ENABLED)
|
||||||
|
{
|
||||||
|
if (!strstr(info.name, "HDMI") && !strstr(info.name, "hdmi") && !strstr(info.name, "efault"))
|
||||||
|
{
|
||||||
|
audioCAPdevs[capanz].bassdev = a;
|
||||||
|
strncpy(audioCAPdevs[capanz].name, info.name, 255);
|
||||||
|
audioCAPdevs[capanz].name[255] = 0;
|
||||||
|
capanz++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32_
|
||||||
|
BASS_WASAPI_DEVICEINFO info;
|
||||||
|
for (a = 0; BASS_WASAPI_GetDeviceInfo(a, &info); a++)
|
||||||
|
{
|
||||||
|
if (!(info.flags & BASS_DEVICE_INPUT) && (info.flags & BASS_DEVICE_ENABLED))
|
||||||
|
{
|
||||||
|
if (!strstr(info.name, "HDMI") && !strstr(info.name, "hdmi") && !strstr(info.name, "efault"))
|
||||||
|
{
|
||||||
|
audioPBdevs[pbanz].bassdev = a;
|
||||||
|
strncpy(audioPBdevs[pbanz].name, info.name, 255);
|
||||||
|
audioPBdevs[pbanz].name[255] = 0;
|
||||||
|
pbanz++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((info.flags & BASS_DEVICE_INPUT) && (info.flags & BASS_DEVICE_ENABLED))
|
||||||
|
{
|
||||||
|
if (!strstr(info.name, "HDMI") && !strstr(info.name, "hdmi") && !strstr(info.name, "efault"))
|
||||||
|
{
|
||||||
|
audioCAPdevs[capanz].bassdev = a;
|
||||||
|
strncpy(audioCAPdevs[capanz].name, info.name, 255);
|
||||||
|
audioCAPdevs[capanz].name[255] = 0;
|
||||||
|
capanz++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void printAudioDevs()
|
||||||
|
{
|
||||||
|
printf("PB devices:\n");
|
||||||
|
for (int i = 0; i < pbanz; i++)
|
||||||
|
printf("idx:%d bass:%d name:%s\n", i, audioPBdevs[i].bassdev, audioPBdevs[i].name);
|
||||||
|
|
||||||
|
printf("CAP devices:\n");
|
||||||
|
for (int i = 0; i < capanz; i++)
|
||||||
|
printf("idx:%d bass:%d name:%s\n", i, audioCAPdevs[i].bassdev, audioCAPdevs[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// build string of audio device name, to be sent to application as response to Broadcast search
|
||||||
|
// starting with PB devices, sperarator ^, capture devices
|
||||||
|
// separator between devices: ~
|
||||||
|
void buildUdpAudioList()
|
||||||
|
{
|
||||||
|
memset(devstring, 0, sizeof(devstring));
|
||||||
|
devstring[0] = ' '; // placeholder for ID for this UDP message
|
||||||
|
|
||||||
|
// playback devices
|
||||||
|
for (int i = 0; i < pbanz; i++)
|
||||||
|
{
|
||||||
|
strcat((char*)devstring, audioPBdevs[i].name);
|
||||||
|
strcat((char*)devstring, "~"); // audio device separator
|
||||||
|
}
|
||||||
|
|
||||||
strcat((char*)(devstring + 1), "^"); // PB, CAP separator
|
strcat((char*)(devstring + 1), "^"); // PB, CAP separator
|
||||||
|
|
||||||
// capture devices
|
// capture devices
|
||||||
BASS_DEVICEINFO recinfo;
|
for (int i = 0; i < capanz; i++)
|
||||||
idx = 0;
|
|
||||||
|
|
||||||
strcat((char*)(devstring + 1), "System Default");
|
|
||||||
strcat((char*)(devstring + 1), "~");
|
|
||||||
strcpy(CAPdevs[idx++], "System Default");
|
|
||||||
|
|
||||||
for (a = 0; BASS_RecordGetDeviceInfo(a, &recinfo); a++)
|
|
||||||
{
|
{
|
||||||
printf("CAP device:%d = %s\n", a, recinfo.name);
|
strcat((char*)devstring, audioCAPdevs[i].name);
|
||||||
if (strlen((char*)(devstring + 1)) > MAXDEVSTRLEN) break;
|
strcat((char*)devstring, "~"); // audio device separator
|
||||||
if (recinfo.flags & BASS_DEVICE_ENABLED)
|
|
||||||
{
|
|
||||||
strncpy(CAPdevs[idx], recinfo.name, 255);
|
|
||||||
CAPdevs[idx][255] = 0;
|
|
||||||
idx++;
|
|
||||||
strcat((char*)(devstring + 1), recinfo.name);
|
|
||||||
strcat((char*)(devstring + 1), "~");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
devstring[0] = 3; // ID for this UDP message
|
||||||
* Audio Device numbering:
|
}
|
||||||
*
|
|
||||||
* Playback:
|
|
||||||
* 0 ... no audio, we use 0 for default, which is -1
|
|
||||||
* 1 ... audio devices
|
|
||||||
*
|
|
||||||
* Record:
|
|
||||||
* 0 ... audio devices
|
|
||||||
* we insert "Default" at position 0, and let the audio devices start with 1, so we are compatible with playback
|
|
||||||
* but in init_audio() we have to substract 1
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint8_t* getAudioDevicelist(int *len)
|
uint8_t* getAudioDevicelist(int *len)
|
||||||
{
|
{
|
||||||
|
@ -148,59 +204,89 @@ uint8_t* getAudioDevicelist(int *len)
|
||||||
}
|
}
|
||||||
|
|
||||||
// pbdev, capdev: -1=default device
|
// pbdev, capdev: -1=default device
|
||||||
int init_audio(int pbdev, int capdev)
|
int init_audio(int setpbdev, int setcapdev)
|
||||||
{
|
{
|
||||||
static int f = 1;
|
static int f = 1;
|
||||||
int ocd = capdev;
|
|
||||||
|
|
||||||
// PB devices start with 1 (0 not used, but here used for Default which is -1)
|
|
||||||
if (pbdev == 255 || pbdev == 0) pbdev = -1;
|
|
||||||
|
|
||||||
// CAP devices start with 0, but we use 0 for Default (-1)
|
|
||||||
// so we have to substract 1 from the real devices
|
|
||||||
if (capdev == 255 || capdev == 0 || capdev == -1) capdev = -1;
|
|
||||||
else capdev--;
|
|
||||||
|
|
||||||
if (f == 1)
|
if (f == 1)
|
||||||
{
|
{
|
||||||
|
// do only once after program start
|
||||||
f = 0;
|
f = 0;
|
||||||
enumerateAudioDevices();
|
readAudioDevs();
|
||||||
|
printAudioDevs();
|
||||||
|
buildUdpAudioList();
|
||||||
init_pipes();
|
init_pipes();
|
||||||
}
|
}
|
||||||
|
|
||||||
close_audio();
|
// translate requested device numbers to bass device numbers
|
||||||
|
if (setpbdev < 0 || setpbdev >= pbanz) setpbdev = 0;
|
||||||
|
if (setcapdev < 0 || setcapdev >= capanz) setcapdev = 0;
|
||||||
|
|
||||||
|
int pbdev = -1;
|
||||||
|
if (setpbdev >=0 && setpbdev < pbanz) pbdev = audioPBdevs[setpbdev].bassdev;
|
||||||
|
int capdev = -1;
|
||||||
|
if (setcapdev >= 0 && setcapdev < capanz) capdev = audioCAPdevs[setcapdev].bassdev;
|
||||||
|
|
||||||
printf("init audio, caprate:%d\n",caprate);
|
printf("init audio, caprate:%d\n",caprate);
|
||||||
if (pbdev != -1)
|
printf("requested PB device: %d bassno:%d name:%s\n", setpbdev, pbdev, audioPBdevs[setpbdev].name);
|
||||||
printf("playback device %d: %s\n", pbdev, PBdevs[pbdev]);
|
printf("requested CAP device: %d bassno:%d name:%s\n", setcapdev, capdev, audioCAPdevs[setcapdev].name);
|
||||||
else
|
|
||||||
printf("playback device %d: %s\n", pbdev, "Default");
|
|
||||||
|
|
||||||
if (capdev != -1)
|
|
||||||
printf("capture device %d: %s\n", capdev, CAPdevs[ocd]);
|
|
||||||
else
|
|
||||||
printf("capture device %d: %s\n", capdev, "Default");
|
|
||||||
|
|
||||||
// check the correct BASS was loaded
|
// check the correct BASS was loaded
|
||||||
if (HIWORD(BASS_GetVersion()) != BASSVERSION)
|
if (HIWORD(BASS_GetVersion()) != BASSVERSION)
|
||||||
{
|
{
|
||||||
printf("An incorrect version of BASS was loaded\n");
|
printf("An incorrect version of BASS was loaded\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32_
|
||||||
|
// use WASAPI for Windows to get exclusive access to sound card
|
||||||
|
return init_wasapi(pbdev, capdev);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LINUX_
|
||||||
|
close_audio();
|
||||||
|
|
||||||
|
// ===== PLAYBACK ======
|
||||||
|
|
||||||
|
// initialize default output device
|
||||||
|
if (!BASS_Init(pbdev, caprate, 0, NULL, NULL))
|
||||||
|
{
|
||||||
|
printf("Can't initialize output device\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read real device number
|
||||||
|
int ret = BASS_GetDevice();
|
||||||
|
if (ret == -1)
|
||||||
|
{
|
||||||
|
printf("BASS_GetDevice: %d err:%d\n", pbdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
pbdev = ret;
|
||||||
|
|
||||||
|
// set play callback
|
||||||
|
BASS_GetInfo(&info);
|
||||||
|
stream = BASS_StreamCreate(info.freq, CHANNELS, BASS_SAMPLE_FLOAT, (STREAMPROC*)WriteStream, 0); // sample: 32 bit float
|
||||||
|
BASS_ChannelSetAttribute(stream, BASS_ATTRIB_BUFFER, 0); // no buffering for minimum latency
|
||||||
|
BASS_ChannelPlay(stream, FALSE); // start it
|
||||||
|
|
||||||
|
// ===== CAPTURE ====
|
||||||
|
|
||||||
// initalize default recording device
|
// initalize default recording device
|
||||||
if (!BASS_RecordInit(capdev))
|
if (!BASS_RecordInit(capdev))
|
||||||
{
|
{
|
||||||
printf("Can't initialize recording device: %d\n", BASS_ErrorGetCode());
|
printf("Can't initialize recording device: %d\n", BASS_ErrorGetCode());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize default output device
|
// read real device number
|
||||||
if (!BASS_Init(pbdev, caprate, 0, NULL, NULL))
|
ret = BASS_GetDevice();
|
||||||
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
printf("Can't initialize output device\n");
|
printf("BASS_GetDevice: %d err:%d\n", capdev, BASS_ErrorGetCode());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
capdev = ret;
|
||||||
|
|
||||||
// set capture callback
|
// set capture callback
|
||||||
rchan = BASS_RecordStart(caprate, CHANNELS, BASS_SAMPLE_FLOAT, RecordingCallback, 0);
|
rchan = BASS_RecordStart(caprate, CHANNELS, BASS_SAMPLE_FLOAT, RecordingCallback, 0);
|
||||||
|
@ -208,23 +294,23 @@ int init_audio(int pbdev, int capdev)
|
||||||
printf("Can't start capturing: %d\n", BASS_ErrorGetCode());
|
printf("Can't start capturing: %d\n", BASS_ErrorGetCode());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set play callback
|
|
||||||
BASS_GetInfo(&info);
|
|
||||||
stream = BASS_StreamCreate(info.freq, CHANNELS, BASS_SAMPLE_FLOAT, (STREAMPROC*)WriteStream, 0); // sample: 32 bit float
|
|
||||||
BASS_ChannelSetAttribute(stream, BASS_ATTRIB_BUFFER, 0); // no buffering for minimum latency
|
|
||||||
BASS_ChannelPlay(stream, FALSE); // start it
|
|
||||||
|
|
||||||
printf("audio initialized\n");
|
printf("audio initialized\n");
|
||||||
|
|
||||||
|
openpbdev = pbdev;
|
||||||
|
opencapdev = capdev;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _LINUX_
|
||||||
|
|
||||||
void close_audio()
|
void close_audio()
|
||||||
{
|
{
|
||||||
if(stream != 0)
|
if(stream != 0)
|
||||||
{
|
{
|
||||||
printf("!close Audio Devices\n");
|
printf("close Audio Devices\n");
|
||||||
BASS_ChannelStop(rchan);
|
BASS_ChannelStop(rchan);
|
||||||
int rr = BASS_RecordFree();
|
int rr = BASS_RecordFree();
|
||||||
if (!rr) printf("Bass_RecordFree error: %d\n", BASS_ErrorGetCode());
|
if (!rr) printf("Bass_RecordFree error: %d\n", BASS_ErrorGetCode());
|
||||||
|
@ -236,11 +322,50 @@ void close_audio()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void selectPBdevice()
|
||||||
|
{
|
||||||
|
if (!BASS_SetDevice(openpbdev))
|
||||||
|
printf("BASS_SetDevice: %d err:%d\n", openpbdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectCAPdevice()
|
||||||
|
{
|
||||||
|
if (!BASS_SetDevice(opencapdev))
|
||||||
|
printf("BASS_SetDevice: %d err:%d\n", opencapdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPBvolume(int v)
|
||||||
|
{
|
||||||
|
// the volume comes in % 0..99
|
||||||
|
// map to 0..1
|
||||||
|
float vf = v;
|
||||||
|
vf /= 100;
|
||||||
|
|
||||||
|
printf("set PB volume to:%d / %f [0..1]\n", v, vf );
|
||||||
|
|
||||||
|
selectPBdevice();
|
||||||
|
if (!BASS_SetVolume(vf))
|
||||||
|
printf("setPBvolume: %d err:%d\n", openpbdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCAPvolume(int v)
|
||||||
|
{
|
||||||
|
// the volume comes in % 0..99
|
||||||
|
// map to min/maxPBvol
|
||||||
|
float vf = v;
|
||||||
|
vf /= 100;
|
||||||
|
|
||||||
|
printf("set CAP volume to:%d / %f [0..1]\n", v, vf);
|
||||||
|
|
||||||
|
selectCAPdevice();
|
||||||
|
if (!BASS_RecordSetInput(-1,BASS_INPUT_ON,vf))
|
||||||
|
printf("setCAPvolume: %d err:%d\n", opencapdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
// capture callback
|
// capture callback
|
||||||
// length: bytes. short=2byte, 2channels, so it requests samples*4
|
|
||||||
BOOL CALLBACK RecordingCallback(HRECORD handle, const void *buffer, DWORD length, void *user)
|
BOOL CALLBACK RecordingCallback(HRECORD handle, const void *buffer, DWORD length, void *user)
|
||||||
{
|
{
|
||||||
//printf("captured %ld samples\n",length/sizeof(float));
|
//printf("captured %ld samples, channels:%d\n",length/sizeof(float),CHANNELS);
|
||||||
//measure_speed(length/sizeof(float));
|
//measure_speed(length/sizeof(float));
|
||||||
|
|
||||||
float *fbuffer = (float *)buffer;
|
float *fbuffer = (float *)buffer;
|
||||||
|
@ -269,6 +394,15 @@ DWORD CALLBACK WriteStream(HSTREAM handle, float *buffer, DWORD length, void *us
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // _LINUX_
|
||||||
|
|
||||||
|
// set volume
|
||||||
|
void setVolume(int pbcap, int v)
|
||||||
|
{
|
||||||
|
if (pbcap == 0) setPBvolume(v);
|
||||||
|
else setCAPvolume(v);
|
||||||
|
}
|
||||||
|
|
||||||
// ================ thread safe fifo for audio callback routines ===============
|
// ================ thread safe fifo for audio callback routines ===============
|
||||||
|
|
||||||
#ifdef _WIN32_
|
#ifdef _WIN32_
|
||||||
|
@ -371,6 +505,26 @@ void pb_write_fifo_clear()
|
||||||
pb_wridx = pb_rdidx = 0;
|
pb_wridx = pb_rdidx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pb_fifo_usedBlocks()
|
||||||
|
{
|
||||||
|
static int old_fill = 0;
|
||||||
|
int fill = 0;
|
||||||
|
|
||||||
|
int fs = pb_fifo_freespace(0);
|
||||||
|
int used = AUDIO_PLAYBACK_BUFLEN - fs;
|
||||||
|
used /= (txinterpolfactor * UDPBLOCKLEN * 8 / bitsPerSymbol);
|
||||||
|
|
||||||
|
if (used > 0) fill = 1; else fill = 0;
|
||||||
|
if (fill == 1 && old_fill == 0)
|
||||||
|
printf("fifo has data to send\n");
|
||||||
|
if (fill == 0 && old_fill == 1)
|
||||||
|
printf("fifo now empty\n");
|
||||||
|
old_fill = fill;
|
||||||
|
|
||||||
|
//printf("free:%d used blocks:%d\n", fs, used);
|
||||||
|
return used;
|
||||||
|
}
|
||||||
|
|
||||||
int pb_fifo_freespace(int nolock)
|
int pb_fifo_freespace(int nolock)
|
||||||
{
|
{
|
||||||
int freebuf = 0;
|
int freebuf = 0;
|
||||||
|
@ -412,3 +566,4 @@ int pb_read_fifo(float *data, int elements)
|
||||||
PB_UNLOCK();
|
PB_UNLOCK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,229 @@
|
||||||
|
/*
|
||||||
|
* High Speed modem to transfer data in a 2,7kHz SSB channel
|
||||||
|
* =========================================================
|
||||||
|
* Author: DJ0ABR
|
||||||
|
*
|
||||||
|
* (c) DJ0ABR
|
||||||
|
* www.dj0abr.de
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*
|
||||||
|
* audio_wasabi.c ... functions to handle audio in/out via a soundcard uses the "BASSWASAPI" library
|
||||||
|
* wasapi is needed because we need exclusive access to the sound card which is not provided for Windows with the normal bass.lib
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "hsmodem.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32_
|
||||||
|
|
||||||
|
#define WASAPI_CHANNELS 2 // wasapi works with 2 only
|
||||||
|
|
||||||
|
void init_pipes();
|
||||||
|
void cap_write_fifo(float sample);
|
||||||
|
int pb_read_fifo(float* data, int elements);
|
||||||
|
void close_wasapi();
|
||||||
|
DWORD CALLBACK PBcallback(void* buffer, DWORD length, void* user);
|
||||||
|
DWORD CALLBACK CAPcallback(void* buffer, DWORD length, void* user);
|
||||||
|
|
||||||
|
float minPBvol = 0;
|
||||||
|
float maxPBvol = 99;
|
||||||
|
float minCAPvol = 0;
|
||||||
|
float maxCAPvol = 99;
|
||||||
|
|
||||||
|
extern int openpbdev;
|
||||||
|
extern int opencapdev;
|
||||||
|
|
||||||
|
float softwareCAPvolume = 0.5;
|
||||||
|
|
||||||
|
int init_wasapi(int pbdev, int capdev)
|
||||||
|
{
|
||||||
|
close_wasapi();
|
||||||
|
|
||||||
|
// ======= init PLAYBACK device ========
|
||||||
|
|
||||||
|
// initialize default output device
|
||||||
|
if (!BASS_WASAPI_Init(pbdev, caprate, WASAPI_CHANNELS, BASS_WASAPI_EXCLUSIVE, 0.1f/*buffer in seconds*/, 0, PBcallback, NULL))
|
||||||
|
{
|
||||||
|
printf("Can't initialize output device: %d err:%d\n", pbdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read real device number since a -1 cannot be started
|
||||||
|
int ret = BASS_WASAPI_GetDevice();
|
||||||
|
if (ret == -1)
|
||||||
|
{
|
||||||
|
printf("BASS_WASAPI_GetDevice: %d err:%d\n", pbdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
pbdev = ret;
|
||||||
|
|
||||||
|
// read the possible volume settings
|
||||||
|
BASS_WASAPI_INFO info;
|
||||||
|
if (!BASS_WASAPI_GetInfo(&info))
|
||||||
|
{
|
||||||
|
printf("BASS_WASAPI_GetInfo: %d err:%d\n", pbdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
minPBvol = info.volmin;
|
||||||
|
maxPBvol = info.volmax;
|
||||||
|
|
||||||
|
// start playback
|
||||||
|
if (!BASS_WASAPI_Start())
|
||||||
|
{
|
||||||
|
printf("BASS_WASAPI_Start: %d err:%d\n", pbdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ======= init CAPTURE device ========
|
||||||
|
|
||||||
|
// initalize default recording device
|
||||||
|
if (capdev == -1) capdev = -2; // cap: -2 is the default device for input
|
||||||
|
if (!BASS_WASAPI_Init(capdev, caprate, WASAPI_CHANNELS, BASS_WASAPI_EXCLUSIVE, 0.1f/*buffer in seconds*/, 0, CAPcallback, NULL))
|
||||||
|
{
|
||||||
|
printf("Can't initialize recording device: %d\n", BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read real device number since a -2 cannot be started
|
||||||
|
ret = BASS_WASAPI_GetDevice();
|
||||||
|
if (ret == -1)
|
||||||
|
{
|
||||||
|
printf("BASS_WASAPI_GetDevice: %d err:%d\n", capdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
capdev = ret;
|
||||||
|
|
||||||
|
// read the possible volume settings
|
||||||
|
if (!BASS_WASAPI_GetInfo(&info))
|
||||||
|
{
|
||||||
|
printf("BASS_WASAPI_GetInfo: %d err:%d\n", pbdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
minCAPvol = info.volmin;
|
||||||
|
maxCAPvol = info.volmax;
|
||||||
|
|
||||||
|
// start recording
|
||||||
|
if (!BASS_WASAPI_Start())
|
||||||
|
{
|
||||||
|
printf("BASS_WASAPI_Start: %d err:%d\n", capdev, BASS_ErrorGetCode());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("WASAPI started successfully for PBdev:%d and CAPdev:%d\n", pbdev, capdev);
|
||||||
|
|
||||||
|
openpbdev = pbdev;
|
||||||
|
opencapdev = capdev;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectPBdevice()
|
||||||
|
{
|
||||||
|
if (!BASS_WASAPI_SetDevice(openpbdev))
|
||||||
|
printf("BASS_WASAPI_SetDevice: %d err:%d\n", openpbdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectCAPdevice()
|
||||||
|
{
|
||||||
|
if (!BASS_WASAPI_SetDevice(opencapdev))
|
||||||
|
printf("BASS_WASAPI_SetDevice: %d err:%d\n", opencapdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPBvolume(int v)
|
||||||
|
{
|
||||||
|
// the volume comes in % 0..99
|
||||||
|
// map to min/maxPBvol
|
||||||
|
float vf = v * (maxPBvol - minPBvol) / 100 + minPBvol;
|
||||||
|
|
||||||
|
if (vf < minPBvol) vf = minPBvol;
|
||||||
|
if (vf > maxPBvol) vf = maxPBvol;
|
||||||
|
|
||||||
|
printf("set PB volume to:%d / %f [%f..%f]\n", v, vf, minPBvol, maxPBvol);
|
||||||
|
|
||||||
|
selectPBdevice();
|
||||||
|
if (!BASS_WASAPI_SetVolume(BASS_WASAPI_CURVE_DB, vf))
|
||||||
|
printf("setPBvolume: %d err:%d\n", openpbdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCAPvolume(int v)
|
||||||
|
{
|
||||||
|
// non of the BASS input level functions are working in WASAPI exclusive mode
|
||||||
|
// so we adjust the input level by software
|
||||||
|
softwareCAPvolume = (float)v;
|
||||||
|
softwareCAPvolume /= 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
void close_wasapi()
|
||||||
|
{
|
||||||
|
printf("close WASAPI Audio Devices\n");
|
||||||
|
|
||||||
|
if (openpbdev != -1)
|
||||||
|
{
|
||||||
|
selectPBdevice();
|
||||||
|
if (!BASS_WASAPI_Free()) printf("BASS_WASAPI_Free: dev:%d err:%d\n", openpbdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opencapdev != -1)
|
||||||
|
{
|
||||||
|
selectCAPdevice();
|
||||||
|
if (!BASS_WASAPI_Free()) printf("BASS_WASAPI_Free: dev:%d err:%d\n", opencapdev, BASS_ErrorGetCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD CALLBACK PBcallback(void* buffer, DWORD length, void* user)
|
||||||
|
{
|
||||||
|
float* fbuffer = (float*)buffer;
|
||||||
|
|
||||||
|
// requested number of stereo samples: length/sizeof(float)
|
||||||
|
// requested real number of samples
|
||||||
|
int req_samples = length / sizeof(float) / WASAPI_CHANNELS;
|
||||||
|
// prepare a buffer to store the mono samples from the fifo
|
||||||
|
float* fdata = (float*)malloc(sizeof(float) * req_samples);
|
||||||
|
// read mono samples from fifo
|
||||||
|
int ret = pb_read_fifo(fdata, req_samples);
|
||||||
|
if (ret == 0)
|
||||||
|
{
|
||||||
|
// fifo empty, send 00
|
||||||
|
memset(fdata, 0, sizeof(float) * req_samples);
|
||||||
|
}
|
||||||
|
// copy the mono samples into the stereo output buffer
|
||||||
|
int didx = 0;
|
||||||
|
for (int i = 0; i < req_samples; i++)
|
||||||
|
{
|
||||||
|
fbuffer[didx++] = fdata[i];
|
||||||
|
fbuffer[didx++] = fdata[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
free(fdata);
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD CALLBACK CAPcallback(void* buffer, DWORD length, void* user)
|
||||||
|
{
|
||||||
|
//printf("CAP callback, len:%d\n",length);
|
||||||
|
//measure_speed_bps(length/sizeof(float)/ WASAPI_CHANNELS);
|
||||||
|
|
||||||
|
float* fbuffer = (float*)buffer;
|
||||||
|
//showbytestringf((char*)"rx: ", fbuffer, 20);
|
||||||
|
for (unsigned int i = 0; i < (length / sizeof(float)); i += WASAPI_CHANNELS)
|
||||||
|
{
|
||||||
|
cap_write_fifo(fbuffer[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE; // continue recording
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _WIN32_
|
2294
hsmodem/bass.h
2294
hsmodem/bass.h
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
BASSWASAPI 2.4 C/C++ header file
|
||||||
|
Copyright (c) 2009-2020 Un4seen Developments Ltd.
|
||||||
|
|
||||||
|
See the BASSWASAPI.CHM file for more detailed documentation
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BASSWASAPI_H
|
||||||
|
#define BASSWASAPI_H
|
||||||
|
|
||||||
|
#include "bass.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BASSWASAPIDEF
|
||||||
|
#define BASSWASAPIDEF(f) WINAPI f
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Additional error codes returned by BASS_ErrorGetCode
|
||||||
|
#define BASS_ERROR_WASAPI 5000 // no WASAPI
|
||||||
|
#define BASS_ERROR_WASAPI_BUFFER 5001 // buffer size is invalid
|
||||||
|
#define BASS_ERROR_WASAPI_CATEGORY 5002 // can't set category
|
||||||
|
#define BASS_ERROR_WASAPI_DENIED 5003 // access denied
|
||||||
|
|
||||||
|
// Device info structure
|
||||||
|
typedef struct {
|
||||||
|
const char *name;
|
||||||
|
const char *id;
|
||||||
|
DWORD type;
|
||||||
|
DWORD flags;
|
||||||
|
float minperiod;
|
||||||
|
float defperiod;
|
||||||
|
DWORD mixfreq;
|
||||||
|
DWORD mixchans;
|
||||||
|
} BASS_WASAPI_DEVICEINFO;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
DWORD initflags;
|
||||||
|
DWORD freq;
|
||||||
|
DWORD chans;
|
||||||
|
DWORD format;
|
||||||
|
DWORD buflen;
|
||||||
|
float volmax;
|
||||||
|
float volmin;
|
||||||
|
float volstep;
|
||||||
|
} BASS_WASAPI_INFO;
|
||||||
|
|
||||||
|
// BASS_WASAPI_DEVICEINFO "type"
|
||||||
|
#define BASS_WASAPI_TYPE_NETWORKDEVICE 0
|
||||||
|
#define BASS_WASAPI_TYPE_SPEAKERS 1
|
||||||
|
#define BASS_WASAPI_TYPE_LINELEVEL 2
|
||||||
|
#define BASS_WASAPI_TYPE_HEADPHONES 3
|
||||||
|
#define BASS_WASAPI_TYPE_MICROPHONE 4
|
||||||
|
#define BASS_WASAPI_TYPE_HEADSET 5
|
||||||
|
#define BASS_WASAPI_TYPE_HANDSET 6
|
||||||
|
#define BASS_WASAPI_TYPE_DIGITAL 7
|
||||||
|
#define BASS_WASAPI_TYPE_SPDIF 8
|
||||||
|
#define BASS_WASAPI_TYPE_HDMI 9
|
||||||
|
#define BASS_WASAPI_TYPE_UNKNOWN 10
|
||||||
|
|
||||||
|
// BASS_WASAPI_DEVICEINFO flags
|
||||||
|
#define BASS_DEVICE_ENABLED 1
|
||||||
|
#define BASS_DEVICE_DEFAULT 2
|
||||||
|
#define BASS_DEVICE_INIT 4
|
||||||
|
#define BASS_DEVICE_LOOPBACK 8
|
||||||
|
#define BASS_DEVICE_INPUT 16
|
||||||
|
#define BASS_DEVICE_UNPLUGGED 32
|
||||||
|
#define BASS_DEVICE_DISABLED 64
|
||||||
|
|
||||||
|
// BASS_WASAPI_Init flags
|
||||||
|
#define BASS_WASAPI_EXCLUSIVE 1
|
||||||
|
#define BASS_WASAPI_AUTOFORMAT 2
|
||||||
|
#define BASS_WASAPI_BUFFER 4
|
||||||
|
#define BASS_WASAPI_EVENT 16
|
||||||
|
#define BASS_WASAPI_SAMPLES 32
|
||||||
|
#define BASS_WASAPI_DITHER 64
|
||||||
|
#define BASS_WASAPI_RAW 128
|
||||||
|
#define BASS_WASAPI_ASYNC 0x100
|
||||||
|
|
||||||
|
#define BASS_WASAPI_CATEGORY_MASK 0xf000
|
||||||
|
#define BASS_WASAPI_CATEGORY_OTHER 0x0000
|
||||||
|
#define BASS_WASAPI_CATEGORY_FOREGROUNDONLYMEDIA 0x1000
|
||||||
|
#define BASS_WASAPI_CATEGORY_BACKGROUNDCAPABLEMEDIA 0x2000
|
||||||
|
#define BASS_WASAPI_CATEGORY_COMMUNICATIONS 0x3000
|
||||||
|
#define BASS_WASAPI_CATEGORY_ALERTS 0x4000
|
||||||
|
#define BASS_WASAPI_CATEGORY_SOUNDEFFECTS 0x5000
|
||||||
|
#define BASS_WASAPI_CATEGORY_GAMEEFFECTS 0x6000
|
||||||
|
#define BASS_WASAPI_CATEGORY_GAMEMEDIA 0x7000
|
||||||
|
#define BASS_WASAPI_CATEGORY_GAMECHAT 0x8000
|
||||||
|
#define BASS_WASAPI_CATEGORY_SPEECH 0x9000
|
||||||
|
#define BASS_WASAPI_CATEGORY_MOVIE 0xa000
|
||||||
|
#define BASS_WASAPI_CATEGORY_MEDIA 0xb000
|
||||||
|
|
||||||
|
// BASS_WASAPI_INFO "format"
|
||||||
|
#define BASS_WASAPI_FORMAT_FLOAT 0
|
||||||
|
#define BASS_WASAPI_FORMAT_8BIT 1
|
||||||
|
#define BASS_WASAPI_FORMAT_16BIT 2
|
||||||
|
#define BASS_WASAPI_FORMAT_24BIT 3
|
||||||
|
#define BASS_WASAPI_FORMAT_32BIT 4
|
||||||
|
|
||||||
|
// BASS_WASAPI_Set/GetVolume modes
|
||||||
|
#define BASS_WASAPI_CURVE_DB 0
|
||||||
|
#define BASS_WASAPI_CURVE_LINEAR 1
|
||||||
|
#define BASS_WASAPI_CURVE_WINDOWS 2
|
||||||
|
#define BASS_WASAPI_VOL_SESSION 8
|
||||||
|
|
||||||
|
typedef DWORD (CALLBACK WASAPIPROC)(void *buffer, DWORD length, void *user);
|
||||||
|
/* WASAPI callback function.
|
||||||
|
buffer : Buffer containing the sample data
|
||||||
|
length : Number of bytes
|
||||||
|
user : The 'user' parameter given when calling BASS_WASAPI_Init
|
||||||
|
RETURN : The number of bytes written (output devices), 0/1 = stop/continue (input devices) */
|
||||||
|
|
||||||
|
// Special WASAPIPROCs
|
||||||
|
#define WASAPIPROC_PUSH (WASAPIPROC*)0 // push output
|
||||||
|
#define WASAPIPROC_BASS (WASAPIPROC*)-1 // BASS channel
|
||||||
|
|
||||||
|
typedef void (CALLBACK WASAPINOTIFYPROC)(DWORD notify, DWORD device, void *user);
|
||||||
|
/* WASAPI device notification callback function.
|
||||||
|
notify : The notification (BASS_WASAPI_NOTIFY_xxx)
|
||||||
|
device : Device that the notification applies to
|
||||||
|
user : The 'user' parameter given when calling BASS_WASAPI_SetNotify */
|
||||||
|
|
||||||
|
// Device notifications
|
||||||
|
#define BASS_WASAPI_NOTIFY_ENABLED 0
|
||||||
|
#define BASS_WASAPI_NOTIFY_DISABLED 1
|
||||||
|
#define BASS_WASAPI_NOTIFY_DEFOUTPUT 2
|
||||||
|
#define BASS_WASAPI_NOTIFY_DEFINPUT 3
|
||||||
|
#define BASS_WASAPI_NOTIFY_FAIL 0x100
|
||||||
|
|
||||||
|
DWORD BASSWASAPIDEF(BASS_WASAPI_GetVersion)();
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_SetNotify)(WASAPINOTIFYPROC *proc, void *user);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_GetDeviceInfo)(DWORD device, BASS_WASAPI_DEVICEINFO *info);
|
||||||
|
float BASSWASAPIDEF(BASS_WASAPI_GetDeviceLevel)(DWORD device, int chan);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_SetDevice)(DWORD device);
|
||||||
|
DWORD BASSWASAPIDEF(BASS_WASAPI_GetDevice)();
|
||||||
|
DWORD BASSWASAPIDEF(BASS_WASAPI_CheckFormat)(DWORD device, DWORD freq, DWORD chans, DWORD flags);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_Init)(int device, DWORD freq, DWORD chans, DWORD flags, float buffer, float period, WASAPIPROC *proc, void *user);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_Free)();
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_GetInfo)(BASS_WASAPI_INFO *info);
|
||||||
|
float BASSWASAPIDEF(BASS_WASAPI_GetCPU)();
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_Lock)(BOOL lock);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_Start)();
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_Stop)(BOOL reset);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_IsStarted)();
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_SetVolume)(DWORD mode, float volume);
|
||||||
|
float BASSWASAPIDEF(BASS_WASAPI_GetVolume)(DWORD mode);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_SetMute)(DWORD mode, BOOL mute);
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_GetMute)(DWORD mode);
|
||||||
|
DWORD BASSWASAPIDEF(BASS_WASAPI_PutData)(void *buffer, DWORD length);
|
||||||
|
DWORD BASSWASAPIDEF(BASS_WASAPI_GetData)(void *buffer, DWORD length);
|
||||||
|
DWORD BASSWASAPIDEF(BASS_WASAPI_GetLevel)();
|
||||||
|
BOOL BASSWASAPIDEF(BASS_WASAPI_GetLevelEx)(float *levels, float length, DWORD flags);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Binary file not shown.
|
@ -80,8 +80,8 @@ void init_packer()
|
||||||
rotate8APSKsyms(_8PSK_headertab[i-1], _8PSK_headertab[i], 8);
|
rotate8APSKsyms(_8PSK_headertab[i-1], _8PSK_headertab[i], 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<8; i++)
|
/*for(int i=0; i<8; i++)
|
||||||
showbytestring((char*)"8CONST: ",_8PSK_headertab[i],8);
|
showbytestring((char*)"8CONST: ",_8PSK_headertab[i],8);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// packs a payload into an udp data block
|
// packs a payload into an udp data block
|
||||||
|
|
|
@ -104,6 +104,8 @@ int rxPreInterpolfactor = 5;
|
||||||
|
|
||||||
int captureDeviceNo = -1;
|
int captureDeviceNo = -1;
|
||||||
int playbackDeviceNo = -1;
|
int playbackDeviceNo = -1;
|
||||||
|
int initialPBvol = -1;
|
||||||
|
int initialCAPvol = -1;
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
@ -164,6 +166,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
init_packer();
|
init_packer();
|
||||||
|
|
||||||
initFEC();
|
initFEC();
|
||||||
|
@ -248,10 +251,12 @@ void startModem()
|
||||||
// int TX audio and modulator
|
// int TX audio and modulator
|
||||||
close_dsp();
|
close_dsp();
|
||||||
init_audio(playbackDeviceNo, captureDeviceNo);
|
init_audio(playbackDeviceNo, captureDeviceNo);
|
||||||
|
setPBvolume(initialPBvol);
|
||||||
|
setCAPvolume(initialCAPvol);
|
||||||
init_dsp();
|
init_dsp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAudioDevices(int pb, int cap)
|
void setAudioDevices(int pb, int cap, int pbvol, int capvol)
|
||||||
{
|
{
|
||||||
//printf("%d %d\n", pb, cap);
|
//printf("%d %d\n", pb, cap);
|
||||||
|
|
||||||
|
@ -260,6 +265,8 @@ void setAudioDevices(int pb, int cap)
|
||||||
restart_modems = 1;
|
restart_modems = 1;
|
||||||
playbackDeviceNo = pb;
|
playbackDeviceNo = pb;
|
||||||
captureDeviceNo = cap;
|
captureDeviceNo = cap;
|
||||||
|
initialPBvol = pbvol;
|
||||||
|
initialCAPvol = capvol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +275,7 @@ void bc_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
|
||||||
{
|
{
|
||||||
if (len > 0 && pdata[0] == 0x3c)
|
if (len > 0 && pdata[0] == 0x3c)
|
||||||
{
|
{
|
||||||
setAudioDevices(pdata[1], pdata[2]);
|
setAudioDevices(pdata[1], pdata[2], pdata[3], pdata[4]);
|
||||||
|
|
||||||
char rxip[20];
|
char rxip[20];
|
||||||
strcpy(rxip, inet_ntoa(rxsock->sin_addr));
|
strcpy(rxip, inet_ntoa(rxsock->sin_addr));
|
||||||
|
@ -311,12 +318,6 @@ void appdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
|
||||||
uint8_t type = pdata[0];
|
uint8_t type = pdata[0];
|
||||||
uint8_t minfo = pdata[1];
|
uint8_t minfo = pdata[1];
|
||||||
|
|
||||||
if (len != (PAYLOADLEN + 2))
|
|
||||||
{
|
|
||||||
printf("data from app: wrong length:%d (should be %d)\n", len - 2, PAYLOADLEN);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// type values: see oscardata config.cs: frame types
|
// type values: see oscardata config.cs: frame types
|
||||||
if (type == 16)
|
if (type == 16)
|
||||||
{
|
{
|
||||||
|
@ -362,8 +363,30 @@ void appdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
|
||||||
{
|
{
|
||||||
// reset liquid RX modem
|
// reset liquid RX modem
|
||||||
resetModem();
|
resetModem();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == 21)
|
||||||
|
{
|
||||||
|
// set playback volume (in % 0..100)
|
||||||
|
setVolume(0,minfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 22)
|
||||||
|
{
|
||||||
|
// set capture volume (in % 0..100)
|
||||||
|
setVolume(1,minfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len != (PAYLOADLEN + 2))
|
||||||
|
{
|
||||||
|
printf("data from app: wrong length:%d (should be %d)\n", len - 2, PAYLOADLEN);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//if (getSending() == 1) return; // already sending (Array sending)
|
//if (getSending() == 1) return; // already sending (Array sending)
|
||||||
|
|
||||||
if (minfo == 0)
|
if (minfo == 0)
|
||||||
|
@ -376,7 +399,7 @@ void appdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
|
||||||
// and bits: symbols * bitsPerSymbol
|
// and bits: symbols * bitsPerSymbol
|
||||||
// and bytes/second: bits/8 = (caprate/txinterpolfactor) * bitsPerSymbol / 8
|
// and bytes/second: bits/8 = (caprate/txinterpolfactor) * bitsPerSymbol / 8
|
||||||
// one frame has 258 bytes, so we need for 5s: 5* ((caprate/txinterpolfactor) * bitsPerSymbol / 8) /258 + 1 frames
|
// one frame has 258 bytes, so we need for 5s: 5* ((caprate/txinterpolfactor) * bitsPerSymbol / 8) /258 + 1 frames
|
||||||
int numframespreamble = 3 * ((caprate / txinterpolfactor) * bitsPerSymbol / 8) / 258 + 1;
|
int numframespreamble = 5 * ((caprate / txinterpolfactor) * bitsPerSymbol / 8) / 258 + 1;
|
||||||
for (int i = 0; i < numframespreamble; i++)
|
for (int i = 0; i < numframespreamble; i++)
|
||||||
toGR_sendData(pdata + 2, type, minfo);
|
toGR_sendData(pdata + 2, type, minfo);
|
||||||
}
|
}
|
||||||
|
@ -427,7 +450,7 @@ void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
|
||||||
// no frame found
|
// no frame found
|
||||||
// if longer ws seconds nothing found, reset liquid RX modem
|
// if longer ws seconds nothing found, reset liquid RX modem
|
||||||
// comes here with symbol rate, i.e. 4000 S/s
|
// comes here with symbol rate, i.e. 4000 S/s
|
||||||
int ws = 2;
|
int ws = 4;
|
||||||
int wt = sr[speedmode].audio / sr[speedmode].tx;
|
int wt = sr[speedmode].audio / sr[speedmode].tx;
|
||||||
if (++fnd >= (wt * ws))
|
if (++fnd >= (wt * ws))
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#pragma comment(lib, "bass.lib")
|
#pragma comment(lib, "bass.lib")
|
||||||
|
#pragma comment(lib, "basswasapi.lib")
|
||||||
#pragma comment(lib, "libliquid.lib")
|
#pragma comment(lib, "libliquid.lib")
|
||||||
#pragma comment(lib, "fftw_lib/libfftw3-3.lib")
|
#pragma comment(lib, "fftw_lib/libfftw3-3.lib")
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "bass.h"
|
#include "bass.h"
|
||||||
|
#include "basswasapi.h"
|
||||||
#include "liquid.h"
|
#include "liquid.h"
|
||||||
#include "frameformat.h"
|
#include "frameformat.h"
|
||||||
#include "fec.h"
|
#include "fec.h"
|
||||||
|
@ -64,6 +66,10 @@
|
||||||
#define CRC16RX 1
|
#define CRC16RX 1
|
||||||
#define CRC16FILE 2
|
#define CRC16FILE 2
|
||||||
|
|
||||||
|
// definitions for audio
|
||||||
|
#define MAXDEVSTRLEN 2000
|
||||||
|
#define CHANNELS 1 // no of channels used
|
||||||
|
|
||||||
void init_packer();
|
void init_packer();
|
||||||
uint8_t* Pack(uint8_t* payload, int type, int status, int* plen);
|
uint8_t* Pack(uint8_t* payload, int type, int status, int* plen);
|
||||||
uint8_t* unpack_data(uint8_t* rxd, int len);
|
uint8_t* unpack_data(uint8_t* rxd, int len);
|
||||||
|
@ -88,7 +94,8 @@ uint8_t* RX_Scramble(uint8_t* data, int len);
|
||||||
uint16_t Crc16_messagecalc(int rxtx, uint8_t* data, int len);
|
uint16_t Crc16_messagecalc(int rxtx, uint8_t* data, int len);
|
||||||
|
|
||||||
void showbytestring(char* title, uint8_t* data, int anz);
|
void showbytestring(char* title, uint8_t* data, int anz);
|
||||||
void measure_speed(int len);
|
void measure_speed_syms(int len);
|
||||||
|
void measure_speed_bps(int len);
|
||||||
|
|
||||||
void initFEC();
|
void initFEC();
|
||||||
void GetFEC(uint8_t* txblock, int len, uint8_t* destArray);
|
void GetFEC(uint8_t* txblock, int len, uint8_t* destArray);
|
||||||
|
@ -100,11 +107,16 @@ void pb_write_fifo_clear();
|
||||||
void pb_write_fifo(float sample);
|
void pb_write_fifo(float sample);
|
||||||
int cap_read_fifo(float* data);
|
int cap_read_fifo(float* data);
|
||||||
uint8_t* getAudioDevicelist(int* len);
|
uint8_t* getAudioDevicelist(int* len);
|
||||||
|
void setPBvolume(int v);
|
||||||
|
void setCAPvolume(int v);
|
||||||
|
void setVolume(int pbcap, int v);
|
||||||
|
int init_wasapi(int pbdev, int capdev);
|
||||||
|
|
||||||
void sleep_ms(int ms);
|
void sleep_ms(int ms);
|
||||||
void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock);
|
void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock);
|
||||||
|
|
||||||
void modulator(uint8_t sym_in);
|
void modulator(uint8_t sym_in);
|
||||||
|
int pb_fifo_usedBlocks();
|
||||||
void init_dsp();
|
void init_dsp();
|
||||||
int demodulator();
|
int demodulator();
|
||||||
void sendToModulator(uint8_t* d, int len);
|
void sendToModulator(uint8_t* d, int len);
|
||||||
|
@ -127,7 +139,7 @@ extern int UdpDataPort_ModemToApp;
|
||||||
extern int txinterpolfactor;
|
extern int txinterpolfactor;
|
||||||
extern int rxPreInterpolfactor;
|
extern int rxPreInterpolfactor;
|
||||||
extern char appIP[20];
|
extern char appIP[20];
|
||||||
|
extern float softwareCAPvolume;
|
||||||
|
|
||||||
#ifdef _LINUX_
|
#ifdef _LINUX_
|
||||||
int isRunning(char* prgname);
|
int isRunning(char* prgname);
|
||||||
|
|
|
@ -220,6 +220,8 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="bass.h" />
|
<ClInclude Include="bass.h" />
|
||||||
|
<ClInclude Include="basswasapi.h" />
|
||||||
|
<ClInclude Include="fec.h" />
|
||||||
<ClInclude Include="fftw3.h" />
|
<ClInclude Include="fftw3.h" />
|
||||||
<ClInclude Include="fftw_lib\fftw3.h" />
|
<ClInclude Include="fftw_lib\fftw3.h" />
|
||||||
<ClInclude Include="frameformat.h" />
|
<ClInclude Include="frameformat.h" />
|
||||||
|
@ -229,6 +231,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="audio.cpp" />
|
<ClCompile Include="audio.cpp" />
|
||||||
|
<ClCompile Include="audio_wasapi.cpp" />
|
||||||
<ClCompile Include="constellation.cpp" />
|
<ClCompile Include="constellation.cpp" />
|
||||||
<ClCompile Include="crc16.cpp" />
|
<ClCompile Include="crc16.cpp" />
|
||||||
<ClCompile Include="fec.cpp" />
|
<ClCompile Include="fec.cpp" />
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
<ClCompile Include="liquid_if.cpp">
|
<ClCompile Include="liquid_if.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="audio_wasapi.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="hsmodem.h">
|
<ClInclude Include="hsmodem.h">
|
||||||
|
@ -74,5 +77,11 @@
|
||||||
<ClInclude Include="fftw_lib\fftw3.h">
|
<ClInclude Include="fftw_lib\fftw3.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="basswasapi.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="fec.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -288,6 +288,9 @@ void make_FFTdata(float f)
|
||||||
|
|
||||||
int bidx = 0;
|
int bidx = 0;
|
||||||
txpl[bidx++] = 4; // type 4: FFT data follows
|
txpl[bidx++] = 4; // type 4: FFT data follows
|
||||||
|
int us = pb_fifo_usedBlocks();
|
||||||
|
if (us > 255) us = 255;
|
||||||
|
txpl[bidx++] = us; // usage of TX fifo
|
||||||
|
|
||||||
for (int i = 0; i < fftlen; i++)
|
for (int i = 0; i < fftlen; i++)
|
||||||
{
|
{
|
||||||
|
@ -311,6 +314,11 @@ static int ccol_idx = 0;
|
||||||
int ret = cap_read_fifo(&f);
|
int ret = cap_read_fifo(&f);
|
||||||
if(ret == 0) return 0;
|
if(ret == 0) return 0;
|
||||||
|
|
||||||
|
// input volume
|
||||||
|
#ifdef _WIN32_
|
||||||
|
f *= softwareCAPvolume;
|
||||||
|
#endif
|
||||||
|
|
||||||
make_FFTdata(f*120);
|
make_FFTdata(f*120);
|
||||||
|
|
||||||
// downconvert into baseband
|
// downconvert into baseband
|
||||||
|
@ -345,7 +353,7 @@ static int ccol_idx = 0;
|
||||||
unsigned int sym_out; // output symbol
|
unsigned int sym_out; // output symbol
|
||||||
modem_demodulate(demod, syms, &sym_out);
|
modem_demodulate(demod, syms, &sym_out);
|
||||||
|
|
||||||
measure_speed(1);
|
//measure_speed_syms(1);
|
||||||
|
|
||||||
// try to extract a complete frame
|
// try to extract a complete frame
|
||||||
uint8_t symb = sym_out;
|
uint8_t symb = sym_out;
|
||||||
|
@ -356,7 +364,7 @@ static int ccol_idx = 0;
|
||||||
// we have about 2000 S/s, but this many points would make the GUI slow
|
// we have about 2000 S/s, but this many points would make the GUI slow
|
||||||
// so we send only every x
|
// so we send only every x
|
||||||
static int ev = 0;
|
static int ev = 0;
|
||||||
//if (++ev >= 2)
|
if (++ev >= 2)
|
||||||
{
|
{
|
||||||
ev = 0;
|
ev = 0;
|
||||||
uint32_t re = (uint32_t)(syms.real * 16777216.0);
|
uint32_t re = (uint32_t)(syms.real * 16777216.0);
|
||||||
|
|
|
@ -28,6 +28,7 @@ int speed = 0;
|
||||||
|
|
||||||
#define MAXSPDARR 5
|
#define MAXSPDARR 5
|
||||||
int spdarr[MAXSPDARR];
|
int spdarr[MAXSPDARR];
|
||||||
|
int spdarrbps[MAXSPDARR];
|
||||||
|
|
||||||
#ifdef _LINUX_
|
#ifdef _LINUX_
|
||||||
int getus()
|
int getus()
|
||||||
|
@ -79,9 +80,37 @@ static int f=1;
|
||||||
return ssum;
|
return ssum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int meanvalbps(int v)
|
||||||
|
{
|
||||||
|
static int f = 1;
|
||||||
|
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAXSPDARR; i++) spdarrbps[i] = -1;
|
||||||
|
f = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = (MAXSPDARR - 1); i > 0; i--)
|
||||||
|
spdarrbps[i] = spdarrbps[i - 1];
|
||||||
|
spdarrbps[0] = v;
|
||||||
|
|
||||||
|
int ssum = 0;
|
||||||
|
int cnt = 0;
|
||||||
|
for (int i = 0; i < MAXSPDARR; i++)
|
||||||
|
{
|
||||||
|
if (spdarrbps[i] != -1)
|
||||||
|
{
|
||||||
|
ssum += spdarrbps[i];
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ssum /= cnt;
|
||||||
|
return ssum;
|
||||||
|
}
|
||||||
|
|
||||||
// len ... number of symbols
|
// len ... number of symbols
|
||||||
// measures and calculates the speed in bit / s
|
// measures and calculates the speed in bit / s
|
||||||
void measure_speed(int len)
|
void measure_speed_syms(int len)
|
||||||
{
|
{
|
||||||
static int lasttim = 0;
|
static int lasttim = 0;
|
||||||
static int elems = 0;
|
static int elems = 0;
|
||||||
|
@ -96,15 +125,43 @@ void measure_speed(int len)
|
||||||
|
|
||||||
|
|
||||||
elems += len;
|
elems += len;
|
||||||
if(timespan < 2000000) return;
|
if(timespan < 1000000) return;
|
||||||
|
|
||||||
double dspd = elems;
|
double dspd = elems;
|
||||||
dspd = dspd * 1e6 / timespan;
|
dspd = dspd * 1e6 / timespan;
|
||||||
speed = meanval((int)dspd) * bitsPerSymbol;
|
speed = meanval((int)dspd) * bitsPerSymbol;
|
||||||
|
|
||||||
// here we have number of elements after 1s
|
// here we have number of elements after 1s
|
||||||
//printf("%d items/s\n",speed);
|
printf("%d sym/s\n",speed);
|
||||||
|
|
||||||
elems=0;
|
elems=0;
|
||||||
lasttim = tim;
|
lasttim = tim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void measure_speed_bps(int len)
|
||||||
|
{
|
||||||
|
static int lasttim = 0;
|
||||||
|
static int elems = 0;
|
||||||
|
|
||||||
|
int tim = getus();
|
||||||
|
int timespan = tim - lasttim;
|
||||||
|
if (timespan < 0)
|
||||||
|
{
|
||||||
|
lasttim = tim;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
elems += len;
|
||||||
|
if (timespan < 1000000) return;
|
||||||
|
|
||||||
|
double dspd = elems;
|
||||||
|
dspd = dspd * 1e6 / timespan;
|
||||||
|
speed = meanvalbps((int)dspd);
|
||||||
|
|
||||||
|
// here we have number of elements after 1s
|
||||||
|
printf("%d bit/s\n", speed);
|
||||||
|
|
||||||
|
elems = 0;
|
||||||
|
lasttim = tim;
|
||||||
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ void UdpRxInit(int *sock, int port, void (*rxfunc)(uint8_t *, int, struct sockad
|
||||||
#ifdef _LINUX_
|
#ifdef _LINUX_
|
||||||
void* threadfunction(void* param) {
|
void* threadfunction(void* param) {
|
||||||
socklen_t fromlen;
|
socklen_t fromlen;
|
||||||
|
pthread_detach(pthread_self());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32_
|
#ifdef _WIN32_
|
||||||
|
@ -129,6 +130,7 @@ void threadfunction(void* param) {
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef _LINUX_
|
#ifdef _LINUX_
|
||||||
|
pthread_exit(NULL); // self terminate this thread
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -192,12 +192,12 @@ namespace oscardata
|
||||||
|
|
||||||
static void txudp(Byte[] txdata, Byte txtype, Byte filestat)
|
static void txudp(Byte[] txdata, Byte txtype, Byte filestat)
|
||||||
{
|
{
|
||||||
// add the tytype and filestatus at the beginning
|
// add the txtype and filestatus at the beginning
|
||||||
Byte[] darr = new byte[statics.PayloadLen + 2];
|
Byte[] darr = new byte[statics.PayloadLen + 2];
|
||||||
darr[0] = txtype;
|
darr[0] = txtype;
|
||||||
darr[1] = filestat;
|
darr[1] = filestat;
|
||||||
Array.Copy(txdata, 0, darr, 2, statics.PayloadLen);
|
Array.Copy(txdata, 0, darr, 2, statics.PayloadLen);
|
||||||
Udp.UdpSend(darr);
|
Udp.UdpSendData(darr);
|
||||||
// Console.WriteLine("TX filestat: " + filestat+ " data:" + darr[2].ToString("X2") + " " + darr[3].ToString("X2"));
|
// Console.WriteLine("TX filestat: " + filestat+ " data:" + darr[2].ToString("X2") + " " + darr[3].ToString("X2"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,25 +71,31 @@
|
||||||
this.bt_file_html = new System.Windows.Forms.Button();
|
this.bt_file_html = new System.Windows.Forms.Button();
|
||||||
this.bt_file_ascii = new System.Windows.Forms.Button();
|
this.bt_file_ascii = new System.Windows.Forms.Button();
|
||||||
this.tabPage5 = new System.Windows.Forms.TabPage();
|
this.tabPage5 = new System.Windows.Forms.TabPage();
|
||||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.cb_audioCAP = new System.Windows.Forms.ComboBox();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.cb_audioPB = new System.Windows.Forms.ComboBox();
|
|
||||||
this.bt_resetmodem = new System.Windows.Forms.Button();
|
|
||||||
this.tb_shutdown = new System.Windows.Forms.TextBox();
|
|
||||||
this.bt_shutdown = new System.Windows.Forms.Button();
|
this.bt_shutdown = new System.Windows.Forms.Button();
|
||||||
this.cb_savegoodfiles = new System.Windows.Forms.CheckBox();
|
this.tb_shutdown = new System.Windows.Forms.TextBox();
|
||||||
this.cb_stampcall = new System.Windows.Forms.CheckBox();
|
this.bt_resetmodem = new System.Windows.Forms.Button();
|
||||||
|
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||||
|
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
|
this.tb_CAPvol = new System.Windows.Forms.TrackBar();
|
||||||
|
this.tb_PBvol = new System.Windows.Forms.TrackBar();
|
||||||
|
this.cb_audioPB = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||||
|
this.cb_audioCAP = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
this.tb_callsign = new System.Windows.Forms.TextBox();
|
this.tb_callsign = new System.Windows.Forms.TextBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.cb_stampcall = new System.Windows.Forms.CheckBox();
|
||||||
|
this.cb_savegoodfiles = new System.Windows.Forms.CheckBox();
|
||||||
this.cb_speed = new System.Windows.Forms.ComboBox();
|
this.cb_speed = new System.Windows.Forms.ComboBox();
|
||||||
this.label_speed = new System.Windows.Forms.Label();
|
this.label_speed = new System.Windows.Forms.Label();
|
||||||
this.timer_searchmodem = new System.Windows.Forms.Timer(this.components);
|
this.timer_searchmodem = new System.Windows.Forms.Timer(this.components);
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.progressBar_fifo = new System.Windows.Forms.ProgressBar();
|
||||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
this.label_fifo = new System.Windows.Forms.Label();
|
||||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
|
||||||
this.statusStrip1.SuspendLayout();
|
this.statusStrip1.SuspendLayout();
|
||||||
this.tabPage1.SuspendLayout();
|
this.tabPage1.SuspendLayout();
|
||||||
this.tabPage2.SuspendLayout();
|
this.tabPage2.SuspendLayout();
|
||||||
|
@ -99,9 +105,11 @@
|
||||||
this.tabControl1.SuspendLayout();
|
this.tabControl1.SuspendLayout();
|
||||||
this.tabPage3.SuspendLayout();
|
this.tabPage3.SuspendLayout();
|
||||||
this.tabPage5.SuspendLayout();
|
this.tabPage5.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
|
||||||
this.groupBox3.SuspendLayout();
|
|
||||||
this.groupBox4.SuspendLayout();
|
this.groupBox4.SuspendLayout();
|
||||||
|
this.groupBox3.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.tb_CAPvol)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.tb_PBvol)).BeginInit();
|
||||||
|
this.groupBox2.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// timer_udpTX
|
// timer_udpTX
|
||||||
|
@ -121,7 +129,7 @@
|
||||||
this.RXstatus});
|
this.RXstatus});
|
||||||
this.statusStrip1.Location = new System.Drawing.Point(0, 669);
|
this.statusStrip1.Location = new System.Drawing.Point(0, 669);
|
||||||
this.statusStrip1.Name = "statusStrip1";
|
this.statusStrip1.Name = "statusStrip1";
|
||||||
this.statusStrip1.Size = new System.Drawing.Size(1304, 22);
|
this.statusStrip1.Size = new System.Drawing.Size(1293, 22);
|
||||||
this.statusStrip1.TabIndex = 4;
|
this.statusStrip1.TabIndex = 4;
|
||||||
this.statusStrip1.Text = "statusStrip1";
|
this.statusStrip1.Text = "statusStrip1";
|
||||||
//
|
//
|
||||||
|
@ -133,6 +141,7 @@
|
||||||
//
|
//
|
||||||
// ts_ip
|
// ts_ip
|
||||||
//
|
//
|
||||||
|
this.ts_ip.ForeColor = System.Drawing.Color.Red;
|
||||||
this.ts_ip.Name = "ts_ip";
|
this.ts_ip.Name = "ts_ip";
|
||||||
this.ts_ip.Size = new System.Drawing.Size(12, 17);
|
this.ts_ip.Size = new System.Drawing.Size(12, 17);
|
||||||
this.ts_ip.Text = "?";
|
this.ts_ip.Text = "?";
|
||||||
|
@ -521,75 +530,28 @@
|
||||||
this.tabPage5.Text = "Setup";
|
this.tabPage5.Text = "Setup";
|
||||||
this.tabPage5.UseVisualStyleBackColor = true;
|
this.tabPage5.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// textBox3
|
// groupBox4
|
||||||
//
|
//
|
||||||
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
this.groupBox4.Controls.Add(this.bt_shutdown);
|
||||||
this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.groupBox4.Controls.Add(this.tb_shutdown);
|
||||||
this.textBox3.ForeColor = System.Drawing.Color.Black;
|
this.groupBox4.Controls.Add(this.bt_resetmodem);
|
||||||
this.textBox3.Location = new System.Drawing.Point(138, 73);
|
this.groupBox4.Controls.Add(this.textBox2);
|
||||||
this.textBox3.Multiline = true;
|
this.groupBox4.Location = new System.Drawing.Point(12, 259);
|
||||||
this.textBox3.Name = "textBox3";
|
this.groupBox4.Name = "groupBox4";
|
||||||
this.textBox3.Size = new System.Drawing.Size(177, 19);
|
this.groupBox4.Size = new System.Drawing.Size(384, 105);
|
||||||
this.textBox3.TabIndex = 12;
|
this.groupBox4.TabIndex = 15;
|
||||||
this.textBox3.Text = "(HDMI is usually not used)";
|
this.groupBox4.TabStop = false;
|
||||||
|
this.groupBox4.Text = "Maintenance";
|
||||||
//
|
//
|
||||||
// textBox2
|
// bt_shutdown
|
||||||
//
|
//
|
||||||
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
this.bt_shutdown.Location = new System.Drawing.Point(17, 19);
|
||||||
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.bt_shutdown.Name = "bt_shutdown";
|
||||||
this.textBox2.ForeColor = System.Drawing.Color.Black;
|
this.bt_shutdown.Size = new System.Drawing.Size(155, 23);
|
||||||
this.textBox2.Location = new System.Drawing.Point(189, 48);
|
this.bt_shutdown.TabIndex = 4;
|
||||||
this.textBox2.Multiline = true;
|
this.bt_shutdown.Text = "Shutdown Modem-SBC";
|
||||||
this.textBox2.Name = "textBox2";
|
this.bt_shutdown.UseVisualStyleBackColor = true;
|
||||||
this.textBox2.Size = new System.Drawing.Size(126, 50);
|
this.bt_shutdown.Click += new System.EventHandler(this.bt_shutdown_Click);
|
||||||
this.textBox2.TabIndex = 11;
|
|
||||||
this.textBox2.Text = "in case the RX has sync\r\nproblems, it can be\r\nre-initialized here.";
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Location = new System.Drawing.Point(12, 50);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(112, 13);
|
|
||||||
this.label4.TabIndex = 10;
|
|
||||||
this.label4.Text = "Audio Record Device:";
|
|
||||||
//
|
|
||||||
// cb_audioCAP
|
|
||||||
//
|
|
||||||
this.cb_audioCAP.FormattingEnabled = true;
|
|
||||||
this.cb_audioCAP.Location = new System.Drawing.Point(138, 46);
|
|
||||||
this.cb_audioCAP.Name = "cb_audioCAP";
|
|
||||||
this.cb_audioCAP.Size = new System.Drawing.Size(230, 21);
|
|
||||||
this.cb_audioCAP.TabIndex = 9;
|
|
||||||
this.cb_audioCAP.Text = "Default";
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.Location = new System.Drawing.Point(12, 23);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(121, 13);
|
|
||||||
this.label3.TabIndex = 8;
|
|
||||||
this.label3.Text = "Audio Playback Device:";
|
|
||||||
//
|
|
||||||
// cb_audioPB
|
|
||||||
//
|
|
||||||
this.cb_audioPB.FormattingEnabled = true;
|
|
||||||
this.cb_audioPB.Location = new System.Drawing.Point(138, 19);
|
|
||||||
this.cb_audioPB.Name = "cb_audioPB";
|
|
||||||
this.cb_audioPB.Size = new System.Drawing.Size(230, 21);
|
|
||||||
this.cb_audioPB.TabIndex = 7;
|
|
||||||
this.cb_audioPB.Text = "Default";
|
|
||||||
//
|
|
||||||
// bt_resetmodem
|
|
||||||
//
|
|
||||||
this.bt_resetmodem.Location = new System.Drawing.Point(189, 19);
|
|
||||||
this.bt_resetmodem.Name = "bt_resetmodem";
|
|
||||||
this.bt_resetmodem.Size = new System.Drawing.Size(117, 23);
|
|
||||||
this.bt_resetmodem.TabIndex = 6;
|
|
||||||
this.bt_resetmodem.Text = "Reset RX Modem";
|
|
||||||
this.bt_resetmodem.UseVisualStyleBackColor = true;
|
|
||||||
this.bt_resetmodem.Click += new System.EventHandler(this.bt_resetmodem_Click);
|
|
||||||
//
|
//
|
||||||
// tb_shutdown
|
// tb_shutdown
|
||||||
//
|
//
|
||||||
|
@ -603,39 +565,152 @@
|
||||||
this.tb_shutdown.TabIndex = 5;
|
this.tb_shutdown.TabIndex = 5;
|
||||||
this.tb_shutdown.Text = "before switching off the \r\nmodem SBC click here to \r\navoid defective SD-cards.\r\n";
|
this.tb_shutdown.Text = "before switching off the \r\nmodem SBC click here to \r\navoid defective SD-cards.\r\n";
|
||||||
//
|
//
|
||||||
// bt_shutdown
|
// bt_resetmodem
|
||||||
//
|
//
|
||||||
this.bt_shutdown.Location = new System.Drawing.Point(17, 19);
|
this.bt_resetmodem.Location = new System.Drawing.Point(189, 19);
|
||||||
this.bt_shutdown.Name = "bt_shutdown";
|
this.bt_resetmodem.Name = "bt_resetmodem";
|
||||||
this.bt_shutdown.Size = new System.Drawing.Size(155, 23);
|
this.bt_resetmodem.Size = new System.Drawing.Size(117, 23);
|
||||||
this.bt_shutdown.TabIndex = 4;
|
this.bt_resetmodem.TabIndex = 6;
|
||||||
this.bt_shutdown.Text = "Shutdown Modem-SBC";
|
this.bt_resetmodem.Text = "Reset RX Modem";
|
||||||
this.bt_shutdown.UseVisualStyleBackColor = true;
|
this.bt_resetmodem.UseVisualStyleBackColor = true;
|
||||||
this.bt_shutdown.Click += new System.EventHandler(this.bt_shutdown_Click);
|
this.bt_resetmodem.Click += new System.EventHandler(this.bt_resetmodem_Click);
|
||||||
//
|
//
|
||||||
// cb_savegoodfiles
|
// textBox2
|
||||||
//
|
//
|
||||||
this.cb_savegoodfiles.AutoSize = true;
|
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||||
this.cb_savegoodfiles.Checked = true;
|
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.cb_savegoodfiles.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.textBox2.ForeColor = System.Drawing.Color.Black;
|
||||||
this.cb_savegoodfiles.Location = new System.Drawing.Point(71, 90);
|
this.textBox2.Location = new System.Drawing.Point(189, 48);
|
||||||
this.cb_savegoodfiles.Name = "cb_savegoodfiles";
|
this.textBox2.Multiline = true;
|
||||||
this.cb_savegoodfiles.Size = new System.Drawing.Size(159, 17);
|
this.textBox2.Name = "textBox2";
|
||||||
this.cb_savegoodfiles.TabIndex = 3;
|
this.textBox2.Size = new System.Drawing.Size(126, 50);
|
||||||
this.cb_savegoodfiles.Text = "Save good files/images only";
|
this.textBox2.TabIndex = 11;
|
||||||
this.cb_savegoodfiles.UseVisualStyleBackColor = true;
|
this.textBox2.Text = "in case the RX has sync\r\nproblems, it can be\r\nre-initialized here.";
|
||||||
//
|
//
|
||||||
// cb_stampcall
|
// groupBox3
|
||||||
//
|
//
|
||||||
this.cb_stampcall.AutoSize = true;
|
this.groupBox3.Controls.Add(this.label6);
|
||||||
this.cb_stampcall.Checked = true;
|
this.groupBox3.Controls.Add(this.label5);
|
||||||
this.cb_stampcall.CheckState = System.Windows.Forms.CheckState.Checked;
|
this.groupBox3.Controls.Add(this.tb_CAPvol);
|
||||||
this.cb_stampcall.Location = new System.Drawing.Point(71, 67);
|
this.groupBox3.Controls.Add(this.tb_PBvol);
|
||||||
this.cb_stampcall.Name = "cb_stampcall";
|
this.groupBox3.Controls.Add(this.cb_audioPB);
|
||||||
this.cb_stampcall.Size = new System.Drawing.Size(146, 17);
|
this.groupBox3.Controls.Add(this.label3);
|
||||||
this.cb_stampcall.TabIndex = 2;
|
this.groupBox3.Controls.Add(this.textBox3);
|
||||||
this.cb_stampcall.Text = "Insert Callsign into picture";
|
this.groupBox3.Controls.Add(this.cb_audioCAP);
|
||||||
this.cb_stampcall.UseVisualStyleBackColor = true;
|
this.groupBox3.Controls.Add(this.label4);
|
||||||
|
this.groupBox3.Location = new System.Drawing.Point(12, 146);
|
||||||
|
this.groupBox3.Name = "groupBox3";
|
||||||
|
this.groupBox3.Size = new System.Drawing.Size(674, 107);
|
||||||
|
this.groupBox3.TabIndex = 14;
|
||||||
|
this.groupBox3.TabStop = false;
|
||||||
|
this.groupBox3.Text = "Transceiver Audio";
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
this.label6.AutoSize = true;
|
||||||
|
this.label6.Location = new System.Drawing.Point(391, 54);
|
||||||
|
this.label6.Name = "label6";
|
||||||
|
this.label6.Size = new System.Drawing.Size(45, 13);
|
||||||
|
this.label6.TabIndex = 16;
|
||||||
|
this.label6.Text = "Volume:";
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Location = new System.Drawing.Point(391, 23);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(45, 13);
|
||||||
|
this.label5.TabIndex = 15;
|
||||||
|
this.label5.Text = "Volume:";
|
||||||
|
//
|
||||||
|
// tb_CAPvol
|
||||||
|
//
|
||||||
|
this.tb_CAPvol.Cursor = System.Windows.Forms.Cursors.SizeAll;
|
||||||
|
this.tb_CAPvol.Location = new System.Drawing.Point(442, 50);
|
||||||
|
this.tb_CAPvol.Maximum = 100;
|
||||||
|
this.tb_CAPvol.MaximumSize = new System.Drawing.Size(0, 24);
|
||||||
|
this.tb_CAPvol.MinimumSize = new System.Drawing.Size(100, 0);
|
||||||
|
this.tb_CAPvol.Name = "tb_CAPvol";
|
||||||
|
this.tb_CAPvol.Size = new System.Drawing.Size(100, 24);
|
||||||
|
this.tb_CAPvol.TabIndex = 14;
|
||||||
|
this.tb_CAPvol.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||||
|
this.tb_CAPvol.Value = 50;
|
||||||
|
this.tb_CAPvol.Scroll += new System.EventHandler(this.tb_CAPvol_Scroll);
|
||||||
|
//
|
||||||
|
// tb_PBvol
|
||||||
|
//
|
||||||
|
this.tb_PBvol.Cursor = System.Windows.Forms.Cursors.SizeAll;
|
||||||
|
this.tb_PBvol.Location = new System.Drawing.Point(442, 19);
|
||||||
|
this.tb_PBvol.Maximum = 100;
|
||||||
|
this.tb_PBvol.MaximumSize = new System.Drawing.Size(0, 24);
|
||||||
|
this.tb_PBvol.MinimumSize = new System.Drawing.Size(100, 0);
|
||||||
|
this.tb_PBvol.Name = "tb_PBvol";
|
||||||
|
this.tb_PBvol.Size = new System.Drawing.Size(100, 24);
|
||||||
|
this.tb_PBvol.TabIndex = 13;
|
||||||
|
this.tb_PBvol.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||||
|
this.tb_PBvol.Value = 50;
|
||||||
|
this.tb_PBvol.Scroll += new System.EventHandler(this.tb_PBvol_Scroll);
|
||||||
|
//
|
||||||
|
// cb_audioPB
|
||||||
|
//
|
||||||
|
this.cb_audioPB.FormattingEnabled = true;
|
||||||
|
this.cb_audioPB.Location = new System.Drawing.Point(138, 19);
|
||||||
|
this.cb_audioPB.Name = "cb_audioPB";
|
||||||
|
this.cb_audioPB.Size = new System.Drawing.Size(230, 21);
|
||||||
|
this.cb_audioPB.TabIndex = 7;
|
||||||
|
this.cb_audioPB.Text = "Default";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(12, 23);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(121, 13);
|
||||||
|
this.label3.TabIndex = 8;
|
||||||
|
this.label3.Text = "Audio Playback Device:";
|
||||||
|
//
|
||||||
|
// textBox3
|
||||||
|
//
|
||||||
|
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||||
|
this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.textBox3.ForeColor = System.Drawing.Color.Black;
|
||||||
|
this.textBox3.Location = new System.Drawing.Point(138, 79);
|
||||||
|
this.textBox3.Multiline = true;
|
||||||
|
this.textBox3.Name = "textBox3";
|
||||||
|
this.textBox3.Size = new System.Drawing.Size(177, 19);
|
||||||
|
this.textBox3.TabIndex = 12;
|
||||||
|
this.textBox3.Text = "(HDMI is usually not used)";
|
||||||
|
//
|
||||||
|
// cb_audioCAP
|
||||||
|
//
|
||||||
|
this.cb_audioCAP.FormattingEnabled = true;
|
||||||
|
this.cb_audioCAP.Location = new System.Drawing.Point(138, 52);
|
||||||
|
this.cb_audioCAP.Name = "cb_audioCAP";
|
||||||
|
this.cb_audioCAP.Size = new System.Drawing.Size(230, 21);
|
||||||
|
this.cb_audioCAP.TabIndex = 9;
|
||||||
|
this.cb_audioCAP.Text = "Default";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(12, 56);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(112, 13);
|
||||||
|
this.label4.TabIndex = 10;
|
||||||
|
this.label4.Text = "Audio Record Device:";
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
this.groupBox2.Controls.Add(this.tb_callsign);
|
||||||
|
this.groupBox2.Controls.Add(this.label1);
|
||||||
|
this.groupBox2.Controls.Add(this.cb_stampcall);
|
||||||
|
this.groupBox2.Controls.Add(this.cb_savegoodfiles);
|
||||||
|
this.groupBox2.Location = new System.Drawing.Point(12, 13);
|
||||||
|
this.groupBox2.Name = "groupBox2";
|
||||||
|
this.groupBox2.Size = new System.Drawing.Size(384, 126);
|
||||||
|
this.groupBox2.TabIndex = 13;
|
||||||
|
this.groupBox2.TabStop = false;
|
||||||
|
this.groupBox2.Text = "Personal Settings";
|
||||||
//
|
//
|
||||||
// tb_callsign
|
// tb_callsign
|
||||||
//
|
//
|
||||||
|
@ -654,6 +729,30 @@
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = "Callsign:";
|
this.label1.Text = "Callsign:";
|
||||||
//
|
//
|
||||||
|
// cb_stampcall
|
||||||
|
//
|
||||||
|
this.cb_stampcall.AutoSize = true;
|
||||||
|
this.cb_stampcall.Checked = true;
|
||||||
|
this.cb_stampcall.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.cb_stampcall.Location = new System.Drawing.Point(71, 67);
|
||||||
|
this.cb_stampcall.Name = "cb_stampcall";
|
||||||
|
this.cb_stampcall.Size = new System.Drawing.Size(146, 17);
|
||||||
|
this.cb_stampcall.TabIndex = 2;
|
||||||
|
this.cb_stampcall.Text = "Insert Callsign into picture";
|
||||||
|
this.cb_stampcall.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// cb_savegoodfiles
|
||||||
|
//
|
||||||
|
this.cb_savegoodfiles.AutoSize = true;
|
||||||
|
this.cb_savegoodfiles.Checked = true;
|
||||||
|
this.cb_savegoodfiles.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.cb_savegoodfiles.Location = new System.Drawing.Point(71, 90);
|
||||||
|
this.cb_savegoodfiles.Name = "cb_savegoodfiles";
|
||||||
|
this.cb_savegoodfiles.Size = new System.Drawing.Size(159, 17);
|
||||||
|
this.cb_savegoodfiles.TabIndex = 3;
|
||||||
|
this.cb_savegoodfiles.Text = "Save good files/images only";
|
||||||
|
this.cb_savegoodfiles.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// cb_speed
|
// cb_speed
|
||||||
//
|
//
|
||||||
this.cb_speed.FormattingEnabled = true;
|
this.cb_speed.FormattingEnabled = true;
|
||||||
|
@ -668,7 +767,7 @@
|
||||||
"6000 8PSK BW: 2500 Hz (QO-100)",
|
"6000 8PSK BW: 2500 Hz (QO-100)",
|
||||||
"6600 8PSK BW: 2600 Hz",
|
"6600 8PSK BW: 2600 Hz",
|
||||||
"7200 8PSK BW: 2700 Hz"});
|
"7200 8PSK BW: 2700 Hz"});
|
||||||
this.cb_speed.Location = new System.Drawing.Point(636, 644);
|
this.cb_speed.Location = new System.Drawing.Point(636, 593);
|
||||||
this.cb_speed.Name = "cb_speed";
|
this.cb_speed.Name = "cb_speed";
|
||||||
this.cb_speed.Size = new System.Drawing.Size(324, 21);
|
this.cb_speed.Size = new System.Drawing.Size(324, 21);
|
||||||
this.cb_speed.TabIndex = 11;
|
this.cb_speed.TabIndex = 11;
|
||||||
|
@ -678,7 +777,7 @@
|
||||||
// label_speed
|
// label_speed
|
||||||
//
|
//
|
||||||
this.label_speed.AutoSize = true;
|
this.label_speed.AutoSize = true;
|
||||||
this.label_speed.Location = new System.Drawing.Point(545, 647);
|
this.label_speed.Location = new System.Drawing.Point(545, 596);
|
||||||
this.label_speed.Name = "label_speed";
|
this.label_speed.Name = "label_speed";
|
||||||
this.label_speed.Size = new System.Drawing.Size(71, 13);
|
this.label_speed.Size = new System.Drawing.Size(71, 13);
|
||||||
this.label_speed.TabIndex = 12;
|
this.label_speed.TabIndex = 12;
|
||||||
|
@ -689,51 +788,32 @@
|
||||||
this.timer_searchmodem.Interval = 1000;
|
this.timer_searchmodem.Interval = 1000;
|
||||||
this.timer_searchmodem.Tick += new System.EventHandler(this.timer_searchmodem_Tick);
|
this.timer_searchmodem.Tick += new System.EventHandler(this.timer_searchmodem_Tick);
|
||||||
//
|
//
|
||||||
// groupBox2
|
// progressBar_fifo
|
||||||
//
|
//
|
||||||
this.groupBox2.Controls.Add(this.tb_callsign);
|
this.progressBar_fifo.Location = new System.Drawing.Point(636, 620);
|
||||||
this.groupBox2.Controls.Add(this.label1);
|
this.progressBar_fifo.Maximum = 20;
|
||||||
this.groupBox2.Controls.Add(this.cb_stampcall);
|
this.progressBar_fifo.Name = "progressBar_fifo";
|
||||||
this.groupBox2.Controls.Add(this.cb_savegoodfiles);
|
this.progressBar_fifo.Size = new System.Drawing.Size(324, 23);
|
||||||
this.groupBox2.Location = new System.Drawing.Point(12, 13);
|
this.progressBar_fifo.Step = 11;
|
||||||
this.groupBox2.Name = "groupBox2";
|
this.progressBar_fifo.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||||
this.groupBox2.Size = new System.Drawing.Size(384, 126);
|
this.progressBar_fifo.TabIndex = 13;
|
||||||
this.groupBox2.TabIndex = 13;
|
|
||||||
this.groupBox2.TabStop = false;
|
|
||||||
this.groupBox2.Text = "Personal Settings";
|
|
||||||
//
|
//
|
||||||
// groupBox3
|
// label_fifo
|
||||||
//
|
//
|
||||||
this.groupBox3.Controls.Add(this.cb_audioPB);
|
this.label_fifo.AutoSize = true;
|
||||||
this.groupBox3.Controls.Add(this.label3);
|
this.label_fifo.Location = new System.Drawing.Point(545, 625);
|
||||||
this.groupBox3.Controls.Add(this.textBox3);
|
this.label_fifo.Name = "label_fifo";
|
||||||
this.groupBox3.Controls.Add(this.cb_audioCAP);
|
this.label_fifo.Size = new System.Drawing.Size(55, 13);
|
||||||
this.groupBox3.Controls.Add(this.label4);
|
this.label_fifo.TabIndex = 14;
|
||||||
this.groupBox3.Location = new System.Drawing.Point(12, 146);
|
this.label_fifo.Text = "TX Buffer:";
|
||||||
this.groupBox3.Name = "groupBox3";
|
|
||||||
this.groupBox3.Size = new System.Drawing.Size(384, 107);
|
|
||||||
this.groupBox3.TabIndex = 14;
|
|
||||||
this.groupBox3.TabStop = false;
|
|
||||||
this.groupBox3.Text = "Transceiver Audio";
|
|
||||||
//
|
|
||||||
// groupBox4
|
|
||||||
//
|
|
||||||
this.groupBox4.Controls.Add(this.bt_shutdown);
|
|
||||||
this.groupBox4.Controls.Add(this.tb_shutdown);
|
|
||||||
this.groupBox4.Controls.Add(this.bt_resetmodem);
|
|
||||||
this.groupBox4.Controls.Add(this.textBox2);
|
|
||||||
this.groupBox4.Location = new System.Drawing.Point(12, 259);
|
|
||||||
this.groupBox4.Name = "groupBox4";
|
|
||||||
this.groupBox4.Size = new System.Drawing.Size(384, 105);
|
|
||||||
this.groupBox4.TabIndex = 15;
|
|
||||||
this.groupBox4.TabStop = false;
|
|
||||||
this.groupBox4.Text = "Maintenance";
|
|
||||||
//
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1304, 691);
|
this.ClientSize = new System.Drawing.Size(1293, 691);
|
||||||
|
this.Controls.Add(this.label_fifo);
|
||||||
|
this.Controls.Add(this.progressBar_fifo);
|
||||||
this.Controls.Add(this.cb_speed);
|
this.Controls.Add(this.cb_speed);
|
||||||
this.Controls.Add(this.label_speed);
|
this.Controls.Add(this.label_speed);
|
||||||
this.Controls.Add(this.panel_txspectrum);
|
this.Controls.Add(this.panel_txspectrum);
|
||||||
|
@ -758,12 +838,14 @@
|
||||||
this.tabPage3.ResumeLayout(false);
|
this.tabPage3.ResumeLayout(false);
|
||||||
this.tabPage3.PerformLayout();
|
this.tabPage3.PerformLayout();
|
||||||
this.tabPage5.ResumeLayout(false);
|
this.tabPage5.ResumeLayout(false);
|
||||||
this.groupBox2.ResumeLayout(false);
|
|
||||||
this.groupBox2.PerformLayout();
|
|
||||||
this.groupBox3.ResumeLayout(false);
|
|
||||||
this.groupBox3.PerformLayout();
|
|
||||||
this.groupBox4.ResumeLayout(false);
|
this.groupBox4.ResumeLayout(false);
|
||||||
this.groupBox4.PerformLayout();
|
this.groupBox4.PerformLayout();
|
||||||
|
this.groupBox3.ResumeLayout(false);
|
||||||
|
this.groupBox3.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.tb_CAPvol)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.tb_PBvol)).EndInit();
|
||||||
|
this.groupBox2.ResumeLayout(false);
|
||||||
|
this.groupBox2.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
@ -831,6 +913,12 @@
|
||||||
private System.Windows.Forms.GroupBox groupBox4;
|
private System.Windows.Forms.GroupBox groupBox4;
|
||||||
private System.Windows.Forms.GroupBox groupBox3;
|
private System.Windows.Forms.GroupBox groupBox3;
|
||||||
private System.Windows.Forms.GroupBox groupBox2;
|
private System.Windows.Forms.GroupBox groupBox2;
|
||||||
|
private System.Windows.Forms.TrackBar tb_PBvol;
|
||||||
|
private System.Windows.Forms.Label label6;
|
||||||
|
private System.Windows.Forms.Label label5;
|
||||||
|
private System.Windows.Forms.TrackBar tb_CAPvol;
|
||||||
|
private System.Windows.Forms.ProgressBar progressBar_fifo;
|
||||||
|
private System.Windows.Forms.Label label_fifo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,12 @@ namespace oscardata
|
||||||
{
|
{
|
||||||
Imagehandler ih = new Imagehandler();
|
Imagehandler ih = new Imagehandler();
|
||||||
int txcommand = 0; // commands what to send
|
int txcommand = 0; // commands what to send
|
||||||
int txframecounter = 0;
|
|
||||||
Byte frameinfo = (Byte)statics.FirstFrame;
|
Byte frameinfo = (Byte)statics.FirstFrame;
|
||||||
String TXfilename;
|
String TXfilename;
|
||||||
int rxbytecounter = 0;
|
int rxbytecounter = 0;
|
||||||
DateTime starttime;
|
DateTime starttime;
|
||||||
String old_tsip = "";
|
String old_tsip = "";
|
||||||
|
bool modemrunning = false;
|
||||||
|
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,9 @@ namespace oscardata
|
||||||
else
|
else
|
||||||
statics.ostype = 1; // Linux
|
statics.ostype = 1; // Linux
|
||||||
|
|
||||||
|
// start hsmodem (.exe)
|
||||||
|
modemrunning = statics.StartHSmodem();
|
||||||
|
|
||||||
// set temp paths
|
// set temp paths
|
||||||
statics.zip_TXtempfilename = statics.addTmpPath(statics.zip_TXtempfilename);
|
statics.zip_TXtempfilename = statics.addTmpPath(statics.zip_TXtempfilename);
|
||||||
statics.zip_RXtempfilename = statics.addTmpPath(statics.zip_RXtempfilename);
|
statics.zip_RXtempfilename = statics.addTmpPath(statics.zip_RXtempfilename);
|
||||||
|
@ -92,26 +95,26 @@ namespace oscardata
|
||||||
// BER testdata
|
// BER testdata
|
||||||
if (txcommand == statics.BERtest)
|
if (txcommand == statics.BERtest)
|
||||||
{
|
{
|
||||||
if (Udp.GetBufferCount() > 3) return;
|
if (Udp.GetBufferCount() < 2)
|
||||||
|
|
||||||
Byte[] txdata = new byte[statics.PayloadLen + 2];
|
|
||||||
|
|
||||||
txdata[0] = (Byte)statics.BERtest; // BER Test Marker
|
|
||||||
txdata[1] = frameinfo;
|
|
||||||
|
|
||||||
Byte tb = (Byte)'A';
|
|
||||||
for (int i = 2; i < txdata.Length; i++)
|
|
||||||
{
|
{
|
||||||
txdata[i] = tb;
|
Byte[] txdata = new byte[statics.PayloadLen + 2];
|
||||||
tb++;
|
|
||||||
if (tb == 'z') tb = (Byte)'A';
|
txdata[0] = (Byte)statics.BERtest; // BER Test Marker
|
||||||
|
txdata[1] = frameinfo;
|
||||||
|
|
||||||
|
Byte tb = (Byte)'A';
|
||||||
|
for (int i = 2; i < txdata.Length; i++)
|
||||||
|
{
|
||||||
|
txdata[i] = tb;
|
||||||
|
tb++;
|
||||||
|
if (tb == 'z') tb = (Byte)'A';
|
||||||
|
}
|
||||||
|
|
||||||
|
// and transmit it
|
||||||
|
Udp.UdpSendData(txdata);
|
||||||
|
|
||||||
|
frameinfo = (Byte)statics.NextFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
// and transmit it
|
|
||||||
Udp.UdpSend(txdata);
|
|
||||||
|
|
||||||
frameinfo = (Byte)statics.NextFrame;
|
|
||||||
txframecounter++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ArraySend.getSending())
|
if (ArraySend.getSending())
|
||||||
|
@ -169,10 +172,14 @@ namespace oscardata
|
||||||
if (ts_ip.Text.Contains("?") || ts_ip.Text.Contains("1.2.3.4") || old_tsip != statics.ModemIP)
|
if (ts_ip.Text.Contains("?") || ts_ip.Text.Contains("1.2.3.4") || old_tsip != statics.ModemIP)
|
||||||
{
|
{
|
||||||
if (statics.ModemIP == "1.2.3.4")
|
if (statics.ModemIP == "1.2.3.4")
|
||||||
|
{
|
||||||
ts_ip.Text = "Modem-IP: ?";
|
ts_ip.Text = "Modem-IP: ?";
|
||||||
|
ts_ip.ForeColor = Color.Red;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ts_ip.Text = "Modem-IP: " + statics.ModemIP;
|
ts_ip.Text = "Modem-IP: " + statics.ModemIP;
|
||||||
|
ts_ip.ForeColor = Color.Black;
|
||||||
old_tsip = statics.ModemIP;
|
old_tsip = statics.ModemIP;
|
||||||
comboBox1_SelectedIndexChanged(null, null); // send speed to modem
|
comboBox1_SelectedIndexChanged(null, null); // send speed to modem
|
||||||
}
|
}
|
||||||
|
@ -193,11 +200,38 @@ namespace oscardata
|
||||||
cb_audioCAP.Items.Add(s);
|
cb_audioCAP.Items.Add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (setPBvolume >= 0)
|
||||||
|
{
|
||||||
|
Byte[] txdata = new byte[2];
|
||||||
|
txdata[0] = (Byte)statics.SetPBvolume;
|
||||||
|
txdata[1] = (Byte)setPBvolume;
|
||||||
|
Udp.UdpSendCtrl(txdata);
|
||||||
|
setPBvolume = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setCAPvolume != -1)
|
||||||
|
{
|
||||||
|
Byte[] txdata = new byte[2];
|
||||||
|
txdata[0] = (Byte)statics.SetCAPvolume;
|
||||||
|
txdata[1] = (Byte)setCAPvolume;
|
||||||
|
Udp.UdpSendCtrl(txdata);
|
||||||
|
setCAPvolume = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(modemrunning == false)
|
||||||
|
{
|
||||||
|
// start hsmodem (.exe)
|
||||||
|
modemrunning = statics.StartHSmodem();
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
save_Setup();
|
save_Setup();
|
||||||
|
statics.killall("hsmodem");
|
||||||
|
statics.killall("hsmodem.exe");
|
||||||
// exit the threads
|
// exit the threads
|
||||||
statics.running = false;
|
statics.running = false;
|
||||||
Udp.Close();
|
Udp.Close();
|
||||||
|
@ -633,6 +667,8 @@ namespace oscardata
|
||||||
panel_constel.Invalidate();
|
panel_constel.Invalidate();
|
||||||
|
|
||||||
panel_txspectrum.Invalidate();
|
panel_txspectrum.Invalidate();
|
||||||
|
|
||||||
|
progressBar_fifo.Value = statics.PBfifousage;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void panel_constel_Paint(object sender, PaintEventArgs e)
|
private void panel_constel_Paint(object sender, PaintEventArgs e)
|
||||||
|
@ -934,7 +970,6 @@ namespace oscardata
|
||||||
|
|
||||||
private void button_startBERtest_Click(object sender, EventArgs e)
|
private void button_startBERtest_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
txframecounter = 1;
|
|
||||||
ber = 0;
|
ber = 0;
|
||||||
framelost = 0;
|
framelost = 0;
|
||||||
totallostframes = 0;
|
totallostframes = 0;
|
||||||
|
@ -978,8 +1013,7 @@ namespace oscardata
|
||||||
|
|
||||||
private void BERcheck(Byte[] rxdata)
|
private void BERcheck(Byte[] rxdata)
|
||||||
{
|
{
|
||||||
String line = "RX: " + rxframecounter.ToString().PadLeft(6, ' ') +
|
String line = "RX: " + rxframecounter.ToString().PadLeft(6, ' ') + " ";
|
||||||
" TX: " + txframecounter.ToString().PadLeft(6, ' ') + " ";
|
|
||||||
|
|
||||||
// print payload (must be printable chars)
|
// print payload (must be printable chars)
|
||||||
line += Encoding.UTF8.GetString(rxdata).Substring(0, 50) + " ...";
|
line += Encoding.UTF8.GetString(rxdata).Substring(0, 50) + " ...";
|
||||||
|
@ -1100,6 +1134,9 @@ namespace oscardata
|
||||||
|
|
||||||
label_speed.Location = new Point(panel_txspectrum.Location.X + panel_txspectrum.Size.Width + 20,panel_txspectrum.Location.Y+10);
|
label_speed.Location = new Point(panel_txspectrum.Location.X + panel_txspectrum.Size.Width + 20,panel_txspectrum.Location.Y+10);
|
||||||
cb_speed.Location = new Point(label_speed.Location.X + label_speed.Size.Width + 10, label_speed.Location.Y-5);
|
cb_speed.Location = new Point(label_speed.Location.X + label_speed.Size.Width + 10, label_speed.Location.Y-5);
|
||||||
|
|
||||||
|
label_fifo.Location = new Point(label_speed.Location.X, label_speed.Location.Y + 35);
|
||||||
|
progressBar_fifo.Location = new Point(cb_speed.Location.X, cb_speed.Location.Y + 35);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String GetMyBroadcastIP()
|
public String GetMyBroadcastIP()
|
||||||
|
@ -1148,10 +1185,12 @@ namespace oscardata
|
||||||
|
|
||||||
private void search_modem()
|
private void search_modem()
|
||||||
{
|
{
|
||||||
Byte[] txb = new byte[3];
|
Byte[] txb = new byte[5];
|
||||||
txb[0] = 0x3c; // ID of this message
|
txb[0] = 0x3c; // ID of this message
|
||||||
txb[1] = getPBaudioDevice();
|
txb[1] = getPBaudioDevice();
|
||||||
txb[2] = getCAPaudioDevice();
|
txb[2] = getCAPaudioDevice();
|
||||||
|
txb[3] = (Byte)tb_PBvol.Value;
|
||||||
|
txb[4] = (Byte)tb_CAPvol.Value;
|
||||||
|
|
||||||
Udp.UdpBCsend(txb, GetMyBroadcastIP(), statics.UdpBCport_AppToModem);
|
Udp.UdpBCsend(txb, GetMyBroadcastIP(), statics.UdpBCport_AppToModem);
|
||||||
|
|
||||||
|
@ -1254,7 +1293,7 @@ namespace oscardata
|
||||||
txdata[1] = (Byte)idx;
|
txdata[1] = (Byte)idx;
|
||||||
|
|
||||||
// and send info to modem
|
// and send info to modem
|
||||||
Udp.UdpSend(txdata);
|
Udp.UdpSendCtrl(txdata);
|
||||||
|
|
||||||
//txcommand = statics.noTX;
|
//txcommand = statics.noTX;
|
||||||
// stop any ongoing transmission
|
// stop any ongoing transmission
|
||||||
|
@ -1363,6 +1402,8 @@ namespace oscardata
|
||||||
cb_savegoodfiles.Checked = (s == "1");
|
cb_savegoodfiles.Checked = (s == "1");
|
||||||
cb_audioPB.Text = ReadString(sr);
|
cb_audioPB.Text = ReadString(sr);
|
||||||
cb_audioCAP.Text = ReadString(sr);
|
cb_audioCAP.Text = ReadString(sr);
|
||||||
|
tb_PBvol.Value = ReadInt(sr);
|
||||||
|
tb_CAPvol.Value = ReadInt(sr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -1387,6 +1428,8 @@ namespace oscardata
|
||||||
sw.WriteLine(cb_savegoodfiles.Checked ? "1" : "0");
|
sw.WriteLine(cb_savegoodfiles.Checked ? "1" : "0");
|
||||||
sw.WriteLine(cb_audioPB.Text);
|
sw.WriteLine(cb_audioPB.Text);
|
||||||
sw.WriteLine(cb_audioCAP.Text);
|
sw.WriteLine(cb_audioCAP.Text);
|
||||||
|
sw.WriteLine(tb_PBvol.Value.ToString());
|
||||||
|
sw.WriteLine(tb_CAPvol.Value.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
@ -1397,11 +1440,9 @@ namespace oscardata
|
||||||
DialogResult dr = MessageBox.Show("Do you want to shut down the Modem-Computer ?", "Shut Down Modem", MessageBoxButtons.YesNo);
|
DialogResult dr = MessageBox.Show("Do you want to shut down the Modem-Computer ?", "Shut Down Modem", MessageBoxButtons.YesNo);
|
||||||
if (dr == DialogResult.Yes)
|
if (dr == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Byte[] txdata = new byte[statics.PayloadLen + 2];
|
Byte[] txdata = new byte[1];
|
||||||
txdata[0] = (Byte)statics.Modem_shutdown;
|
txdata[0] = (Byte)statics.Modem_shutdown;
|
||||||
|
Udp.UdpSendCtrl(txdata);
|
||||||
// and transmit it
|
|
||||||
Udp.UdpSend(txdata);
|
|
||||||
|
|
||||||
MessageBox.Show("Please wait abt. 1 minute before powering OFF the modem", "Shut Down Modem", MessageBoxButtons.OK);
|
MessageBox.Show("Please wait abt. 1 minute before powering OFF the modem", "Shut Down Modem", MessageBoxButtons.OK);
|
||||||
}
|
}
|
||||||
|
@ -1411,20 +1452,33 @@ namespace oscardata
|
||||||
// TEST ONLY: tell modem to send a file
|
// TEST ONLY: tell modem to send a file
|
||||||
private void button1_Click(object sender, EventArgs e)
|
private void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Byte[] txdata = new byte[statics.PayloadLen + 2];
|
Byte[] txdata = new byte[1];
|
||||||
txdata[0] = (Byte)statics.AutosendFile;
|
txdata[0] = (Byte)statics.AutosendFile;
|
||||||
|
|
||||||
// and transmit it
|
// and transmit it
|
||||||
Udp.UdpSend(txdata);
|
Udp.UdpSendCtrl(txdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bt_resetmodem_Click(object sender, EventArgs e)
|
private void bt_resetmodem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Byte[] txdata = new byte[statics.PayloadLen + 2];
|
Byte[] txdata = new byte[1];
|
||||||
txdata[0] = (Byte)statics.ResetModem;
|
txdata[0] = (Byte)statics.ResetModem;
|
||||||
|
|
||||||
// and transmit it
|
// and transmit it
|
||||||
Udp.UdpSend(txdata);
|
Udp.UdpSendCtrl(txdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setPBvolume = -1;
|
||||||
|
int setCAPvolume = -1;
|
||||||
|
|
||||||
|
private void tb_PBvol_Scroll(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
setPBvolume = tb_PBvol.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tb_CAPvol_Scroll(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
setCAPvolume = tb_CAPvol.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -1,10 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace oscardata
|
namespace oscardata
|
||||||
|
@ -26,6 +28,8 @@ namespace oscardata
|
||||||
public static Byte AutosendFolder = 18;
|
public static Byte AutosendFolder = 18;
|
||||||
public static Byte Modem_shutdown = 19;
|
public static Byte Modem_shutdown = 19;
|
||||||
public static Byte ResetModem = 20;
|
public static Byte ResetModem = 20;
|
||||||
|
public static Byte SetPBvolume = 21;
|
||||||
|
public static Byte SetCAPvolume = 22;
|
||||||
|
|
||||||
// frame sequence, modem needs that for i.e. sending a preamble
|
// frame sequence, modem needs that for i.e. sending a preamble
|
||||||
public static Byte FirstFrame = 0;
|
public static Byte FirstFrame = 0;
|
||||||
|
@ -33,6 +37,11 @@ namespace oscardata
|
||||||
public static Byte LastFrame = 2;
|
public static Byte LastFrame = 2;
|
||||||
public static Byte SingleFrame = 3;
|
public static Byte SingleFrame = 3;
|
||||||
|
|
||||||
|
// udp messages from modem
|
||||||
|
public static Byte udp_payload = 1;
|
||||||
|
public static Byte udp_bc = 3;
|
||||||
|
public static Byte udp_fft = 4;
|
||||||
|
public static Byte udp_iq = 5;
|
||||||
|
|
||||||
// global static variables
|
// global static variables
|
||||||
public static bool running = true;
|
public static bool running = true;
|
||||||
|
@ -56,6 +65,7 @@ namespace oscardata
|
||||||
public static int GotAudioDevices = 0;
|
public static int GotAudioDevices = 0;
|
||||||
public static String[] AudioPBdevs;
|
public static String[] AudioPBdevs;
|
||||||
public static String[] AudioCAPdevs;
|
public static String[] AudioCAPdevs;
|
||||||
|
public static int PBfifousage = 0;
|
||||||
|
|
||||||
public static void setDatarate(int rate)
|
public static void setDatarate(int rate)
|
||||||
{
|
{
|
||||||
|
@ -139,11 +149,11 @@ namespace oscardata
|
||||||
return enc.GetBytes(str);
|
return enc.GetBytes(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ByteArrayToString(byte[] arr)
|
public static string ByteArrayToString(byte[] arr, int offset = 0)
|
||||||
{
|
{
|
||||||
Byte[] ba = new byte[arr.Length];
|
Byte[] ba = new byte[arr.Length];
|
||||||
int dst = 0;
|
int dst = 0;
|
||||||
for (int i = 0; i < arr.Length; i++)
|
for (int i = offset; i < arr.Length; i++)
|
||||||
{
|
{
|
||||||
if (arr[i] != 0) ba[dst++] = arr[i];
|
if (arr[i] != 0) ba[dst++] = arr[i];
|
||||||
}
|
}
|
||||||
|
@ -271,5 +281,76 @@ namespace oscardata
|
||||||
|
|
||||||
return fn.Substring(0, idx) + "." + ext;
|
return fn.Substring(0, idx) + "." + ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Process cmd = null;
|
||||||
|
public static bool StartHSmodem()
|
||||||
|
{
|
||||||
|
// kill old processes already running
|
||||||
|
killall("hsmodem");
|
||||||
|
killall("hsmodem.exe");
|
||||||
|
// starte Prozesse
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ostype == 0)
|
||||||
|
{
|
||||||
|
if (!File.Exists("hsmodem.exe")) return false;
|
||||||
|
cmd = new Process();
|
||||||
|
cmd.StartInfo.FileName = "hsmodem.exe";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!File.Exists("hsmodem")) return false;
|
||||||
|
cmd = new Process();
|
||||||
|
cmd.StartInfo.FileName = "hsmodem";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd != null)
|
||||||
|
{
|
||||||
|
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Normal;// .Hidden;
|
||||||
|
cmd.StartInfo.Arguments = "";
|
||||||
|
cmd.Start();
|
||||||
|
Console.WriteLine("hsmodem started");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { return false; }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void killall(String s)
|
||||||
|
{
|
||||||
|
if (ostype == 0)
|
||||||
|
{
|
||||||
|
// kill a Windows process
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var process in Process.GetProcessesByName(s))
|
||||||
|
process.Kill();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// kill a Linux process
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (cmd != null)
|
||||||
|
cmd.Kill();
|
||||||
|
cmd = null;
|
||||||
|
|
||||||
|
Process proc = new Process();
|
||||||
|
proc.EnableRaisingEvents = false;
|
||||||
|
proc.StartInfo.FileName = "killall";
|
||||||
|
proc.StartInfo.UseShellExecute = false;
|
||||||
|
proc.StartInfo.RedirectStandardOutput = true;
|
||||||
|
proc.OutputDataReceived += (sender, args) => { }; // schreibe Output ins nichts
|
||||||
|
proc.StartInfo.RedirectStandardError = true;
|
||||||
|
proc.ErrorDataReceived += (sender, args) => { }; // schreibe Output ins nichts
|
||||||
|
proc.StartInfo.Arguments = s;
|
||||||
|
proc.Start();
|
||||||
|
proc.WaitForExit();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="packages.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|
|
@ -16,7 +16,6 @@ using System.Drawing;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms.VisualStyles;
|
|
||||||
|
|
||||||
namespace oscardata
|
namespace oscardata
|
||||||
{
|
{
|
||||||
|
@ -29,6 +28,7 @@ namespace oscardata
|
||||||
// Pipes for data transferred via UDP ports
|
// Pipes for data transferred via UDP ports
|
||||||
static UdpQueue uq_rx = new UdpQueue();
|
static UdpQueue uq_rx = new UdpQueue();
|
||||||
static UdpQueue uq_tx = new UdpQueue();
|
static UdpQueue uq_tx = new UdpQueue();
|
||||||
|
static UdpQueue uq_ctrl = new UdpQueue();
|
||||||
static UdpQueue uq_fft = new UdpQueue();
|
static UdpQueue uq_fft = new UdpQueue();
|
||||||
static UdpQueue uq_iq = new UdpQueue();
|
static UdpQueue uq_iq = new UdpQueue();
|
||||||
|
|
||||||
|
@ -83,13 +83,13 @@ namespace oscardata
|
||||||
int rxtype = rxarr[0];
|
int rxtype = rxarr[0];
|
||||||
Byte[] b = new byte[rxarr.Length - 1];
|
Byte[] b = new byte[rxarr.Length - 1];
|
||||||
Array.Copy(rxarr, 1, b, 0, b.Length);
|
Array.Copy(rxarr, 1, b, 0, b.Length);
|
||||||
|
|
||||||
// payload
|
// payload
|
||||||
if (rxtype == 1)
|
if (rxtype == statics.udp_payload)
|
||||||
uq_rx.Add(b);
|
uq_rx.Add(b);
|
||||||
|
|
||||||
// Broadcast response
|
// Broadcast response
|
||||||
if (rxtype == 3)
|
if (rxtype == statics.udp_bc)
|
||||||
{
|
{
|
||||||
statics.ModemIP = RemoteEndpoint.Address.ToString();
|
statics.ModemIP = RemoteEndpoint.Address.ToString();
|
||||||
searchtimeout = 0;
|
searchtimeout = 0;
|
||||||
|
@ -103,11 +103,16 @@ namespace oscardata
|
||||||
}
|
}
|
||||||
|
|
||||||
// FFT data
|
// FFT data
|
||||||
if (rxtype == 4)
|
if (rxtype == statics.udp_fft)
|
||||||
uq_fft.Add(b);
|
{
|
||||||
|
statics.PBfifousage = b[0];
|
||||||
|
Byte[] b1 = new byte[b.Length - 1];
|
||||||
|
Array.Copy(b, 1, b1, 0, b1.Length);
|
||||||
|
uq_fft.Add(b1);
|
||||||
|
}
|
||||||
|
|
||||||
// IQ data
|
// IQ data
|
||||||
if (rxtype == 5)
|
if (rxtype == statics.udp_iq)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < b.Length; i++)
|
for (int i = 0; i < b.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +172,7 @@ namespace oscardata
|
||||||
}
|
}
|
||||||
|
|
||||||
static int panelw = 75, panelh = 75;
|
static int panelw = 75, panelh = 75;
|
||||||
static int maxdrawanz = 250;
|
static int maxdrawanz = 160;
|
||||||
static int drawanz = 0;
|
static int drawanz = 0;
|
||||||
static Bitmap bm;
|
static Bitmap bm;
|
||||||
static void drawBitmap(int re, int im)
|
static void drawBitmap(int re, int im)
|
||||||
|
@ -194,7 +199,7 @@ namespace oscardata
|
||||||
int x = panelw / 2 + (int)fre;
|
int x = panelw / 2 + (int)fre;
|
||||||
int y = panelh / 2 + (int)fim;
|
int y = panelh / 2 + (int)fim;
|
||||||
|
|
||||||
int et = 1;
|
int et = 2;
|
||||||
gr.FillEllipse(Brushes.Blue, x - et, y - et, et * 2, et * 2);
|
gr.FillEllipse(Brushes.Blue, x - et, y - et, et * 2, et * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,35 +214,62 @@ namespace oscardata
|
||||||
// calculate cycle time for the requested data rate
|
// calculate cycle time for the requested data rate
|
||||||
// time in ms for one bit: 1000/statics.datarate
|
// time in ms for one bit: 1000/statics.datarate
|
||||||
|
|
||||||
int actdatarate = statics.getDatarate();
|
//int actdatarate = statics.getDatarate();
|
||||||
int wait_datarate = (int)(((double)statics.UdpBlocklen * 8.0 * 1000.0 / (double)(statics.getDatarate())));
|
//int wait_datarate = (int)(((double)statics.UdpBlocklen * 8.0 * 1000.0 / (double)(statics.getDatarate())));
|
||||||
|
//Timer TTimer = new Timer(new TimerCallback(TXTickTimer), autoEvent, 0, wait_datarate);
|
||||||
|
|
||||||
Timer TTimer = new Timer(new TimerCallback(TXTickTimer), autoEvent, 0, wait_datarate);
|
while (statics.running)
|
||||||
|
{
|
||||||
|
bool wait = true;
|
||||||
|
if(uq_ctrl.Count() > 0)
|
||||||
|
{
|
||||||
|
// Control Message: send immediately
|
||||||
|
Byte[] b = uq_ctrl.Getarr();
|
||||||
|
udpc.Send(b, b.Length, statics.ModemIP, statics.UdpTXport);
|
||||||
|
wait = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(statics.PBfifousage < 2)
|
||||||
|
{
|
||||||
|
// we need to send more payload data
|
||||||
|
if (uq_tx.Count() > 0)
|
||||||
|
{
|
||||||
|
Byte[] b = uq_tx.Getarr();
|
||||||
|
udpc.Send(b, b.Length, statics.ModemIP, statics.UdpTXport);
|
||||||
|
wait = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wait) Thread.Sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
while (statics.running)
|
while (statics.running)
|
||||||
{
|
{
|
||||||
autoEvent.WaitOne();
|
autoEvent.WaitOne();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (uq_tx.Count() > 0)
|
while (uq_tx.Count() > 0)
|
||||||
{
|
{
|
||||||
// TX data available
|
// TX data available
|
||||||
Byte[] b = uq_tx.Getarr();
|
Byte[] b = uq_tx.Getarr();
|
||||||
udpc.Send(b, b.Length, statics.ModemIP, statics.UdpTXport);
|
udpc.Send(b, b.Length, statics.ModemIP, statics.UdpTXport);
|
||||||
|
if (b[0] < 16) break; // continue without pause for internal control messages, or break for TX messages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
String err = e.ToString();
|
String err = e.ToString();
|
||||||
}
|
}
|
||||||
if(statics.getDatarate() != actdatarate)
|
|
||||||
|
// do not wait in case of internal messages
|
||||||
|
if (statics.getDatarate() != actdatarate)
|
||||||
{
|
{
|
||||||
// rate has been changed, reset the timer
|
// rate has been changed, reset the timer
|
||||||
wait_datarate = (int)(((double)statics.UdpBlocklen * 8.0 * 1000.0 / (double)(statics.getDatarate())));
|
wait_datarate = (int)(((double)statics.UdpBlocklen * 8.0 * 1000.0 / (double)(statics.getDatarate())));
|
||||||
TTimer.Change(0, wait_datarate);
|
TTimer.Change(0, wait_datarate);
|
||||||
actdatarate = statics.getDatarate();
|
actdatarate = statics.getDatarate();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UdpBCsend(Byte[] b, String ip, int port)
|
public static void UdpBCsend(Byte[] b, String ip, int port)
|
||||||
|
@ -257,16 +289,26 @@ namespace oscardata
|
||||||
// send a Byte array via UDP
|
// send a Byte array via UDP
|
||||||
// this function can be called from anywhere in the program
|
// this function can be called from anywhere in the program
|
||||||
// it transfers the data to the udp-tx thread via a thread-safe pipe
|
// it transfers the data to the udp-tx thread via a thread-safe pipe
|
||||||
public static void UdpSend(Byte[] b)
|
public static void UdpSendData(Byte[] b)
|
||||||
{
|
{
|
||||||
uq_tx.Add(b);
|
uq_tx.Add(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UdpSendCtrl(Byte[] b)
|
||||||
|
{
|
||||||
|
uq_ctrl.Add(b);
|
||||||
|
}
|
||||||
|
|
||||||
public static int GetBufferCount()
|
public static int GetBufferCount()
|
||||||
{
|
{
|
||||||
return uq_tx.Count();
|
return uq_tx.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetBufferCountCtrl()
|
||||||
|
{
|
||||||
|
return uq_ctrl.Count();
|
||||||
|
}
|
||||||
|
|
||||||
public static Byte[] UdpReceive()
|
public static Byte[] UdpReceive()
|
||||||
{
|
{
|
||||||
if (uq_rx.Count() == 0) return null;
|
if (uq_rx.Count() == 0) return null;
|
||||||
|
|
Loading…
Reference in New Issue