Skip to content

Commit d13232d

Browse files
committed
Release 0.5.5
* Provided C-compatible function interface and symbol exports. All C functions and types are prefixed with lsp_dsp_ prefix to not to clash with other types. C++ interface has not changed, all functions and data types are still in lsp::dsp namespace.
2 parents 946a41e + 83cd018 commit d13232d

Some content is hidden

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

63 files changed

+4619
-5804
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
* RECENT CHANGES
33
*******************************************************************************
44

5+
=== 0.5.5 ===
6+
* Provided C-compatible function interface and symbol exports. All C functions and
7+
types are prefixed with lsp_dsp_ prefix to not to clash with other types. C++
8+
interface has not changed, all functions and data types are still in lsp::dsp namespace.
9+
510
=== 0.5.4 ===
611
* Added pkg-config file generation.
712

README.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,12 @@ make prune
101101
Usage
102102
======
103103

104-
Here's the code snippet of how the library can be initialized and used:
104+
Here's the code snippet of how the library can be initialized and used in C++:
105105

106106
```C++
107-
108107
#include <lsp-plug.in/dsp/dsp.h>
109108
#include <stdio.h>
110-
109+
#include <stdlib.h>
111110

112111
int main(int argc, const char **argv)
113112
{
@@ -128,15 +127,16 @@ int main(int argc, const char **argv)
128127

129128
// For faster computing we can tune CPU by updating thread context.
130129
// This will enable Flush-to-Zero and Denormals-are-Zero flags on
131-
// CPUs that support them
130+
// CPUs that support them. This is thread-local change and should
131+
// be called in each individual processing thread
132132
dsp::context_t ctx;
133133
dsp::start(&ctx);
134134

135135
// Here we call some dsp functions, for example dsp::fill_zero
136136
float v[0x1000];
137137
dsp::fill_zero(v, sizeof(v)/sizeof(float));
138138

139-
// At the end, we need to restore the context
139+
// At the end, we need to restore the context and reset CPU settings to defaults
140140
dsp::finish(&ctx);
141141

142142
return 0;
@@ -145,5 +145,48 @@ int main(int argc, const char **argv)
145145

146146
```
147147
148+
Also all functions can be accessed from pure C with ```lsp_dsp_``` prefix in the funcion and type names:
149+
150+
```C
151+
#include <lsp-plug.in/dsp/dsp.h>
152+
#include <stdio.h>
153+
#include <stdlib.h>
154+
155+
int main(int argc, const char **argv)
156+
{
157+
// Initialize DSP
158+
lsp_dsp_init();
159+
160+
// Optionally: output information about the system
161+
lsp_dsp_info_t *info = lsp_dsp_info();
162+
if (info != NULL)
163+
{
164+
printf("Architecture: %s\n", info->arch);
165+
printf("Processor: %s\n", info->cpu);
166+
printf("Model: %s\n", info->model);
167+
printf("Features: %s\n", info->features);
168+
169+
free(info);
170+
}
171+
172+
// For faster computing we can tune CPU by updating thread context.
173+
// This will enable Flush-to-Zero and Denormals-are-Zero flags on
174+
// CPUs that support them. This is thread-local change and should
175+
// be called in each individual processing thread
176+
lsp_dsp_context_t ctx;
177+
lsp_dsp_start(&ctx);
178+
179+
// Here we call some dsp functions, for example lsp_dsp_fill_zero
180+
float v[0x1000];
181+
lsp_dsp_fill_zero(v, sizeof(v)/sizeof(float));
182+
183+
// At the end, we need to restore the context and reset CPU settings to defaults
184+
lsp_dsp_finish(&ctx);
185+
186+
return 0;
187+
}
188+
189+
190+
```
148191

149192

0 commit comments

Comments
 (0)