Skip to content

Commit b1d791e

Browse files
committed
Actually, no need to escape _ in code blocks.
1 parent e54b50d commit b1d791e

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

README_freedv.md

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ Generally, the FreeDV API is used as follows:
103103
Call freedv\_open() or freedv\_advanced\_open() depending on the mode being used:
104104

105105
```
106-
\#include "freedv\_api.h"
106+
#include "freedv_api.h"
107107
108108
struct freedv* dv;
109-
if ((mode == FREEDV\_MODE\_700D) || (mode == FREEDV\_MODE\_700E) || (mode == FREEDV\_MODE\_2020)) {
109+
if ((mode == FREEDV_MODE_700D) || (mode == FREEDV_MODE_700E) || (mode == FREEDV_MODE_2020)) {
110110
struct freedv_advanced adv;
111-
dv = freedv\_open\_advanced(mode, &adv);
111+
dv = freedv_open_advanced(mode, &adv);
112112
} else {
113-
dv = fredv\_open(mode);
113+
dv = fredv_open(mode);
114114
}
115115
116116
if (dv == NULL) {
@@ -120,36 +120,36 @@ if (dv == NULL) {
120120

121121
Available modes:
122122

123-
* FREEDV\_MODE\_1600
124-
* FREEDV\_MODE\_2400A
125-
* FREEDV\_MODE\_2400B
126-
* FREEDV\_MODE\_800XA
127-
* FREEDV\_MODE\_700C
128-
* FREEDV\_MODE\_700D
129-
* FREEDV\_MODE\_2020
130-
* FREEDV\_MODE\_700E
123+
* FREEDV_MODE_1600
124+
* FREEDV_MODE_2400A
125+
* FREEDV_MODE_2400B
126+
* FREEDV_MODE_800XA
127+
* FREEDV_MODE_700C
128+
* FREEDV_MODE_700D
129+
* FREEDV_MODE_2020
130+
* FREEDV_MODE_700E
131131

132132
#### Enabling reliable receiving/sending of callsigns in the voice stream (e.g. for PSK Reporter)
133133

134134
```
135-
\#include "reliable\_text.h"
135+
\#include "reliable_text.h"
136136
137-
reliable\_text\_t rt = reliable\_text\_create();
137+
reliable_text_t rt = reliable_text_create();
138138
if (rt == NULL) { /* handle error */ }
139139
140140
void* stateObject = NULL; /* can be a pointer to anything */
141-
reliable\_text\_use\_with\_freedv(rt, dv, &OnReliableTextRx, stateObject);
141+
reliable_text_use_with_freedv(rt, dv, &OnReliableTextRx, stateObject);
142142
143143
char* callsign = "KA6ABC";
144-
reliable\_text\_set\_string(rt, callsign, strlen(callsign));
144+
reliable_text_set_string(rt, callsign, strlen(callsign));
145145
146146
...
147147
148-
void OnReliableTextRx(reliable\_text\_t rt, const char* txt\_ptr, int length, void* state)
148+
void OnReliableTextRx(reliable_text_t rt, const char* txt_ptr, int length, void* state)
149149
{
150-
fprintf(stderr, "OnReliableTextRx: received %s\n", txt\_ptr);
150+
fprintf(stderr, "OnReliableTextRx: received %s\n", txt_ptr);
151151
...
152-
reliable\_text\_reset(rt);
152+
reliable_text_reset(rt);
153153
}
154154
```
155155

@@ -158,7 +158,7 @@ void OnReliableTextRx(reliable\_text\_t rt, const char* txt\_ptr, int length, vo
158158
*Note: this is mutually exclusive with reliable\_text above.*
159159

160160
```
161-
freedv\_set\_callback\_txt(dv, &TextRxFn, &TextTxFn, stateObject);
161+
freedv_set_callback_txt(dv, &TextRxFn, &TextTxFn, stateObject);
162162
163163
...
164164
@@ -171,7 +171,7 @@ char TextTxFn(void *callback_state)
171171
return text[currentIndex];
172172
}
173173
174-
void TextRxFn(void *callback\_state, char c)
174+
void TextRxFn(void *callback_state, char c)
175175
{
176176
fprintf(stderr, "Received character %c from stream\n", c);
177177
}
@@ -180,8 +180,8 @@ void TextRxFn(void *callback\_state, char c)
180180
#### Decoding audio
181181

