Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Digital Signal Processing Engine Library
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
DSPE
Digital Signal Processing Engine Library
Commits
b741de1b
Commit
b741de1b
authored
1 year ago
by
Marek Blok
Browse files
Options
Downloads
Patches
Plain Diff
Initial ver. of test_runtime_algorithm_change.cpp
parent
f93e5a03
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
examples/makefile
+7
-1
7 additions, 1 deletion
examples/makefile
examples/runtime_algorithm_change.cpp
+108
-0
108 additions, 0 deletions
examples/runtime_algorithm_change.cpp
with
117 additions
and
1 deletion
.gitignore
+
2
−
0
View file @
b741de1b
...
@@ -97,3 +97,5 @@ examples/*.dot
...
@@ -97,3 +97,5 @@ examples/*.dot
examples/DSPElib_examples.exe
examples/DSPElib_examples.exe
examples/DSPElib_examples_dbg.exe
examples/DSPElib_examples_dbg.exe
examples/DSPElib_examples.o
examples/DSPElib_examples.o
examples/runtime_algorithm_change.exe
examples/runtime_algorithm_change.o
This diff is collapsed.
Click to expand it.
examples/makefile
+
7
−
1
View file @
b741de1b
...
@@ -26,7 +26,7 @@ else #rls
...
@@ -26,7 +26,7 @@ else #rls
endif
endif
all
:
hello.exe echo.exe sound_input.exe multirate.exe callbacks.exe socket_server.exe socket_client.exe socket_server_2.exe socket_client_2.exe macro_example.exe asynchronous.exe asynchronous_CT.exe DSPElib_examples.exe
all
:
hello.exe
runtime_algorithm_change.exe
echo.exe sound_input.exe multirate.exe callbacks.exe socket_server.exe socket_client.exe socket_server_2.exe socket_client_2.exe macro_example.exe asynchronous.exe asynchronous_CT.exe DSPElib_examples.exe
#all: echo.exe
#all: echo.exe
hello.o
:
$(SRC_DIR)/hello.cpp
hello.o
:
$(SRC_DIR)/hello.cpp
...
@@ -34,6 +34,11 @@ hello.o: $(SRC_DIR)/hello.cpp
...
@@ -34,6 +34,11 @@ hello.o: $(SRC_DIR)/hello.cpp
hello.exe
:
hello.o
hello.exe
:
hello.o
$(
CC
)
-L
"
$(
DSPELIB_DIR_ROOT
)
/
$(
TYPE
)
"
"
$(
SRC_DIR
)
/hello.o"
-o
"
$(
SRC_DIR
)
/hello.exe"
$(
LINKER_FLAGS
)
-lDSPE
-lwinmm
$(
CC
)
-L
"
$(
DSPELIB_DIR_ROOT
)
/
$(
TYPE
)
"
"
$(
SRC_DIR
)
/hello.o"
-o
"
$(
SRC_DIR
)
/hello.exe"
$(
LINKER_FLAGS
)
-lDSPE
-lwinmm
runtime_algorithm_change.o
:
$(SRC_DIR)/runtime_algorithm_change.cpp
$(
CC
)
-DWIN32
-I
"
$(
DSPELIB_DIR_ROOT
)
/include"
-I
"
$(
DSPELIB_DIR_ROOT
)
/include/
$(
TYPE
)
"
$(
CFLAGS
)
-c
"
$(
SRC_DIR
)
/runtime_algorithm_change.cpp"
-o
"
$(
SRC_DIR
)
/runtime_algorithm_change.o"
runtime_algorithm_change.exe
:
runtime_algorithm_change.o
$(
CC
)
-L
"
$(
DSPELIB_DIR_ROOT
)
/
$(
TYPE
)
"
"
$(
SRC_DIR
)
/runtime_algorithm_change.o"
-o
"
$(
SRC_DIR
)
/runtime_algorithm_change.exe"
$(
LINKER_FLAGS
)
-lDSPE
-lwinmm
echo.o
:
$(SRC_DIR)/echo.cpp
echo.o
:
$(SRC_DIR)/echo.cpp
$(
CC
)
-DWIN32
-I
"
$(
DSPELIB_DIR_ROOT
)
/include"
-I
"
$(
DSPELIB_DIR_ROOT
)
/include/
$(
TYPE
)
"
$(
CFLAGS
)
-c
$(
SRC_DIR
)
/echo.cpp
-o
"
$(
SRC_DIR
)
/echo.o"
$(
CC
)
-DWIN32
-I
"
$(
DSPELIB_DIR_ROOT
)
/include"
-I
"
$(
DSPELIB_DIR_ROOT
)
/include/
$(
TYPE
)
"
$(
CFLAGS
)
-c
$(
SRC_DIR
)
/echo.cpp
-o
"
$(
SRC_DIR
)
/echo.o"
echo.exe
:
echo.o
echo.exe
:
echo.o
...
@@ -97,6 +102,7 @@ DSPElib_examples.exe: DSPElib_examples.o
...
@@ -97,6 +102,7 @@ DSPElib_examples.exe: DSPElib_examples.o
clean
:
clean
:
rm
-f
$(
SRC_DIR
)
/hello.exe
$(
SRC_DIR
)
/hello.o
rm
-f
$(
SRC_DIR
)
/hello.exe
$(
SRC_DIR
)
/hello.o
rm
-f
$(
SRC_DIR
)
/runtime_algorithm_change.exe
$(
SRC_DIR
)
/runtime_algorithm_change.o
rm
-f
$(
SRC_DIR
)
/echo.exe
$(
SRC_DIR
)
/echo.o
rm
-f
$(
SRC_DIR
)
/echo.exe
$(
SRC_DIR
)
/echo.o
rm
-f
$(
SRC_DIR
)
/sound_input.exe
$(
SRC_DIR
)
/sound_input.o
rm
-f
$(
SRC_DIR
)
/sound_input.exe
$(
SRC_DIR
)
/sound_input.o
rm
-f
$(
SRC_DIR
)
/asynchronous.exe
$(
SRC_DIR
)
/asynchronous.o
rm
-f
$(
SRC_DIR
)
/asynchronous.exe
$(
SRC_DIR
)
/asynchronous.o
...
...
This diff is collapsed.
Click to expand it.
examples/runtime_algorithm_change.cpp
0 → 100644
+
108
−
0
View file @
b741de1b
/*! Simple Digital Signal Processing Engine usage example.
* \author Marek Blok
* \date 2023.10.31
* \date updated 2023.10.31
*/
#include
<DSP_lib.h>
class
Branch_A
{
private:
std
::
unique_ptr
<
DSP
::
u
::
Const
>
Const
;
std
::
unique_ptr
<
DSP
::
u
::
Addition
>
Add
;
public:
//! adds blocks
void
create_branch
(
DSP
::
Clock_ptr
clock
,
DSP
::
output
&
input_Signal
,
DSP
::
input
&
output_Signal
,
DSP
::
Float
value
=
0.5
)
{
Const
.
reset
(
new
DSP
::
u
::
Const
(
clock
,
value
));
std
::
stringstream
ss
;
ss
<<
value
;
Const
->
SetName
(
ss
.
str
());
Add
.
reset
(
new
DSP
::
u
::
Addition
(
2U
,
0U
));
input_Signal
>>
Add
->
Input
(
"in1.re"
);
Const
->
Output
(
"out"
)
>>
Add
->
Input
(
"in2.re"
);
Add
->
Output
(
"out"
)
>>
output_Signal
;
}
void
clear_branch
(
void
)
{
Const
.
reset
(
nullptr
);
Add
.
reset
(
nullptr
);
}
};
#ifndef INCLUDE_DSPE_EXAMPLES
int
main
(
void
)
#else
#include
"DSPE_examples.h"
int
test_runtime_algorithm_change
(
void
)
#endif // INCLUDE_DSPE_EXAMPLES
{
DSP
::
Clock_ptr
MasterClock
;
std
::
string
tekst
;
int
temp
;
long
int
Fp
;
Branch_A
branch_A
;
DSP
::
log
.
SetLogState
(
DSP
::
e
::
LogState
::
console
|
DSP
::
e
::
LogState
::
file
);
DSP
::
log
.
SetLogFileName
(
"log_file.log"
);
DSP
::
log
<<
DSP
::
lib_version_string
()
<<
std
::
endl
<<
std
::
endl
;
DSP
::
log
<<
"Hello"
<<
DSP
::
e
::
LogMode
::
second
<<
"World !!!"
<<
std
::
endl
;
MasterClock
=
DSP
::
Clock
::
CreateMasterClock
();
#ifndef INCLUDE_DSPE_EXAMPLES
DSP
::
u
::
WaveInput
AudioIn
(
MasterClock
,
"DSPElib.wav"
,
"."
);
#else
DSP
::
u
::
WaveInput
AudioIn
(
MasterClock
,
"DSPElib.wav"
,
"../examples"
);
#endif // INCLUDE_DSPE_EXAMPLES
Fp
=
AudioIn
.
GetSamplingRate
();
DSP
::
u
::
AudioOutput
AudioOut
(
Fp
);
// AudioIn.Output("out") >> AudioOut.Input("in");
branch_A
.
create_branch
(
MasterClock
,
AudioIn
.
Output
(
"out"
),
AudioOut
.
Input
(
"in"
),
-
0.5
);
DSP
::
Component
::
CheckInputsOfAllComponents
();
DSP
::
Component
::
ListOfAllComponents
(
true
);
DSP
::
Clock
::
SchemeToDOTfile
(
MasterClock
,
"test_runtime_algorithm_change.dot"
);
temp
=
1
;
do
{
DSP
::
Clock
::
Execute
(
MasterClock
,
Fp
/
8
);
DSP
::
log
<<
"MAIN"
<<
DSP
::
e
::
LogMode
::
second
<<
temp
<<
std
::
endl
;
branch_A
.
clear_branch
();
DSP
::
Component
::
ListOfAllComponents
(
true
);
{
std
::
stringstream
filename
;
filename
<<
"test_runtime_algorithm_change_"
<<
2
*
temp
-
1
<<
".dot"
;
DSP
::
Clock
::
SchemeToDOTfile
(
MasterClock
,
filename
.
str
());
}
if
((
temp
%
2
)
==
0
)
branch_A
.
create_branch
(
MasterClock
,
AudioIn
.
Output
(
"out"
),
AudioOut
.
Input
(
"in"
),
-
0.5
);
else
branch_A
.
create_branch
(
MasterClock
,
AudioIn
.
Output
(
"out"
),
AudioOut
.
Input
(
"in"
),
+
0.5
);
DSP
::
Component
::
ListOfAllComponents
(
true
);
// AudioIn.Output("out") >> AudioOut.Input("in"); // !!! TODO add way to remove connection without removing blocks???
{
std
::
stringstream
filename
;
filename
<<
"test_runtime_algorithm_change_"
<<
2
*
temp
<<
".dot"
;
DSP
::
Clock
::
SchemeToDOTfile
(
MasterClock
,
filename
.
str
());
}
temp
++
;
}
while
(
AudioIn
.
GetBytesRead
()
!=
0
);
DSP
::
Clock
::
SchemeToDOTfile
(
MasterClock
,
"test_runtime_algorithm_change_B.dot"
);
branch_A
.
clear_branch
();
DSP
::
Clock
::
FreeClocks
();
DSP
::
log
<<
DSP
::
e
::
LogMode
::
Error
<<
"MAIN"
<<
DSP
::
e
::
LogMode
::
second
<<
"end"
<<
std
::
endl
;
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment