Synthesizer based on the Unzen / Nucleo F746ZG
Dependencies: amakusa mbed-dsp mbed shimabara ukifune unzen_nucleo_f746
Fork of skeleton_unzen_nucleo_f746 by
雲仙フレームワークのテストとして作っているプロジェクトです。中身はどんどん変っていきます。 説明はDSP空挺団の「シンセサイザー」カテゴリーを参照してください。初回は「ドッグフードを食べる」です。
Diff: monophonic.cpp
- Revision:
- 27:fcb1f1da2ad7
- Parent:
- 26:e99f71165e19
- Child:
- 28:547f19ed6f67
diff -r e99f71165e19 -r fcb1f1da2ad7 monophonic.cpp --- a/monophonic.cpp Fri Feb 10 21:31:17 2017 +0000 +++ b/monophonic.cpp Sat Feb 11 07:15:21 2017 +0000 @@ -2,18 +2,19 @@ // constructor. -Monophonic::Monophonic( unsigned int block_size ) +Monophonic::Monophonic( unsigned int a_block_size ) { + this->block_size = a_block_size; + // initializing the subm-odules. this->vfo = new VFO(block_size); // allocate VFO - this->dc_blocker = new DCBlocker( block_size ); - this->sv_filter = new SVFilter( block_size ); -// this->eg = new EG( block_size ); + this->dc_blocker = new DCBlocker( this->block_size ); + this->sv_filter = new SVFilter( this->block_size ); + this->eg = new EG( this->block_size ); work_buf_a = new float32_t[block_size]; work_buf_b = new float32_t[block_size]; - this->block_size = block_size; } // End of constructor() Monophonic::~Monophonic( void ) @@ -22,7 +23,7 @@ delete this->vfo; delete this->dc_blocker; delete this->sv_filter; -// delete this->eg; + delete this->eg; delete[] work_buf_a; delete[] work_buf_b; @@ -45,11 +46,11 @@ this->sv_filter->run( work_buf_b, out_buffer ); // generate envelope -// this->eg->run( work_buf_a ); + this->eg->run( work_buf_a ); // apply envelope -// for ( int i= 0; i< this->block_size; i++ ) -// out_buffer[ i ] *= work_buf_a[ i ]; + for ( int i= 0; i< this->block_size; i++ ) + out_buffer[ i ] *= work_buf_a[ i ]; } // End of run() @@ -101,31 +102,31 @@ // Turn note on void Monophonic::eg_on(void) { -// this->eg->on(); + this->eg->on(); } // Turn note off void Monophonic::eg_off(void) { -// this->eg->off(); + this->eg->off(); } void Monophonic::set_eg_attack( float32_t attack ) { -// this->eg->set_attack( attack ); + this->eg->set_attack( attack ); } void Monophonic::set_eg_decay( float32_t decay ) { -// this->eg->set_decay( decay ); + this->eg->set_decay( decay ); } void Monophonic::set_eg_sustain( float32_t sustain ) { -// this->eg->set_sustain( sustain ); + this->eg->set_sustain( sustain ); } void Monophonic::set_eg_release ( float32_t release ) { -// this->eg->set_release( release ); + this->eg->set_release( release ); }