diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c276d366..009792c15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,7 @@ SET(LMMS_DATA_DIR ${DATA_DIR}/lmms) CHECK_INCLUDE_FILES(stdint.h LMMS_HAVE_STDINT_H) +CHECK_INCLUDE_FILES(stdlib.h LMMS_HAVE_STDLIB_H) CHECK_INCLUDE_FILES(pthread.h LMMS_HAVE_PTHREAD_H) CHECK_INCLUDE_FILES(unistd.h LMMS_HAVE_UNISTD_H) CHECK_INCLUDE_FILES(sys/types.h LMMS_HAVE_SYS_TYPES_H) diff --git a/ChangeLog b/ChangeLog index 1fe7ded24..7127b5380 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-07-25 Tobias Doerffel + + * plugins/organic/organic.cpp: + * plugins/triple_oscillator/triple_oscillator.cpp: + * include/mixer.h: + * include/sample_buffer.h: + * include/oscillator.h: + * include/types.h: + * src/core/sample_play_handle.cpp: + * src/core/sample_buffer.cpp: + * src/core/oscillator.cpp: + * lmmsconfig.h.in: + * CMakeLists.txt: + less header-dependencies and moved some type-definitions + 2008-07-23 Tobias Doerffel * data/locale/fr.qm: diff --git a/include/mixer.h b/include/mixer.h index 0838247de..c82ab8a3e 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -57,21 +57,6 @@ class audioPort; const fpp_t DEFAULT_BUFFER_SIZE = 256; -const ch_cnt_t DEFAULT_CHANNELS = 2; - -const ch_cnt_t SURROUND_CHANNELS = -#ifndef LMMS_DISABLE_SURROUND - 4; -#else - 2; -#endif - - - -typedef sample_t sampleFrame[DEFAULT_CHANNELS]; -typedef sample_t surroundSampleFrame[SURROUND_CHANNELS]; - - const Uint8 BYTES_PER_SAMPLE = sizeof( sample_t ); const Uint8 BYTES_PER_INT_SAMPLE = sizeof( int_sample_t ); const Uint8 BYTES_PER_FRAME = sizeof( sampleFrame ); diff --git a/include/oscillator.h b/include/oscillator.h index 765d447b5..54f657384 100644 --- a/include/oscillator.h +++ b/include/oscillator.h @@ -28,15 +28,18 @@ #include "lmmsconfig.h" +#include + #ifdef LMMS_HAVE_STDLIB_H #include #endif -#include "mixer.h" #include "sample_buffer.h" #include "lmms_constants.h" -#include "lmms_math.h" -#include "automatable_model.h" + + +class sampleBuffer; +class intModel; class EXPORT oscillator @@ -66,8 +69,8 @@ public: } ; - oscillator( const intModel & _wave_shape_model, - const intModel & _mod_algo_model, + oscillator( const intModel * _wave_shape_model, + const intModel * _mod_algo_model, const float & _freq, const float & _detuning, const float & _phase_offset, @@ -154,8 +157,8 @@ public: private: - const intModel & m_waveShapeModel; - const intModel & m_modulationAlgoModel; + const intModel * m_waveShapeModel; + const intModel * m_modulationAlgoModel; const float & m_freq; const float & m_detuning; const float & m_volume; diff --git a/include/sample_buffer.h b/include/sample_buffer.h index 365bcac20..a59ff5fc8 100644 --- a/include/sample_buffer.h +++ b/include/sample_buffer.h @@ -29,7 +29,9 @@ #include #include -#include "mixer.h" +#include + +#include "export.h" #include "interpolation.h" #include "types.h" #include "lmms_math.h" @@ -72,7 +74,7 @@ public: bool play( sampleFrame * _ab, handleState * _state, const fpp_t _frames, - const float _freq = BaseFreq, + const float _freq, const bool _looped = FALSE ) const; void visualize( QPainter & _p, const QRect & _dr, const QRect & _clip ); diff --git a/include/types.h b/include/types.h index ef816e8b8..c0f3e6d73 100644 --- a/include/types.h +++ b/include/types.h @@ -27,6 +27,7 @@ #define _TYPES_H #include +#include "lmmsconfig.h" typedef unsigned char Uint8; typedef signed char Sint8; @@ -74,4 +75,19 @@ struct valueRanges } ; +const ch_cnt_t DEFAULT_CHANNELS = 2; + +const ch_cnt_t SURROUND_CHANNELS = +#ifndef LMMS_DISABLE_SURROUND + 4; +#else + 2; +#endif + + + +typedef sample_t sampleFrame[DEFAULT_CHANNELS]; +typedef sample_t surroundSampleFrame[SURROUND_CHANNELS]; + + #endif diff --git a/lmmsconfig.h.in b/lmmsconfig.h.in index 676d7c84b..dff06e747 100644 --- a/lmmsconfig.h.in +++ b/lmmsconfig.h.in @@ -11,6 +11,7 @@ #cmakedefine LMMS_HAVE_VST #cmakedefine LMMS_HAVE_STDINT_H +#cmakedefine LMMS_HAVE_STDLIB_H #cmakedefine LMMS_HAVE_PTHREAD_H #cmakedefine LMMS_HAVE_UNISTD_H #cmakedefine LMMS_HAVE_SYS_TYPES_H diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index 633a4ed0e..7474445b9 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -206,16 +206,16 @@ void organicInstrument::playNote( notePlayHandle * _n, bool, { // create left oscillator oscs_l[i] = new oscillator( - m_osc[i]->m_waveShape, - m_modulationAlgo, + &m_osc[i]->m_waveShape, + &m_modulationAlgo, _n->frequency(), m_osc[i]->m_detuningLeft, m_osc[i]->m_phaseOffsetLeft, m_osc[i]->m_volumeLeft ); // create right oscillator oscs_r[i] = new oscillator( - m_osc[i]->m_waveShape, - m_modulationAlgo, + &m_osc[i]->m_waveShape, + &m_modulationAlgo, _n->frequency(), m_osc[i]->m_detuningRight, m_osc[i]->m_phaseOffsetRight, @@ -225,8 +225,8 @@ void organicInstrument::playNote( notePlayHandle * _n, bool, { // create left oscillator oscs_l[i] = new oscillator( - m_osc[i]->m_waveShape, - m_modulationAlgo, + &m_osc[i]->m_waveShape, + &m_modulationAlgo, _n->frequency(), m_osc[i]->m_detuningLeft, m_osc[i]->m_phaseOffsetLeft, @@ -234,8 +234,8 @@ void organicInstrument::playNote( notePlayHandle * _n, bool, oscs_l[i + 1] ); // create right oscillator oscs_r[i] = new oscillator( - m_osc[i]->m_waveShape, - m_modulationAlgo, + &m_osc[i]->m_waveShape, + &m_modulationAlgo, _n->frequency(), m_osc[i]->m_detuningRight, m_osc[i]->m_phaseOffsetRight, diff --git a/plugins/triple_oscillator/triple_oscillator.cpp b/plugins/triple_oscillator/triple_oscillator.cpp index 6d1906054..71f231f8f 100644 --- a/plugins/triple_oscillator/triple_oscillator.cpp +++ b/plugins/triple_oscillator/triple_oscillator.cpp @@ -326,15 +326,15 @@ void tripleOscillator::playNote( notePlayHandle * _n, bool, if( i == NUM_OF_OSCILLATORS - 1 ) { oscs_l[i] = new oscillator( - m_osc[i]->m_waveShapeModel, - m_osc[i]->m_modulationAlgoModel, + &m_osc[i]->m_waveShapeModel, + &m_osc[i]->m_modulationAlgoModel, _n->frequency(), m_osc[i]->m_detuningLeft, m_osc[i]->m_phaseOffsetLeft, m_osc[i]->m_volumeLeft ); oscs_r[i] = new oscillator( - m_osc[i]->m_waveShapeModel, - m_osc[i]->m_modulationAlgoModel, + &m_osc[i]->m_waveShapeModel, + &m_osc[i]->m_modulationAlgoModel, _n->frequency(), m_osc[i]->m_detuningRight, m_osc[i]->m_phaseOffsetRight, @@ -343,16 +343,16 @@ void tripleOscillator::playNote( notePlayHandle * _n, bool, else { oscs_l[i] = new oscillator( - m_osc[i]->m_waveShapeModel, - m_osc[i]->m_modulationAlgoModel, + &m_osc[i]->m_waveShapeModel, + &m_osc[i]->m_modulationAlgoModel, _n->frequency(), m_osc[i]->m_detuningLeft, m_osc[i]->m_phaseOffsetLeft, m_osc[i]->m_volumeLeft, oscs_l[i + 1] ); oscs_r[i] = new oscillator( - m_osc[i]->m_waveShapeModel, - m_osc[i]->m_modulationAlgoModel, + &m_osc[i]->m_waveShapeModel, + &m_osc[i]->m_modulationAlgoModel, _n->frequency(), m_osc[i]->m_detuningRight, m_osc[i]->m_phaseOffsetRight, diff --git a/src/core/oscillator.cpp b/src/core/oscillator.cpp index 30bdbfd55..779a40991 100644 --- a/src/core/oscillator.cpp +++ b/src/core/oscillator.cpp @@ -26,11 +26,14 @@ #include "oscillator.h" +#include "engine.h" +#include "mixer.h" +#include "automatable_model.h" -oscillator::oscillator( const intModel & _wave_shape_model, - const intModel & _mod_algo_model, +oscillator::oscillator( const intModel * _wave_shape_model, + const intModel * _mod_algo_model, const float & _freq, const float & _detuning, const float & _phase_offset, @@ -62,7 +65,7 @@ void oscillator::update( sampleFrame * _ab, const fpp_t _frames, } if( m_subOsc != NULL ) { - switch( m_modulationAlgoModel.value() ) + switch( m_modulationAlgoModel->value() ) { case PhaseModulation: updatePM( _ab, _frames, _chnl ); @@ -92,7 +95,7 @@ void oscillator::update( sampleFrame * _ab, const fpp_t _frames, void oscillator::updateNoSub( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { - switch( m_waveShapeModel.value() ) + switch( m_waveShapeModel->value() ) { case SineWave: default: @@ -128,7 +131,7 @@ void oscillator::updateNoSub( sampleFrame * _ab, const fpp_t _frames, void oscillator::updatePM( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { - switch( m_waveShapeModel.value() ) + switch( m_waveShapeModel->value() ) { case SineWave: default: @@ -164,7 +167,7 @@ void oscillator::updatePM( sampleFrame * _ab, const fpp_t _frames, void oscillator::updateAM( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { - switch( m_waveShapeModel.value() ) + switch( m_waveShapeModel->value() ) { case SineWave: default: @@ -200,7 +203,7 @@ void oscillator::updateAM( sampleFrame * _ab, const fpp_t _frames, void oscillator::updateMix( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { - switch( m_waveShapeModel.value() ) + switch( m_waveShapeModel->value() ) { case SineWave: default: @@ -236,7 +239,7 @@ void oscillator::updateMix( sampleFrame * _ab, const fpp_t _frames, void oscillator::updateSync( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { - switch( m_waveShapeModel.value() ) + switch( m_waveShapeModel->value() ) { case SineWave: default: @@ -272,7 +275,7 @@ void oscillator::updateSync( sampleFrame * _ab, const fpp_t _frames, void oscillator::updateFM( sampleFrame * _ab, const fpp_t _frames, const ch_cnt_t _chnl ) { - switch( m_waveShapeModel.value() ) + switch( m_waveShapeModel->value() ) { case SineWave: default: diff --git a/src/core/sample_buffer.cpp b/src/core/sample_buffer.cpp index b6e113262..4b71ac359 100644 --- a/src/core/sample_buffer.cpp +++ b/src/core/sample_buffer.cpp @@ -26,6 +26,7 @@ #include "sample_buffer.h" +#include "mixer.h" #include diff --git a/src/core/sample_play_handle.cpp b/src/core/sample_play_handle.cpp index 4095b27e0..c55631fbb 100644 --- a/src/core/sample_play_handle.cpp +++ b/src/core/sample_play_handle.cpp @@ -132,7 +132,8 @@ void samplePlayHandle::play( bool /* _try_parallelizing */, stereoVolumeVector v = { { m_volumeModel->value() / DefaultVolume, m_volumeModel->value() / DefaultVolume } }; - m_sampleBuffer->play( _working_buffer, &m_state, frames ); + m_sampleBuffer->play( _working_buffer, &m_state, frames, + BaseFreq ); engine::getMixer()->bufferToPort( _working_buffer, frames, offset(), v, m_audioPort ); }