Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of Signal_nucleo_f746 by
Diff: signal_processing.h
- Revision:
- 18:b9b1116f8768
- Parent:
- 16:d4ea3e6a0bce
- Child:
- 19:f5e785fe50b1
diff -r 728ffc633179 -r b9b1116f8768 signal_processing.h
--- a/signal_processing.h Tue Jan 31 14:19:16 2017 +0000
+++ b/signal_processing.h Wed Feb 01 15:00:31 2017 +0000
@@ -3,30 +3,32 @@
#include "amakusa.h"
-enum wave_style { triangle, square };
+#define SAMPLING_FREQUENCY 48000
- // User Signal processing Class
+enum wave_form { triangle, square };
+
+ // Variable Frequency Oscillator. Only square and triangle
class VFO {
public:
- // essential members. Do not touch
VFO( void );
+ virtual ~VFO(void);
void run(
- float out_buffer[], // place to write the right output samples
+ float out_buffer[], // place to write the right output samples
unsigned int block_size // block size [sample]
);
// parameter settings
- void set_frequency( int freq ); // unit is Hz.
- void set_Fs( int Fs ); // unit is Hz.
+ void set_frequency( int freq ); // unit is Hz.
+ void set_Fs( int Fs ); // unit is Hz.
void set_duty_cycle( float duty ); // 0 ... 0.5
- void set_wave_style( wave_style style );
+ void set_wave_form( wave_form form );
private:
// control variables.
int frequency; // VFO frequency [Hz]
int Fs; // sampling Frequency [Hz]
float duty_cycle; // VFO duty cycle. 0 ... 0.5
- wave_style style; // style of the wave form.
+ wave_form form; // form of the wave form.
int current_phase; // internal variable of VFO.
// internal variable.
@@ -37,6 +39,23 @@
void update_parameters(void); // call one of the parameter is changed.
};
+ // Monophonic synthsizer class
+class Monophonic {
+public:
+ Monophonic( unsigned int block_size );
+ virtual ~Monophonic(void);
+ void run(
+ float out_buffer[], // place to write the right output samples
+ unsigned int block_size // block size [sample]
+ );
+ void set_Fs( int Fs ); // unit is Hz.
+ void set_vfo_frequency( int freq ); // unit is Hz.
+ void set_vfo_duty_cycle( float duty ); // 0 ... 0.5
+ void set_vfo_wave_form( wave_form form );
+private:
+ VFO *vfo;
+};
+
// User Signal processing Class
class SignalProcessing {
@@ -56,7 +75,7 @@
void set_Fs( int Fs ); // unit is Hz.
void set_vfo_frequency( int freq ); // unit is Hz.
void set_vfo_duty_cycle( float duty ); // 0 ... 0.5
- void set_vfo_wave_style( wave_style style );
+ void set_vfo_wave_form( wave_form form );
private:
// essential members. Do not touch.
void enter_critical_section(void);
@@ -64,7 +83,7 @@
// project dependent members.
float volume_level; // 0 ... 1.0
- VFO *vfo;
+ Monophonic * note;
};
#endif
