8000 v2.8.7 10-09-2020 · ZipDriver/Thetis-2.9.0@86f91df · GitHub
[go: up one dir, main page]

Skip to content

Commit 86f91df

Browse files
committed
v2.8.7 10-09-2020
1 parent 0b0273e commit 86f91df

File tree

106 files changed

+15175
-3254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+15175
-3254
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/* pro.c
2+
3+
This file is part of a program that implements a Software-Defined Radio.
4+
5+
Copyright (C) 2017 Warren Pratt, NR0V
6+
7+
This program is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU General Public License
9+
as published by the Free Software Foundation; either version 2
10+
of the License, or (at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20+
21+
The author can be reached by email at
22+
23+
warren@wpratt.com
24+
25+
*/
26+
27+
#include "pro.h"
28+
29+
PRO create_pro (
30+
int run,
31+
int psize,
32+
int npacks,
33+
int lpacks )
34+
{
35+
PRO a = (PRO) malloc (sizeof (pro));
36+
int i;
37+
a->run = run;
38+
a->psize = psize;
39+
a->npacks = npacks;
40+
a->lpacks = lpacks;
41+
a->pbuffs = (unsigned char *) calloc (a->npacks, a->psize * sizeof (unsigned char));
42+
a->pbuff = (unsigned char **) calloc (a->npacks, sizeof (unsigned char *));
43+
for (i = 0; i < a->npacks; i++)
44+
a->pbuff[i] = a->pbuffs + i * a->psize;
45+
a->sbuff = (unsigned int *)calloc(a->npacks, sizeof(unsigned int));
46+
a->mask = a->npacks - 1;
47+
a->base_set = 0;
48+
a->in_order_count = 0;
49+
a->lastseqnum = 0;
50+
a->ooopCounter = 0;
51+
InitializeCriticalSectionAndSpinCount (&a->cspro, 2500);
52+
return a;
53+
}
54+
55+
void destroy_pro ( PRO a )
56+
{
57+
if (a != NULL)
58+
{
59+
DeleteCriticalSection(&a->cspro);
60+
free(a->pbuff);
61+
free(a->pbuffs);
62+
free(a->sbuff);
63+
free(a);
64+
}
65+
}
66+
67+
void xpro (PRO a, unsigned int seqnum, char* buffer)
68+
{
69+
if (a->run)
70+
{
71+
EnterCriticalSection (&a->cspro);
72+
if (!a->base_set)
73+
{
74+
if (seqnum == a->lastseqnum + 1)
75+
{
76+
a->in_order_count++;
77+
if (a->in_order_count == a->npacks)
78+
{
79+
a->out_idx = (seqnum - a->lpacks) & a->mask;
80+
a->base_set = 1;
81+
}
82+
}
83+
else
84+
{
85+
a->in_order_count = 0;
86+
}
87+
a->lastseqnum = seqnum;
88+
}
89+
else
90+
{
91+
a->in_idx = seqnum & a->mask;
92+
memcpy (a->pbuff[a->in_idx], buffer, a->psize * sizeof (unsigned char));
93+
a->sbuff[a->in_idx] = seqnum;
94+
a->out_idx = (a->out_idx + 1) & a->mask;
95+
memcpy (buffer, a->pbuff[a->out_idx], a->psize * sizeof (unsigned char));
96+
if (a->sbuff[a->out_idx] != a->lastseqnum + 1) a->ooopCounter++;
97+
a->lastseqnum = a->sbuff[a->out_idx];
98+
}
99+
LeaveCriticalSection (&a->cspro);
100+
}
101+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/* pro.h
2+
3+
This file is part of a program that implements a Software-Defined Radio.
4+
5+
Copyright (C) 2017 Warren Pratt, NR0V
6+
7+
This program is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU General Public License
9+
as published by the Free Software Foundation; either version 2
10+
of the License, or (at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20+
21+
The author can be reached by email at
22+
23+
warren@wpratt.com
24+
25+
*/
26+
27+
#ifndef _pro_h
28+
#define _pro_h
29+
30+
#include <stdlib.h>
31+
#include <Windows.h>
32+
33+
typedef struct _pro
34+
{
35+
int run;
36+
int psize; // packet size (bytes)
37+
int npacks; // number of packets stored for re-ordering
38+
int lpacks; // latency, in packets; POWER OF TWO!!!!
39+
unsigned char* pbuffs; // pointer to packet memory
40+
unsigned char** pbuff; // pointers to packet buffers
41+
int in_idx; // index of pbuff in which to put the packet
42+
int out_idx; // index of pbuff from which to take next packet
43+
int mask;
44+
int base_set;
45+
int in_order_count;
46+
unsigned int lastseqnum;
47+
int ooopCounter;
48+
unsigned int* sbuff;
49+
CRITICAL_SECTION cspro;
50+
} pro, *PRO;
51+
52+
extern PRO create_pro (
53+
int run,
54+
int psize,
55+
int npacks,
56+
int lpacks );
57+
58+
extern void destroy_pro ( PRO a );
59+
60+
extern void xpro (PRO a, unsigned int seqnum, char* buffer);
61+
62+
#endif

Project Files/Source/Console/BasicAudio.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public string SoundFile {
5656
}
5757
public void LoadSound(string sFile)
5858
{
59-
if (m_bLoading) return;
59+
if (m_bLoading || sFile == "") return;
6060
m_bOkToPlay = false;
6161
m_bLoading = true;
6262

0 commit comments

Comments
 (0)
0