182182
```
183-
int freedvRxModulatedSampleRate = freedv\_get\_modem\_sample\_rate(dv);
184-
int freedvRxSpeechSampleRate = freedv\_get\_speech\_sample\_rate(dv);
183+
int freedvRxModulatedSampleRate = freedv_get_modem_sample_rate(dv);
184+
int freedvRxSpeechSampleRate = freedv_get_speech_sample_rate(dv);
185185
186186
/* Note that FreeDV expects int16 samples, not float. Input audio should be
187187
resampled to the rate expected by the current mode (e.g. inside freedvRxModulatedSampleRate
@@ -190,44 +190,45 @@ short* resampledRxInput = malloc(/* size of resampled input buffer */);
190190
short* rxOutput = malloc(/* size of output buffer */);
191191
resample(rxInput, resampledRxInput, radioRate, freedvRxModulatedSampleRate);
192192
193-
/* Loop through available samples until we run out. Each time, call freedv\_nin() to get
194-
the current number of samples the mode needs followed by freedv\_rx() to actually feed
195-
them in. 0 is perfectly okay for freedv\_nin() depending on the current internal state. */
196-
int nsamples = freedv\_nin(dv);
193+
/* Loop through available samples until we run out. Each time, call freedv_nin() to get
194+
the current number of samples the mode needs followed by freedv_rx() to actually feed
195+
them in. 0 is perfectly okay for freedv_nin() depending on the current internal state. */
196+
int nsamples = freedv_nin(dv);
197197
short* currentBuf = resampledRxInput;
198198
while (currentBuf < sizeofBuffer)
199199
{
200-
freedv\_rx(dv, rxOutput, currentBuf);
200+
freedv_rx(dv, rxOutput, currentBuf);
201201
resample(rxOutput, radioOutput, freedvRxSpeechSampleRate, radioRate);
202202
currentBuf += nsamples;
203-
nsamples = freedv\_nin(dv);
203+
nsamples = freedv_nin(dv);
204204
}
205205
```
206206

207207
#### Transmitting audio
208208

209209
```
210-
int freedvTxModulatedSampleRate = freedv\_get\_modem\_sample\_rate(dv);
211-
int freedvTxSpeechSampleRate = freedv\_get\_speech\_sample\_rate(dv);
212-
int requiredTxSpeechSamples = freedv\_get\_n\_speech\_samples(dv);
210+
int freedvTxModulatedSampleRate = freedv_get_modem_sample_rate(dv);
211+
int freedvTxSpeechSampleRate = freedv_get_speech_sample_rate(dv);
212+
int requiredTxSpeechSamples = freedv_get_n_speech_samples(dv);
213213
214214
short* txInput = malloc(/* size of resampled output buffer */);
215215
short* txOutput = malloc(/* size of output buffer */);
216216
217217
while(speech samples available)
218218
{
219219
memcpy(txInput, radioSamples, requiredTxSpeechSamples);
220-
freedv\_tx(dv, txOutput, txInput);
220+
freedv_tx(dv, txOutput, txInput);
221221
}
222+
```
222223

223224
#### Cleanup
224225

225226
```
226-
/* if reliable\_text is enabled */
227-
reliable\_text\_unlink\_from\_freedv(rt);
227+
/* if reliable_text is enabled */
228+
reliable_text_unlink_from_freedv(rt);
228229
229230
/* always required to free memory */
230-
freedv\_close(dv);
231+
freedv_close(dv);
231232
```
232233

233234
## FreeDV 2400A and 2400B modes

0 commit comments

Comments
 (0)