├── translations ├── simdsp_en.qm └── simdsp_es.qm ├── dependencies ├── matio │ ├── hdf5.dll │ ├── zlib.dll │ ├── libmatio.dll │ ├── COPYING-matio │ └── matio_pubconf.h ├── fftw3 │ ├── libfftw3-3.dll │ ├── libfftw3f-3.dll │ └── libfftw3l-3.dll ├── rtaudio │ ├── libs │ │ ├── linux-64 │ │ │ ├── RtAudio.o │ │ │ ├── librtaudio.a │ │ │ ├── librtaudio.so │ │ │ ├── librtaudio.so.6 │ │ │ ├── librtaudio.so.6.0.0 │ │ │ └── librtaudio.lai │ │ ├── windows-32 │ │ │ ├── RtAudio.o │ │ │ ├── librtaudio.a │ │ │ ├── librtaudio-6.dl │ │ │ ├── librtaudio-6.dll │ │ │ ├── librtaudio.dll.a │ │ │ ├── librtaudio.la │ │ │ └── librtaudio.lai │ │ └── windows-64 │ │ │ ├── RtAudio.o │ │ │ ├── librtaudio.a │ │ │ ├── librtaudio-6.dll │ │ │ ├── librtaudio.dll.a │ │ │ ├── librtaudio.la │ │ │ └── librtaudio.lai │ └── include │ │ ├── ginclude.h │ │ ├── asiodrivers.h │ │ ├── asiolist.h │ │ ├── iasiodrv.h │ │ ├── asiosys.h │ │ ├── asiodrvr.h │ │ └── asiodrivers.cpp └── core │ ├── simdsp.h │ └── sdfunctions.h ├── src ├── gui │ ├── resources │ │ ├── images │ │ │ ├── splash.png │ │ │ ├── icons │ │ │ │ ├── add.png │ │ │ │ ├── edit.png │ │ │ │ ├── play.png │ │ │ │ ├── save.png │ │ │ │ ├── stop.png │ │ │ │ ├── builder.png │ │ │ │ ├── load_mat.png │ │ │ │ ├── new_file.png │ │ │ │ ├── remove.png │ │ │ │ ├── save_mat.png │ │ │ │ ├── simdsp.ico │ │ │ │ ├── simdsp.png │ │ │ │ ├── autoscale.png │ │ │ │ ├── resetzoom.png │ │ │ │ └── originals │ │ │ │ │ ├── ic_save_black_24dp_2x.png │ │ │ │ │ ├── ic_stop_black_24dp_2x.png │ │ │ │ │ ├── ic_pageview_black_24dp_2x.png │ │ │ │ │ ├── ic_settings_black_24dp_2x.png │ │ │ │ │ ├── ic_file_upload_black_24dp_2x.png │ │ │ │ │ ├── ic_mode_edit_black_24dp_2x.png │ │ │ │ │ ├── ic_play_arrow_black_24dp_2x.png │ │ │ │ │ ├── ic_file_download_black_24dp_2x.png │ │ │ │ │ ├── ic_add_circle_outline_black_24dp_2x.png │ │ │ │ │ ├── ic_create_new_folder_black_24dp_2x.png │ │ │ │ │ ├── ic_remove_circle_outline_black_24dp_2x.png │ │ │ │ │ └── ic_settings_backup_restore_black_24dp_2x.png │ │ │ ├── screenshot.png │ │ │ └── simdsp_icon.png │ │ ├── templates │ │ │ ├── sdSourceTPL.txt │ │ │ ├── sdHeaderTPL.txt │ │ │ ├── simdsp.cpp │ │ │ ├── _simdsp.cpp │ │ │ ├── sdBaseTPL.txt │ │ │ └── Makefile_simdsp │ │ ├── files │ │ │ ├── SDWords.txt │ │ │ └── keyWords.txt │ │ └── stylesheets │ │ │ └── simdsp-design.qss │ ├── view │ │ ├── sdmat.h │ │ ├── sdplot.ui │ │ ├── sdkeyboard.h │ │ ├── sdkeyboard.cpp │ │ ├── sdplot.h │ │ ├── sdmat.cpp │ │ ├── sdview.h │ │ └── sdmat.ui │ ├── pri │ │ ├── translations.pri │ │ ├── simdsp.pri │ │ ├── actions.pri │ │ ├── editor.pri │ │ ├── view.pri │ │ └── project.pri │ ├── help │ │ ├── sdhelp.h │ │ ├── sdhelp.ui │ │ └── sdhelp.cpp │ ├── project │ │ ├── sdeditoption.h │ │ ├── sdeditoption.cpp │ │ ├── sdnewproject.h │ │ ├── sdeditoption.ui │ │ ├── sdbuildoptions.h │ │ ├── sdproject.h │ │ ├── sdprojectexplorer.ui │ │ ├── sdprojectexplorer.h │ │ ├── sdnewproject.cpp │ │ └── sdnewproject.ui │ ├── simdspresources.qrc │ ├── actions │ │ ├── sdbuilder.h │ │ ├── sdnewfile.h │ │ ├── sdnewfile.cpp │ │ ├── sdbuilder.cpp │ │ └── sdnewfile.ui │ ├── editor │ │ ├── sdeditortab.ui │ │ ├── sdeditor.h │ │ └── sdeditortab.h │ ├── main.cpp │ ├── gui.pro │ └── simdsp.h ├── include │ ├── simdsp.h │ └── sdfunctions.h ├── examples │ ├── IIR │ │ ├── iir_d2_fp │ │ │ ├── coefs_iir_bp_fp.h │ │ │ └── iir_d2_fp.cpp │ │ ├── iir_d3_fp │ │ │ ├── coefs_iir_bp_fp.h │ │ │ └── iir_d3_fp.cpp │ │ ├── iir_d1 │ │ │ ├── coefs_iir_bp.h │ │ │ └── iir_d1.cpp │ │ ├── iir_d2 │ │ │ ├── coefs_iir_bp.h │ │ │ └── iir_d2.cpp │ │ ├── iir_d3 │ │ │ ├── coefs_iir_bp.h │ │ │ └── iir_d3.cpp │ │ ├── iir_sos_fp │ │ │ └── coefs_iir_bp_sos_fp.h │ │ └── iir_sos │ │ │ ├── coefs_iir_bp_sos.h │ │ │ └── iir_sos.cpp │ ├── Basics │ │ └── Keyboard │ │ │ └── Keyboard.cpp │ ├── FFT │ │ ├── denoising │ │ │ ├── fft_f.h │ │ │ └── denoising.cpp │ │ └── fastconv │ │ │ ├── fft_f.h │ │ │ ├── coefs.h │ │ │ └── fastconv.cpp │ └── FIR │ │ ├── fir_conv │ │ └── fir_conv.cpp │ │ ├── fir_circular_buffer │ │ └── fir_circular_buffer.cpp │ │ └── fir_dma │ │ └── fir_dma.cpp └── sdcore │ ├── sdcore_global.h │ ├── sdfunctions.h │ ├── sdaudio.h │ ├── sdcore.pro │ ├── sdcore.h │ ├── sdfunctions.cpp │ ├── sdsignal.h │ └── sdaudio.cpp ├── tools ├── Bat_To_Exe_Converter │ ├── Bat_To_Exe_Converter.exe │ ├── Bat_To_Exe_Converter_x64.exe │ └── license.txt ├── release.bat └── release.sh ├── .github ├── ISSUE_TEMPLATE │ ├── custom.md │ ├── feature_request.md │ └── bug_report.md └── workflows │ └── main.yml ├── scripts ├── simdsp.desktop ├── simdsp.bat ├── simdsp ├── simdsp.sh └── install_simdsp.sh ├── .gitignore ├── .travis.yml ├── SimDSP.pro ├── snap └── snapcraft.yaml └── README.md /translations/simdsp_en.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/translations/simdsp_en.qm -------------------------------------------------------------------------------- /translations/simdsp_es.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/translations/simdsp_es.qm -------------------------------------------------------------------------------- /dependencies/matio/hdf5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/matio/hdf5.dll -------------------------------------------------------------------------------- /dependencies/matio/zlib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/matio/zlib.dll -------------------------------------------------------------------------------- /dependencies/fftw3/libfftw3-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/fftw3/libfftw3-3.dll -------------------------------------------------------------------------------- /dependencies/matio/libmatio.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/matio/libmatio.dll -------------------------------------------------------------------------------- /dependencies/fftw3/libfftw3f-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/fftw3/libfftw3f-3.dll -------------------------------------------------------------------------------- /dependencies/fftw3/libfftw3l-3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/fftw3/libfftw3l-3.dll -------------------------------------------------------------------------------- /src/gui/resources/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/splash.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/add.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/edit.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/play.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/save.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/stop.png -------------------------------------------------------------------------------- /src/gui/resources/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/screenshot.png -------------------------------------------------------------------------------- /src/gui/resources/images/simdsp_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/simdsp_icon.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/builder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/builder.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/load_mat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/load_mat.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/new_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/new_file.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/remove.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/save_mat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/save_mat.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/simdsp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/simdsp.ico -------------------------------------------------------------------------------- /src/gui/resources/images/icons/simdsp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/simdsp.png -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/linux-64/RtAudio.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/linux-64/RtAudio.o -------------------------------------------------------------------------------- /src/gui/resources/images/icons/autoscale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/autoscale.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/resetzoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/resetzoom.png -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/linux-64/librtaudio.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/linux-64/librtaudio.a -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/linux-64/librtaudio.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/linux-64/librtaudio.so -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-32/RtAudio.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-32/RtAudio.o -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-64/RtAudio.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-64/RtAudio.o -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/linux-64/librtaudio.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/linux-64/librtaudio.so.6 -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-32/librtaudio.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-32/librtaudio.a -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-64/librtaudio.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-64/librtaudio.a -------------------------------------------------------------------------------- /src/gui/resources/templates/sdSourceTPL.txt: -------------------------------------------------------------------------------- 1 | // SimDSP C++ Source file Template 2 | 3 | #include 4 | 5 | // TODO: Write your code here 6 | -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-32/librtaudio-6.dl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-32/librtaudio-6.dl -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-32/librtaudio-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-32/librtaudio-6.dll -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-32/librtaudio.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-32/librtaudio.dll.a -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-64/librtaudio-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-64/librtaudio-6.dll -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-64/librtaudio.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/windows-64/librtaudio.dll.a -------------------------------------------------------------------------------- /tools/Bat_To_Exe_Converter/Bat_To_Exe_Converter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/tools/Bat_To_Exe_Converter/Bat_To_Exe_Converter.exe -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/linux-64/librtaudio.so.6.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/dependencies/rtaudio/libs/linux-64/librtaudio.so.6.0.0 -------------------------------------------------------------------------------- /tools/Bat_To_Exe_Converter/Bat_To_Exe_Converter_x64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/tools/Bat_To_Exe_Converter/Bat_To_Exe_Converter_x64.exe -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_save_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_save_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_stop_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_stop_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_pageview_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_pageview_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_settings_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_settings_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_file_upload_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_file_upload_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_mode_edit_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_mode_edit_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_play_arrow_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_play_arrow_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_file_download_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_file_download_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/templates/sdHeaderTPL.txt: -------------------------------------------------------------------------------- 1 | // SimDSP Header file Template 2 | 3 | #ifndef 4 | #define 5 | 6 | #include 7 | 8 | // TODO: Write your code here 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_add_circle_outline_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_add_circle_outline_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_create_new_folder_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_create_new_folder_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/templates/simdsp.cpp: -------------------------------------------------------------------------------- 1 | #include "simdsp.h" 2 | 3 | int main() 4 | { 5 | initSDCore(); 6 | dsp_setup(); 7 | 8 | while(true){ 9 | dsp_loop(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /scripts/simdsp.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=SimDSP 3 | GenericName=SimDSP 4 | Type=Application 5 | Categories=Development; 6 | Exec=simdsp 7 | Icon=simdsp 8 | Comment=DSP Simulator 9 | Terminal=false 10 | -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_remove_circle_outline_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_remove_circle_outline_black_24dp_2x.png -------------------------------------------------------------------------------- /src/gui/resources/images/icons/originals/ic_settings_backup_restore_black_24dp_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmcapacho/SimDSP/HEAD/src/gui/resources/images/icons/originals/ic_settings_backup_restore_black_24dp_2x.png -------------------------------------------------------------------------------- /scripts/simdsp.bat: -------------------------------------------------------------------------------- 1 | set PATH=resources\dlls;%cd%\MinGW\bin;%PATH% 2 | set LIBRARY_PATH=%cd%\resources\dlls 3 | set LD_LIBRARY_PATH=%cd%\resources\dlls 4 | set CPATH=%cd%\resources\include; 5 | start resources\dlls\SimDSP.exe 6 | exit 7 | -------------------------------------------------------------------------------- /src/gui/resources/templates/_simdsp.cpp: -------------------------------------------------------------------------------- 1 | #include "simdsp.h" 2 | 3 | void dsp_init() 4 | { 5 | initSDCore(); 6 | dsp_setup(); 7 | } 8 | 9 | void loop() 10 | { 11 | dsp_loop(); 12 | } 13 | 14 | void* getSDCore() 15 | { 16 | return sd_void; 17 | } 18 | -------------------------------------------------------------------------------- /src/include/simdsp.h: -------------------------------------------------------------------------------- 1 | #ifndef SIMDSP_H 2 | #define SIMDSP_H 3 | 4 | #include "sdfunctions.h" 5 | 6 | extern "C" void dsp_setup(); 7 | extern "C" void dsp_loop(); 8 | extern "C" void dsp_init(); 9 | extern "C" void* getSDCore(); 10 | 11 | #endif /* SIMDSP */ 12 | -------------------------------------------------------------------------------- /scripts/simdsp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | appname="SimDSP" 3 | 4 | dirname="$(dirname -- "$(readlink -f -- "${0}")" )" 5 | 6 | if [ "$dirname" = "." ]; then 7 | dirname="$PWD/$dirname" 8 | fi 9 | 10 | LD_LIBRARY_PATH="${dirname}/lib" 11 | export LD_LIBRARY_PATH 12 | 13 | "$appname" $* 14 | -------------------------------------------------------------------------------- /src/gui/resources/templates/sdBaseTPL.txt: -------------------------------------------------------------------------------- 1 | // SimDSP main file 2 | 3 | #include 4 | 5 | void dsp_setup() 6 | { 7 | // put your setup code here, to run once: 8 | 9 | } 10 | 11 | void dsp_loop() 12 | { 13 | // put your main code here, to run repeatedly: 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dependencies/core/simdsp.h: -------------------------------------------------------------------------------- 1 | #ifndef SIMDSP_H 2 | #define SIMDSP_H 3 | 4 | #include "sdfunctions.h" 5 | 6 | extern "C" __attribute__ ((visibility("default"))) void dsp_setup(); 7 | extern "C" __attribute__ ((visibility("default"))) void dsp_loop(); 8 | extern "C" __attribute__ ((visibility("default"))) void dsp_init(); 9 | extern "C" __attribute__ ((visibility("default"))) void* getSDCore(); 10 | 11 | #endif /* SIMDSP */ 12 | -------------------------------------------------------------------------------- /src/gui/resources/files/SDWords.txt: -------------------------------------------------------------------------------- 1 | attachInterrupt(void (*callback)()) 2 | println(string text) 3 | println(int number) 4 | println(short number) 5 | println(double number) 6 | println(float number) 7 | println(const char *format, ...) 8 | readKeyboard() 9 | setfs(double fs) 10 | readADC() 11 | writeDAC(short value) 12 | captureBlock( short* pBuffer, int length, void (*callback)() ) 13 | playBlock( short* pBuffer, int length, void (*callback)() ) 14 | enableMic(int length) 15 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d2_fp/coefs_iir_bp_fp.h: -------------------------------------------------------------------------------- 1 | #include 2 | #define N 14 3 | #define M 14 4 | #define Q 13 5 | 6 | const short b_k[N] = { 7 | 91, 8 | 273, 9 | -182, 10 | -1276, 11 | -456, 12 | 2278, 13 | 1822, 14 | -1822, 15 | -2278, 16 | 456, 17 | 1276, 18 | 182, 19 | -273, 20 | -91, 21 | }; 22 | 23 | const short a_k[M] = { 24 | 8192, 25 | 15887, 26 | 19033, 27 | 15271, 28 | 12006, 29 | 8446, 30 | 4538, 31 | 1495, 32 | 348, 33 | 144, 34 | 68, 35 | 9, 36 | -4, 37 | -1, 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d3_fp/coefs_iir_bp_fp.h: -------------------------------------------------------------------------------- 1 | #include 2 | #define N 14 3 | #define M 14 4 | #define Q 13 5 | 6 | const short b_k[N] = { 7 | 91, 8 | 273, 9 | -182, 10 | -1276, 11 | -456, 12 | 2278, 13 | 1822, 14 | -1822, 15 | -2278, 16 | 456, 17 | 1276, 18 | 182, 19 | -273, 20 | -91, 21 | }; 22 | 23 | const short a_k[M] = { 24 | 8192, 25 | 15887, 26 | 19033, 27 | 15271, 28 | 12006, 29 | 8446, 30 | 4538, 31 | 1495, 32 | 348, 33 | 144, 34 | 68, 35 | 9, 36 | -4, 37 | -1, 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /scripts/simdsp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | appname="SimDSP" 3 | 4 | dirname="$(dirname -- "$(readlink -f -- "${0}")" )" 5 | 6 | if [ "$dirname" = "." ]; then 7 | dirname="$PWD/$dirname/resources/" 8 | fi 9 | 10 | dirname="$dirname/resources/" 11 | 12 | if [ -n "$LIBRARY_PATH" ]; then 13 | LIBRARY_PATH=$LIBRARY_PATH:"${dirname}/lib" 14 | else 15 | LIBRARY_PATH="${dirname}/lib" 16 | fi 17 | 18 | LD_LIBRARY_PATH="${dirname}/lib" 19 | export LD_LIBRARY_PATH 20 | export LIBRARY_PATH 21 | 22 | CPATH="${dirname}/include" 23 | export CPATH 24 | 25 | "$dirname/lib/$appname" $* 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .qmake.stash 2 | 3 | # QtCreator folders and files # 4 | ##################### 5 | SimDSP.pro.user 6 | /src/SimDSP-build-* 7 | /src/release* 8 | /src/build* 9 | /src/gui/build* 10 | /debug* 11 | *.user 12 | *.user* 13 | /src/sdcore/sdcore.pro.user 14 | /src/sdcore/sdcore-build-* 15 | /src/sdcore/release* 16 | /src/sdcore/build* 17 | /src/sdcore/debug* 18 | /src/sdcore*.user 19 | /src/sdcore/*.user* 20 | object_script.* 21 | /src/examples/*/*/build* 22 | 23 | # SimDSP Tools and files folder 24 | ##################### 25 | /files 26 | 27 | Makefile 28 | Makefile.* 29 | SimDSP 30 | SimDSP.exe 31 | -------------------------------------------------------------------------------- /src/gui/resources/files/keyWords.txt: -------------------------------------------------------------------------------- 1 | asm 2 | auto 3 | bool 4 | break 5 | case 6 | catch 7 | char 8 | class 9 | const 10 | continue 11 | default 12 | delete 13 | do 14 | double 15 | else 16 | enum 17 | explicit 18 | export 19 | extern 20 | false 21 | float 22 | for 23 | friend 24 | if 25 | inline 26 | int 27 | long 28 | namespace 29 | new 30 | operator 31 | private 32 | protected 33 | public 34 | register 35 | return 36 | short 37 | signed 38 | sizeof 39 | static 40 | struct 41 | switch 42 | template 43 | this 44 | throw 45 | true 46 | try 47 | typedef 48 | union 49 | unsigned 50 | using 51 | virtual 52 | void 53 | volatile 54 | while 55 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | os: linux 3 | dist: bionic 4 | 5 | services: 6 | - xvfb 7 | 8 | install: 9 | - sudo apt-get install -y qt5-default qttools5-dev-tools libfftw3-3 libfftw3-dev libegl1-mesa libqscintilla2-qt5-dev 10 | # RtAudio support 11 | - sudo apt-get install libasound2-dev libjack-dev libpulse-dev doxygen oss4-dev 12 | 13 | # Install matio 14 | - sudo apt-get install libmatio-dev 15 | 16 | # Install RtAudio 17 | - git clone https://github.com/thestk/rtaudio.git 18 | - cd rtaudio 19 | - ./autogen.sh 20 | - make 21 | - sudo make install 22 | - cd $TRAVIS_BUILD_DIR 23 | 24 | script: 25 | - qmake SimDSP.pro 26 | - make 27 | - cd src/build 28 | - ./SimDSP & 29 | -------------------------------------------------------------------------------- /src/gui/view/sdmat.h: -------------------------------------------------------------------------------- 1 | #ifndef SDMAT_H 2 | #define SDMAT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace Ui { 13 | class SDMat; 14 | } 15 | 16 | class SDMat : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit SDMat(QWidget *parent = nullptr); 22 | ~SDMat(); 23 | 24 | signals: 25 | void loadVariable(QString path, QString varName); 26 | 27 | public slots: 28 | void loadData(); 29 | void browseFile(); 30 | void changeVariable(int index); 31 | 32 | private: 33 | Ui::SDMat *ui; 34 | 35 | QStringList mat_types; 36 | QStringList types; 37 | }; 38 | 39 | #endif // SDMAT_H 40 | -------------------------------------------------------------------------------- /src/examples/Basics/Keyboard/Keyboard.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // =================================================================================== 6 | // Manejo del teclado 7 | // =================================================================================== 8 | 9 | #include 10 | 11 | void printKey() 12 | { 13 | // Imprime la tecla presionada 14 | println(readKeyboard()); 15 | } 16 | 17 | void dsp_setup() 18 | { 19 | // Asigna la función a ejecutar cuando 20 | // se presiona una tecla 21 | attachInterrupt(printKey); 22 | } 23 | 24 | void dsp_loop() 25 | { 26 | // No hace nada en la función principal 27 | } 28 | -------------------------------------------------------------------------------- /dependencies/rtaudio/include/ginclude.h: -------------------------------------------------------------------------------- 1 | #ifndef __gInclude__ 2 | #define __gInclude__ 3 | 4 | #if SGI 5 | #undef BEOS 6 | #undef MAC 7 | #undef WINDOWS 8 | // 9 | #define ASIO_BIG_ENDIAN 1 10 | #define ASIO_CPU_MIPS 1 11 | #elif defined(_WIN32) || defined(_WIN64) 12 | #undef BEOS 13 | #undef MAC 14 | #undef SGI 15 | #define WINDOWS 1 16 | #define ASIO_LITTLE_ENDIAN 1 17 | #define ASIO_CPU_X86 1 18 | #elif BEOS 19 | #undef MAC 20 | #undef SGI 21 | #undef WINDOWS 22 | #define ASIO_LITTLE_ENDIAN 1 23 | #define ASIO_CPU_X86 1 24 | // 25 | #else 26 | #define MAC 1 27 | #undef BEOS 28 | #undef WINDOWS 29 | #undef SGI 30 | #define ASIO_BIG_ENDIAN 1 31 | #define ASIO_CPU_PPC 1 32 | #endif 33 | 34 | // always 35 | #define NATIVE_INT64 0 36 | #define IEEE754_64FLOAT 1 37 | 38 | #endif // __gInclude__ 39 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d1/coefs_iir_bp.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define M 14 4 | 5 | #define N 14 6 | 7 | uint64_t b_k[M]={ 8 | 0x3f86c70bca666bb0LL, 9 | 0x3fa11548d7ccd0dfLL, 10 | 0xbf96c70bca666d90LL, 11 | 0xbfc3ee2a51199ea8LL, 12 | 0xbfac78cebd000ad0LL, 13 | 0x3fd1cb8136200350LL, 14 | 0x3fcc78cebd00059eLL, 15 | 0xbfcc78cebd0007eeLL, 16 | 0xbfd1cb8136200450LL, 17 | 0x3fac78cebd000587LL, 18 | 0x3fc3ee2a51199e26LL, 19 | 0x3f96c70bca666c3cLL, 20 | 0xbfa11548d7ccd0c1LL, 21 | 0xbf86c70bca666bbaLL, 22 | }; 23 | uint64_t a_k[N]={ 24 | 0x3ff0000000000000LL, 25 | 0x3fff076074e0ebd8LL, 26 | 0x40029626b6d93520LL, 27 | 0x3ffdd3962cf61eacLL, 28 | 0x3ff773055a398608LL, 29 | 0x3ff07ec9449b34d4LL, 30 | 0x3fe1b9cf81054ef2LL, 31 | 0x3fc75ad9366d5c2fLL, 32 | 0x3fa5c071d580b69dLL, 33 | 0x3f920f393cf485bfLL, 34 | 0x3f811d8c9051f58eLL, 35 | 0x3f51da15ae86adb0LL, 36 | 0xbf3e5bee2cc48f50LL, 37 | 0xbf200035887efc82LL, 38 | }; 39 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d2/coefs_iir_bp.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define M 14 4 | 5 | #define N 14 6 | 7 | uint64_t b_k[M]={ 8 | 0x3f86c70bca666bb0LL, 9 | 0x3fa11548d7ccd0dfLL, 10 | 0xbf96c70bca666d90LL, 11 | 0xbfc3ee2a51199ea8LL, 12 | 0xbfac78cebd000ad0LL, 13 | 0x3fd1cb8136200350LL, 14 | 0x3fcc78cebd00059eLL, 15 | 0xbfcc78cebd0007eeLL, 16 | 0xbfd1cb8136200450LL, 17 | 0x3fac78cebd000587LL, 18 | 0x3fc3ee2a51199e26LL, 19 | 0x3f96c70bca666c3cLL, 20 | 0xbfa11548d7ccd0c1LL, 21 | 0xbf86c70bca666bbaLL, 22 | }; 23 | uint64_t a_k[N]={ 24 | 0x3ff0000000000000LL, 25 | 0x3fff076074e0ebd8LL, 26 | 0x40029626b6d93520LL, 27 | 0x3ffdd3962cf61eacLL, 28 | 0x3ff773055a398608LL, 29 | 0x3ff07ec9449b34d4LL, 30 | 0x3fe1b9cf81054ef2LL, 31 | 0x3fc75ad9366d5c2fLL, 32 | 0x3fa5c071d580b69dLL, 33 | 0x3f920f393cf485bfLL, 34 | 0x3f811d8c9051f58eLL, 35 | 0x3f51da15ae86adb0LL, 36 | 0xbf3e5bee2cc48f50LL, 37 | 0xbf200035887efc82LL, 38 | }; 39 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d3/coefs_iir_bp.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define M 14 4 | 5 | #define N 14 6 | 7 | uint64_t b_k[M]={ 8 | 0x3f86c70bca666bb0LL, 9 | 0x3fa11548d7ccd0dfLL, 10 | 0xbf96c70bca666d90LL, 11 | 0xbfc3ee2a51199ea8LL, 12 | 0xbfac78cebd000ad0LL, 13 | 0x3fd1cb8136200350LL, 14 | 0x3fcc78cebd00059eLL, 15 | 0xbfcc78cebd0007eeLL, 16 | 0xbfd1cb8136200450LL, 17 | 0x3fac78cebd000587LL, 18 | 0x3fc3ee2a51199e26LL, 19 | 0x3f96c70bca666c3cLL, 20 | 0xbfa11548d7ccd0c1LL, 21 | 0xbf86c70bca666bbaLL, 22 | }; 23 | uint64_t a_k[N]={ 24 | 0x3ff0000000000000LL, 25 | 0x3fff076074e0ebd8LL, 26 | 0x40029626b6d93520LL, 27 | 0x3ffdd3962cf61eacLL, 28 | 0x3ff773055a398608LL, 29 | 0x3ff07ec9449b34d4LL, 30 | 0x3fe1b9cf81054ef2LL, 31 | 0x3fc75ad9366d5c2fLL, 32 | 0x3fa5c071d580b69dLL, 33 | 0x3f920f393cf485bfLL, 34 | 0x3f811d8c9051f58eLL, 35 | 0x3f51da15ae86adb0LL, 36 | 0xbf3e5bee2cc48f50LL, 37 | 0xbf200035887efc82LL, 38 | }; 39 | -------------------------------------------------------------------------------- /dependencies/rtaudio/include/asiodrivers.h: -------------------------------------------------------------------------------- 1 | #ifndef __AsioDrivers__ 2 | #define __AsioDrivers__ 3 | 4 | #include "ginclude.h" 5 | 6 | #if MAC 7 | #include "CodeFragments.hpp" 8 | 9 | class AsioDrivers : public CodeFragments 10 | 11 | #elif WINDOWS 12 | #include 13 | #include "asiolist.h" 14 | 15 | class AsioDrivers : public AsioDriverList 16 | 17 | #elif SGI || BEOS 18 | #include "asiolist.h" 19 | 20 | class AsioDrivers : public AsioDriverList 21 | 22 | #else 23 | #error implement me 24 | #endif 25 | 26 | { 27 | public: 28 | AsioDrivers(); 29 | ~AsioDrivers(); 30 | 31 | bool getCurrentDriverName(char *name); 32 | long getDriverNames(char **names, long maxDrivers); 33 | bool loadDriver(char *name); 34 | void removeCurrentDriver(); 35 | long getCurrentDriverIndex() {return curIndex;} 36 | protected: 37 | unsigned long connID; 38 | long curIndex; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /scripts/install_simdsp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # this is a rough beginning of a linux install script for SimDSP 4 | # 5 | # first ensure SimDSP is unpacked in its final destination 6 | # and then run this script 7 | 8 | APPLICATIONSDIR="${HOME}/.local/share/applications" 9 | 10 | APPDIR=$(dirname "$0") 11 | 12 | cd $APPDIR 13 | 14 | # install SimDSP desktop entry for user 15 | desktop-file-edit --set-key=Exec --set-value="$(pwd)/simdsp" simdsp.desktop 16 | xdg-desktop-menu install --novendor --mode user simdsp.desktop 17 | 18 | # install image-files into user hicolor theme with specified size 19 | # ~/.local/share/icons/hicolor/*size* 20 | # /apps 21 | xdg-icon-resource install --noupdate --novendor --mode user --context apps \ 22 | --size 256 resources/icons/simdsp_icon.png simdsp 23 | 24 | # update user databases 25 | update-desktop-database "${APPLICATIONSDIR}" 26 | xdg-icon-resource forceupdate --mode user 27 | 28 | echo "installed SimDSP system icons" 29 | -------------------------------------------------------------------------------- /src/examples/FFT/denoising/fft_f.h: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ============================================================================================= 6 | // Código fuente de la Sección 6.2 para el cálculo de la Transformada Rápida de Fourier (FFT). 7 | // 8 | // Función para calcular la FFT para vectores con el formato 9 | // 10 | // |R|I|R|I| ... |R|I| 11 | // con cada valor |R| o |I| de tipo float. 12 | // 13 | // Los datos deben ser entrados con el ordenamiento bit-reversal 14 | // ============================================================================================= 15 | 16 | void fbasicfft( float* in, float *out, int Nfft, int inv ); 17 | 18 | #define fft(in, out, N) fbasicfft(in, out, N, 1) 19 | #define ifft(in, out, N) fbasicfft(in, out, N, -1) 20 | -------------------------------------------------------------------------------- /src/examples/FFT/fastconv/fft_f.h: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ============================================================================================= 6 | // Código fuente de la Sección 6.2 para el cálculo de la Transformada Rápida de Fourier (FFT). 7 | // 8 | // Función para calcular la FFT para vectores con el formato 9 | // 10 | // |R|I|R|I| ... |R|I| 11 | // con cada valor |R| o |I| de tipo float. 12 | // 13 | // Los datos deben ser entrados con el ordenamiento bit-reversal 14 | // ============================================================================================= 15 | 16 | void fbasicfft( float* in, float *out, int Nfft, int inv ); 17 | 18 | #define fft(in, out, N) fbasicfft(in, out, N, 1) 19 | #define ifft(in, out, N) fbasicfft(in, out, N, -1) 20 | -------------------------------------------------------------------------------- /src/gui/resources/templates/Makefile_simdsp: -------------------------------------------------------------------------------- 1 | ################################################## 2 | # SimDSP Makefile 3 | # Do not edit this file manually 4 | ################################################## 5 | 6 | CC = gcc 7 | CXX = g++ 8 | INCPATH = 9 | LIBPATH = 10 | LIBS = 11 | EXTRA_FLAGS = 12 | 13 | SRCS = $(wildcard *.cpp) 14 | OBJS = $(addprefix build/,$(subst .cpp,.o,$(SRCS))) 15 | 16 | ifeq ($(OS),Windows_NT) 17 | CXXFLAGS = -O3 -Wall -std=c++11 18 | LDFLAGS = 19 | TARGET = build/sdapp.exe 20 | else 21 | CXXFLAGS = -O3 -Wall -fPIC -std=c++11 22 | LDFLAGS = 23 | TARGET = build/sdapp 24 | endif 25 | 26 | .PHONY: all 27 | all: $(TARGET) 28 | 29 | $(TARGET): $(OBJS) 30 | $(CXX) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LIBS) -lsdcore -lrtaudio 31 | 32 | build/%.o:%.cpp 33 | $(CXX) $(INCPATH) $(CXXFLAGS) $(EXTRA_FLAGS) -c $< -o $@ 34 | 35 | .PHONY: clean 36 | clean: 37 | ifeq ($(OS),Windows_NT) 38 | rmdir /S build 39 | else 40 | rm -rf build 41 | endif 42 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /src/gui/pri/translations.pri: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # SimDSP Project file include. 3 | # 4 | # Copyright (c) 2021 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | TRANSLATIONS += \ 24 | translations/simdsp_en.ts \ 25 | translations/simdsp_es.ts \ 26 | -------------------------------------------------------------------------------- /SimDSP.pro: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # SimDSP Project file. 3 | # 4 | # Copyright (c) 2021 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | TEMPLATE = subdirs 24 | SUBDIRS = sdcore gui 25 | 26 | sdcore.subdir = src/sdcore 27 | gui.subdir = src/gui 28 | 29 | gui.depends = sdcore 30 | -------------------------------------------------------------------------------- /src/gui/pri/simdsp.pri: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # SimDSP Project file include. 3 | # 4 | # Copyright (c) 2017 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | HEADERS += \ 24 | simdsp.h 25 | 26 | SOURCES += \ 27 | simdsp.cpp \ 28 | main.cpp 29 | 30 | FORMS += \ 31 | simdsp.ui 32 | 33 | 34 | -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-32/librtaudio.la: -------------------------------------------------------------------------------- 1 | # librtaudio.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='librtaudio-6.dll' 9 | 10 | # Names of this library. 11 | library_names='librtaudio.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='librtaudio.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lole32 -ldsound -lwinmm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for librtaudio. 26 | current=6 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=no 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-64/librtaudio.la: -------------------------------------------------------------------------------- 1 | # librtaudio.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='librtaudio-6.dll' 9 | 10 | # Names of this library. 11 | library_names='librtaudio.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='librtaudio.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lole32 -ldsound -lwinmm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for librtaudio. 26 | current=6 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=no 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /src/sdcore/sdcore_global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Core global. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | 23 | #ifndef SIMDSPCORE_GLOBAL_H 24 | #define SIMDSPCORE_GLOBAL_H 25 | 26 | #include 27 | 28 | #if defined(SIMDSPCORE_LIBRARY) 29 | # define SIMDSPCORESHARED_EXPORT Q_DECL_EXPORT 30 | #else 31 | # define SIMDSPCORESHARED_EXPORT Q_DECL_IMPORT 32 | #endif 33 | 34 | #endif // SIMDSPCORE_GLOBAL_H 35 | -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-32/librtaudio.lai: -------------------------------------------------------------------------------- 1 | # librtaudio.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/librtaudio-6.dll' 9 | 10 | # Names of this library. 11 | library_names='librtaudio.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='librtaudio.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lole32 -ldsound -lwinmm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for librtaudio. 26 | current=6 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/windows-64/librtaudio.lai: -------------------------------------------------------------------------------- 1 | # librtaudio.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/librtaudio-6.dll' 9 | 10 | # Names of this library. 11 | library_names='librtaudio.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='librtaudio.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lole32 -ldsound -lwinmm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for librtaudio. 26 | current=6 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /dependencies/rtaudio/libs/linux-64/librtaudio.lai: -------------------------------------------------------------------------------- 1 | # librtaudio.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='librtaudio.so.6' 9 | 10 | # Names of this library. 11 | library_names='librtaudio.so.6.0.0 librtaudio.so.6 librtaudio.so' 12 | 13 | # The name of the static archive. 14 | old_library='librtaudio.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lpthread -lasound' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for librtaudio. 26 | current=6 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /tools/Bat_To_Exe_Converter/license.txt: -------------------------------------------------------------------------------- 1 | License Agreement 2 | 3 | Copyright (c) 2018 Fatih Kodak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/gui/pri/actions.pri: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # SimDSP Project file include. 3 | # 4 | # Copyright (c) 2017 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | HEADERS += \ 24 | actions/sdbuilder.h \ 25 | actions/sdnewfile.h 26 | 27 | SOURCES += \ 28 | actions/sdbuilder.cpp \ 29 | actions/sdnewfile.cpp 30 | 31 | FORMS += \ 32 | actions/sdnewfile.ui 33 | 34 | -------------------------------------------------------------------------------- /src/gui/pri/editor.pri: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # SimDSP Project file include. 3 | # 4 | # Copyright (c) 2017 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | HEADERS += \ 24 | editor/sdeditor.h \ 25 | editor/sdeditortab.h 26 | 27 | SOURCES += \ 28 | editor/sdeditor.cpp \ 29 | editor/sdeditortab.cpp 30 | 31 | FORMS += \ 32 | editor/sdeditortab.ui 33 | 34 | -------------------------------------------------------------------------------- /src/examples/FIR/fir_conv/fir_conv.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ============================================================================================= 6 | // Implementacion de la suma de convolucion usando punteros 7 | // ============================================================================================= 8 | 9 | #include 10 | #include "coefs_filter.h" 11 | 12 | void conv(int p, double *h, double *x, double *y); 13 | 14 | double x[P+1]; 15 | double yn; 16 | 17 | void dsp_setup() 18 | { 19 | setfs(1e3); 20 | } 21 | 22 | double xn; 23 | 24 | void dsp_loop() 25 | { 26 | 27 | /*Lectura del ADC*/ 28 | xn=(double)readADC(); 29 | x[0]=xn; 30 | 31 | conv(P,h, x, &yn); 32 | 33 | /*Escritura en DAC*/ 34 | writeDAC((short)(yn)); 35 | 36 | } 37 | 38 | void conv(int p, double *h, double *x, double *y){ 39 | 40 | int k; 41 | double *xk,*bk; 42 | 43 | xk = x+p-1; 44 | bk = h+p-1; 45 | 46 | *y=0.0; 47 | 48 | for(k=0;k. 20 | */ 21 | 22 | #ifndef SDHELP_H 23 | #define SDHELP_H 24 | 25 | #include 26 | #include 27 | 28 | namespace Ui { 29 | class SDHelp; 30 | } 31 | 32 | class SDHelp : public QDialog 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | explicit SDHelp(QWidget *parent = 0); 38 | ~SDHelp(); 39 | 40 | private: 41 | Ui::SDHelp *ui; 42 | 43 | QHelpEngine* helpEngine; 44 | }; 45 | 46 | #endif // SDHELP_H 47 | -------------------------------------------------------------------------------- /src/gui/help/sdhelp.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDHelp 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 607 13 | 344 14 | 15 | 16 | 17 | SimDSP Help 18 | 19 | 20 | 21 | 0 22 | 23 | 24 | 3 25 | 26 | 27 | 3 28 | 29 | 30 | 3 31 | 32 | 33 | 3 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/gui/view/sdplot.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDPlot 4 | 5 | 6 | 7 | 0 8 | 0 9 | 386 10 | 254 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 2 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 2 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | QCustomPlot 40 | QWidget 41 |
view/qcustomplot.h
42 | 1 43 |
44 |
45 | 46 | 47 |
48 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_sos_fp/coefs_iir_bp_sos_fp.h: -------------------------------------------------------------------------------- 1 | /*Second Order Sections (SOS) automatically generated header file*/ 2 | /*Alexander López Parrado, PhD*/ 3 | 4 | /*The number of sections*/ 5 | #define NSECT 6 6 | 7 | /*Number of bits in fractional part of coeffcients*/ 8 | /*Fixed point format with 16 bits ([3].[13])*/ 9 | #define Q 13 10 | 11 | /*Gain on each stage*/ 12 | const int16_t gk = 1885; 13 | 14 | /*Filter Coefficients b00,b01,b02,a00,a01,a02,b10,b11,b12,b10,b11,b12,...*/ 15 | const int16_t SOS[NSECT*3*2] = { 16 | 8192, //1.000000 17 | 16416, //2.003874 18 | 8224, //1.003879 19 | 8192, //1.000000 20 | -2526, //-0.308392 21 | 4722, //0.576461 22 | 8192, //1.000000 23 | 16384, //1.999999 24 | 8192, //1.000004 25 | 8192, //1.000000 26 | -4394, //-0.536414 27 | 4833, //0.589957 28 | 8192, //1.000000 29 | 16352, //1.996127 30 | 8160, //0.996132 31 | 8192, //1.000000 32 | -969, //-0.118321 33 | 5501, //0.671487 34 | 8192, //1.000000 35 | -16418, //-2.004127 36 | 8226, //1.004133 37 | 8192, //1.000000 38 | -6197, //-0.756445 39 | 5735, //0.700025 40 | 8192, //1.000000 41 | -16384, //-1.999995 42 | 8192, //1.000001 43 | 8192, //1.000000 44 | -39, //-0.004797 45 | 7106, //0.867452 46 | 8192, //1.000000 47 | -16350, //-1.995878 48 | 8158, //0.995883 49 | 8192, //1.000000 50 | -7687, //-0.938387 51 | 7242, //0.884042 52 | }; 53 | -------------------------------------------------------------------------------- /src/gui/project/sdeditoption.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP edit option. 3 | * 4 | * Copyright (c) 2018 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDEditOption_H 23 | #define SDEditOption_H 24 | 25 | #include 26 | 27 | namespace Ui { 28 | class SDEditOption; 29 | } 30 | 31 | class SDEditOption : public QDialog 32 | { 33 | Q_OBJECT 34 | 35 | public: 36 | explicit SDEditOption(QString text = QString(), QString value = QString(), QWidget *parent = nullptr); 37 | ~SDEditOption(); 38 | 39 | QString getValue(); 40 | 41 | private: 42 | Ui::SDEditOption *ui; 43 | }; 44 | 45 | #endif // SDEditOption_H 46 | -------------------------------------------------------------------------------- /src/gui/project/sdeditoption.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP edit library. 3 | * 4 | * Copyright (c) 2018 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdeditoption.h" 23 | #include "ui_sdeditoption.h" 24 | 25 | SDEditOption::SDEditOption(QString text, QString value, QWidget *parent) : 26 | QDialog(parent), 27 | ui(new Ui::SDEditOption) 28 | { 29 | ui->setupUi(this); 30 | 31 | ui->label->setText(text); 32 | ui->lineEdit->setText(value); 33 | } 34 | 35 | SDEditOption::~SDEditOption() 36 | { 37 | delete ui; 38 | } 39 | 40 | QString SDEditOption::getValue() 41 | { 42 | return ui->lineEdit->text(); 43 | } 44 | -------------------------------------------------------------------------------- /src/gui/help/sdhelp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP help. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdhelp.h" 23 | #include "ui_sdhelp.h" 24 | 25 | SDHelp::SDHelp(QWidget *parent) : 26 | QDialog(parent), 27 | ui(new Ui::SDHelp) 28 | { 29 | ui->setupUi(this); 30 | 31 | helpEngine = new QHelpEngine(":/help/simdsphelp.qhc"); 32 | helpEngine->setupData(); 33 | 34 | ui->tabWidget->addTab(reinterpret_cast(helpEngine->contentWidget()), "Contents"); 35 | ui->tabWidget->addTab(reinterpret_cast(helpEngine->indexWidget()), "Index"); 36 | } 37 | 38 | SDHelp::~SDHelp() 39 | { 40 | delete ui; 41 | } 42 | -------------------------------------------------------------------------------- /src/gui/pri/view.pri: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # SimDSP Project file include. 3 | # 4 | # Copyright (c) 2019 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | HEADERS += \ 24 | view/qcustomplot.h \ 25 | view/sdkeyboard.h \ 26 | view/sdmat.h \ 27 | view/sdplot.h \ 28 | view/sdview.h 29 | 30 | SOURCES += \ 31 | view/qcustomplot.cpp \ 32 | view/sdkeyboard.cpp \ 33 | view/sdmat.cpp \ 34 | view/sdplot.cpp \ 35 | view/sdview.cpp 36 | 37 | FORMS += \ 38 | view/sdkeyboard.ui \ 39 | view/sdmat.ui \ 40 | view/sdplot.ui \ 41 | view/sdview.ui 42 | -------------------------------------------------------------------------------- /dependencies/matio/COPYING-matio: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2019, Christopher C. Hulbert 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /src/gui/simdspresources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | resources/files/keyWords.txt 4 | resources/templates/sdBaseTPL.txt 5 | resources/templates/sdSourceTPL.txt 6 | resources/templates/sdHeaderTPL.txt 7 | resources/templates/simdsp.cpp 8 | ../sdcore/sdfunctions.h 9 | resources/stylesheets/simdsp-design.qss 10 | resources/images/icons/play.png 11 | resources/images/icons/load_mat.png 12 | resources/images/icons/stop.png 13 | resources/images/icons/save_mat.png 14 | resources/images/icons/builder.png 15 | resources/images/icons/new_file.png 16 | resources/images/icons/save.png 17 | resources/images/icons/simdsp.png 18 | resources/files/SDWords.txt 19 | resources/images/splash.png 20 | resources/images/icons/autoscale.png 21 | resources/images/icons/resetzoom.png 22 | resources/templates/Makefile_simdsp 23 | resources/images/icons/add.png 24 | resources/images/icons/edit.png 25 | resources/images/icons/remove.png 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/gui/view/sdkeyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Keyboard. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDKEYBOARD_H 23 | #define SDKEYBOARD_H 24 | 25 | #include 26 | #include 27 | 28 | namespace Ui { 29 | class SDKeyboard; 30 | } 31 | 32 | class SDKeyboard : public QWidget 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | explicit SDKeyboard(QWidget *parent = nullptr); 38 | ~SDKeyboard(); 39 | 40 | int keyboardStatus(); 41 | 42 | signals: 43 | void keyboardClicked(); 44 | 45 | public slots: 46 | void updateKey(QAbstractButton *button); 47 | 48 | private: 49 | Ui::SDKeyboard *ui; 50 | 51 | int status; 52 | }; 53 | 54 | #endif // SDKEYBOARD_H 55 | -------------------------------------------------------------------------------- /src/gui/actions/sdbuilder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP build support. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDBUILDER_H 23 | #define SDBUILDER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | class SDBuilder : public QObject 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit SDBuilder(); 35 | bool build(); 36 | void clean(); 37 | void create(); 38 | void createMakefile(); 39 | 40 | signals: 41 | void builderOutput(QByteArray error); 42 | 43 | public slots: 44 | void readStandardError(); 45 | void readStandardOutput(); 46 | 47 | private: 48 | QProcess *process; 49 | }; 50 | 51 | #endif // SDBUILDER_H 52 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d1/iir_d1.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ================================================================================== 6 | // Filtro IIR en estructura directa tipo I 7 | // ================================================================================== 8 | 9 | #include 10 | #include 11 | #include "coefs_iir_bp.h" 12 | 13 | double x[M]; 14 | double y[N]; 15 | 16 | //Función que implementa la estructura directa tipo I para filtros IIR 17 | double iir1(double xn,double *x,double *y,double *b,double *a,int p){ 18 | 19 | int i; 20 | double yn; 21 | 22 | yn=0.0; 23 | 24 | 25 | x[0]=xn; 26 | 27 | //Rama de entrada 28 | for(i=(p-1);i>=0;i--) 29 | { 30 | yn+=b[i]*x[i]; 31 | x[i]=x[i-1]; 32 | } 33 | 34 | //Rama de salida 35 | for(i=(p-1);i>=1;i--) 36 | { 37 | yn-=a[i]*y[i]; 38 | y[i]=y[i-1]; 39 | } 40 | 41 | y[1]=yn; 42 | 43 | return yn; 44 | 45 | } 46 | 47 | void dsp_setup() 48 | { 49 | 50 | setfs(10000); 51 | memset(x, 0, M*sizeof(double)); 52 | memset(y, 0, N*sizeof(double)); 53 | 54 | } 55 | 56 | void dsp_loop() 57 | { 58 | double xn,yn; 59 | xn=(double)readADC(); 60 | yn=iir1(xn,x,y,(double *)b_k,(double *)a_k,N); 61 | writeDAC((short)yn); 62 | } 63 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d3/iir_d3.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ================================================================================== 6 | // Filtro IIR en estructura directa tipo III 7 | // ================================================================================== 8 | 9 | #include "coefs_iir_bp.h" 10 | #include 11 | 12 | 13 | double iir3(double x_n,double *v,double *b,double *a,int n){ 14 | 15 | int k; 16 | 17 | double y_n; 18 | 19 | /*Cálculo de la salida una vez se lee el ADC*/ 20 | y_n=b[0]*x_n+v[0]; 21 | 22 | 23 | /*Cálculo de v[n]*/ 24 | for(k=0; k 12 | 13 | double iir2(double x_n,double *w,double *b,double *a,int n){ 14 | 15 | double y_n,w_n; 16 | int k; 17 | 18 | w_n=x_n; 19 | 20 | /*Cálculo de w[n]*/ 21 | for(k=n-1; k>=1; k--) 22 | w_n -=a[k]*w[k]; 23 | 24 | /*w_n actual*/ 25 | w[0]=w_n; 26 | 27 | y_n=0; 28 | /*Cálculo de la rama de salida*/ 29 | for(k=n-1; k>=0; k--) { 30 | y_n +=b[k]*w[k]; 31 | w[k] = w[k-1]; 32 | } 33 | 34 | 35 | return y_n; 36 | 37 | } 38 | 39 | 40 | double w[N]; 41 | 42 | void dsp_setup() 43 | { 44 | // put your setup code here, to run once: 45 | int k; 46 | 47 | setfs(10000); 48 | for(k=0; k. 20 | */ 21 | 22 | #ifndef SDNEWPROJECT_H 23 | #define SDNEWPROJECT_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace Ui { 31 | class SDNewProject; 32 | } 33 | 34 | class SDNewProject : public QDialog 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | explicit SDNewProject(QWidget *parent = nullptr); 40 | ~SDNewProject(); 41 | void getProjectInfo(QString &name, QString &path); 42 | 43 | public slots: 44 | void browsePath(); 45 | void createFolder(); 46 | void changeLineEdit(const QString& value); 47 | 48 | private: 49 | Ui::SDNewProject *ui; 50 | }; 51 | 52 | #endif // SDNEWPROJECT_H 53 | -------------------------------------------------------------------------------- /src/gui/view/sdkeyboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Keyboard. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdkeyboard.h" 23 | #include "ui_sdkeyboard.h" 24 | 25 | SDKeyboard::SDKeyboard(QWidget *parent) : 26 | QWidget(parent), 27 | ui(new Ui::SDKeyboard) 28 | { 29 | ui->setupUi(this); 30 | 31 | status = -1; 32 | 33 | connect(ui->keyboardGroup, QOverload::of(&QButtonGroup::buttonClicked),this, &SDKeyboard::updateKey); 34 | } 35 | 36 | SDKeyboard::~SDKeyboard() 37 | { 38 | delete ui; 39 | } 40 | 41 | int SDKeyboard::keyboardStatus() 42 | { 43 | return status; 44 | } 45 | 46 | void SDKeyboard::updateKey(QAbstractButton *button) 47 | { 48 | status = button->text().toInt(Q_NULLPTR, 16); 49 | emit keyboardClicked(); 50 | } 51 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | 6 | linux: 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | os: [ubuntu-18.04, ubuntu-20.04] 11 | runs-on: ${{ matrix.os }} 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2 15 | - name: Install dependencies 16 | run: | 17 | sudo apt update 18 | sudo apt install -y qt5-default qttools5-dev-tools libfftw3-3 libfftw3-dev libegl1-mesa libqscintilla2-qt5-dev 19 | sudo apt install libasound2-dev libjack-dev libpulse-dev doxygen oss4-dev 20 | sudo apt install libmatio-dev 21 | - name: Compile 22 | run: | 23 | qmake SimDSP.pro 24 | make -j 25 | 26 | win: 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | os: [windows-latest] 31 | runs-on: ${{ matrix.os }} 32 | defaults: 33 | run: 34 | shell: msys2 {0} 35 | steps: 36 | - name: Checkout 37 | uses: actions/checkout@v2 38 | with: 39 | repository: lmcapacho/SimDSP 40 | - name: Setup MSYS2 41 | uses: msys2/setup-msys2@v2 42 | with: 43 | msystem: MINGW64 44 | update: true 45 | install: > 46 | base-devel 47 | git 48 | mingw-w64-x86_64-toolchain 49 | mingw-w64-x86_64-qscintilla 50 | - name: Compile 51 | run: | 52 | qmake SimDSP.pro 53 | make 54 | -------------------------------------------------------------------------------- /src/gui/pri/project.pri: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # SimDSP Project file include. 3 | # 4 | # Copyright (c) 2017 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | HEADERS += \ 24 | project/sdeditoption.h \ 25 | project/sdproject.h \ 26 | project/sdprojectexplorer.h \ 27 | project/sdnewproject.h \ 28 | project/sdbuildoptions.h 29 | 30 | SOURCES += \ 31 | project/sdeditoption.cpp \ 32 | project/sdproject.cpp \ 33 | project/sdnewproject.cpp \ 34 | project/sdprojectexplorer.cpp \ 35 | project/sdbuildoptions.cpp 36 | 37 | FORMS += \ 38 | project/sdeditoption.ui \ 39 | project/sdprojectexplorer.ui \ 40 | project/sdnewproject.ui \ 41 | project/sdbuildoptions.ui 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/gui/editor/sdeditortab.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDEditortab 4 | 5 | 6 | 7 | 0 8 | 0 9 | 133 10 | 16 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 2 31 | 32 | 33 | 34 | 35 | false 36 | 37 | 38 | 39 | 40 | 41 | -1 42 | 43 | 44 | true 45 | 46 | 47 | true 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/include/sdfunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Functions. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDFUNCTIONS_H 23 | #define SDFUNCTIONS_H 24 | 25 | #include 26 | 27 | extern void* sd_void; 28 | 29 | using namespace std; 30 | 31 | void attachInterrupt(void (*callback)()); 32 | void println(string text); 33 | void println(int number); 34 | void println(short number); 35 | void println(double number); 36 | void println(float number); 37 | void println(const char *format, ...); 38 | int readKeyboard(); 39 | void setfs(double fs); 40 | short readADC(); 41 | void writeDAC(short value); 42 | void captureBlock( short* pBuffer, int length, void (*callback)() ); 43 | void playBlock( short* pBuffer, int length, void (*callback)() ); 44 | void enableMic(int length); 45 | 46 | void initSDCore(); 47 | 48 | #endif // SDFUNCTIONS_H 49 | -------------------------------------------------------------------------------- /src/sdcore/sdfunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Functions. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDFUNCTIONS_H 23 | #define SDFUNCTIONS_H 24 | 25 | #include 26 | 27 | extern void* sd_void; 28 | 29 | using namespace std; 30 | 31 | void attachInterrupt(void (*callback)()); 32 | void println(string text); 33 | void println(int number); 34 | void println(short number); 35 | void println(double number); 36 | void println(float number); 37 | void println(const char *format, ...); 38 | int readKeyboard(); 39 | void setfs(double fs); 40 | short readADC(); 41 | void writeDAC(short value); 42 | void captureBlock( short* pBuffer, int length, void (*callback)() ); 43 | void playBlock( short* pBuffer, int length, void (*callback)() ); 44 | void enableMic(int length); 45 | 46 | void initSDCore(); 47 | 48 | #endif // SDFUNCTIONS_H 49 | -------------------------------------------------------------------------------- /dependencies/core/sdfunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Functions. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | 23 | #ifndef SDFUNCTIONS_H 24 | #define SDFUNCTIONS_H 25 | 26 | #include 27 | 28 | extern void* sd_void; 29 | 30 | using namespace std; 31 | 32 | void attachInterrupt(void (*callback)()); 33 | void println(string text); 34 | void println(int number); 35 | void println(short number); 36 | void println(double number); 37 | void println(float number); 38 | void println(const char *format, ...); 39 | int readKeyboard(); 40 | void setfs(double fs); 41 | short readADC(); 42 | void writeDAC(short value); 43 | void captureBlock( short* pBuffer, int length, void (*callback)() ); 44 | void playBlock( short* pBuffer, int length, void (*callback)() ); 45 | void enableMic(int length); 46 | 47 | void initSDCore(); 48 | 49 | #endif // SDFUNCTIONS_H 50 | -------------------------------------------------------------------------------- /src/examples/FIR/fir_circular_buffer/fir_circular_buffer.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ============================================================================================= 6 | // Filtro FIR usando buffer circular 7 | // ============================================================================================= 8 | 9 | //Archivo de cabecera con coeficientes de filtro FIR 10 | #include "coefs_filter.h" 11 | 12 | //Operación módulo con signo 13 | #define MOD(a,b) ((((a)%(b))+(b))%(b)) 14 | 15 | #include 16 | 17 | //Regresor/Memoria del filtro FIR 18 | double x[P]; 19 | 20 | //Convolución usando buffer circular 21 | void cbuff_conv(int p, double *h, double *x,double xn, double *y) 22 | { 23 | 24 | //Índice que indica el inicio del buffer circular, variable estática 25 | static int xins=0; 26 | int i; 27 | 28 | //Entrada actual 29 | x[xins]=xn; 30 | *y=0.0; 31 | 32 | //Convolución usando direccionamiento circular 33 | for(i=0;i. 20 | */ 21 | 22 | #ifndef SDNEWFILE_H 23 | #define SDNEWFILE_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #define SOURCE 0 35 | #define HEADER 1 36 | 37 | namespace Ui { 38 | class SDNewFile; 39 | } 40 | 41 | class SDNewFile : public QDialog 42 | { 43 | Q_OBJECT 44 | 45 | public: 46 | explicit SDNewFile(QWidget *parent = nullptr); 47 | ~SDNewFile(); 48 | QString getFileName(); 49 | 50 | public slots: 51 | void changeTemplateSelect(int index); 52 | void changeFileName(const QString &fileName); 53 | void createFile(); 54 | 55 | private: 56 | void loadTemplate(int index); 57 | 58 | Ui::SDNewFile *ui; 59 | }; 60 | 61 | #endif // SDNEWFILE_H 62 | -------------------------------------------------------------------------------- /dependencies/rtaudio/include/iasiodrv.h: -------------------------------------------------------------------------------- 1 | #include "asiosys.h" 2 | #include "asio.h" 3 | 4 | /* Forward Declarations */ 5 | 6 | #ifndef __ASIODRIVER_FWD_DEFINED__ 7 | #define __ASIODRIVER_FWD_DEFINED__ 8 | typedef interface IASIO IASIO; 9 | #endif /* __ASIODRIVER_FWD_DEFINED__ */ 10 | 11 | interface IASIO : public IUnknown 12 | { 13 | 14 | virtual ASIOBool init(void *sysHandle) = 0; 15 | virtual void getDriverName(char *name) = 0; 16 | virtual long getDriverVersion() = 0; 17 | virtual void getErrorMessage(char *string) = 0; 18 | virtual ASIOError start() = 0; 19 | virtual ASIOError stop() = 0; 20 | virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) = 0; 21 | virtual ASIOError getLatencies(long *inputLatency, long *outputLatency) = 0; 22 | virtual ASIOError getBufferSize(long *minSize, long *maxSize, 23 | long *preferredSize, long *granularity) = 0; 24 | virtual ASIOError canSampleRate(ASIOSampleRate sampleRate) = 0; 25 | virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate) = 0; 26 | virtual ASIOError setSampleRate(ASIOSampleRate sampleRate) = 0; 27 | virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources) = 0; 28 | virtual ASIOError setClockSource(long reference) = 0; 29 | virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp) = 0; 30 | virtual ASIOError getChannelInfo(ASIOChannelInfo *info) = 0; 31 | virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, 32 | long bufferSize, ASIOCallbacks *callbacks) = 0; 33 | virtual ASIOError disposeBuffers() = 0; 34 | virtual ASIOError controlPanel() = 0; 35 | virtual ASIOError future(long selector,void *opt) = 0; 36 | virtual ASIOError outputReady() = 0; 37 | }; 38 | -------------------------------------------------------------------------------- /dependencies/rtaudio/include/asiosys.h: -------------------------------------------------------------------------------- 1 | #ifndef __asiosys__ 2 | #define __asiosys__ 3 | 4 | #if defined(_WIN32) || defined(_WIN64) 5 | #undef MAC 6 | #define PPC 0 7 | #define WINDOWS 1 8 | #define SGI 0 9 | #define SUN 0 10 | #define LINUX 0 11 | #define BEOS 0 12 | 13 | #define NATIVE_INT64 0 14 | #define IEEE754_64FLOAT 1 15 | 16 | #elif BEOS 17 | #define MAC 0 18 | #define PPC 0 19 | #define WINDOWS 0 20 | #define PC 0 21 | #define SGI 0 22 | #define SUN 0 23 | #define LINUX 0 24 | 25 | #define NATIVE_INT64 0 26 | #define IEEE754_64FLOAT 1 27 | 28 | #ifndef DEBUG 29 | #define DEBUG 0 30 | #if DEBUG 31 | void DEBUGGERMESSAGE(char *string); 32 | #else 33 | #define DEBUGGERMESSAGE(a) 34 | #endif 35 | #endif 36 | 37 | #elif SGI 38 | #define MAC 0 39 | #define PPC 0 40 | #define WINDOWS 0 41 | #define PC 0 42 | #define SUN 0 43 | #define LINUX 0 44 | #define BEOS 0 45 | 46 | #define NATIVE_INT64 0 47 | #define IEEE754_64FLOAT 1 48 | 49 | #ifndef DEBUG 50 | #define DEBUG 0 51 | #if DEBUG 52 | void DEBUGGERMESSAGE(char *string); 53 | #else 54 | #define DEBUGGERMESSAGE(a) 55 | #endif 56 | #endif 57 | 58 | #else // MAC 59 | 60 | #define MAC 1 61 | #define PPC 1 62 | #define WINDOWS 0 63 | #define PC 0 64 | #define SGI 0 65 | #define SUN 0 66 | #define LINUX 0 67 | #define BEOS 0 68 | 69 | #define NATIVE_INT64 0 70 | #define IEEE754_64FLOAT 1 71 | 72 | #ifndef DEBUG 73 | #define DEBUG 0 74 | #if DEBUG 75 | void DEBUGGERMESSAGE(char *string); 76 | #else 77 | #define DEBUGGERMESSAGE(a) 78 | #endif 79 | #endif 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/sdcore/sdaudio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Audio. 3 | * 4 | * Copyright (c) 2018 parrado 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | 23 | #ifndef SDAUDIO_H 24 | #define SDAUDIO_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | class SDSignal; 37 | 38 | class SDAudio : public QObject 39 | { 40 | Q_OBJECT 41 | public: 42 | explicit SDAudio(QObject *parent = nullptr); 43 | ~SDAudio(); 44 | 45 | int initSoundCard() { return initSoundCard(4096, 8000);} 46 | int initSoundCard(int bSize, double fs); 47 | 48 | 49 | void record(); 50 | void play(short *outBuffer); 51 | 52 | QByteArray *buffer_adc; 53 | QByteArray *buffer_dac; 54 | QMutex *mutex_adc; 55 | QMutex *mutex_dac; 56 | 57 | 58 | void recordFinish( short *inBuffer); 59 | void playFinish(); 60 | 61 | private: 62 | RtAudio *adc,*dac; 63 | int bufferSize; 64 | SDSignal *mySD; 65 | }; 66 | 67 | #endif // SDAUDIO_H 68 | -------------------------------------------------------------------------------- /src/sdcore/sdcore.pro: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # sdcore Project file. 3 | # 4 | # Copyright (c) 2017 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | CONFIG += c++11 24 | 25 | TARGET = sdcore 26 | TEMPLATE = lib 27 | 28 | DEFINES += SIMDSPCORE_LIBRARY 29 | 30 | DESTDIR = $$PWD/../build 31 | OBJECTS_DIR = build/obj 32 | MOC_DIR = build/moc 33 | 34 | SOURCES += sdcore.cpp \ 35 | sdfunctions.cpp \ 36 | sdsignal.cpp \ 37 | sdaudio.cpp 38 | 39 | HEADERS += sdcore.h\ 40 | sdcore_global.h \ 41 | sdfunctions.h \ 42 | sdsignal.h \ 43 | sdaudio.h 44 | 45 | INCLUDEPATH += $$PWD/../../dependencies/rtaudio 46 | 47 | unix { 48 | target.path = /usr/lib 49 | INSTALLS += target 50 | LIBS += -lm 51 | LIBS += -L$$PWD/../../dependencies/rtaudio/libs/linux-64 -lrtaudio 52 | } 53 | 54 | win32 { 55 | LIBS += -L$$PWD\..\..\dependencies\rtaudio\libs\windows-64 -lrtaudio 56 | } 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_sos/coefs_iir_bp_sos.h: -------------------------------------------------------------------------------- 1 | /*Second Order Sections (SOS) automatically generated header file*/ 2 | /*M.Eng. Alexander López Parrado*/ 3 | 4 | /*The number of sections*/ 5 | #define NSECT 6 6 | 7 | /*Gain on each stage*/ 8 | const double gk = 0.230074389198000883727246446142; 9 | 10 | /*Filter Coefficients b00,b01,b02,a00,a01,a02,b10,b11,b12,b10,b11,b12,...*/ 11 | const double SOS[NSECT*3*2] = { 12 | 1.000000000000000000000000000000, 13 | 2.003873592874664488761027314467, 14 | 1.003878595075469615238716869499, 15 | 1.000000000000000000000000000000, 16 | -0.308392229322772215560632957931, 17 | 0.576460808219188103329599925928, 18 | 1.000000000000000000000000000000, 19 | 1.999999037325182360547159987618, 20 | 1.000004037645775722964458509523, 21 | 1.000000000000000000000000000000, 22 | -0.536413613122100563224137204088, 23 | 0.589957163005016993473361708311, 24 | 1.000000000000000000000000000000, 25 | 1.996127369800154482959442248102, 26 | 0.996132368272432233702318171709, 27 | 1.000000000000000000000000000000, 28 | -0.118320527668062461246201166887, 29 | 0.671486765812457586655170871381, 30 | 1.000000000000000000000000000000, 31 | -2.004127146654789193291890114779, 32 | 1.004132827755166879057924234075, 33 | 1.000000000000000000000000000000, 34 | -0.756445093457906114764455196564, 35 | 0.700024556746531190221105589444, 36 | 1.000000000000000000000000000000, 37 | -1.999995193883212785124214860843, 38 | 1.000000865033715991003759882005, 39 | 1.000000000000000000000000000000, 40 | -0.004796838928343469254933495449, 41 | 0.867452385446174090155579960992, 42 | 1.000000000000000000000000000000, 43 | -1.995877659461999353851524574566, 44 | 0.995883320738179866893347025325, 45 | 1.000000000000000000000000000000, 46 | -0.938386617096532482662496477133, 47 | 0.884041746221454816101470441936, 48 | }; 49 | -------------------------------------------------------------------------------- /snap/snapcraft.yaml: -------------------------------------------------------------------------------- 1 | name: simdsp 2 | version: '1.0.1' 3 | summary: Simulation software for Digital Signal Processing 4 | description: | 5 | SimDSP provides simulation of DSP algorithms written in C/C++ 6 | language by generating the necessary signals of 15-bit ADC and DAC. 7 | The programs under debugging must be written using the editor included in this software. 8 | It is not necessary to install any compiler for compiling or debugging purposes, 9 | since installers are boundle versions that includes editor, compiler and debugger. 10 | icon: resources/images/simdsp_icon.png 11 | license: GPL-3.0 12 | 13 | grade: stable 14 | confinement: strict 15 | base: core18 16 | 17 | architectures: 18 | - build-on: amd64 19 | 20 | parts: 21 | sdcore: 22 | plugin: qmake 23 | project-files: [sdcore.pro] 24 | source: https://github.com/lmcapacho/SimDSP/archive/v1.0.1.tar.gz 25 | source-subdir: sdcore 26 | stage-packages: 27 | - libaec0 28 | - libdouble-conversion1 29 | - libfftw3-double3 30 | - libfreetype6 31 | - libgl1 32 | - libglvnd0 33 | - libglx0 34 | - libgraphite2-3 35 | - libharfbuzz0b 36 | - libhdf5-100 37 | - libicu60 38 | - libmatio4 39 | - libpng16-16 40 | - libqt5core5a 41 | - libqt5gui5 42 | - libqt5printsupport5 43 | - libqt5widgets5 44 | - libsz2 45 | - libx11-6 46 | - libxau6 47 | - libxcb1 48 | - libxdmcp6 49 | - librtaudio6 50 | 51 | simdsp: 52 | plugin: qmake 53 | project-files: [SimDSP.pro] 54 | source: https://github.com/lmcapacho/SimDSP/archive/v1.0.1.tar.gz 55 | build-packages: 56 | - libegl1-mesa 57 | - qtmultimedia5-dev 58 | - libfftw3-3 59 | - libfftw3-dev 60 | - libmatio-dev 61 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d3_fp/iir_d3_fp.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ================================================================================== 6 | // Filtro IIR en estructura directa tipo III y punto fijo 7 | // ================================================================================== 8 | 9 | #include "coefs_iir_bp_fp.h" 10 | #include 11 | 12 | #include 13 | 14 | //Tipo de dato para los coeficientes 15 | typedef int16_t coeff_t; 16 | //Tipo de dato para las líneas de retardos, considera 16 de bits de guarda para la ganancia de las etapas 17 | typedef int32_t delay_t; 18 | //Tipo de dato para los acumuladores antes de correr la coma 19 | typedef int64_t acc_t; 20 | 21 | //Linea de retardos del filtro 22 | delay_t v[N-1]; 23 | 24 | delay_t iir3_fp(coeff_t x_n,delay_t *v,const coeff_t *b,const coeff_t *a,int8_t n,int8_t q){ 25 | 26 | uint8_t k; 27 | acc_t y_n; 28 | 29 | 30 | /*Cálculo de la salida*/ 31 | y_n=(((acc_t)b_k[0])*((acc_t)x_n)+((acc_t)v[0]<>q; 32 | 33 | /*Cálculo de v[n]*/ 34 | for(k=0; k>q; 36 | 37 | /*Cálculo de v_{n-1}*/ 38 | v[n-2]=(((acc_t)b_k[n-1])*((acc_t)x_n)-((acc_t)a_k[n-1])*((acc_t)y_n))>>q; 39 | 40 | return (delay_t)y_n; 41 | 42 | } 43 | 44 | 45 | void dsp_setup() 46 | { 47 | 48 | int k; 49 | 50 | setfs(10000); 51 | for(k=0; k<(N-1); k++) v[k] = 0; 52 | 53 | } 54 | 55 | void dsp_loop() 56 | { 57 | 58 | double x_n,y_n; 59 | 60 | 61 | /*Lectura del ADC*/ 62 | x_n=(coeff_t)readADC(); 63 | 64 | y_n=iir3_fp(x_n,v,b_k,a_k,N,Q); 65 | 66 | /*Escritura al DAC*/ 67 | writeDAC((short)(y_n)); 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_d2_fp/iir_d2_fp.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ================================================================================== 6 | // Filtro IIR en estructura directa tipo II en punto fijo 7 | // ================================================================================== 8 | 9 | #include "coefs_iir_bp_fp.h" 10 | #include 11 | 12 | #include 13 | 14 | //Tipo de dato para los coeficientes 15 | typedef int16_t coeff_t; 16 | //Tipo de dato para las líneas de retardos, considera 16 de bits de guarda para la ganancia de las etapas 17 | typedef int32_t delay_t; 18 | //Tipo de dato para los acumuladores antes de correr la coma 19 | typedef int64_t acc_t; 20 | 21 | delay_t iir2_fp(coeff_t x_n,delay_t *w,const coeff_t *b,const coeff_t *a,int8_t n,int8_t q){ 22 | 23 | acc_t y_n; 24 | acc_t w_n; 25 | int8_t k; 26 | 27 | w_n=(acc_t)(x_n<=1; k--) 31 | w_n -=((acc_t)a[k]*(acc_t)w[k]); 32 | 33 | 34 | /*w_n actual*/ 35 | w[0]=w_n>>q; 36 | 37 | y_n=0; 38 | /*Cálculo de la rama de salida*/ 39 | for(k=n-1; k>=0; k--) { 40 | y_n +=(acc_t)b[k]*(acc_t)w[k]; 41 | w[k] = w[k-1]; 42 | } 43 | 44 | 45 | return (delay_t)(y_n>>q); 46 | 47 | } 48 | 49 | 50 | 51 | delay_t w[N]; 52 | 53 | 54 | void dsp_setup() 55 | { 56 | // put your setup code here, to run once: 57 | int k; 58 | 59 | setfs(10000); 60 | for(k=0; k. 20 | */ 21 | 22 | #ifndef SDPLOT_H 23 | #define SDPLOT_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | #include "qcustomplot.h" 31 | 32 | namespace Ui { 33 | class SDPlot; 34 | } 35 | 36 | class SDPlot : public QWidget 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | explicit SDPlot(QWidget *parent = nullptr); 42 | ~SDPlot(); 43 | void setSizeWindow(int size); 44 | void setMaxSizeWindow(int size); 45 | void updatePlotTime(const QVector *data); 46 | void updatePlotFreq(const QVector *data); 47 | void clearPlot(); 48 | void setfs(double fsValue); 49 | void setAutoScale(); 50 | void resetZoom(); 51 | 52 | signals: 53 | void zoomX(int); 54 | void zoomY(int); 55 | 56 | public slots: 57 | void plotMouseRelease(QMouseEvent *event); 58 | void plotMouseMove(QMouseEvent *event); 59 | void plotMouseWheel(QWheelEvent *event); 60 | 61 | private: 62 | Ui::SDPlot *ui; 63 | 64 | QCPItemLine *cursor; 65 | QCPItemText *cursorLabel; 66 | 67 | QVector *keysTime; 68 | QVector *keysFreq; 69 | 70 | double y; 71 | double x; 72 | double fs; 73 | bool cursorMove; 74 | 75 | double yMax; 76 | bool bAutoScale; 77 | 78 | int sizeWindow; 79 | int maxSizeWindow; 80 | }; 81 | 82 | #endif // SDPLOT_H 83 | -------------------------------------------------------------------------------- /src/gui/editor/sdeditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP editor. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDEditor_H 23 | #define SDEditor_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | class SDEditor : public QsciScintilla 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | SDEditor(); 42 | 43 | void newFile(QString fileName); 44 | void loadTemplate(QString fileName); 45 | bool loadFile(const QString &fileName, bool readOnly=false); 46 | bool save(); 47 | bool saveAs(); 48 | bool saveFile(const QString &fileName); 49 | QString userFriendlyCurrentFile(); 50 | QString currentFile() { return curFile; } 51 | bool isFileLoad(); 52 | void isFileLoad(bool load); 53 | bool closeEditor(); 54 | 55 | void setFont(QFont &); 56 | 57 | private slots: 58 | void documentWasModified(bool m); 59 | void test(); 60 | 61 | private: 62 | bool isSaved(); 63 | void setCurrentFile(const QString &fileName); 64 | QString strippedName(const QString &fullFileName); 65 | 66 | QFont font; 67 | QsciLexerCPP *lexer; 68 | QsciAPIs *lexer_apis; 69 | 70 | QString curFile; 71 | bool isUntitled; 72 | bool isLoad; 73 | }; 74 | 75 | #endif // SDEditor_H 76 | -------------------------------------------------------------------------------- /src/gui/project/sdeditoption.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDEditOption 4 | 5 | 6 | 7 | 0 8 | 0 9 | 362 10 | 76 11 | 12 | 13 | 14 | SimDSP - Edit Option 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Qt::Horizontal 35 | 36 | 37 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | buttonBox 47 | accepted() 48 | SDEditOption 49 | accept() 50 | 51 | 52 | 248 53 | 254 54 | 55 | 56 | 157 57 | 274 58 | 59 | 60 | 61 | 62 | buttonBox 63 | rejected() 64 | SDEditOption 65 | reject() 66 | 67 | 68 | 316 69 | 260 70 | 71 | 72 | 286 73 | 274 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/gui/project/sdbuildoptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP build options. 3 | * 4 | * Copyright (c) 2018 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDBUILDOPTIONS_H 23 | #define SDBUILDOPTIONS_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "sdeditoption.h" 34 | 35 | namespace Ui { 36 | class SDBuildOptions; 37 | } 38 | 39 | class SDBuildOptions : public QDialog 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | explicit SDBuildOptions(QString path, QWidget *parent = nullptr); 45 | ~SDBuildOptions(); 46 | 47 | public slots: 48 | void addFlags(); 49 | void editFlags(); 50 | void removeFlags(); 51 | void addInclude(); 52 | void editInclude(); 53 | void removeInclude(); 54 | void addLibrary(); 55 | void editLibrary(); 56 | void removeLibrary(); 57 | void addLib(); 58 | void editLib(); 59 | void removeLib(); 60 | void changeStd(); 61 | 62 | private: 63 | void addOption(QString option, QString value, QString prefix = nullptr); 64 | void editOption(QString option, QString oldValue, QString newValue); 65 | void removeOption(QString option, QString value, QString prefix = nullptr); 66 | void loadOptions(); 67 | QString searchOption(QString option); 68 | 69 | Ui::SDBuildOptions *ui; 70 | 71 | QFile mkFile; 72 | }; 73 | 74 | #endif // SDBUILDOPTIONS_H 75 | -------------------------------------------------------------------------------- /src/gui/resources/stylesheets/simdsp-design.qss: -------------------------------------------------------------------------------- 1 | /* ----------- Main Window ----------- */ 2 | QMainWindow { 3 | background-color: #FFFFFF; 4 | } 5 | 6 | /* ------------ Menu Bar ------------- */ 7 | QMenuBar { 8 | background-color: #f1d204; 9 | color: #131418; 10 | left:5px; 11 | } 12 | 13 | QMenuBar::item { 14 | spacing: 10px; 15 | padding: 7px 10px; 16 | } 17 | 18 | QMenuBar::item:selected { 19 | color: #000000; 20 | background: #FFFFFF; 21 | } 22 | 23 | QMenuBar::item:pressed { 24 | color: #000000; 25 | background: #FFFFFF; 26 | } 27 | 28 | /* ---------- Menu dropdowns ---------- */ 29 | 30 | QMenu { 31 | background-color: #FFFFFF; 32 | color:#333; 33 | margin: 0px 3px 0px 3px; 34 | border:none; 35 | } 36 | 37 | QMenu::item { 38 | background-color: #FFFFFF; 39 | color:#333; 40 | margin: 2px; 41 | padding: 2px 15px 2px 20px; 42 | } 43 | 44 | QMenu::item:selected { 45 | color: #000000; 46 | background: #f1d204; 47 | } 48 | 49 | QMenu::separator { 50 | background-color: #c1c1c1; 51 | height:1px; 52 | } 53 | 54 | QMenu::indicator { 55 | width: 15px; 56 | height: 15px; 57 | } 58 | 59 | QMenu::item:disabled { 60 | color:#b7b7b7; 61 | } 62 | 63 | QMenu::item:disabled:selected { 64 | color:#b7b7b7; 65 | background-color: #d9d9d9; 66 | } 67 | 68 | /* ---------- Tool bar ---------- */ 69 | 70 | QToolBar { 71 | background: #FFFFFF; 72 | } 73 | 74 | /* ---------- Tool button ---------- */ 75 | 76 | QToolButton { 77 | color: #2A2A2A; 78 | /*font-family: Ubuntu;*/ 79 | } 80 | 81 | 82 | QPlainTextEdit{ 83 | background-color: #FAFAFA; 84 | color: #383a42; 85 | } 86 | 87 | QTextEdit#appOutput{ 88 | background-color: #FFFFFF; 89 | } 90 | 91 | 92 | /*QToolButton:hover { 93 | background: #006565; 94 | border: 1px; 95 | border-color: white; 96 | }*/ 97 | 98 | QTreeWidget{ 99 | background-color: #47484B; 100 | color: #FFFFFF; 101 | } 102 | 103 | QTreeWidget::item:selected{ 104 | background-color: white; 105 | color: black; 106 | } 107 | 108 | QTabWidget { 109 | background: #FFFFFF; 110 | } 111 | 112 | QStatusBar { 113 | background-color: #1F1F1F; 114 | color: #FAFAFA; 115 | } 116 | 117 | 118 | /*QPushButton { 119 | color: blue; 120 | }*/ 121 | -------------------------------------------------------------------------------- /src/gui/main.cpp: -------------------------------------------------------------------------------- 1 | #include "simdsp.h" 2 | #include 3 | #include 4 | #include 5 | 6 | void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg); 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | qInstallMessageHandler(myMessageOutput); 11 | 12 | QCoreApplication::setOrganizationName("SimDSP"); 13 | QCoreApplication::setOrganizationDomain("github.com/lmcapacho/SimDSP"); 14 | QCoreApplication::setApplicationName("SimDSP"); 15 | 16 | QFile file(":/resources/stylesheets/simdsp-design.qss"); 17 | file.open(QFile::ReadOnly); 18 | QString styleSheet = QLatin1String(file.readAll()); 19 | 20 | QApplication a(argc, argv); 21 | 22 | QTranslator simdspTranslator; 23 | simdspTranslator.load(QString("simdsp_") + QLocale::system().name().toLower(), QCoreApplication::applicationDirPath() + QString("/translations/")); 24 | a.installTranslator(&simdspTranslator); 25 | 26 | QSplashScreen *splash = new QSplashScreen; 27 | splash->setPixmap(QPixmap(":/resources/images/splash.png")); 28 | splash->show(); 29 | a.processEvents(); 30 | 31 | SimDSP w; 32 | w.showMaximized(); 33 | 34 | splash->finish(&w); 35 | 36 | a.setStyleSheet(styleSheet); 37 | 38 | return a.exec(); 39 | } 40 | 41 | void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) 42 | { 43 | QByteArray localMsg = msg.toLocal8Bit(); 44 | switch (type) { 45 | case QtDebugMsg: 46 | fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 47 | break; 48 | case QtWarningMsg: 49 | fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 50 | break; 51 | case QtCriticalMsg: 52 | fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 53 | break; 54 | case QtFatalMsg: 55 | fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 56 | abort(); 57 | case QtInfoMsg: 58 | fprintf(stderr, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 59 | break; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/gui/editor/sdeditortab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP editor tabs. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDEditortab_H 23 | #define SDEditortab_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "sdeditor.h" 35 | 36 | namespace Ui { 37 | class SDEditortab; 38 | } 39 | 40 | class SDEditor; 41 | class Highlighter; 42 | 43 | class SDEditortab : public QWidget 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | explicit SDEditortab(QWidget *parent = nullptr); 49 | ~SDEditortab(); 50 | void newFile(QString fileName); 51 | bool openFile(QString fileName, bool readOnly=false); 52 | SDEditor *createEditor(); 53 | SDEditor *activeEditor(); 54 | void asterisk(); 55 | int tabClose(); 56 | void saveFile(); 57 | void saveAll(); 58 | void closeAll(); 59 | void setClosable(bool closable); 60 | void increaseFontSize(); 61 | void decreaseFontSize(); 62 | void resetFontSize(); 63 | void resetFont(); 64 | void selectFont(); 65 | int getOpenedTabs(); 66 | 67 | public slots: 68 | void selectAll(); 69 | void undo(); 70 | void redo(); 71 | 72 | signals: 73 | void tabCloseRequested(); 74 | 75 | private: 76 | bool findFile(QString fileName); 77 | bool loadFile(QString fileName, bool readOnly=false); 78 | void setFont(SDEditor *editor); 79 | void setFontAll(); 80 | 81 | QFont font; 82 | 83 | Ui::SDEditortab *ui; 84 | 85 | QSettings settings; 86 | 87 | Highlighter *highlighter; 88 | int findTab; 89 | }; 90 | 91 | #endif // SDEditortab_H 92 | -------------------------------------------------------------------------------- /src/gui/project/sdproject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP project. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDPROJECT_H 23 | #define SDPROJECT_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "sdprojectexplorer.h" 35 | #include "../actions/sdbuilder.h" 36 | #include "../editor/sdeditortab.h" 37 | 38 | class SDProject : public QObject 39 | { 40 | Q_OBJECT 41 | public: 42 | explicit SDProject(SDProjectexplorer *explorer, 43 | SDEditortab *editorTab, 44 | QTextEdit *appOutput, 45 | QTextEdit *issuesOutput); 46 | void newProject(QString projectName, QString projectPath); 47 | bool openProject(QString projectPath); 48 | bool openExample(QString examplePath); 49 | int closeProject(); 50 | int closeActiveProject(); 51 | bool buildProject(); 52 | void cleanProject(); 53 | void closeAll(); 54 | 55 | void newFile(QString fileName); 56 | void saveFile(); 57 | int closeTab(); 58 | void closeAllTabs(); 59 | 60 | void addRecentProjects(QString path); 61 | 62 | SDEditortab *editor; 63 | 64 | signals: 65 | void tabOpen(); 66 | void buildIssues(int total); 67 | 68 | public slots: 69 | void builderOutput(QByteArray data); 70 | void itemActivated(QString fileName, bool isExample); 71 | void removeFile(QString fileName); 72 | 73 | private: 74 | SDProjectexplorer *projectExplorer; 75 | SDBuilder *builder; 76 | 77 | QTextEdit *output; 78 | QTextEdit *issues; 79 | QString path; 80 | 81 | int totalIssues; 82 | QRegularExpression msgRegExp; 83 | QRegularExpression ldRegExp; 84 | }; 85 | 86 | #endif // SDPROJECT_H 87 | -------------------------------------------------------------------------------- /dependencies/rtaudio/include/asiodrvr.h: -------------------------------------------------------------------------------- 1 | /* 2 | Steinberg Audio Stream I/O API 3 | (c) 1996, Steinberg Soft- und Hardware GmbH 4 | charlie (May 1996) 5 | 6 | asiodrvr.h 7 | c++ superclass to implement asio functionality. from this, 8 | you can derive whatever required 9 | */ 10 | 11 | #ifndef _asiodrvr_ 12 | #define _asiodrvr_ 13 | 14 | // cpu and os system we are running on 15 | #include "asiosys.h" 16 | // basic "C" interface 17 | #include "asio.h" 18 | 19 | class AsioDriver; 20 | extern AsioDriver *getDriver(); // for generic constructor 21 | 22 | #if WINDOWS 23 | #include 24 | #include "combase.h" 25 | #include "iasiodrv.h" 26 | class AsioDriver : public IASIO ,public CUnknown 27 | { 28 | public: 29 | AsioDriver(LPUNKNOWN pUnk, HRESULT *phr); 30 | 31 | DECLARE_IUNKNOWN 32 | // Factory method 33 | static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr); 34 | // IUnknown 35 | virtual HRESULT STDMETHODCALLTYPE NonDelegatingQueryInterface(REFIID riid,void **ppvObject); 36 | 37 | #else 38 | 39 | class AsioDriver 40 | { 41 | public: 42 | AsioDriver(); 43 | #endif 44 | virtual ~AsioDriver(); 45 | 46 | virtual ASIOBool init(void* sysRef); 47 | virtual void getDriverName(char *name); // max 32 bytes incl. terminating zero 48 | virtual long getDriverVersion(); 49 | virtual void getErrorMessage(char *string); // max 124 bytes incl. 50 | 51 | virtual ASIOError start(); 52 | virtual ASIOError stop(); 53 | 54 | virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels); 55 | virtual ASIOError getLatencies(long *inputLatency, long *outputLatency); 56 | virtual ASIOError getBufferSize(long *minSize, long *maxSize, 57 | long *preferredSize, long *granularity); 58 | 59 | virtual ASIOError canSampleRate(ASIOSampleRate sampleRate); 60 | virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate); 61 | virtual ASIOError setSampleRate(ASIOSampleRate sampleRate); 62 | virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources); 63 | virtual ASIOError setClockSource(long reference); 64 | 65 | virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp); 66 | virtual ASIOError getChannelInfo(ASIOChannelInfo *info); 67 | 68 | virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, 69 | long bufferSize, ASIOCallbacks *callbacks); 70 | virtual ASIOError disposeBuffers(); 71 | 72 | virtual ASIOError controlPanel(); 73 | virtual ASIOError future(long selector, void *opt); 74 | virtual ASIOError outputReady(); 75 | }; 76 | #endif 77 | -------------------------------------------------------------------------------- /src/gui/project/sdprojectexplorer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDProjectexplorer 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Projects 21 | 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 1 31 | 32 | 33 | 2 34 | 35 | 36 | 2 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | false 45 | 46 | 47 | false 48 | 49 | 50 | 3 51 | 52 | 53 | false 54 | 55 | 56 | 57 | Project 58 | 59 | 60 | 61 | 62 | Path 63 | 64 | 65 | 66 | 67 | isExample 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Projects 76 | 77 | 78 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter 79 | 80 | 81 | 4 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /src/gui/project/sdprojectexplorer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP project explorer. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SDPROJECTEXPLORER_H 23 | #define SDPROJECTEXPLORER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include "sdbuildoptions.h" 36 | 37 | namespace Ui { 38 | class SDProjectexplorer; 39 | } 40 | 41 | class SDProjectexplorer : public QWidget 42 | { 43 | Q_OBJECT 44 | 45 | public: 46 | explicit SDProjectexplorer(QWidget *parent = nullptr); 47 | ~SDProjectexplorer(); 48 | bool addProject(QString path, QString name); 49 | void addExample(QString path, QString name); 50 | void addFile(QString name); 51 | void setExpanded(bool expanded); 52 | void setProjectName(QString name); 53 | void sortProject(); 54 | int removeProject(); 55 | int removeActiveProject(); 56 | void removeAllProjects(); 57 | bool isExample(); 58 | 59 | signals: 60 | void buildProject(); 61 | void cleanProject(); 62 | void runProject(); 63 | void closeProject(); 64 | void closeActiveProject(); 65 | void changePath(); 66 | 67 | void newFile(); 68 | void deleteFile(QString fileName); 69 | void itemActivated(QString fileName, bool isExample); 70 | 71 | public slots: 72 | void itemActivatedSD(QTreeWidgetItem* item, int column); 73 | void showContextMenu(const QPoint &pos); 74 | void activateProject(); 75 | void showContainingFolder(); 76 | void openFile(); 77 | void removeFile(); 78 | void buildOptions(); 79 | 80 | private: 81 | 82 | Ui::SDProjectexplorer *ui; 83 | QTreeWidgetItem* currentProject; 84 | QTreeWidgetItem* selectItem; 85 | }; 86 | #endif // SDPROJECTEXPLORER_H 87 | -------------------------------------------------------------------------------- /src/sdcore/sdcore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Core. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SIMDSPCORE_H 23 | #define SIMDSPCORE_H 24 | 25 | 26 | #include 27 | 28 | 29 | #include 30 | #include 31 | #include "sdcore_global.h" 32 | 33 | #include "sdsignal.h" 34 | 35 | 36 | using namespace std; 37 | 38 | 39 | 40 | class SIMDSPCORESHARED_EXPORT SimDSPCore: public QObject 41 | { 42 | Q_OBJECT 43 | public: 44 | SimDSPCore(); 45 | ~SimDSPCore(); 46 | 47 | void attachInterrupt(void (*callback)()); 48 | void println( string text ); 49 | void println( short number ); 50 | void println( int number ){ println(static_cast(number));} 51 | void println( double number ); 52 | void println( float number ){ println(static_cast(number));} 53 | int readKeyboard(); 54 | void setfs(double fs); 55 | short readADC(); 56 | void writeDAC(short value); 57 | void captureBlock( short* pBuffer, int length, void (*callback)() ); 58 | void playBlock( short* pBuffer, int length, void (*callback)() ); 59 | void enableMic(int length); 60 | 61 | void init(); 62 | void start(); 63 | void stop(); 64 | 65 | void keyboardClicked(int iKey); 66 | 67 | void changeInput(int inputIndex); 68 | void changeFrequency(int freq); 69 | void changeAmplitude(int amp); 70 | void changeFileSize(int length); 71 | void changeAWGN(bool checked); 72 | void changeSNR(int snr); 73 | 74 | private: 75 | 76 | QSharedMemory *plotBufferIn; 77 | QSharedMemory *plotBufferOut; 78 | QSharedMemory *fileBufferIn; 79 | QSharedMemory *fileBufferOut; 80 | int key; 81 | void (*sdKeyboardISRFnc)(); 82 | 83 | QVector *sharedMemoryArray; 84 | 85 | 86 | SDSignal *sd; 87 | 88 | void standardInputTask(); 89 | std::thread *standardInputThread; 90 | }; 91 | 92 | #endif // SIMDSPCORE_H 93 | -------------------------------------------------------------------------------- /src/gui/gui.pro: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # GUI SimDSP Project file. 3 | # 4 | # Copyright (c) 2021 lmcapacho 5 | # 6 | # This file is part of SimDSP. 7 | # 8 | # SimDSP is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # SimDSP is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with SimDSP. If not, see . 20 | # 21 | ####################################################################### 22 | 23 | QT += core gui 24 | QT += widgets printsupport 25 | 26 | CONFIG += c++11 qscintilla2 27 | 28 | RESOURCES += \ 29 | simdspresources.qrc 30 | 31 | include(pri/actions.pri) 32 | include(pri/editor.pri) 33 | include(pri/project.pri) 34 | include(pri/view.pri) 35 | include(pri/simdsp.pri) 36 | include(pri/translations.pri) 37 | 38 | DESTDIR = $$PWD/../build 39 | OBJECTS_DIR = build/obj 40 | MOC_DIR = build/moc 41 | RCC_DIR = build/rcc 42 | UI_DIR = build/ui 43 | 44 | unix { 45 | 46 | isEmpty(PREFIX) { 47 | PREFIX = /usr 48 | } 49 | BINDIR = $$PREFIX/bin 50 | INCLUDEDIR = $$PREFIX/include 51 | DATADIR = $$PREFIX/share 52 | PKGDATADIR = $$DATADIR/simdsp 53 | 54 | target.path = $$BINDIR 55 | 56 | bin.path = $$PKGDATADIR 57 | bin.files = simdsp 58 | 59 | include.path = $$INCLUDEDIR 60 | include.files += sdcore/simdsp.h sdcore/sdfunctions.h 61 | 62 | desktop.path = $$DATADIR/applications 63 | desktop.files += simdsp.desktop 64 | 65 | icon.path = $$DATADIR/icons 66 | icon.extra = install -D -m 0644 $$PWD/resources/images/simdsp_icon.png $(INSTALL_ROOT)$$DATADIR/icons/simdsp.png 67 | 68 | INSTALLS += target bin include desktop icon 69 | 70 | LIBS += -lfftw3 -lm -lmatio -lqscintilla2_qt5 71 | } 72 | 73 | win32 { 74 | INCLUDEPATH += "$$PWD\..\..\dependencies\fftw3" \ 75 | "$$PWD\..\..\dependencies\matio" 76 | 77 | LIBS += "$$PWD\..\..\dependencies\fftw3\libfftw3-3.dll" \ 78 | "$$PWD\..\..\dependencies\matio\libmatio.dll" \ 79 | "$$PWD\..\..\dependencies\matio\hdf5.dll" \ 80 | "$$PWD\..\..\dependencies\matio\zlib.dll" 81 | } 82 | 83 | TARGET = SimDSP 84 | TEMPLATE = app 85 | -------------------------------------------------------------------------------- /src/gui/view/sdmat.cpp: -------------------------------------------------------------------------------- 1 | #include "sdmat.h" 2 | #include "ui_sdmat.h" 3 | 4 | SDMat::SDMat(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::SDMat) 7 | { 8 | ui->setupUi(this); 9 | 10 | mat_types << "Empty" << "Cell" << "Struct" << "Object" << "Char" << 11 | "Sparse" << "Double" << "Single" << "Int8" << "Uint8" << 12 | "Int16" << "Uint16" << "Int32" << "Uint32" << "Int64" << 13 | "Uint64" << "Function" << "Opaque"; 14 | 15 | ui->buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true); 16 | 17 | connect(ui->browseButton, &QPushButton::pressed, this, &SDMat::browseFile); 18 | connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &SDMat::loadData); 19 | connect(ui->variables, QOverload::of(&QComboBox::currentIndexChanged), this, &SDMat::changeVariable); 20 | } 21 | 22 | SDMat::~SDMat() 23 | { 24 | delete ui; 25 | } 26 | 27 | void SDMat::browseFile() 28 | { 29 | QSettings settings; 30 | QString lastopen = settings.value("MatFiles/lastopen").toString(); 31 | 32 | QString filePath = QFileDialog::getOpenFileName(this, tr("Open File"), lastopen, tr("Matlab/Octave Files (*.mat)")); 33 | 34 | if( !filePath.isEmpty() ){ 35 | mat_t *matfp; 36 | matvar_t *matvar; 37 | matfp = Mat_Open(filePath.toLatin1().data(), MAT_ACC_RDONLY); 38 | 39 | ui->filePath->setText(filePath); 40 | ui->error->setText(""); 41 | ui->varType->setText(""); 42 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); 43 | types.clear(); 44 | ui->variables->clear(); 45 | 46 | if ( nullptr == matfp ) { 47 | ui->error->setText("Error opening MAT file"); 48 | ui->buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true); 49 | ui->filePath->setText(""); 50 | return; 51 | } 52 | 53 | while ( (matvar = Mat_VarReadNextInfo(matfp)) != nullptr ) { 54 | types.append(mat_types[static_cast(matvar->class_type)] + (matvar->isComplex ? " - Complex" : "" ) ); 55 | ui->variables->addItem(matvar->name); 56 | Mat_VarFree(matvar); 57 | matvar = nullptr; 58 | } 59 | 60 | if( !types.isEmpty() ){ 61 | ui->varType->setText(types[0]); 62 | ui->variables->setCurrentIndex(0); 63 | } 64 | 65 | Mat_Close(matfp); 66 | } 67 | } 68 | 69 | void SDMat::changeVariable(int index) 70 | { 71 | if( !types.isEmpty() ) 72 | ui->varType->setText(types[index]); 73 | } 74 | 75 | void SDMat::loadData() 76 | { 77 | QSettings settings; 78 | settings.setValue("MatFiles/lastopen",QFileInfo(ui->filePath->text()).canonicalPath()); 79 | 80 | emit loadVariable(ui->filePath->text(), ui->variables->currentText()); 81 | } 82 | -------------------------------------------------------------------------------- /src/gui/project/sdnewproject.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP new project. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdnewproject.h" 23 | #include "ui_sdnewproject.h" 24 | 25 | SDNewProject::SDNewProject(QWidget *parent) : 26 | QDialog(parent), 27 | ui(new Ui::SDNewProject) 28 | { 29 | ui->setupUi(this); 30 | 31 | ui->projectPath->setText(QDir::homePath()); 32 | ui->projectName->setFocus(); 33 | 34 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 35 | 36 | connect(ui->browseButton, &QPushButton::clicked, this, &SDNewProject::browsePath); 37 | connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &SDNewProject::createFolder); 38 | connect(ui->projectName, QOverload::of(&QLineEdit::textChanged), this, &SDNewProject::changeLineEdit); 39 | } 40 | 41 | SDNewProject::~SDNewProject() 42 | { 43 | delete ui; 44 | } 45 | 46 | void SDNewProject::getProjectInfo(QString &name, QString &path) 47 | { 48 | name = ui->projectName->text(); 49 | path = ui->projectPath->text() + QDir::separator() + name; 50 | } 51 | 52 | void SDNewProject::browsePath() 53 | { 54 | QString path = QFileDialog::getExistingDirectory(this, 55 | tr("Save SimDSP Project"),QDir::homePath(), 56 | QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); 57 | 58 | if( !path.isEmpty() ) 59 | ui->projectPath->setText(path); 60 | } 61 | 62 | 63 | void SDNewProject::createFolder() 64 | { 65 | QDir dir(ui->projectPath->text()); 66 | 67 | if(dir.exists()){ 68 | dir.mkpath(ui->projectPath->text() + QDir::separator() + ui->projectName->text()); 69 | } 70 | } 71 | 72 | void SDNewProject::changeLineEdit(const QString &value) 73 | { 74 | QString filePath = ui->projectPath->text() + QDir::separator() + value; 75 | 76 | if( value.isEmpty() ){ 77 | ui->message->setText("Project name is empty"); 78 | ui->buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true); 79 | return; 80 | } 81 | else{ 82 | ui->message->setText(filePath); 83 | filePath += QDir::separator() + value + ".cpp"; 84 | } 85 | 86 | QFileInfo file(filePath); 87 | 88 | if( file.exists() ){ 89 | ui->message->setText("A project with the same name already exists in the project folder"); 90 | ui->buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true); 91 | return; 92 | } 93 | 94 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); 95 | } 96 | -------------------------------------------------------------------------------- /tools/release.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cls 4 | 5 | echo. 6 | echo NOTE: Execute this script from outside the SimDSP folder 7 | echo. 8 | 9 | set argc=0 10 | for %%x in (%*) do Set /A argc+=1 11 | 12 | IF /I "%argc%" NEQ "3" ( 13 | call :usage 14 | echo. 15 | exit 16 | ) 17 | 18 | set RELNAME=%1 19 | set QT_HOME=%2 20 | set MINGW_PATH=%3 21 | 22 | echo. 23 | 24 | reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set arch_aux="i386" || set arch_aux="x86_64" 25 | 26 | set script_folder=%~dp0% 27 | 28 | echo script_folder %script_folder% 29 | set current_dir=%cd% 30 | 31 | IF %arch_aux%=="x86_64" ( 32 | set arch=AMD64 33 | ) ELSE ( 34 | set arch=i386 35 | ) 36 | 37 | set app_folder=%script_folder%..\ 38 | set sdcore_folder=%app_folder%sdcore 39 | 40 | echo. 41 | echo appfolder %app_folder% 42 | echo sdcorefolder %sdcore_folder% 43 | 44 | echo. 45 | cd %sdcore_folder% 46 | echo Compiling SimDSP core... 47 | %QT_HOME%\bin\qmake.exe -config release 48 | %MINGW_PATH%\bin\mingw32-make.exe 49 | 50 | echo. 51 | cd %app_folder% 52 | echo Compiling SimDSP app... 53 | %QT_HOME%\bin\qmake -config release 54 | %MINGW_PATH%\bin\mingw32-make.exe 55 | 56 | echo. 57 | set release_name=simdsp-%RELNAME%.windows.%arch% 58 | set release_folder=%current_dir%\%release_name% 59 | echo making release folder: %release_folder% 60 | if not exist %release_folder% mkdir %release_folder% 61 | 62 | echo. 63 | echo copying release files 64 | copy simdsp.bat %release_folder% 65 | copy README.md %release_folder% 66 | copy LICENSE %release_folder% 67 | 68 | if not exist %release_folder%\icons mkdir %release_folder%\icons 69 | copy resources\images\icons\simdsp.ico %release_folder%\icons 70 | copy SimDSP.exe %release_folder% 71 | 72 | echo. 73 | cd %release_folder% 74 | echo making include folder 75 | if not exist include mkdir include 76 | 77 | echo. 78 | echo copying headers files 79 | copy %sdcore_folder%\simdsp.h include 80 | copy %sdcore_folder%\sdfunctions.h include 81 | 82 | echo. 83 | if not exist examples mkdir examples 84 | echo copying examples 85 | xcopy /s/e %app_folder%\examples examples 86 | 87 | echo. 88 | echo making libraries folder 89 | if not exist dlls mkdir dlls 90 | copy SimDSP.exe dlls 91 | 92 | echo. 93 | cd dlls 94 | echo copying libraries 95 | %QT_HOME%\bin\windeployqt.exe SimDSP.exe 96 | del SimDSP.exe 97 | 98 | echo. 99 | echo copying sdcore libraries 100 | copy %sdcore_folder%\build\sdcore.dll 101 | copy %sdcore_folder%\build\libsdcore.a 102 | copy %app_folder%\resources\dependencies\fftw3\libfftw3-3.dll 103 | 104 | echo. 105 | cd %release_folder% 106 | if not exist resources mkdir resources 107 | move SimDSP.exe dlls 108 | move include resources 109 | move dlls\platforms resources 110 | move dlls resources 111 | move examples resources 112 | move icons resources 113 | 114 | %script_folder%\Bat_To_Exe_Converter\Bat_To_Exe_Converter_x64.exe /bat simdsp.bat /exe SimDSP.exe /icon resources\icons\simdsp.ico 115 | del simdsp.bat 116 | 117 | if not exist MinGW mkdir MinGW 118 | xcopy /s/e %MINGW_PATH% MinGW 119 | 120 | echo done! 121 | 122 | exit 123 | 124 | :usage 125 | echo Usage : release.bat version qt_path mingw_path 126 | EXIT /B 0 127 | -------------------------------------------------------------------------------- /src/sdcore/sdfunctions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Functions. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdfunctions.h" 23 | #include "sdcore.h" 24 | 25 | #include 26 | #include 27 | 28 | SimDSPCore* sd; 29 | void* SIMDSPCORESHARED_EXPORT sd_void; 30 | 31 | /****************************************** 32 | * SimDSP Core functions 33 | ******************************************/ 34 | 35 | void SIMDSPCORESHARED_EXPORT attachInterrupt(void (*callback)()) 36 | { 37 | sd->attachInterrupt(callback); 38 | } 39 | 40 | void SIMDSPCORESHARED_EXPORT println(string text) 41 | { 42 | sd->println(text); 43 | } 44 | 45 | void SIMDSPCORESHARED_EXPORT println(short number) 46 | { 47 | sd->println(number); 48 | } 49 | 50 | void SIMDSPCORESHARED_EXPORT println(int number) 51 | { 52 | sd->println(number); 53 | } 54 | 55 | void SIMDSPCORESHARED_EXPORT println(double number) 56 | { 57 | sd->println(number); 58 | } 59 | 60 | void SIMDSPCORESHARED_EXPORT println(float number) 61 | { 62 | sd->println(number); 63 | } 64 | 65 | void SIMDSPCORESHARED_EXPORT println(const char *format, ...) 66 | { 67 | QString buffer; 68 | va_list args; 69 | va_start(args, format); 70 | 71 | buffer.vsprintf(format, args); 72 | va_end(args); 73 | 74 | sd->println(buffer.toStdString()); 75 | } 76 | 77 | int SIMDSPCORESHARED_EXPORT readKeyboard() 78 | { 79 | return sd->readKeyboard(); 80 | } 81 | 82 | void SIMDSPCORESHARED_EXPORT setfs(double fs) 83 | { 84 | sd->setfs(fs); 85 | } 86 | 87 | short SIMDSPCORESHARED_EXPORT readADC() 88 | { 89 | return sd->readADC(); 90 | } 91 | 92 | void SIMDSPCORESHARED_EXPORT writeDAC(short value) 93 | { 94 | sd->writeDAC(value); 95 | } 96 | 97 | void SIMDSPCORESHARED_EXPORT captureBlock( short* pBuffer, int length, void (*callback)() ) 98 | { 99 | sd->captureBlock( pBuffer, length, callback ); 100 | } 101 | 102 | void SIMDSPCORESHARED_EXPORT playBlock( short* pBuffer, int length, void (*callback)() ) 103 | { 104 | sd->playBlock( pBuffer, length, callback ); 105 | } 106 | 107 | void SIMDSPCORESHARED_EXPORT enableMic(int length) 108 | { 109 | sd->enableMic(length); 110 | } 111 | 112 | void SIMDSPCORESHARED_EXPORT initSDCore() 113 | { 114 | if(!sd){ 115 | sd = new SimDSPCore(); 116 | sd_void = reinterpret_cast(sd); 117 | } 118 | sd->setfs(8000); 119 | sd->start(); 120 | } 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /tools/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Based into fritzing release script (https://github.com/fritzing/fritzing-app) 3 | # Using linuxdeployqt (https://github.com/probonopd/linuxdeployqt) 4 | 5 | arch_aux=`uname -m` 6 | 7 | echo "" 8 | echo "NOTE: Execute this script from outside the SimDSP folder" 9 | echo "" 10 | 11 | 12 | usage () 13 | { 14 | echo 'Usage : release.sh -version -qt-path ' 15 | exit 16 | } 17 | 18 | if [ "$#" -ne 4 ] 19 | then 20 | usage 21 | fi 22 | 23 | while [ "$1" != "" ]; do 24 | case "$1" in 25 | "-version" ) shift 26 | RELNAME=$1 27 | ;; 28 | "-qt-path" ) shift 29 | QT_HOME=$1 30 | ;; 31 | * ) echo "$1" " invalid option" 32 | exit 33 | esac 34 | shift 35 | done 36 | 37 | echo 38 | script_path="$(readlink -f "$0")" 39 | script_folder=$(dirname $script_path) 40 | echo "script_folder $script_folder" 41 | 42 | current_dir=$(pwd) 43 | 44 | if [ "$arch_aux" == 'x86_64' ] ; then 45 | arch='AMD64' 46 | QT_HOME=$QT_HOME"/gcc_64" 47 | else 48 | arch='i386' 49 | QT_HOME=$QT_HOME"/gcc" 50 | fi 51 | 52 | app_folder=$(dirname $script_folder) 53 | sdcore_folder="$app_folder/sdcore" 54 | 55 | echo "appfolder $app_folder" 56 | echo "sdcorefolder $sdcore_folder" 57 | 58 | cd $sdcore_folder 59 | echo "Compiling SimDSP core..." 60 | $QT_HOME/bin/qmake -config release 61 | make 62 | 63 | cd $app_folder 64 | echo "Compiling SimDSP app..." 65 | $QT_HOME/bin/qmake -config release 66 | make 67 | 68 | release_name=simdsp-$RELNAME.linux.$arch 69 | release_folder="$current_dir/$release_name" 70 | echo "making release folder: $release_folder" 71 | mkdir $release_folder 72 | 73 | echo "copying release files" 74 | cp -rf simdsp.sh install_simdsp.sh simdsp.desktop README.md LICENSE $release_folder/ 75 | mkdir $release_folder/icons 76 | cp resources/images/simdsp_icon.png $release_folder/icons/ 77 | cp SimDSP $release_folder/ 78 | chmod +x $release_folder/install_simdsp.sh 79 | 80 | export LD_LIBRARY_PATH=$sdcore_folder/build 81 | cd $release_folder 82 | 83 | echo "making include folder" 84 | mkdir include 85 | 86 | echo "copying examples" 87 | mkdir examples 88 | cp -rf $app_folder/examples . 89 | 90 | echo "copying headers files" 91 | cp -rf $sdcore_folder/simdsp.h $sdcore_folder/sdfunctions.h include/ 92 | 93 | echo "copying libraries" 94 | wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" 95 | chmod a+x linuxdeployqt*.AppImage 96 | ./linuxdeployqt*.AppImage SimDSP -bundle-non-qt-libs -qmake=$QT_HOME/bin/qmake 97 | 98 | echo "copying sdcore libraries" 99 | cp -d $sdcore_folder/build/libsdcore.so* lib/ 100 | 101 | rm AppRun 102 | 103 | mv plugins/* lib/ 104 | rm -rf plugins 105 | 106 | mkdir resources 107 | mv SimDSP resources 108 | mv lib include icons examples doc translations resources 109 | rm -f qt.conf 110 | 111 | mv simdsp.sh simdsp 112 | chmod +x simdsp 113 | 114 | rm -f linuxdeployqt*.AppImage 115 | 116 | cd $current_dir 117 | 118 | echo "compressing...." 119 | tar -cjf ./$release_name.tar.bz2 $release_name 120 | 121 | echo "cleaning up" 122 | rm -rf $release_folder 123 | 124 | echo "done!" 125 | -------------------------------------------------------------------------------- /src/examples/FIR/fir_dma/fir_dma.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ============================================================================================= 6 | // Filtro FIR usando DMA y procesamiento orientado a bloques 7 | // ============================================================================================= 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "coefs_filter.h" 15 | 16 | 17 | #define N_DATOS 8192 18 | 19 | //Buffers de captura 20 | short buffer_1[N_DATOS+P-1]; 21 | short buffer_2[N_DATOS+P-1]; 22 | 23 | //Buffer de salida 24 | short buffer_salida[N_DATOS]; 25 | 26 | //punteros a los buffer 27 | short *datos_adquiriendo; 28 | short *datos_procesando; 29 | 30 | void block_conv(double * coefs, short *entrada, short *salida, short *init,int p,int Nbloque){ 31 | 32 | int k; 33 | int n; 34 | double y; 35 | 36 | //calcula convolución del bloque 37 | for(n=0;n. 20 | */ 21 | 22 | #ifndef SDVIEW_H 23 | #define SDVIEW_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | 35 | #include "sdmat.h" 36 | 37 | #define MAXFILESIZE 1048576 38 | 39 | using namespace std; 40 | 41 | namespace Ui { 42 | class SDView; 43 | } 44 | 45 | class SDView : public QWidget 46 | { 47 | Q_OBJECT 48 | public: 49 | 50 | enum SignalTypes{ 51 | SIGNAL_SIN, 52 | SIGNAL_SQUARE, 53 | SIGNAL_SAWTOOTH, 54 | SIGNAL_NOISE, 55 | SIGNAL_FILE, 56 | SIGNAL_MIC 57 | }; 58 | 59 | SDView(QWidget *parent = nullptr); 60 | ~SDView(); 61 | 62 | void println( QString text ); 63 | int readKeyboard(); 64 | void setfs(double fs); 65 | void enableMic(); 66 | void clearOutput(); 67 | void newData(); 68 | void updateFFT(); 69 | 70 | void init(); 71 | void start(); 72 | void stop(); 73 | 74 | signals: 75 | void changeView(QByteArray data); 76 | 77 | public slots: 78 | void autoScale(); 79 | void resetZoom(); 80 | void loadMatFile(); 81 | void saveMatFile(); 82 | 83 | void keyboardClicked(); 84 | 85 | void setInput(int inputIndex); 86 | void setFrequency(int freq); 87 | void setAmplitude(int amp); 88 | void changeAmplitude(int inc); 89 | void setBaseTime(int bt); 90 | void changeBaseTime(int inc); 91 | 92 | void setInOutSelect(QAbstractButton *button); 93 | 94 | void setAWGN(bool checked); 95 | void setSNR(int value); 96 | 97 | void setSizeWindow(int size); 98 | 99 | void loadFile(QString path, QString varName); 100 | 101 | private: 102 | Ui::SDView *ui; 103 | 104 | QTextEdit *output; 105 | 106 | QTimer *refresh; 107 | 108 | SDMat *sdmat; 109 | 110 | QSharedMemory SDPlotBufferIn; 111 | QSharedMemory SDPlotBufferOut; 112 | QSharedMemory SDFileBufferIn; 113 | QSharedMemory SDFileBufferOut; 114 | 115 | QVector *inTime; 116 | QVector *outTime; 117 | QVector *inFreq; 118 | QVector *outFreq; 119 | 120 | size_t fileLength; 121 | 122 | int fftWidth; 123 | double *fftInADC; 124 | fftw_complex *fftOutADC; 125 | double *fftInDAC; 126 | fftw_complex *fftOutDAC; 127 | 128 | fftw_plan planADC; 129 | fftw_plan planDAC; 130 | }; 131 | 132 | #endif // SDVIEW_H 133 | -------------------------------------------------------------------------------- /src/gui/simdsp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP main. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #ifndef SIMDSP_H 23 | #define SIMDSP_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "view/sdview.h" 35 | #include "editor/sdeditortab.h" 36 | #include "project/sdproject.h" 37 | #include "project/sdnewproject.h" 38 | #include "actions/sdbuilder.h" 39 | #include "actions/sdnewfile.h" 40 | 41 | #define SDAPP_NOTFOUND 127 42 | #ifdef Q_OS_LINUX 43 | #define SDAPP_KILL 9 44 | #elif defined(Q_OS_WIN32) 45 | #define SDAPP_KILL 62097 46 | #endif 47 | 48 | namespace Ui { 49 | class SimDSP; 50 | } 51 | 52 | class SimDSP : public QMainWindow 53 | { 54 | Q_OBJECT 55 | 56 | public: 57 | explicit SimDSP(QWidget *parent = nullptr); 58 | ~SimDSP(); 59 | 60 | public slots: 61 | // Files slots 62 | void actionNewFile(); 63 | void actionSaveFile(); 64 | void actionCloseTab(); 65 | void actionCloseAll(); 66 | 67 | // SDCore slots 68 | void actionRun(); 69 | void actionStop(); 70 | void actionLoad(); 71 | void actionSave(); 72 | void actionAutoScale(); 73 | void actionResetZoom(); 74 | 75 | // Project slots 76 | void actionNewProject(); 77 | void actionOpenProject(); 78 | void actionBuildProject(); 79 | void actionCleanProject(); 80 | void actionCloseProject(); 81 | void actionCloseActiveProject(); 82 | void actionCloseAllProjectsEditors(); 83 | void actionOpenRecentProject(); 84 | void actionClearRecentProjects(); 85 | 86 | // Edit slots 87 | void actionIncreaseFontSize(); 88 | void actionDecreaseFontSize(); 89 | void actionResetFontSize(); 90 | void actionResetFont(); 91 | void actionFont(); 92 | 93 | // Help slots 94 | void actionAbout(); 95 | void actionAboutQt(); 96 | void actionHelpContents(); 97 | 98 | // Example slots 99 | void actionOpenExample(); 100 | 101 | // SDApp slots 102 | void sdappReadyRead(); 103 | 104 | // View slots 105 | void changeView(QByteArray data); 106 | 107 | void tabOpen(); 108 | void issues(int total); 109 | 110 | void sdappFinished(int exitCode, QProcess::ExitStatus exitStatus); 111 | 112 | private: 113 | Ui::SimDSP *ui; 114 | 115 | void initActionsConnections(); 116 | void loadExamples(); 117 | void loadRecentProjects(); 118 | 119 | void menuCloseAllProjects(); 120 | void menuOpenProject(); 121 | 122 | void closeEvent(QCloseEvent *event); 123 | 124 | QSettings settings; 125 | 126 | QList examplesActionList; 127 | 128 | SDProject *sdproject; 129 | SDBuilder *sdbuilder; 130 | 131 | QProcess *sdapp; 132 | 133 | bool isRun; 134 | }; 135 | 136 | #endif // SIMDSP_H 137 | -------------------------------------------------------------------------------- /src/gui/actions/sdnewfile.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP new file. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdnewfile.h" 23 | #include "ui_sdnewfile.h" 24 | 25 | SDNewFile::SDNewFile(QWidget *parent) : 26 | QDialog(parent), 27 | ui(new Ui::SDNewFile) 28 | { 29 | ui->setupUi(this); 30 | 31 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 32 | 33 | loadTemplate(SOURCE); 34 | 35 | connect(ui->templateSelect, QOverload::of(&QComboBox::currentIndexChanged), this, &SDNewFile::changeTemplateSelect); 36 | connect(ui->fileName, QOverload::of(&QLineEdit::textChanged), this, &SDNewFile::changeFileName); 37 | connect(ui->buttonBox,&QDialogButtonBox::accepted, this, &SDNewFile::createFile); 38 | } 39 | 40 | SDNewFile::~SDNewFile() 41 | { 42 | delete ui; 43 | } 44 | 45 | void SDNewFile::loadTemplate(int index) 46 | { 47 | QFile file; 48 | 49 | if( index == SOURCE ) 50 | file.setFileName(":/resources/templates/sdSourceTPL.txt"); 51 | else 52 | file.setFileName(":/resources/templates/sdHeaderTPL.txt"); 53 | 54 | file.open(QFile::ReadOnly | QFile::Text); 55 | 56 | QTextStream in(&file); 57 | ui->preview->setPlainText(in.readAll()); 58 | } 59 | 60 | void SDNewFile::changeTemplateSelect(int index) 61 | { 62 | loadTemplate(index); 63 | changeFileName(ui->fileName->text()); 64 | } 65 | 66 | void SDNewFile::changeFileName(const QString &fileName) 67 | { 68 | QRegExp rx; 69 | 70 | if( ui->templateSelect->currentIndex() == SOURCE ) 71 | rx.setPattern("\\w+\\.cpp"); 72 | else 73 | rx.setPattern("\\w+\\.h"); 74 | 75 | 76 | QValidator *validator = new QRegExpValidator(rx, this); 77 | ui->path->setText(QDir::currentPath() + QDir::separator() + fileName); 78 | 79 | int pos = 0; 80 | if( validator->validate(const_cast(fileName), pos) == QValidator::Acceptable ){ 81 | QFileInfo fi(QDir::currentPath() + QDir::separator() + fileName); 82 | if( fi.exists() ){ 83 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 84 | ui->path->setText("The file exists in this project"); 85 | } else{ 86 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); 87 | } 88 | } 89 | else{ 90 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 91 | } 92 | } 93 | 94 | void SDNewFile::createFile() 95 | { 96 | QString fileName = ui->fileName->text(); 97 | 98 | if( ui->templateSelect->currentIndex() == SOURCE ) 99 | QFile::copy(":/resources/templates/sdSourceTPL.txt", fileName); 100 | else 101 | QFile::copy(":/resources/templates/sdHeaderTPL.txt", fileName); 102 | 103 | QFile code(fileName); 104 | code.setPermissions(QFile::WriteUser | QFile::ReadUser); 105 | } 106 | 107 | QString SDNewFile::getFileName() 108 | { 109 | return ui->fileName->text(); 110 | } 111 | -------------------------------------------------------------------------------- /src/sdcore/sdsignal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Signal. 3 | * 4 | * Copyright (c) 2017 Jorge I. Marin H. 5 | * Alexander López Parrado 6 | * Luis Miguel Capacho V. 7 | * 8 | * This file is part of SimDSP. 9 | * 10 | * SimDSP is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * SimDSP is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with SimDSP. If not, see . 22 | */ 23 | 24 | #ifndef SDSIGNAL_H 25 | #define SDSIGNAL_H 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #define NBITS 15 38 | #define MIDVALUE (1<<(NBITS-1)) 39 | #define MAXFILESIZE 1048576 40 | 41 | class SDSignal : public QObject 42 | { 43 | typedef struct{ 44 | short* pBuffer; 45 | int length; 46 | void (*callback)(); 47 | }sdBlock; 48 | 49 | Q_OBJECT 50 | Q_ENUMS(SignalTypes) 51 | 52 | public: 53 | 54 | enum SignalTypes{ 55 | SIGNAL_SIN, 56 | SIGNAL_SQUARE, 57 | SIGNAL_SAWTOOTH, 58 | SIGNAL_NOISE, 59 | SIGNAL_FILE, 60 | SIGNAL_MIC 61 | }; 62 | 63 | SDSignal(QVector *); 64 | ~SDSignal(); 65 | 66 | double getfs(); 67 | 68 | void setfs(double fsValue); 69 | void setSignalAmplitude(double amp); 70 | void setSignalType(int st); 71 | void setSignalFrequency(double freq); 72 | 73 | void changeSNR(int value); 74 | void changeAWGN(bool state); 75 | 76 | double getSignalFrequency(); 77 | 78 | double wgn(); 79 | double getSample(); 80 | short readADC(); 81 | void writeDAC(short value); 82 | void captureBlock( short* pBuffer, int length, void (*callback)() ); 83 | void playBlock( short* pBuffer, int length, void (*callback)() ); 84 | 85 | void enableMic(int length); 86 | 87 | void changeFileSize(int length); 88 | 89 | void start(); 90 | void stop(); 91 | 92 | 93 | void recordFinish(short* data); 94 | void playFinish(); 95 | 96 | void processBlocks(); 97 | 98 | private: 99 | 100 | void updateBuffer(sdBlock *block, QVector *values); 101 | void captureBlockFnc(sdBlock *block); 102 | void playBlockFnc(sdBlock *block); 103 | 104 | double fs; 105 | double signalFrequency; 106 | double signalAmplitude; 107 | double omegafq; 108 | int fileSize; 109 | double snr; 110 | bool bAWGN; 111 | std::default_random_engine generator; 112 | std::normal_distribution distribution; 113 | 114 | SignalTypes signalType; 115 | 116 | QVector *xs; 117 | QVector *ys; 118 | 119 | 120 | std::thread *timer; 121 | 122 | int n; 123 | 124 | int screenWidth; 125 | 126 | int currentBufferWidth; 127 | 128 | double fMax; 129 | 130 | bool bSyncronize; 131 | bool bSyncpulse; 132 | 133 | int iFileInIndex=0; 134 | int iFileOutIndex=0; 135 | 136 | bool bReadADC; 137 | bool bProcessBlocks; 138 | bool bMicRecording; 139 | bool bMicEnabled; 140 | 141 | bool isPlayCallBack; 142 | bool isRecordCallBack; 143 | 144 | SDAudio *soundCard; 145 | 146 | sdBlock* block_capture = nullptr; 147 | sdBlock* block_play = nullptr; 148 | 149 | QVector *sharedMemoryArray; 150 | }; 151 | 152 | #endif // QSDSIGNAL_H 153 | -------------------------------------------------------------------------------- /src/gui/actions/sdbuilder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP build support. 3 | * 4 | * Copyright (c) 2017 lmcapacho 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdbuilder.h" 23 | 24 | SDBuilder::SDBuilder() 25 | { 26 | process = new QProcess(this); 27 | 28 | connect(process, &QProcess::readyReadStandardError, this, &SDBuilder::readStandardError); 29 | connect(process, &QProcess::readyReadStandardOutput, this, &SDBuilder::readStandardOutput); 30 | } 31 | 32 | bool SDBuilder::build() 33 | { 34 | QDir build(QDir::currentPath()+"/build"); 35 | QDir currentPath(QDir::currentPath()); 36 | QString mkName = currentPath.dirName()+".mk"; 37 | 38 | if( !build.exists() ) 39 | create(); 40 | else{ 41 | QFile makefile(mkName); 42 | if( !makefile.exists() ) 43 | createMakefile(); 44 | } 45 | 46 | QFile::copy(":/resources/templates/simdsp.cpp", QDir::currentPath()+"/simdsp.cpp"); 47 | QFile::setPermissions(QDir::currentPath()+"/simdsp.cpp", QFile::WriteUser | QFile::ReadUser); 48 | 49 | #ifdef Q_OS_LINUX 50 | QFile::remove(QDir::currentPath()+"/build/sdapp"); 51 | process->start("make", QStringList() << "-f" << mkName); 52 | #elif defined(Q_OS_WIN32) 53 | QFile::remove(QDir::currentPath()+"/build/sdapp.exe"); 54 | process->start("mingw32-make", QStringList() << "-f" << mkName); 55 | #endif 56 | 57 | process->waitForStarted(); 58 | if(!process->waitForFinished()) 59 | return false; 60 | 61 | QFile::remove(QDir::currentPath()+"/simdsp.cpp"); 62 | 63 | #ifdef Q_OS_LINUX 64 | QFileInfo output(QDir::currentPath()+"/build/sdapp"); 65 | #elif defined(Q_OS_WIN32) 66 | QFileInfo output(QDir::currentPath()+"/build/sdapp.exe"); 67 | #endif 68 | 69 | return output.exists(); 70 | } 71 | 72 | void SDBuilder::clean() 73 | { 74 | QDir build(QDir::currentPath()+"/build"); 75 | QDir currentPath(QDir::currentPath()); 76 | QString mkName = currentPath.dirName()+".mk"; 77 | 78 | if( ! build.exists() ) 79 | return; 80 | else{ 81 | QFile makefile(mkName); 82 | 83 | if( !makefile.exists() ) 84 | createMakefile(); 85 | } 86 | 87 | #ifdef Q_OS_LINUX 88 | process->start("make", QStringList() << "-f" << mkName << "clean"); 89 | #elif defined(Q_OS_WIN32) 90 | process->start("mingw32-make", QStringList() << "-f" << mkName << "clean"); 91 | #endif 92 | process->waitForStarted(); 93 | process->waitForFinished(); 94 | } 95 | 96 | void SDBuilder::create() 97 | { 98 | QDir build(QDir::currentPath()); 99 | build.mkpath("build"); 100 | 101 | createMakefile(); 102 | } 103 | 104 | void SDBuilder::createMakefile() 105 | { 106 | QDir currentPath(QDir::currentPath()); 107 | QString mkName = currentPath.dirName()+".mk"; 108 | 109 | QFile::copy(":/resources/templates/Makefile_simdsp", mkName); 110 | QFile makefile(mkName); 111 | makefile.setPermissions(QFile::WriteUser | QFile::ReadUser); 112 | } 113 | 114 | void SDBuilder::readStandardError() 115 | { 116 | process->setReadChannel(QProcess::StandardError); 117 | 118 | if(process->canReadLine()){ 119 | QByteArray stdError = process->readAll(); 120 | emit builderOutput(stdError); 121 | } 122 | } 123 | 124 | void SDBuilder::readStandardOutput() 125 | { 126 | process->setReadChannel(QProcess::StandardOutput); 127 | 128 | if(process->canReadLine()){ 129 | QByteArray stdOutput = process->readAll(); 130 | emit builderOutput(stdOutput); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/gui/actions/sdnewfile.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDNewFile 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 400 13 | 300 14 | 15 | 16 | 17 | New File 18 | 19 | 20 | 21 | 9 22 | 23 | 24 | 9 25 | 26 | 27 | 9 28 | 29 | 30 | 9 31 | 32 | 33 | 34 | 35 | 36 | 37 | Choose a template: 38 | 39 | 40 | 41 | 42 | 43 | 44 | Name: 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | C++ Source File 53 | 54 | 55 | 56 | 57 | C++ Header File 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Preview: 69 | 70 | 71 | 72 | 73 | 74 | 75 | true 76 | 77 | 78 | true 79 | 80 | 81 | 82 | 83 | 84 | 85 | Qt::LeftToRight 86 | 87 | 88 | 89 | 90 | 91 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | Qt::Horizontal 101 | 102 | 103 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | buttonBox 113 | accepted() 114 | SDNewFile 115 | accept() 116 | 117 | 118 | 248 119 | 254 120 | 121 | 122 | 157 123 | 274 124 | 125 | 126 | 127 | 128 | buttonBox 129 | rejected() 130 | SDNewFile 131 | reject() 132 | 133 | 134 | 316 135 | 260 136 | 137 | 138 | 286 139 | 274 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /dependencies/rtaudio/include/asiodrivers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "asiodrivers.h" 3 | 4 | AsioDrivers* asioDrivers = 0; 5 | 6 | bool loadAsioDriver(char *name); 7 | 8 | bool loadAsioDriver(char *name) 9 | { 10 | if(!asioDrivers) 11 | asioDrivers = new AsioDrivers(); 12 | if(asioDrivers) 13 | return asioDrivers->loadDriver(name); 14 | return false; 15 | } 16 | 17 | //------------------------------------------------------------------------------------ 18 | 19 | #if MAC 20 | 21 | bool resolveASIO(unsigned long aconnID); 22 | 23 | AsioDrivers::AsioDrivers() : CodeFragments("ASIO Drivers", 'AsDr', 'Asio') 24 | { 25 | connID = -1; 26 | curIndex = -1; 27 | } 28 | 29 | AsioDrivers::~AsioDrivers() 30 | { 31 | removeCurrentDriver(); 32 | } 33 | 34 | bool AsioDrivers::getCurrentDriverName(char *name) 35 | { 36 | if(curIndex >= 0) 37 | return getName(curIndex, name); 38 | return false; 39 | } 40 | 41 | long AsioDrivers::getDriverNames(char **names, long maxDrivers) 42 | { 43 | for(long i = 0; i < getNumFragments() && i < maxDrivers; i++) 44 | getName(i, names[i]); 45 | return getNumFragments() < maxDrivers ? getNumFragments() : maxDrivers; 46 | } 47 | 48 | bool AsioDrivers::loadDriver(char *name) 49 | { 50 | char dname[64]; 51 | unsigned long newID; 52 | 53 | for(long i = 0; i < getNumFragments(); i++) 54 | { 55 | if(getName(i, dname) && !strcmp(name, dname)) 56 | { 57 | if(newInstance(i, &newID)) 58 | { 59 | if(resolveASIO(newID)) 60 | { 61 | if(connID != -1) 62 | removeInstance(curIndex, connID); 63 | curIndex = i; 64 | connID = newID; 65 | return true; 66 | } 67 | } 68 | break; 69 | } 70 | } 71 | return false; 72 | } 73 | 74 | void AsioDrivers::removeCurrentDriver() 75 | { 76 | if(connID != -1) 77 | removeInstance(curIndex, connID); 78 | connID = -1; 79 | curIndex = -1; 80 | } 81 | 82 | //------------------------------------------------------------------------------------ 83 | 84 | #elif WINDOWS 85 | 86 | #include "iasiodrv.h" 87 | 88 | extern IASIO* theAsioDriver; 89 | 90 | AsioDrivers::AsioDrivers() : AsioDriverList() 91 | { 92 | curIndex = -1; 93 | } 94 | 95 | AsioDrivers::~AsioDrivers() 96 | { 97 | } 98 | 99 | bool AsioDrivers::getCurrentDriverName(char *name) 100 | { 101 | if(curIndex >= 0) 102 | return asioGetDriverName(curIndex, name, 32) == 0 ? true : false; 103 | name[0] = 0; 104 | return false; 105 | } 106 | 107 | long AsioDrivers::getDriverNames(char **names, long maxDrivers) 108 | { 109 | for(long i = 0; i < asioGetNumDev() && i < maxDrivers; i++) 110 | asioGetDriverName(i, names[i], 32); 111 | return asioGetNumDev() < maxDrivers ? asioGetNumDev() : maxDrivers; 112 | } 113 | 114 | bool AsioDrivers::loadDriver(char *name) 115 | { 116 | char dname[64]; 117 | char curName[64]; 118 | 119 | for(long i = 0; i < asioGetNumDev(); i++) 120 | { 121 | if(!asioGetDriverName(i, dname, 32) && !strcmp(name, dname)) 122 | { 123 | curName[0] = 0; 124 | getCurrentDriverName(curName); // in case we fail... 125 | removeCurrentDriver(); 126 | 127 | if(!asioOpenDriver(i, (void **)&theAsioDriver)) 128 | { 129 | curIndex = i; 130 | return true; 131 | } 132 | else 133 | { 134 | theAsioDriver = 0; 135 | if(curName[0] && strcmp(dname, curName)) 136 | loadDriver(curName); // try restore 137 | } 138 | break; 139 | } 140 | } 141 | return false; 142 | } 143 | 144 | void AsioDrivers::removeCurrentDriver() 145 | { 146 | if(curIndex != -1) 147 | asioCloseDriver(curIndex); 148 | curIndex = -1; 149 | } 150 | 151 | #elif SGI || BEOS 152 | 153 | #include "asiolist.h" 154 | 155 | AsioDrivers::AsioDrivers() 156 | : AsioDriverList() 157 | { 158 | curIndex = -1; 159 | } 160 | 161 | AsioDrivers::~AsioDrivers() 162 | { 163 | } 164 | 165 | bool AsioDrivers::getCurrentDriverName(char *name) 166 | { 167 | return false; 168 | } 169 | 170 | long AsioDrivers::getDriverNames(char **names, long maxDrivers) 171 | { 172 | return 0; 173 | } 174 | 175 | bool AsioDrivers::loadDriver(char *name) 176 | { 177 | return false; 178 | } 179 | 180 | void AsioDrivers::removeCurrentDriver() 181 | { 182 | } 183 | 184 | #else 185 | #error implement me 186 | #endif 187 | -------------------------------------------------------------------------------- /src/gui/view/sdmat.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDMat 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 418 13 | 146 14 | 15 | 16 | 17 | Load Mat File 18 | 19 | 20 | 21 | 22 | 23 | Qt::Horizontal 24 | 25 | 26 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 27 | 28 | 29 | 30 | 31 | 32 | 33 | 0 34 | 35 | 36 | 37 | 38 | 39 | 40 | Mat File: 41 | 42 | 43 | 44 | 45 | 46 | 47 | true 48 | 49 | 50 | 51 | 52 | 53 | 54 | Browse... 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Variable: 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 0 78 | 79 | 80 | 81 | 82 | 83 | 50 84 | false 85 | 86 | 87 | 88 | Type: 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | Qt::Horizontal 103 | 104 | 105 | 106 | 40 107 | 20 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | buttonBox 132 | rejected() 133 | SDMat 134 | reject() 135 | 136 | 137 | 316 138 | 260 139 | 140 | 141 | 286 142 | 274 143 | 144 | 145 | 146 | 147 | buttonBox 148 | accepted() 149 | SDMat 150 | accept() 151 | 152 | 153 | 248 154 | 254 155 | 156 | 157 | 157 158 | 274 159 | 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /src/gui/project/sdnewproject.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDNewProject 4 | 5 | 6 | Qt::NonModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 400 13 | 187 14 | 15 | 16 | 17 | New SimDSP Project 18 | 19 | 20 | 21 | 22 | 23 | Qt::Horizontal 24 | 25 | 26 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 10 36 | 37 | 38 | 10 39 | 40 | 41 | 10 42 | 43 | 44 | 45 | 46 | Name: 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 10 59 | 60 | 61 | 10 62 | 63 | 64 | 10 65 | 66 | 67 | 68 | 69 | Path: 70 | 71 | 72 | 73 | 74 | 75 | 76 | true 77 | 78 | 79 | true 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 0 88 | 0 89 | 90 | 91 | 92 | Browse... 93 | 94 | 95 | 96 | 16 97 | 16 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 10 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | buttonBox 129 | accepted() 130 | SDNewProject 131 | accept() 132 | 133 | 134 | 248 135 | 254 136 | 137 | 138 | 157 139 | 274 140 | 141 | 142 | 143 | 144 | buttonBox 145 | rejected() 146 | SDNewProject 147 | reject() 148 | 149 | 150 | 316 151 | 260 152 | 153 | 154 | 286 155 | 274 156 | 157 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /src/sdcore/sdaudio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SimDSP Audio. 3 | * 4 | * Copyright (c) 2018 parrado 5 | * 6 | * This file is part of SimDSP. 7 | * 8 | * SimDSP is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * SimDSP is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with SimDSP. If not, see . 20 | */ 21 | 22 | #include "sdaudio.h" 23 | #include "sdcore.h" 24 | 25 | SDAudio::SDAudio(QObject *parent) : 26 | QObject(parent) 27 | { 28 | adc = new RtAudio(); 29 | dac = new RtAudio(); 30 | mutex_adc=new QMutex(); 31 | mutex_dac=new QMutex(); 32 | 33 | mySD=(SDSignal*)parent; 34 | } 35 | 36 | SDAudio::~SDAudio() 37 | { 38 | adc->stopStream(); 39 | dac->stopStream(); 40 | adc->closeStream(); 41 | dac->closeStream(); 42 | 43 | delete buffer_adc; 44 | delete buffer_dac; 45 | delete mutex_adc; 46 | delete mutex_dac; 47 | } 48 | 49 | //Callback de captura de la tarjeta de sonido 50 | int in( void * /*outputBuffer*/, void *inputBuffer, unsigned int nBufferFrames, 51 | double /*streamTime*/, RtAudioStreamStatus /*status*/, void * data ) 52 | { 53 | SDAudio *sda; 54 | 55 | sda=(SDAudio*)data; 56 | 57 | QMutex *mtx_adc=sda->mutex_adc; 58 | 59 | QByteArray *bufferin=sda->buffer_adc; 60 | 61 | //Se copian los datos al buffer de captura de SimDSP (exclusión mútua) 62 | mtx_adc->lock(); 63 | memcpy(bufferin->data(),inputBuffer,nBufferFrames*sizeof(short)); 64 | mtx_adc->unlock(); 65 | 66 | //Se emite la señal de final de captura a la GUI 67 | sda->recordFinish((short*)bufferin->data()) ; 68 | 69 | return 0; 70 | } 71 | 72 | //Callback de reproducción de la tarjeta de sonido 73 | int out( void *outputBuffer, void * /*inputBuffer*/, unsigned int nBufferFrames, 74 | double /*streamTime*/, RtAudioStreamStatus /*status*/, void * data ) 75 | { 76 | SDAudio *sda; 77 | 78 | sda=(SDAudio*)data; 79 | 80 | QMutex *mtx_dac=sda->mutex_dac; 81 | 82 | QByteArray *bufferout=sda->buffer_dac; 83 | short *outaux=(short *)outputBuffer; 84 | short *bufferoutaux=(short *)bufferout->constData(); 85 | 86 | //Se copian los datos mezclados a los canales estereo usando exclusión mútua. 87 | mtx_dac->lock(); 88 | for(unsigned int i=0;iunlock(); 93 | 94 | //Emite señal de final de reproducción a la GUI 95 | sda->playFinish(); 96 | 97 | return 0; 98 | } 99 | 100 | //Inicializa tarjeta de sonido con rtaudio 101 | int SDAudio::initSoundCard(int bSize, double fs) 102 | { 103 | 104 | bufferSize = bSize*sizeof(short); 105 | buffer_adc = new QByteArray(bufferSize, 0); 106 | buffer_dac = new QByteArray(bufferSize, 0); 107 | 108 | unsigned int fsl = fs; 109 | 110 | unsigned int bufferFrames = bSize; 111 | RtAudio::StreamParameters iParams, oParams; 112 | iParams.deviceId = 0; 113 | iParams.nChannels = 1; 114 | iParams.firstChannel = 0; 115 | 116 | oParams.deviceId = 0; 117 | oParams.nChannels = 2; 118 | oParams.firstChannel = 0; 119 | 120 | iParams.deviceId = adc->getDefaultInputDevice(); 121 | oParams.deviceId = dac->getDefaultOutputDevice(); 122 | 123 | RtAudio::StreamOptions options; 124 | 125 | if(adc->isStreamOpen()){ 126 | if(adc->isStreamRunning()) 127 | adc->stopStream(); 128 | adc->closeStream(); 129 | } 130 | if(dac->isStreamOpen()){ 131 | if(dac->isStreamRunning()) 132 | dac->stopStream(); 133 | dac->closeStream(); 134 | } 135 | 136 | try{ 137 | adc->openStream( NULL, &iParams, RTAUDIO_SINT16, fsl, &bufferFrames, &in, (void *)this, &options ); 138 | dac->openStream( &oParams, NULL, RTAUDIO_SINT16, fsl, &bufferFrames, &out, (void *)this, &options ); 139 | }catch(...){ 140 | return -1; 141 | } 142 | 143 | return 0; 144 | } 145 | 146 | void SDAudio::record() 147 | { 148 | if(adc->isStreamRunning()==false) 149 | adc->startStream(); 150 | } 151 | 152 | void SDAudio::play(short *outBuffer) 153 | { 154 | if(dac->isStreamRunning()==false) 155 | dac->startStream(); 156 | 157 | mutex_dac->lock(); 158 | memcpy(buffer_dac->data(),outBuffer,bufferSize); 159 | mutex_dac->unlock(); 160 | } 161 | 162 | void SDAudio::recordFinish(short *data) 163 | { 164 | mySD->recordFinish(data); 165 | } 166 | 167 | void SDAudio::playFinish() 168 | { 169 | mySD->playFinish(); 170 | } 171 | -------------------------------------------------------------------------------- /src/examples/FFT/fastconv/fastconv.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ============================================================================================= 6 | // Convolución rápida empleando el método de solapamiento y suma. 7 | // 8 | // Para activar la captura por micrófono debe activar el micrófono descomentanto la línea 155. 9 | // ============================================================================================= 10 | 11 | 12 | #include 13 | #include 14 | 15 | #include "fft_f.h" 16 | #include "coefs.h" 17 | 18 | #define Nh 100 19 | #define Nx 157 20 | #define Nfft 256 21 | 22 | //Buffers de captura 23 | short buffer_1[Nx]; 24 | short buffer_2[Nx]; 25 | 26 | //Buffer de salida 27 | short BufferSalida[Nx]; 28 | 29 | //Punteros al doble buffer de DMA 30 | short *BufferCaptura; 31 | short *BufferProcesa; 32 | 33 | //Buffers para hacer el procesamiento interno de la convolución rápida 34 | float X_n[Nfft*2]; 35 | float X_k[Nfft*2]; 36 | float Y_n[Nfft*2]; 37 | float Y_k[Nfft*2]; 38 | float H_n[Nfft*2]; 39 | float H_k[Nfft*2]; 40 | float Yadd[Nfft]; 41 | 42 | 43 | //Función para hacer el bitreversal256 para un bloque de Nfft = 256 44 | void bitreversal256(float *x_n, float *x_k) { 45 | int cbr; 46 | for (int c = 0; c> 1) | 52 | ((c & 0x20) >> 3) | 53 | ((c & 0x40) >> 5) | 54 | ((c & 0x80) >> 7); 55 | x_k[cbr*2] = x_n[2*c]; //Parte real 56 | x_k[cbr*2+1]= x_n[2*c+1]; //Parte imaginaria 57 | } 58 | } 59 | 60 | //Rutina que simulará la ISR que se invoca una vez ha finalizado 61 | //la transferencia por DMA 62 | 63 | void dma_callbackfnc(){ 64 | int n,k; 65 | short *BufferT; 66 | 67 | //Intercambia los buffer de adquisición y de cálculo 68 | BufferT=BufferCaptura; 69 | BufferCaptura=BufferProcesa; 70 | BufferProcesa=BufferT; 71 | 72 | //Inicia una nueva captura por DMA para garantizar la ejecución en 73 | //tiempo real. Nótese que la dirección en la cual se inicia la captura es Nh-1, 74 | //con el fin de reservar las primeras posiciones para los elementos del bloque anterior 75 | captureBlock(BufferCaptura, Nx, dma_callbackfnc ); 76 | 77 | //Completa el bloque de entrada con ceros y fija la parte imaginaria a 0.0 78 | for(n=0;n 15 | #include 16 | 17 | #include "fft_f.h" 18 | #include "window.h" 19 | 20 | #define Nfft 1024 21 | #define Nx Nfft/2 22 | #define Nstep Nfft/4 23 | #define umbral 3e10 24 | 25 | //Buffers de captura 26 | short buffer_1[Nx]; 27 | short buffer_2[Nx]; 28 | 29 | //Buffer de salida 30 | short BufferSalida[Nstep]; 31 | 32 | //Punteros al doble buffer de DMA 33 | short *BufferCaptura; 34 | short *BufferProcesa; 35 | 36 | //Buffers para hacer el procesamiento interno de la convolución rápida 37 | float X_n[Nfft*2]; 38 | float X_k[Nfft*2]; 39 | float Y_n[Nfft*2]; 40 | float Y_k[Nfft*2]; 41 | float Yadd[Nfft]; 42 | 43 | //Función para hacer el bitreversal1024 para un bloque de Nfft = 256 44 | void bitreversal1024(float *x_n, float *x_k) { 45 | int cbr; 46 | for (int c = 0; c> 1) | 53 | ((c & 0x40) >> 3) | 54 | ((c & 0x80) >> 5) | 55 | ((c & 0x100) >> 7) | 56 | ((c & 0x200) >> 9); 57 | x_k[cbr*2] = x_n[2*c]; //Parte real 58 | x_k[cbr*2+1]= x_n[2*c+1]; //Parte imaginaria 59 | } 60 | } 61 | 62 | //Rutina que simulará la ISR que se invoca una vez ha finalizado 63 | //la transferencia por DMA 64 | 65 | void dma_callbackfnc(){ 66 | int n,k; 67 | short *BufferT; 68 | 69 | //Intercambia los buffer de adquisición y de cálculo 70 | BufferT=BufferCaptura; 71 | BufferCaptura=BufferProcesa; 72 | BufferProcesa=BufferT; 73 | 74 | //Inicia una nueva captura por DMA para garantizar la ejecución en 75 | //tiempo real. Nótese que la dirección en la cual se inicia la captura es Nh-1, 76 | //con el fin de reservar las primeras posiciones para los elementos del bloque anterior 77 | captureBlock(BufferCaptura+Nstep, Nstep, dma_callbackfnc ); 78 | 79 | //Completa el bloque de entrada con ceros, fija la parte imaginaria a 0.0, y enventana 80 | for(n=0;nmaxmag) maxmag = mag; 99 | if (mag > umbral) { 100 | Y_k[2*k] = X_k[2*k]; //Parte real 101 | Y_k[2*k+1] = X_k[2*k+1]; //Parte imaginaria 102 | } else { 103 | Y_k[2*k] = 0.0; //Parte real 104 | Y_k[2*k+1] = 0.0; //Parte imaginaria 105 | } 106 | } 107 | 108 | println("Max_mag %g", maxmag); 109 | 110 | //Calcula la IFFT 111 | bitreversal1024(Y_k,Y_n); 112 | ifft(Y_n,Y_n,Nfft); 113 | 114 | //Aplica la adición de bloques de salida según el método overlap-add (descarta la parte imaginaria de y, pues es cero. 115 | for(n=0;n header file. */ 49 | #if defined(_MSC_VER) && _MSC_VER >= 1600 50 | #define MATIO_HAVE_STDINT_H 1 51 | #else 52 | #undef MATIO_HAVE_STDINT_H 53 | #endif 54 | 55 | /* Define to 1 if you have the header file. */ 56 | #if defined(_MSC_VER) && _MSC_VER >= 1800 57 | #define MATIO_HAVE_INTTYPES_H 1 58 | #else 59 | #undef MATIO_HAVE_INTTYPES_H 60 | #endif 61 | 62 | #if MATIO_HAVE_STDINT_H 63 | /* int16 type */ 64 | #define _mat_int16_t int16_t 65 | 66 | /* int32 type */ 67 | #define _mat_int32_t int32_t 68 | 69 | /* int64 type */ 70 | #define _mat_int64_t int64_t 71 | 72 | /* int8 type */ 73 | #define _mat_int8_t int8_t 74 | 75 | /* uint16 type */ 76 | #define _mat_uint16_t uint16_t 77 | 78 | /* uint32 type */ 79 | #define _mat_uint32_t uint32_t 80 | 81 | /* uint64 type */ 82 | #define _mat_uint64_t uint64_t 83 | 84 | /* uint8 type */ 85 | #define _mat_uint8_t uint8_t 86 | #else 87 | /* int16 type */ 88 | #define _mat_int16_t short 89 | 90 | /* int32 type */ 91 | #define _mat_int32_t int 92 | 93 | /* int64 type */ 94 | #if defined(_MSC_VER) && _MSC_VER < 1300 95 | #define _mat_int64_t __int64 96 | #else 97 | #define _mat_int64_t long long 98 | #endif 99 | 100 | /* int8 type */ 101 | #define _mat_int8_t signed char 102 | 103 | /* uint16 type */ 104 | #define _mat_uint16_t unsigned short 105 | 106 | /* uint32 type */ 107 | #define _mat_uint32_t unsigned 108 | 109 | /* uint64 type */ 110 | #if defined(_MSC_VER) && _MSC_VER < 1300 111 | #define _mat_uint64_t unsigned __int64 112 | #else 113 | #define _mat_uint64_t unsigned long long 114 | #endif 115 | 116 | /* uint8 type */ 117 | #define _mat_uint8_t unsigned char 118 | #endif 119 | 120 | #if MATIO_HAVE_INTTYPES_H 121 | # include 122 | #endif 123 | 124 | #if MATIO_HAVE_STDINT_H 125 | # include 126 | #endif 127 | 128 | #ifdef _mat_int64_t 129 | typedef _mat_int64_t mat_int64_t; 130 | #endif 131 | #ifdef _mat_uint64_t 132 | typedef _mat_uint64_t mat_uint64_t; 133 | #endif 134 | #ifdef _mat_int32_t 135 | typedef _mat_int32_t mat_int32_t; 136 | #endif 137 | #ifdef _mat_uint32_t 138 | typedef _mat_uint32_t mat_uint32_t; 139 | #endif 140 | #ifdef _mat_int16_t 141 | typedef _mat_int16_t mat_int16_t; 142 | #endif 143 | #ifdef _mat_uint16_t 144 | typedef _mat_uint16_t mat_uint16_t; 145 | #endif 146 | #ifdef _mat_int8_t 147 | typedef _mat_int8_t mat_int8_t; 148 | #endif 149 | #ifdef _mat_uint8_t 150 | typedef _mat_uint8_t mat_uint8_t; 151 | #endif 152 | 153 | /* 154 | The following macros handle noreturn attributes according to the latest 155 | C11/C++11 standard with fallback to the MSVC extension if using an older 156 | compiler. 157 | */ 158 | #define MATIO_NORETURNATTR 159 | #if __STDC_VERSION__ >= 201112L 160 | #define MATIO_NORETURN _Noreturn 161 | #elif __cplusplus >= 201103L 162 | #define MATIO_NORETURN [[noreturn]] 163 | #elif defined(_MSC_VER) && _MSC_VER >= 1200 164 | #define MATIO_NORETURN __declspec(noreturn) 165 | #else 166 | #define MATIO_NORETURN 167 | #endif 168 | 169 | /* 170 | The following macros handle format attributes for type-checks against a 171 | format string. 172 | */ 173 | 174 | #define MATIO_FORMATATTR_PRINTF1 175 | #define MATIO_FORMATATTR_PRINTF2 176 | #define MATIO_FORMATATTR_VPRINTF 177 | 178 | #endif /* MATIO_PUBCONF_H */ 179 | -------------------------------------------------------------------------------- /src/examples/IIR/iir_sos/iir_sos.cpp: -------------------------------------------------------------------------------- 1 | // Fundamentos de Procesamiento Digital de Señales: Teoría e Implementación Práctica 2 | // Jorge Iván Marín-Hurtado, Alexander López-Parrado, Luis Miguel Capacho-Valbuena 3 | // ISBN: 978-958-48-2955-9 4 | // (c) 2017 5 | // ================================================================================== 6 | // Filtro IIR en estructura en cascada de secciones de segundo orden (SOS) 7 | // ================================================================================== 8 | 9 | #include "coefs_iir_bp_sos.h" 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | /*Implementa una sección de segundo orden usando estructura directa tipo I*/ 16 | double sos_d1(const double *bk,const double *ak,double *x,double *y,double xn){ 17 | double yn; 18 | 19 | /*Muestra actual*/ 20 | x[0]=xn; 21 | 22 | /*Parte no recursiva y actualización*/ 23 | yn=((double)bk[0])*((double)x[0])+((double)bk[1])*((double)x[1])+((double)bk[2])*((double)x[2]); 24 | x[2]=x[1]; 25 | x[1]=x[0]; 26 | 27 | 28 | /*Parte recursiva y actualización*/ 29 | yn=(yn-(((double)ak[1])*((double)y[0]))-(((double)ak[2])*((double)y[1]))); 30 | y[1]=y[0]; 31 | y[0]=yn; 32 | 33 | /**Retorna salida*/ 34 | return yn; 35 | 36 | 37 | } 38 | 39 | /*Implementa una sección de segundo orden usando estructura directa tipo II*/ 40 | double sos_d2(const double *bk,const double *ak,double *w,double xn){ 41 | 42 | double yn; 43 | 44 | /*Acumuladores*/ 45 | double w_n; 46 | 47 | /*Entrada a punto fijo*/ 48 | w_n=(((double)(xn))-(double)ak[1]*(double)w[1]-(double)ak[2]*(double)w[2]); 49 | 50 | 51 | 52 | w[0]=w_n; 53 | 54 | /*Cálculo de la rama de salida*/ 55 | 56 | yn =((double)bk[0]*(double)w[0]+(double)bk[1]*(double)w[1]+(double)bk[2]*(double)w[2]); 57 | w[2] = w[1]; 58 | w[1] = w[0]; 59 | 60 | 61 | /**Retorna salida*/ 62 | return yn; 63 | 64 | 65 | } 66 | 67 | 68 | /*Implementa una sección de segundo orden usando estructura directa tipo III*/ 69 | double sos_d3(const double *bk,const double *ak,double *v,double xn){ 70 | double yn; 71 | 72 | /*Calcula salida*/ 73 | yn=(((double)bk[0])*((double)xn)+(((double)v[0]))); 74 | 75 | /*Actualización de la memoria del filtro*/ 76 | v[0]=(((double)bk[1])*((double)xn)-(((double)ak[1])*((double)yn))+(((double)v[1]))); 77 | v[1]=(((double)bk[2])*((double)xn)-(((double)ak[2])*((double)yn))); 78 | 79 | /**Retorna salida*/ 80 | return yn; 81 | 82 | 83 | } 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | /*Implementa un filtro IIR usando secciones de segundo orden (Estructura tipo I)*/ 93 | double sos_filterd1(const double *sos, const double gk, int8_t nsect, double *w,double xn){ 94 | 95 | int8_t k; 96 | double yn=0; 97 | 98 | /*Se filtra a través de las secciones de segundo orden*/ 99 | for(k=0;k