├── .clang-format ├── .github └── workflows │ └── c-cpp.yml ├── .gitignore ├── .gitmodules ├── Build └── .gitignore ├── Doxyfile ├── FaustCode └── WaveReader.h ├── FaustSource ├── WaveReader.h ├── faustmath.h ├── owl.cpp ├── owl.h └── owl.lib ├── GenSource ├── GenPatch.hpp ├── genlib.cpp ├── genlib.h ├── genlib_common.h ├── genlib_common_win.h ├── genlib_exportfunctions.h └── genlib_ops.h ├── HISTORY.md ├── HeavySource ├── HvMessage.c └── HvUtils.h ├── LICENSE ├── LICENSE_VCV.md ├── LibSource ├── AbstractSynth.h ├── AdsrEnvelope.h ├── AgnesiOscillator.h ├── AudioBuffer.h ├── BiquadFilter.h ├── ChirpOscillator.h ├── CircularBuffer.h ├── ColourScreenPatch.cpp ├── ColourScreenPatch.h ├── ComplexFloatArray.cpp ├── ComplexFloatArray.h ├── ComplexFourierTransform.h ├── ComplexOscillator.h ├── ComplexShortArray.cpp ├── ComplexShortArray.h ├── ComplexTransform.h ├── Control.h ├── CrossFadingCircularBuffer.h ├── DcBlockingFilter.h ├── DelayProcessor.h ├── DryWetProcessor.h ├── Envelope.h ├── ExponentialDecayEnvelope.h ├── FastFourierTransform.cpp ├── FastFourierTransform.h ├── FastLogTable.h ├── FastPowTable.h ├── FeedbackProcessor.h ├── FirFilter.h ├── FloatArray.cpp ├── FloatArray.h ├── FloatMatrix.cpp ├── FloatMatrix.h ├── FractionalCircularBuffer.h ├── IntArray.h ├── InterpolatingCircularBuffer.h ├── Interpolator.h ├── MidiMessage.h ├── MidiPolyphonicExpressionProcessor.h ├── MidiProcessor.h ├── MidiStatus.h ├── MonochromeScreenPatch.cpp ├── MonochromeScreenPatch.h ├── MonophonicProcessor.h ├── MorphingOscillator.h ├── NoiseGenerator.h ├── NoiseOscillator.h ├── OpenWareLibrary.h ├── OpenWareMidiControl.h ├── Oscillator.h ├── Patch.h ├── PatchParameter.cpp ├── PatchParameter.h ├── PitchDetector.h ├── PolyBlepOscillator.cpp ├── PolyBlepOscillator.h ├── PolyphonicProcessor.h ├── QuadratureSineOscillator.h ├── RampOscillator.h ├── Resample.h ├── Resource.cpp ├── Resource.h ├── SampleOscillator.h ├── ScreenBuffer.h ├── ShortArray.cpp ├── ShortArray.h ├── ShortFastFourierTransform.cpp ├── ShortFastFourierTransform.h ├── SignalGenerator.h ├── SignalProcessor.h ├── SimpleArray.h ├── SineOscillator.h ├── SmoothValue.cpp ├── SmoothValue.h ├── SmoothingFilter.h ├── SquareOscillator.h ├── SquareWaveOscillator.h ├── StateVariableFilter.h ├── StompBox.h ├── Synth.h ├── TapTempo.h ├── TemplatePatch.hpp ├── TriangleOscillator.h ├── VariableShapeOscillator.h ├── VelocityCurve.h ├── VoiceAllocator.h ├── VoltsPerOctave.cpp ├── VoltsPerOctave.h ├── VosimOscillator.h ├── WavFile.h ├── WavetableOscillator.cpp ├── WavetableOscillator.h ├── Window.cpp ├── Window.h ├── basicmaths.c ├── basicmaths.h ├── custom_dsp.h ├── fastlog.c ├── fastlog.h ├── fastpow.c ├── fastpow.h ├── message.h └── qint.h ├── Libraries ├── CMSIS │ ├── DSP │ │ ├── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_const_structs.h │ │ │ └── arm_math.h │ │ └── Source │ │ │ ├── BasicMathFunctions │ │ │ ├── BasicMathFunctions.c │ │ │ ├── arm_abs_f32.c │ │ │ ├── arm_abs_q15.c │ │ │ ├── arm_abs_q31.c │ │ │ ├── arm_abs_q7.c │ │ │ ├── arm_add_f32.c │ │ │ ├── arm_add_q15.c │ │ │ ├── arm_add_q31.c │ │ │ ├── arm_add_q7.c │ │ │ ├── arm_dot_prod_f32.c │ │ │ ├── arm_dot_prod_q15.c │ │ │ ├── arm_dot_prod_q31.c │ │ │ ├── arm_dot_prod_q7.c │ │ │ ├── arm_mult_f32.c │ │ │ ├── arm_mult_q15.c │ │ │ ├── arm_mult_q31.c │ │ │ ├── arm_mult_q7.c │ │ │ ├── arm_negate_f32.c │ │ │ ├── arm_negate_q15.c │ │ │ ├── arm_negate_q31.c │ │ │ ├── arm_negate_q7.c │ │ │ ├── arm_offset_f32.c │ │ │ ├── arm_offset_q15.c │ │ │ ├── arm_offset_q31.c │ │ │ ├── arm_offset_q7.c │ │ │ ├── arm_scale_f32.c │ │ │ ├── arm_scale_q15.c │ │ │ ├── arm_scale_q31.c │ │ │ ├── arm_scale_q7.c │ │ │ ├── arm_shift_q15.c │ │ │ ├── arm_shift_q31.c │ │ │ ├── arm_shift_q7.c │ │ │ ├── arm_sub_f32.c │ │ │ ├── arm_sub_q15.c │ │ │ ├── arm_sub_q31.c │ │ │ └── arm_sub_q7.c │ │ │ ├── CommonTables │ │ │ ├── CommonTables.c │ │ │ ├── arm_common_tables.c │ │ │ └── arm_const_structs.c │ │ │ ├── ComplexMathFunctions │ │ │ ├── ComplexMathFunctions.c │ │ │ ├── arm_cmplx_conj_f32.c │ │ │ ├── arm_cmplx_conj_q15.c │ │ │ ├── arm_cmplx_conj_q31.c │ │ │ ├── arm_cmplx_dot_prod_f32.c │ │ │ ├── arm_cmplx_dot_prod_q15.c │ │ │ ├── arm_cmplx_dot_prod_q31.c │ │ │ ├── arm_cmplx_mag_f32.c │ │ │ ├── arm_cmplx_mag_q15.c │ │ │ ├── arm_cmplx_mag_q31.c │ │ │ ├── arm_cmplx_mag_squared_f32.c │ │ │ ├── arm_cmplx_mag_squared_q15.c │ │ │ ├── arm_cmplx_mag_squared_q31.c │ │ │ ├── arm_cmplx_mult_cmplx_f32.c │ │ │ ├── arm_cmplx_mult_cmplx_q15.c │ │ │ ├── arm_cmplx_mult_cmplx_q31.c │ │ │ ├── arm_cmplx_mult_real_f32.c │ │ │ ├── arm_cmplx_mult_real_q15.c │ │ │ └── arm_cmplx_mult_real_q31.c │ │ │ ├── ControllerFunctions │ │ │ ├── ControllerFunctions.c │ │ │ ├── arm_pid_init_f32.c │ │ │ ├── arm_pid_init_q15.c │ │ │ ├── arm_pid_init_q31.c │ │ │ ├── arm_pid_reset_f32.c │ │ │ ├── arm_pid_reset_q15.c │ │ │ ├── arm_pid_reset_q31.c │ │ │ ├── arm_sin_cos_f32.c │ │ │ └── arm_sin_cos_q31.c │ │ │ ├── FastMathFunctions │ │ │ ├── FastMathFunctions.c │ │ │ ├── arm_cos_f32.c │ │ │ ├── arm_cos_q15.c │ │ │ ├── arm_cos_q31.c │ │ │ ├── arm_sin_f32.c │ │ │ ├── arm_sin_q15.c │ │ │ ├── arm_sin_q31.c │ │ │ ├── arm_sqrt_q15.c │ │ │ └── arm_sqrt_q31.c │ │ │ ├── FilteringFunctions │ │ │ ├── FilteringFunctions.c │ │ │ ├── arm_biquad_cascade_df1_32x64_init_q31.c │ │ │ ├── arm_biquad_cascade_df1_32x64_q31.c │ │ │ ├── arm_biquad_cascade_df1_f32.c │ │ │ ├── arm_biquad_cascade_df1_fast_q15.c │ │ │ ├── arm_biquad_cascade_df1_fast_q31.c │ │ │ ├── arm_biquad_cascade_df1_init_f32.c │ │ │ ├── arm_biquad_cascade_df1_init_q15.c │ │ │ ├── arm_biquad_cascade_df1_init_q31.c │ │ │ ├── arm_biquad_cascade_df1_q15.c │ │ │ ├── arm_biquad_cascade_df1_q31.c │ │ │ ├── arm_biquad_cascade_df2T_f32.c │ │ │ ├── arm_biquad_cascade_df2T_f64.c │ │ │ ├── arm_biquad_cascade_df2T_init_f32.c │ │ │ ├── arm_biquad_cascade_df2T_init_f64.c │ │ │ ├── arm_biquad_cascade_stereo_df2T_f32.c │ │ │ ├── arm_biquad_cascade_stereo_df2T_init_f32.c │ │ │ ├── arm_conv_f32.c │ │ │ ├── arm_conv_fast_opt_q15.c │ │ │ ├── arm_conv_fast_q15.c │ │ │ ├── arm_conv_fast_q31.c │ │ │ ├── arm_conv_opt_q15.c │ │ │ ├── arm_conv_opt_q7.c │ │ │ ├── arm_conv_partial_f32.c │ │ │ ├── arm_conv_partial_fast_opt_q15.c │ │ │ ├── arm_conv_partial_fast_q15.c │ │ │ ├── arm_conv_partial_fast_q31.c │ │ │ ├── arm_conv_partial_opt_q15.c │ │ │ ├── arm_conv_partial_opt_q7.c │ │ │ ├── arm_conv_partial_q15.c │ │ │ ├── arm_conv_partial_q31.c │ │ │ ├── arm_conv_partial_q7.c │ │ │ ├── arm_conv_q15.c │ │ │ ├── arm_conv_q31.c │ │ │ ├── arm_conv_q7.c │ │ │ ├── arm_correlate_f32.c │ │ │ ├── arm_correlate_fast_opt_q15.c │ │ │ ├── arm_correlate_fast_q15.c │ │ │ ├── arm_correlate_fast_q31.c │ │ │ ├── arm_correlate_opt_q15.c │ │ │ ├── arm_correlate_opt_q7.c │ │ │ ├── arm_correlate_q15.c │ │ │ ├── arm_correlate_q31.c │ │ │ ├── arm_correlate_q7.c │ │ │ ├── arm_fir_decimate_f32.c │ │ │ ├── arm_fir_decimate_fast_q15.c │ │ │ ├── arm_fir_decimate_fast_q31.c │ │ │ ├── arm_fir_decimate_init_f32.c │ │ │ ├── arm_fir_decimate_init_q15.c │ │ │ ├── arm_fir_decimate_init_q31.c │ │ │ ├── arm_fir_decimate_q15.c │ │ │ ├── arm_fir_decimate_q31.c │ │ │ ├── arm_fir_f32.c │ │ │ ├── arm_fir_fast_q15.c │ │ │ ├── arm_fir_fast_q31.c │ │ │ ├── arm_fir_init_f32.c │ │ │ ├── arm_fir_init_q15.c │ │ │ ├── arm_fir_init_q31.c │ │ │ ├── arm_fir_init_q7.c │ │ │ ├── arm_fir_interpolate_f32.c │ │ │ ├── arm_fir_interpolate_init_f32.c │ │ │ ├── arm_fir_interpolate_init_q15.c │ │ │ ├── arm_fir_interpolate_init_q31.c │ │ │ ├── arm_fir_interpolate_q15.c │ │ │ ├── arm_fir_interpolate_q31.c │ │ │ ├── arm_fir_lattice_f32.c │ │ │ ├── arm_fir_lattice_init_f32.c │ │ │ ├── arm_fir_lattice_init_q15.c │ │ │ ├── arm_fir_lattice_init_q31.c │ │ │ ├── arm_fir_lattice_q15.c │ │ │ ├── arm_fir_lattice_q31.c │ │ │ ├── arm_fir_q15.c │ │ │ ├── arm_fir_q31.c │ │ │ ├── arm_fir_q7.c │ │ │ ├── arm_fir_sparse_f32.c │ │ │ ├── arm_fir_sparse_init_f32.c │ │ │ ├── arm_fir_sparse_init_q15.c │ │ │ ├── arm_fir_sparse_init_q31.c │ │ │ ├── arm_fir_sparse_init_q7.c │ │ │ ├── arm_fir_sparse_q15.c │ │ │ ├── arm_fir_sparse_q31.c │ │ │ ├── arm_fir_sparse_q7.c │ │ │ ├── arm_iir_lattice_f32.c │ │ │ ├── arm_iir_lattice_init_f32.c │ │ │ ├── arm_iir_lattice_init_q15.c │ │ │ ├── arm_iir_lattice_init_q31.c │ │ │ ├── arm_iir_lattice_q15.c │ │ │ ├── arm_iir_lattice_q31.c │ │ │ ├── arm_lms_f32.c │ │ │ ├── arm_lms_init_f32.c │ │ │ ├── arm_lms_init_q15.c │ │ │ ├── arm_lms_init_q31.c │ │ │ ├── arm_lms_norm_f32.c │ │ │ ├── arm_lms_norm_init_f32.c │ │ │ ├── arm_lms_norm_init_q15.c │ │ │ ├── arm_lms_norm_init_q31.c │ │ │ ├── arm_lms_norm_q15.c │ │ │ ├── arm_lms_norm_q31.c │ │ │ ├── arm_lms_q15.c │ │ │ └── arm_lms_q31.c │ │ │ ├── MatrixFunctions │ │ │ ├── MatrixFunctions.c │ │ │ ├── arm_mat_add_f32.c │ │ │ ├── arm_mat_add_q15.c │ │ │ ├── arm_mat_add_q31.c │ │ │ ├── arm_mat_cmplx_mult_f32.c │ │ │ ├── arm_mat_cmplx_mult_q15.c │ │ │ ├── arm_mat_cmplx_mult_q31.c │ │ │ ├── arm_mat_init_f32.c │ │ │ ├── arm_mat_init_q15.c │ │ │ ├── arm_mat_init_q31.c │ │ │ ├── arm_mat_inverse_f32.c │ │ │ ├── arm_mat_inverse_f64.c │ │ │ ├── arm_mat_mult_f32.c │ │ │ ├── arm_mat_mult_fast_q15.c │ │ │ ├── arm_mat_mult_fast_q31.c │ │ │ ├── arm_mat_mult_q15.c │ │ │ ├── arm_mat_mult_q31.c │ │ │ ├── arm_mat_scale_f32.c │ │ │ ├── arm_mat_scale_q15.c │ │ │ ├── arm_mat_scale_q31.c │ │ │ ├── arm_mat_sub_f32.c │ │ │ ├── arm_mat_sub_q15.c │ │ │ ├── arm_mat_sub_q31.c │ │ │ ├── arm_mat_trans_f32.c │ │ │ ├── arm_mat_trans_q15.c │ │ │ └── arm_mat_trans_q31.c │ │ │ ├── StatisticsFunctions │ │ │ ├── StatisticsFunctions.c │ │ │ ├── arm_max_f32.c │ │ │ ├── arm_max_q15.c │ │ │ ├── arm_max_q31.c │ │ │ ├── arm_max_q7.c │ │ │ ├── arm_mean_f32.c │ │ │ ├── arm_mean_q15.c │ │ │ ├── arm_mean_q31.c │ │ │ ├── arm_mean_q7.c │ │ │ ├── arm_min_f32.c │ │ │ ├── arm_min_q15.c │ │ │ ├── arm_min_q31.c │ │ │ ├── arm_min_q7.c │ │ │ ├── arm_power_f32.c │ │ │ ├── arm_power_q15.c │ │ │ ├── arm_power_q31.c │ │ │ ├── arm_power_q7.c │ │ │ ├── arm_rms_f32.c │ │ │ ├── arm_rms_q15.c │ │ │ ├── arm_rms_q31.c │ │ │ ├── arm_std_f32.c │ │ │ ├── arm_std_q15.c │ │ │ ├── arm_std_q31.c │ │ │ ├── arm_var_f32.c │ │ │ ├── arm_var_q15.c │ │ │ └── arm_var_q31.c │ │ │ ├── SupportFunctions │ │ │ ├── SupportFunctions.c │ │ │ ├── arm_copy_f32.c │ │ │ ├── arm_copy_q15.c │ │ │ ├── arm_copy_q31.c │ │ │ ├── arm_copy_q7.c │ │ │ ├── arm_fill_f32.c │ │ │ ├── arm_fill_q15.c │ │ │ ├── arm_fill_q31.c │ │ │ ├── arm_fill_q7.c │ │ │ ├── arm_float_to_q15.c │ │ │ ├── arm_float_to_q31.c │ │ │ ├── arm_float_to_q7.c │ │ │ ├── arm_q15_to_float.c │ │ │ ├── arm_q15_to_q31.c │ │ │ ├── arm_q15_to_q7.c │ │ │ ├── arm_q31_to_float.c │ │ │ ├── arm_q31_to_q15.c │ │ │ ├── arm_q31_to_q7.c │ │ │ ├── arm_q7_to_float.c │ │ │ ├── arm_q7_to_q15.c │ │ │ └── arm_q7_to_q31.c │ │ │ └── TransformFunctions │ │ │ ├── TransformFunctions.c │ │ │ ├── arm_bitreversal.c │ │ │ ├── arm_bitreversal2.S │ │ │ ├── arm_bitreversal2.c │ │ │ ├── arm_cfft_f32.c │ │ │ ├── arm_cfft_q15.c │ │ │ ├── arm_cfft_q31.c │ │ │ ├── arm_cfft_radix2_f32.c │ │ │ ├── arm_cfft_radix2_init_f32.c │ │ │ ├── arm_cfft_radix2_init_q15.c │ │ │ ├── arm_cfft_radix2_init_q31.c │ │ │ ├── arm_cfft_radix2_q15.c │ │ │ ├── arm_cfft_radix2_q31.c │ │ │ ├── arm_cfft_radix4_f32.c │ │ │ ├── arm_cfft_radix4_init_f32.c │ │ │ ├── arm_cfft_radix4_init_q15.c │ │ │ ├── arm_cfft_radix4_init_q31.c │ │ │ ├── arm_cfft_radix4_q15.c │ │ │ ├── arm_cfft_radix4_q31.c │ │ │ ├── arm_cfft_radix8_f32.c │ │ │ ├── arm_dct4_f32.c │ │ │ ├── arm_dct4_init_f32.c │ │ │ ├── arm_dct4_init_q15.c │ │ │ ├── arm_dct4_init_q31.c │ │ │ ├── arm_dct4_q15.c │ │ │ ├── arm_dct4_q31.c │ │ │ ├── arm_rfft_f32.c │ │ │ ├── arm_rfft_fast_f32.c │ │ │ ├── arm_rfft_fast_init_f32.c │ │ │ ├── arm_rfft_init_f32.c │ │ │ ├── arm_rfft_init_q15.c │ │ │ ├── arm_rfft_init_q31.c │ │ │ ├── arm_rfft_q15.c │ │ │ └── arm_rfft_q31.c │ ├── Include │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armclang.h │ │ ├── cmsis_armclang_ltm.h │ │ ├── cmsis_compiler.h │ │ ├── cmsis_gcc.h │ │ ├── cmsis_iccarm.h │ │ ├── cmsis_version.h │ │ ├── core_armv81mml.h │ │ ├── core_armv8mbl.h │ │ ├── core_armv8mml.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm1.h │ │ ├── core_cm23.h │ │ ├── core_cm3.h │ │ ├── core_cm33.h │ │ ├── core_cm35p.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_sc000.h │ │ ├── core_sc300.h │ │ ├── mpu_armv7.h │ │ ├── mpu_armv8.h │ │ └── tz_context.h │ └── LICENSE.txt ├── KissFFT │ ├── CHANGELOG │ ├── COPYING │ ├── README │ ├── _kiss_fft_guts.h │ ├── kiss_fft.c │ ├── kiss_fft.h │ └── kissfft.hh ├── polyblep │ ├── LICENSE │ ├── README │ └── dsp │ │ └── oscillator.h └── syscalls │ └── libnosys_gnu.c ├── Makefile ├── Maximilian ├── MaximilianPatch.hpp ├── maximilian.cpp └── maximilian.h ├── Owl ├── PatchSource └── .gitignore ├── README.md ├── SoulSource └── SoulPatch.hpp ├── Source ├── MemoryBuffer.hpp ├── Patch.cpp ├── PatchMetadata.cpp ├── PatchMetadata.h ├── PatchProcessor.cpp ├── PatchProcessor.h ├── PatchProgram.cpp ├── ProgramVector.h ├── STM32F746ZGTx_FLASH.ld ├── SampleBuffer.hpp ├── SampleBufferTest.cpp ├── ServiceCall.h ├── ShortBuffer.hpp ├── ShortPatchProgram.cpp ├── ccmheap.ld ├── device.h ├── flash.ld ├── font.c ├── heap.h ├── heap_5.c ├── main.cpp ├── main.h ├── message.cpp ├── operators.cpp ├── owl1.ld ├── owl2.ld ├── owl3.ld ├── sbrk.c ├── sramheap.ld ├── startup.s ├── system_tables.cpp └── system_tables.h ├── TestPatches ├── BiquadFilterTestPatch.hpp ├── CircularFloatBufferTestPatch.hpp ├── ComplexFloatArrayTestPatch.hpp ├── ComplexFourierTransformTestPatch.hpp ├── ComplexShortArrayTestPatch.hpp ├── CppTest │ └── CppTestPatch.hpp ├── DaisySPTest │ └── DaisySPTestPatch.hpp ├── DummyPatch.hpp ├── EnvelopeTestPatch.hpp ├── FastExpTestPatch.hpp ├── FastLogTestPatch.hpp ├── FastPowTestPatch.hpp ├── FaustTest │ ├── FaustPatch.hpp │ └── FaustTest.dsp ├── FirFilterPerformanceTestPatch.hpp ├── FirFilterTestPatch.hpp ├── FirInit.h ├── FloatArrayTestPatch.hpp ├── FourierPitchDetectorTestPatch.hpp ├── FractionalCircularFloatBufferTestPatch.hpp ├── GenTest │ ├── MIDItestMinMax.cpp │ ├── MIDItestMinMax.gendsp │ └── MIDItestMinMax.h ├── HeavyTest │ └── HeavyTest.pd ├── InterpolatingCircularBufferTestPatch.hpp ├── MidiMessageTestPatch.hpp ├── PatchRun.cpp ├── PatchTest.cpp ├── QuadratureSineOscillatorTestPatch.hpp ├── ResampleTestPatch.hpp ├── ShortArrayTestPatch.hpp ├── ShortFastFourierTestPatch.hpp ├── SineOscillatorTestPatch.hpp ├── SoulTest │ ├── SineSynth.hpp │ ├── SineSynth.soul │ ├── SoulPatch.hpp │ └── soul.hpp ├── TestPatch.hpp ├── ZeroCrossingPitchDetectorTestPatch.hpp └── fileio.h ├── Tests └── ShortArrayTest.cpp ├── Tools ├── Heavy │ └── uploader.py ├── HeavyPatch.tpl.hpp ├── Heavy_owl_constants.tpl.h ├── MakeLogTable.c ├── MakePowTable.c ├── build_send_receive_constants.py ├── makeresource.py └── owl.sh ├── WebSource ├── patch.html ├── wavy-jones.js ├── web.cpp └── webaudio.js ├── compile-heavy.sh ├── compile.mk ├── faust.mk ├── gen.mk ├── heavy.mk ├── libs.mk ├── listpatches.sh ├── maximilian.mk ├── native.mk ├── soul.mk ├── sources.mk ├── tables.mk └── web.mk /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: WebKit 3 | BreakBeforeBinaryOperators: None 4 | ColumnLimit: '80' 5 | CompactNamespaces: 'false' 6 | SpaceBeforeParens: Never 7 | SpaceInEmptyParentheses: 'false' 8 | Standard: Cpp11 9 | TabWidth: '4' 10 | UseTab: Never 11 | AlwaysBreakTemplateDeclarations: 'Yes' 12 | IndentWidth: '4' 13 | ContinuationIndentWidth: '4' 14 | AllowShortFunctionsOnASingleLine: None 15 | PenaltyExcessCharacter: '2' 16 | PointerAlignment: 'Left' 17 | SortIncludes: 'false' 18 | SpaceBeforeParens: ControlStatements 19 | BreakBeforeBraces: Custom 20 | BraceWrapping: 21 | AfterClass: false 22 | AfterControlStatement: false 23 | AfterEnum: false 24 | AfterFunction: false 25 | AfterNamespace: false 26 | AfterObjCDeclaration: false 27 | AfterStruct: false 28 | AfterUnion: false 29 | BeforeCatch: false 30 | BeforeElse: true 31 | IndentBraces: false 32 | 33 | ... 34 | -------------------------------------------------------------------------------- /.github/workflows/c-cpp.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: 4 | push: 5 | branches: [ master, develop ] 6 | pull_request: 7 | branches: [ master, develop ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | submodules: true 18 | - name: Setup arm-none-eabi-gcc 19 | uses: fiam/arm-none-eabi-gcc@v1 20 | with: 21 | release: '10-2020-q4' 22 | - name: Setup emsdk 23 | uses: mymindstorm/setup-emsdk@v7 24 | with: 25 | version: 2.0.10 26 | - name: Setup python 27 | uses: actions/setup-python@v2 28 | with: 29 | python-version: 2.7 30 | - name: make 31 | run: make 32 | - name: make check 33 | run: make check 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # vim garbage 26 | .*.swp 27 | .*.swo 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | Source/progname.s 35 | 36 | #Unignore this - because .lib extension is ignored for libraries 37 | !FaustCode/owl.lib 38 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Libraries/DaisySP"] 2 | path = Libraries/DaisySP 3 | url = https://github.com/electro-smith/DaisySP.git 4 | branch = master 5 | [submodule "Tools/hvcc"] 6 | path = Tools/hvcc 7 | url = https://github.com/pingdynasty/hvcc.git 8 | branch = develop 9 | -------------------------------------------------------------------------------- /Build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /FaustSource/faustmath.h: -------------------------------------------------------------------------------- 1 | #ifndef __fastmath_h__ 2 | #define __fastmath_h__ 3 | 4 | #include "basicmaths.h" 5 | 6 | // This file extends functions from basicmaths.h with all function names 7 | // used by Faust fast maths calls. 8 | 9 | // For reference, see 10 | // https://github.com/grame-cncm/faust/blob/master-dev/compiler/global.cpp#L173-L215 11 | 12 | // Float versions 13 | 14 | #define fast_fabsf(x) abs(x) 15 | #define fast_acosf(x) acosf(x) 16 | #define fast_asinf(x) asinf(x) 17 | #define fast_atanf(x) atanf(x) 18 | #define fast_atan2f(x, y) atan2f(x, y) // Optimized for ARM 19 | #define fast_ceilf(x) ceilf(x) 20 | #define fast_cosf(x) cosf(x) // Optimized for ARM 21 | // fast_expf is defined in basicmath.h 22 | // fast_exp2f is defined in basicmath.h 23 | // fast_exp10f is defined in basicmath.h 24 | #define fast_floorf(x) floorf(x) 25 | #define fast_fmodf(x, y) fmodf(x, y) 26 | // fast_logf is defined in basicmath.h 27 | // fast_log2f is defined in basicmath.h 28 | // fast_log10f is defined in basicmath.h 29 | // fast_powf is defined in basicmath.h 30 | #define fast_remainderf(x, y) remainderf(x, y) 31 | #define fast_rintf(x) rintf(x) 32 | #define fast_roundf(x) roundf(x) 33 | #define fast_sinf(x) sinf(x) // Optimized for ARM 34 | #define fast_sqrtf(x) sqrtf(x) // Optimized for ARM 35 | #define fast_tanf(x) tanf(x) 36 | 37 | // Double versions 38 | 39 | // Actually, we'll end up calling float versions and casting them to doubles. 40 | #define fast_fabs(x) abs(x) 41 | #define fast_acos(x) fast_acosf(x) 42 | #define fast_asin(x) fast_asinf(x) 43 | #define fast_atan(x) fast_atanf(x) 44 | #define fast_atan2(x, y) fast_atan2f(x, y) 45 | #define fast_ceil(x) fast_ceilf(x) 46 | #define fast_cos(x) fast_cosf(x) 47 | #define fast_exp(x) fast_expf(x) 48 | #define fast_exp2(x, y) fast_exp2f(x, y) 49 | #define fast_exp10(x) fast_exp10f(x) 50 | #define fast_floor(x) fast_floorf(x) 51 | #define fast_fmod(x, y) fast_fmodf(x, y) 52 | #define fast_log(x) fast_logf(x) 53 | #define fast_log2(x) fast_log2f(x) 54 | #define fast_log10(x) fast_log10f(x) 55 | #define fast_pow(x, y) fast_powf(x, y) 56 | #define fast_remainder(x, y) fast_remainderf(x, y) 57 | #define fast_rint(x) fast_rintf(x) 58 | #define fast_round(x) fast_roundf(x) 59 | #define fast_sin(x) fast_sinf(x) 60 | #define fast_sqrt(x) fast_sqrtf(x) 61 | #define fast_tan(x) fast_tanf(x) 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /FaustSource/owl.h: -------------------------------------------------------------------------------- 1 | #ifndef __OWL_H 2 | #define __OWL_H 3 | 4 | /* In this file we declare all OWL foreign functions. 5 | * They can be used in a FAUST patch like this: 6 | * 7 | * owl_button = ffunction(int owl_button(int, int), ,""); 8 | * 9 | * owl_parameter = ffunction(int owl_parameter(int, float), ,""); 10 | * 11 | * pushbutton = ffunction(int owl_pushbutton(int), ,""); 12 | * 13 | * sample2hertz = ffunction(float sample2hertz(float, float), , ""); 14 | * 15 | * hertz2sample = ffunction(float, hertz2sample(float, float), , ""); 16 | * 17 | * sample2volts = ffunction(float sample2volts(float), , ""); 18 | * 19 | * volts2hertz = ffunction(float volts2hertz(float), , ""); 20 | * 21 | * volts2sample = ffunction(float volts2sample(float), , ""); 22 | * 23 | * hertz2volts = ffunction(float hertz2volts(float), , ""); 24 | * 25 | * Or you can just call import("owl.lib"); in your patch and use definitions 26 | * from that file. 27 | */ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | int owl_pushbutton(int value); 34 | int owl_button(int bid, int value); 35 | float owl_parameter(int pid, float value); 36 | float sample2hertz(float tune, float sample); 37 | float hertz2sample(float tune, float hertz); 38 | float sample2volts(float sample); 39 | float volts2hertz(float volts); 40 | float volts2sample(float volts); 41 | float hertz2volts(float hertz); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* __OWL_H */ 48 | -------------------------------------------------------------------------------- /FaustSource/owl.lib: -------------------------------------------------------------------------------- 1 | // Foreign functions and constants for output buttons and parameters 2 | 3 | owl_button = ffunction(int owl_button(int, int), ,""); 4 | owl_parameter = ffunction(int owl_parameter(int, float), ,""); 5 | 6 | OWL_B1 = fconstant(int BUTTON_A, ); 7 | OWL_B2 = fconstant(int BUTTON_B, ); 8 | OWL_B3 = fconstant(int BUTTON_C, ); 9 | OWL_B4 = fconstant(int BUTTON_D, ); 10 | OWL_B5 = fconstant(int BUTTON_E, ); 11 | OWL_B6 = fconstant(int BUTTON_F, ); 12 | OWL_B7 = fconstant(int BUTTON_G, ); 13 | OWL_B8 = fconstant(int BUTTON_H, ); 14 | OWL_A = fconstant(int PARAMETER_A, ); 15 | OWL_B = fconstant(int PARAMETER_B, ); 16 | OWL_C = fconstant(int PARAMETER_C, ); 17 | OWL_D = fconstant(int PARAMETER_D, ); 18 | OWL_E = fconstant(int PARAMETER_E, ); 19 | OWL_F = fconstant(int PARAMETER_F, ); 20 | OWL_G = fconstant(int PARAMETER_G, ); 21 | OWL_H = fconstant(int PARAMETER_H, ); 22 | 23 | //------------------------ pushbutton ---------------- 24 | // Send a gate signal to push button 25 | // 26 | // ### Usage: 27 | // `_:pushbutton` 28 | // 29 | pushbutton = ffunction(int owl_pushbutton(int), , ""); 30 | 31 | //------------------------ Voltage convertion ---------------- 32 | 33 | //------------------------ sample2hertz ---------------------- 34 | // Convert input sample to frequency in Hertz 35 | // 36 | // ### Usage: 37 | // `_:sample2hertz(tune):_` 38 | // 39 | sample2hertz = ffunction(float sample2hertz(float, float), , ""); 40 | 41 | //------------------------ hertz2sample ---------------------- 42 | // Convert frequency in Hertz to output sample 43 | // 44 | // ### Usage: 45 | // `_:hertz2sample(tune):_` 46 | // 47 | hertz2sample = ffunction(float hertz2sample(float, float), , ""); 48 | 49 | //------------------------ sample2volts ---------------------- 50 | // Convert input sample to Volts 51 | // 52 | // ### Usage: 53 | // `_:sample2volts:_` 54 | // 55 | sample2volts = ffunction(float sample2volts(float), , ""); 56 | 57 | //------------------------ volts2hertz ----------------------- 58 | // Convert Volts into Hertz 59 | // 60 | // ### Usage: 61 | // `_:volts2hertz:_` 62 | // 63 | volts2hertz = ffunction(float volts2hertz(float), , ""); 64 | 65 | //------------------------ volts2sample ---------------------- 66 | // Convert Volts into output sample 67 | // 68 | // ### Usage: 69 | // `_:volts2sample:_` 70 | // 71 | volts2sample = ffunction(float volts2sample(float), , ""); 72 | 73 | //------------------------ hertz2volts ---------------------- 74 | // Convert Hertz into Volts 75 | // 76 | // ### Usage: 77 | // `_:hertz2volts:_` 78 | // 79 | hertz2volts = ffunction(float hertz2volts(float), , ""); 80 | -------------------------------------------------------------------------------- /GenSource/genlib_common_win.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************************* 2 | Copyright (c) 2012 Cycling '74 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies 11 | or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 14 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | *******************************************************************************************************************/ 19 | 20 | #ifndef GENLIB_COMMON_WIN_H 21 | #define GENLIB_COMMON_WIN_H 22 | 23 | #ifdef _MSC_VER 24 | #define GEN_WINDOWS 25 | #endif 26 | 27 | #ifdef GEN_WINDOWS 28 | 29 | #include 30 | #include 31 | 32 | typedef __int32 int32_t; 33 | typedef unsigned __int32 uint32_t; 34 | typedef __int64 int64_t; 35 | typedef unsigned __int64 uint64_t; 36 | #define malloc_size _msize 37 | 38 | #define __DBL_EPSILON__ (DBL_EPSILON) 39 | 40 | #endif 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /GenSource/genlib_exportfunctions.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************************* 2 | Copyright (c) 2012 Cycling '74 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies 11 | or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 14 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | *******************************************************************************************************************/ 19 | 20 | #ifndef GENLIB_EXPORT_FUNCTIONS_H 21 | #define GENLIB_EXPORT_FUNCTIONS_H 1 22 | 23 | typedef char *t_ptr; 24 | 25 | t_ptr sysmem_newptr(t_ptr_size size); 26 | t_ptr sysmem_newptrclear(t_ptr_size size); 27 | t_ptr sysmem_resizeptr(void *ptr, t_ptr_size newsize); 28 | t_ptr sysmem_resizeptrclear(void *ptr, t_ptr_size newsize); 29 | t_ptr_size sysmem_ptrsize(void *ptr); 30 | void sysmem_freeptr(void *ptr); 31 | void sysmem_copyptr(const void *src, void *dst, t_ptr_size bytes); 32 | unsigned long systime_ticks(void); 33 | 34 | void genlib_report_error(const char *s); 35 | void genlib_report_message(const char *s); 36 | void set_zero64(t_sample *mem, long size); 37 | 38 | #endif // GENLIB_EXPORT_FUNCTIONS_H 39 | -------------------------------------------------------------------------------- /LICENSE_VCV.md: -------------------------------------------------------------------------------- 1 | All copyright holders (i.e. contributors) listed below have agreed to transfer copyright for the code in `LibSource` and `Source` to Martin Klang, for the purpose of dual licensing of both of these subdirectories. The original `GPL-v3` license still holds. In addition, a commercial license may exist for specific use, for example, for VCV closed source and premium plugins such as the Befaco Oneiroi project. 2 | 3 | Contributors (and therefore original copyright holders): 4 | 5 | * Martin Klang / mars / pingdynasty 6 | * Giulio Moro / giuliomoro 7 | * Stanislav Shtin / antisvin 8 | * Damian Quartz / ddf 9 | * Ewan Hemingway / hemmer 10 | -------------------------------------------------------------------------------- /LibSource/AgnesiOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __AgnesiOscillator_h 2 | #define __AgnesiOscillator_h 3 | 4 | #include "Oscillator.h" 5 | 6 | /** 7 | * Oscillator that produces an Agnesi curve (Witch of Agnesi) 8 | * With a=0.5, the output is between near 0 (0.038 for N=5) and 1. 9 | * N sets the x range for one half period, which determines the y offset. 10 | */ 11 | class AgnesiOscillator : public Oscillator { 12 | private: 13 | const float sr; 14 | float a; 15 | float N; 16 | float incr = 0; 17 | float x = 0; 18 | float offset = 0; 19 | float gain = 1; 20 | public: 21 | AgnesiOscillator(float sr, float a, float N) 22 | : sr(sr), a(a), N(N) {} 23 | static float agnesi(float x, float a){ 24 | return (8*a*a*a) / (x*x + 4*a*a); 25 | } 26 | void setFrequency(float freq){ 27 | incr = 2*N*freq/sr; 28 | } 29 | float getFrequency(){ 30 | return incr*sr/(2*N); 31 | } 32 | void setPhase(float phase){ 33 | x = N*(phase-M_PI)/M_PI; 34 | } 35 | float getPhase(){ 36 | return M_PI*x/N+M_PI; 37 | } 38 | void reset(){ 39 | x = -N; 40 | } 41 | /** 42 | * Normalise offset and gain so that signal is between -1 and 1 43 | */ 44 | void normalise(){ 45 | offset = agnesi(N, a); 46 | gain = 2/(agnesi(0, a) - offset); 47 | offset += 0.5; 48 | } 49 | float generate(){ 50 | float y = agnesi(x, a); 51 | x += incr; 52 | if(x > N) 53 | x -= 2*N; 54 | return clamp(gain*(y-offset), -1.0f, 1.0f); 55 | } 56 | float generate(float fm){ 57 | // modulate coefficient 'a' instead of rate 58 | float y = agnesi(x, a*(1+fm)); 59 | x += incr; 60 | if(x > N) 61 | x -= 2*N; 62 | return clamp(gain*(y-offset), -1.0f, 1.0f); 63 | } 64 | using SignalGenerator::generate; 65 | static AgnesiOscillator* create(float sr, float a=0.5, float N=5){ 66 | AgnesiOscillator* osc = new AgnesiOscillator(sr, a, N); 67 | osc->normalise(); 68 | return osc; 69 | } 70 | static void destroy(AgnesiOscillator* obj){ 71 | delete obj; 72 | } 73 | }; 74 | 75 | #endif /* __AgnesiOscillator_h */ 76 | -------------------------------------------------------------------------------- /LibSource/AudioBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef __AudioBuffer_h__ 2 | #define __AudioBuffer_h__ 3 | 4 | #include "FloatArray.h" 5 | 6 | class AudioBuffer { 7 | public: 8 | virtual ~AudioBuffer(); 9 | virtual FloatArray getSamples(int channel) = 0; 10 | virtual int getChannels() = 0; 11 | virtual int getSize() = 0; 12 | virtual void clear() = 0; 13 | void multiply(float scalar){ 14 | for(int i=0; iphase = phase; 49 | } 50 | float generate(){ 51 | float sample = sinf(phase); 52 | phase += incr; 53 | incr *= rate; 54 | if(phase >= 2*M_PI) 55 | phase -= 2*M_PI; 56 | return sample; 57 | } 58 | float generate(float fm){ 59 | float sample = sinf(phase); 60 | phase += incr + fm; 61 | incr *= rate; 62 | return sample; 63 | } 64 | static ChirpOscillator* create(float sr){ 65 | return new ChirpOscillator(sr); 66 | } 67 | static void destroy(ChirpOscillator* osc){ 68 | delete osc; 69 | } 70 | }; 71 | 72 | #endif /* CHIRP_OSCILLATOR_H */ 73 | -------------------------------------------------------------------------------- /LibSource/ColourScreenPatch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "device.h" 4 | #include "ColourScreenPatch.h" 5 | #include "ProgramVector.h" 6 | #include "PatchProcessor.h" 7 | #include "ServiceCall.h" 8 | 9 | PatchProcessor* getInitialisingPatchProcessor(); 10 | 11 | static void onDrawCallback(uint8_t* pixels, uint16_t width, uint16_t height){ 12 | ColourScreenPatch* patch = (ColourScreenPatch*)getInitialisingPatchProcessor()->patch; 13 | if(patch != NULL){ 14 | ColourScreenBuffer screen(width, height); 15 | screen.setBuffer(pixels); 16 | patch->processScreen(screen); 17 | } 18 | } 19 | 20 | ColourScreenPatch::ColourScreenPatch(){ 21 | void* drawArgs[] = {(void*)SYSTEM_FUNCTION_DRAW, (void*)&onDrawCallback}; 22 | getProgramVector()->serviceCall(OWL_SERVICE_REGISTER_CALLBACK, drawArgs, 2); 23 | } 24 | 25 | ColourScreenPatch::~ColourScreenPatch(){} 26 | 27 | template<> 28 | Colour ColourScreenBuffer::getPixel(unsigned int x, unsigned int y){ 29 | if(x >= width || y >= height) 30 | return 0; 31 | return pixels[y*width+x]; 32 | } 33 | 34 | template<> 35 | void ColourScreenBuffer::setPixel(unsigned int x, unsigned int y, Colour c){ 36 | if(x < width && y < height) 37 | pixels[y*width+x] = c; 38 | } 39 | 40 | template<> 41 | void ColourScreenBuffer::invertPixel(unsigned int x, unsigned int y){ 42 | if(x < width && y < height) 43 | pixels[y*width+x] ^= WHITE; 44 | } 45 | 46 | template<> 47 | void ColourScreenBuffer::fade(uint16_t steps){ 48 | for(int i=0; i> steps) & RED) | 51 | (((pixels[i] & GREEN) >> steps) & GREEN) | 52 | (((pixels[i] & BLUE) >> steps) & BLUE); 53 | } 54 | 55 | template<> 56 | void ColourScreenBuffer::fill(Colour c) { 57 | for(int i=0; i ColourScreenBuffer; 15 | 16 | /** 17 | * Abstract base class for patches that use a colour screen. 18 | * Colour format is 16 bits RGB565: RRRRR GGGGGG BBBBB 19 | * Compatible OLED drivers: SSD1331, SEPS1114A 20 | */ 21 | class ColourScreenPatch : public Patch { 22 | public: 23 | ColourScreenPatch(); 24 | virtual ~ColourScreenPatch(); 25 | uint16_t getScreenWidth(); 26 | uint16_t getScreenHeight(); 27 | virtual void processScreen(ColourScreenBuffer& screen) = 0; 28 | }; 29 | -------------------------------------------------------------------------------- /LibSource/ComplexFourierTransform.h: -------------------------------------------------------------------------------- 1 | #ifndef __ComplexFourierTransform_h__ 2 | #define __ComplexFourierTransform_h__ 3 | 4 | #include "ComplexFloatArray.h" 5 | 6 | #ifdef ARM_CORTEX 7 | #include "arm_const_structs.h" 8 | 9 | class ComplexFourierTransform { 10 | private: 11 | arm_cfft_instance_f32 instance; 12 | public: 13 | ComplexFourierTransform(){}; 14 | ComplexFourierTransform(int len){ 15 | init(len); 16 | } 17 | void init(int len){ 18 | ASSERT(len==32 || len ==64 || len==128 || len==256 || len==512 || len==1024 || len==2048 || len==4096, "Unsupported FFT size"); 19 | void* args[] = {(void*)&instance, (void*)&len}; 20 | getProgramVector()->serviceCall(OWL_SERVICE_ARM_CFFT_INIT_F32, args, 2); 21 | // Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096. 22 | } 23 | void fft(ComplexFloatArray inout){ 24 | ASSERT(inout.getSize() >= getSize(), "Input array too small"); 25 | arm_cfft_f32(&instance, (float*)inout.getData(), 0, 1); //forward 26 | } 27 | void ifft(ComplexFloatArray inout){ 28 | ASSERT(inout.getSize() >= getSize(), "Input array too small"); 29 | arm_cfft_f32(&instance, (float*)inout.getData(), 1, 1); //inverse 30 | } 31 | int getSize(){ 32 | return instance.fftLen; 33 | } 34 | }; 35 | #endif /* ARM_CORTEX */ 36 | 37 | #ifndef ARM_CORTEX 38 | #include "kiss_fft.h" 39 | class ComplexFourierTransform { 40 | private: 41 | kiss_fft_cfg cfgfft; 42 | kiss_fft_cfg cfgifft; 43 | ComplexFloatArray temp; 44 | public: 45 | ComplexFourierTransform(){} 46 | ComplexFourierTransform(int len){ 47 | init(len); 48 | } 49 | ~ComplexFourierTransform(){ 50 | ComplexFloatArray::destroy(temp); 51 | } 52 | void init(int len){ 53 | ASSERT(len==32 || len ==64 || len==128 || len==256 || len==512 || len==1024 || len==2048 || len==4096, "Unsupported FFT size"); 54 | cfgfft = kiss_fft_alloc(len, 0 , 0, 0); 55 | cfgifft = kiss_fft_alloc(len, 1,0, 0); 56 | temp = ComplexFloatArray::create(len); 57 | } 58 | void fft(ComplexFloatArray inout){ 59 | ASSERT(inout.getSize() >= getSize(), "Input array too small"); 60 | kiss_fft(cfgfft, (kiss_fft_cpx*)(float*)inout.getData(), (kiss_fft_cpx*)(float*)temp.getData()); 61 | inout.copyFrom(temp); 62 | } 63 | void ifft(ComplexFloatArray inout){ 64 | ASSERT(inout.getSize() >= getSize(), "Input array too small"); 65 | kiss_fft(cfgifft, (kiss_fft_cpx*)(float*)inout.getData(), (kiss_fft_cpx*)(float*)temp.getData()); 66 | temp.scale(1.0f/getSize()); 67 | inout.copyFrom(temp); 68 | } 69 | size_t getSize(){ 70 | return temp.getSize(); 71 | } 72 | }; 73 | #endif /* ifndef ARM_CORTEX */ 74 | 75 | #endif // __ComplexFourierTransform_h__ 76 | -------------------------------------------------------------------------------- /LibSource/ComplexOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMPLEX_OSCILLATOR_H__ 2 | #define __COMPLEX_OSCILLATOR_H__ 3 | 4 | #include "SignalGenerator.h" 5 | #include "Oscillator.h" 6 | 7 | /** 8 | * A complex oscillator is a MultiSignalGenerator with 2 channels that 9 | * operates at a given frequency and that can be frequency modulated. 10 | * 11 | * A single sample is represented as a ComplexFloat value, while blocks 12 | * of audio are stored in an AudioBuffer with 2 channels. 13 | */ 14 | class ComplexOscillator : public ComplexSignalGenerator { 15 | public: 16 | ComplexOscillator() = default; 17 | virtual ~ComplexOscillator() = default; 18 | using ComplexSignalGenerator::generate; 19 | /** 20 | * Set oscillator sample rate 21 | */ 22 | virtual void setSampleRate(float value){} 23 | /** 24 | * Set oscillator frequency in Hertz 25 | */ 26 | virtual void setFrequency(float value) = 0; 27 | /** 28 | * Get oscillator frequency in Hertz 29 | */ 30 | virtual float getFrequency() = 0; 31 | /** 32 | * Set current oscillator phase in radians 33 | * @param phase a value between 0 and 2*pi 34 | */ 35 | virtual void setPhase(float phase) = 0; 36 | /** 37 | * Get current oscillator phase in radians 38 | * @return a value between 0 and 2*pi 39 | */ 40 | virtual float getPhase() = 0; 41 | /** 42 | * Reset oscillator (typically resets phase) 43 | */ 44 | virtual void reset() = 0; 45 | /** 46 | * Produce a sample with frequency modulation. 47 | */ 48 | virtual ComplexFloat generate(float fm) = 0; 49 | /** 50 | * Produce a block of samples with frequency modulation. 51 | */ 52 | virtual void generate(ComplexFloatArray output, FloatArray fm){ 53 | for(size_t i=0; i 60 | using ComplexOscillatorTemplate = OscillatorTemplate; 61 | #endif 62 | -------------------------------------------------------------------------------- /LibSource/Control.h: -------------------------------------------------------------------------------- 1 | #ifndef __Control_h__ 2 | #define __Control_h__ 3 | 4 | #include "Patch.h" 5 | #include "message.h" 6 | #include "main.h" 7 | 8 | template 9 | class Control { 10 | public: 11 | Control(){ 12 | ASSERT(PID < getProgramVector()->parameters_size, "Invalid parameter ID"); 13 | } 14 | Control(const float value){ 15 | ASSERT(PID < getProgramVector()->parameters_size, "Invalid parameter ID"); 16 | set(value); 17 | } 18 | void set(const float value){ 19 | if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && PID < 4) 20 | doSetPatchParameter(PID, 4095 - (int16_t)(value*4096.0f)); 21 | else 22 | doSetPatchParameter(PID, (int16_t)(value*4096)); 23 | } 24 | float get(){ 25 | if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && PID < 4){ 26 | return (4095 - getProgramVector()->parameters[PID])/4096.0f; 27 | }else{ 28 | return getProgramVector()->parameters[PID]/4096.0f; 29 | } 30 | } 31 | Control& operator=(const float value){ 32 | set(value); 33 | return *this; 34 | } 35 | operator float(){ 36 | return get(); 37 | } 38 | }; 39 | 40 | #endif /* __Control_h__ */ 41 | -------------------------------------------------------------------------------- /LibSource/CrossFadingCircularBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef _CrossFadingCircularBuffer_hpp_ 2 | #define _CrossFadingCircularBuffer_hpp_ 3 | 4 | #include 5 | #include "CircularBuffer.h" 6 | 7 | template 8 | class CrossFadingCircularBuffer : public CircularBuffer { 9 | protected: 10 | FloatArray buffer; 11 | public: 12 | CrossFadingCircularBuffer() {} 13 | CrossFadingCircularBuffer(T* data, size_t size, FloatArray buffer): 14 | CircularBuffer(data, size), buffer(buffer) {} 15 | /** 16 | * Read from buffer with a delay. 17 | * The output will be crossfaded between the previous delay time and the new one. 18 | */ 19 | void delay(T* out, size_t len, int delay_samples){ 20 | delay(out, len, CircularBuffer::getDelay(), delay_samples); 21 | } 22 | /** 23 | * Write to buffer and read with a delay 24 | */ 25 | void delay(T* in, T* out, size_t len, int delay_samples){ 26 | CircularBuffer::write(in, len); 27 | delay(out, len, CircularBuffer::getDelay(), delay_samples + len); 28 | } 29 | /** 30 | * Read from buffer with a delay 31 | */ 32 | void delay(T* out, size_t len, int beginDelay, int endDelay){ 33 | ASSERT(len <= buffer.getSize(), "Buffer too small"); 34 | FloatArray output(out, len); 35 | CircularBuffer::setDelay(beginDelay); 36 | CircularBuffer::read(out, len); 37 | output.scale(1, 0); 38 | CircularBuffer::setDelay(endDelay); 39 | CircularBuffer::read(buffer.getData(), len); 40 | buffer.scale(0, 1); 41 | output.add(buffer); 42 | } 43 | /** 44 | * Write to buffer and read with a delay 45 | */ 46 | void delay(T* in, T* out, size_t len, int beginDelay, int endDelay){ 47 | CircularBuffer::write(in, len); 48 | delay(out, len, beginDelay + len, endDelay + len); // set delays relative to where we started writing 49 | } 50 | static CrossFadingCircularBuffer* create(size_t len, size_t blocksize){ 51 | CrossFadingCircularBuffer* obj = 52 | new CrossFadingCircularBuffer(new T[len], len, FloatArray::create(blocksize)); 53 | obj->clear(); 54 | return obj; 55 | } 56 | static void destroy(CrossFadingCircularBuffer* obj){ 57 | FloatArray::destroy(obj->buffer); 58 | delete[] obj->data; 59 | delete obj; 60 | } 61 | }; 62 | 63 | typedef CrossFadingCircularBuffer CrossFadingCircularFloatBuffer; 64 | 65 | #endif /* _CrossFadingCircularBuffer_hpp_ */ 66 | -------------------------------------------------------------------------------- /LibSource/DryWetProcessor.h: -------------------------------------------------------------------------------- 1 | #ifndef __DryWetProcessor_h__ 2 | #define __DryWetProcessor_h__ 3 | 4 | #include 5 | #include "SignalProcessor.h" 6 | 7 | template 8 | class DryWetSignalProcessor : public Processor { 9 | protected: 10 | FloatArray mix_buffer; 11 | float mix_amount; 12 | public: 13 | template 14 | DryWetSignalProcessor(FloatArray buffer, Args&&... args) : 15 | Processor(std::forward(args)...), mix_buffer(buffer), mix_amount(0) {} 16 | void setMix(float amount){ 17 | mix_amount = amount; 18 | } 19 | float getMix(){ 20 | return mix_amount; 21 | } 22 | void process(FloatArray input, FloatArray output){ 23 | mix_buffer.copyFrom(input); 24 | Processor::process(input, output); 25 | output.multiply(mix_amount); 26 | mix_buffer.multiply(1-mix_amount); 27 | output.add(mix_buffer); 28 | } 29 | template 30 | static DryWetSignalProcessor* create(size_t blocksize, Args&&... args){ 31 | FloatArray buffer = FloatArray::create(blocksize); 32 | return new DryWetSignalProcessor(buffer, std::forward(args)...); 33 | } 34 | static void destroy(DryWetSignalProcessor* obj){ 35 | FloatArray::destroy(obj->mix_buffer); 36 | Processor::destroy(obj); 37 | } 38 | }; 39 | 40 | template 41 | class DryWetMultiSignalProcessor : public Processor { 42 | protected: 43 | AudioBuffer* mix_buffer; 44 | float mix_amount; 45 | public: 46 | template 47 | DryWetMultiSignalProcessor(AudioBuffer* buffer, Args&&... args) : 48 | Processor(std::forward(args)...), mix_buffer(buffer), mix_amount(0) {} 49 | void setMix(float amount){ 50 | mix_amount = amount; 51 | } 52 | float getMix(){ 53 | return mix_amount; 54 | } 55 | void process(AudioBuffer& input, AudioBuffer& output){ 56 | mix_buffer->copyFrom(input); 57 | Processor::process(input, output); 58 | output.multiply(mix_amount); 59 | mix_buffer->multiply(1-mix_amount); 60 | output.add(*mix_buffer); 61 | } 62 | template 63 | static DryWetMultiSignalProcessor* create(size_t channels, size_t blocksize, Args&&... args){ 64 | AudioBuffer* buffer = AudioBuffer::create(channels, blocksize); 65 | return new DryWetMultiSignalProcessor(buffer, std::forward(args)...); 66 | } 67 | static void destroy(DryWetMultiSignalProcessor* obj){ 68 | AudioBuffer::destroy(obj->mix_buffer); 69 | Processor::destroy(obj); 70 | } 71 | }; 72 | 73 | #endif // __DryWetProcessor_h__ 74 | -------------------------------------------------------------------------------- /LibSource/Envelope.h: -------------------------------------------------------------------------------- 1 | #ifndef ENVELOPE_HPP 2 | #define ENVELOPE_HPP 3 | 4 | #include "FloatArray.h" 5 | #include "SignalGenerator.h" 6 | #include "SignalProcessor.h" 7 | 8 | class Envelope : public SignalGenerator, SignalProcessor { 9 | public: 10 | using SignalGenerator::generate; 11 | virtual void trigger(){ 12 | trigger(true, 0); 13 | } 14 | virtual void trigger(bool state){ 15 | trigger(state, 0); 16 | } 17 | virtual void trigger(bool state, int triggerDelay) = 0; 18 | virtual void gate(bool state){ 19 | gate(state, 0); 20 | } 21 | virtual void gate(bool state, int gateDelay){} 22 | virtual float process(float input){ 23 | return input*generate(); 24 | } 25 | /** 26 | * Attenuate samples in @param input by envelope and place results in @param output 27 | */ 28 | virtual void process(FloatArray input, FloatArray output){ 29 | for(size_t n = 0; n < output.getSize(); n++) 30 | output[n] = input[n]*generate(); 31 | } 32 | }; 33 | 34 | #endif /* ENVELOPE_HPP */ 35 | -------------------------------------------------------------------------------- /LibSource/ExponentialDecayEnvelope.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPONENTIAL_DECAY_ENVELOPE_H 2 | #define EXPONENTIAL_DECAY_ENVELOPE_H 3 | 4 | #include "Envelope.h" 5 | 6 | class ExponentialDecayEnvelope : public Envelope { 7 | protected: 8 | float sr; 9 | float value; 10 | float incr; 11 | float calculateMultiplier(float startLevel, float endLevel, size_t lengthInSamples) { 12 | // Ref: Christian Schoenebeck http://www.musicdsp.org/showone.php?id=189 13 | return 1.0 + (logf(endLevel) - logf(startLevel)) / (lengthInSamples+20); 14 | } 15 | public: 16 | ExponentialDecayEnvelope(float sr=48000): sr(sr), value(0), incr(0){} 17 | using Envelope::gate; 18 | using Envelope::trigger; 19 | using Envelope::process; 20 | using SignalGenerator::generate; 21 | void setSampleRate(float sampleRate){ 22 | sr = sampleRate; 23 | } 24 | void setDecaySamples(float samples){ // set decay time in samples 25 | incr = calculateMultiplier(1, 0.0001, samples); 26 | } 27 | void setDecay(float sec){ // set decay time in seconds to reach -80dB 28 | incr = calculateMultiplier(1, 0.0001, sec*sr); 29 | } 30 | void trigger(bool state, int triggerDelay){ 31 | if(state) 32 | value = 1; 33 | } 34 | void gate(bool state, int triggerDelay){ 35 | value = state; 36 | } 37 | /** 38 | * Produce the next envelope sample. 39 | */ 40 | float generate(){ 41 | float sample = value; 42 | value *= incr; 43 | return sample; 44 | } 45 | float getLevel(){ 46 | return value; 47 | } 48 | void setLevel(float level){ 49 | value = level; 50 | } 51 | [[deprecated("use generate() instead.")]] 52 | float getNextSample(){ 53 | return generate(); // increments envelope one step 54 | } 55 | static ExponentialDecayEnvelope* create(float sr){ 56 | return new ExponentialDecayEnvelope(sr); 57 | } 58 | static void destroy(ExponentialDecayEnvelope* env){ 59 | delete env; 60 | } 61 | }; 62 | 63 | #endif /* EXPONENTIAL_DECAY_ENVELOPE_H */ 64 | -------------------------------------------------------------------------------- /LibSource/FastPowTable.h: -------------------------------------------------------------------------------- 1 | /* fast pow lookup table, precision 6, size 64 */ 2 | const uint32_t fast_pow_precision = 6; 3 | const uint32_t fast_pow_table_size = 64; 4 | const uint32_t fast_pow_table[64] = { 5 | 45549, 137391, 230233, 324086, 418961, 514869, 611822, 709830, 808906, 909060, 1010305, 1112653, 1216114, 1320703, 1426431, 1533309, 1641352, 1750571, 1860979, 1972590, 2085416, 2199471, 2314767, 2431320, 2549141, 2668245, 2788646, 2910359, 3033396, 3157774, 3283506, 3410607, 3539092, 3668976, 3800274, 3933002, 4067176, 4202811, 4339922, 4478527, 4618641, 4760280, 4903462, 5048204, 5194521, 5342431, 5491953, 5643102, 5795897, 5950356, 6106498, 6264339, 6423899, 6585197, 6748251, 6913080, 7079705, 7248144, 7418417, 7590544, 7764545, 7940442, 8118253, 8298001, }; 6 | -------------------------------------------------------------------------------- /LibSource/Interpolator.h: -------------------------------------------------------------------------------- 1 | #ifndef _Interpolator_h_ 2 | #define _Interpolator_h_ 3 | 4 | #include 5 | 6 | class Interpolator { 7 | public: 8 | static float linear(float y1, float y2, float mu){ 9 | return y1 + (y2 - y1) * mu; 10 | } 11 | static float cosine(float y1, float y2, float mu){ 12 | float mu2 = (1-cosf(mu*M_PI))/2; 13 | return y1*(1-mu2)+y2*mu2; 14 | } 15 | /** 16 | * Three-point cubic interpolation of point between y1 and y2 17 | * ref: http://www.ebyte.it/library/codesnippets/P3Interpolation.html 18 | */ 19 | static float cubic(float y0, float y1, float y2, float mu){ 20 | float d1 = 0.5*(y2-y0); 21 | float d2 = y2-y1+y0-y1; 22 | float dx = mu; 23 | return y1 + dx*(d1+0.5*d2*dx); 24 | } 25 | /** 26 | * Four-point cubic interpolation 27 | * Get the interpolated value of a curve described by y0 to y4, 28 | * somewhere between the points y1 and y2. 29 | */ 30 | static float cubic(float y0, float y1, float y2, float y3, float mu) { 31 | float mu2 = mu*mu; 32 | float a0 = y3 - y2 - y0 + y1; 33 | float a1 = y0 - y1 - a0; 34 | float a2 = y2 - y0; 35 | float a3 = y1; 36 | return a0*mu*mu2+a1*mu2+a2*mu+a3; 37 | } 38 | static float cubicSmooth(float y0, float y1, float y2, float y3, float mu) { 39 | // use Catmull-Rom splines: 40 | // take the slope between the previous point and the next as the derivative at the current point 41 | float mu2 = mu*mu; 42 | float a0 = -0.5*y0 + 1.5*y1 - 1.5*y2 + 0.5*y3; 43 | float a1 = y0 - 2.5*y1 + 2*y2 - 0.5*y3; 44 | float a2 = -0.5*y0 + 0.5*y2; 45 | float a3 = y1; 46 | return a0*mu*mu2+a1*mu2+a2*mu+a3; 47 | } 48 | /* 49 | Tension: 1 is high, 0 normal, -1 is low 50 | Bias: 0 is even, 51 | positive is towards first segment, 52 | negative towards the other 53 | */ 54 | static float hermite(float y0, float y1, float y2, float y3, float mu, float tension=0, float bias=0){ 55 | float mu2 = mu * mu; 56 | float mu3 = mu2 * mu; 57 | float m0 = (y1-y0)*(1+bias)*(1-tension)/2; 58 | m0 += (y2-y1)*(1-bias)*(1-tension)/2; 59 | float m1 = (y2-y1)*(1+bias)*(1-tension)/2; 60 | m1 += (y3-y2)*(1-bias)*(1-tension)/2; 61 | float a0 = 2*mu3 - 3*mu2 + 1; 62 | float a1 = mu3 - 2*mu2 + mu; 63 | float a2 = mu3 - mu2; 64 | float a3 = -2*mu3 + 3*mu2; 65 | return(a0*y1+a1*m0+a2*m1+a3*y2); 66 | } 67 | }; 68 | 69 | enum InterpolationMethod { 70 | LINEAR_INTERPOLATION, 71 | COSINE_INTERPOLATION, 72 | CUBIC_3P_INTERPOLATION, 73 | CUBIC_4P_INTERPOLATION, 74 | CUBIC_4P_SMOOTH_INTERPOLATION, 75 | HERMITE_INTERPOLATION 76 | }; 77 | 78 | #endif /* _Interpolator_h_ */ 79 | -------------------------------------------------------------------------------- /LibSource/MidiProcessor.h: -------------------------------------------------------------------------------- 1 | #ifndef __MidiProcessor_h__ 2 | #define __MidiProcessor_h__ 3 | 4 | #include "MidiMessage.h" 5 | 6 | /** 7 | * Base class for MIDI processors such as AbstractSynth. 8 | * Derived classes can overload the specific message handlers, 9 | * and/or the entry-point: process(MidiMessage msg) 10 | */ 11 | class MidiProcessor { 12 | public: 13 | virtual ~MidiProcessor(){} 14 | virtual void noteOn(MidiMessage msg){} 15 | virtual void noteOff(MidiMessage msg){} 16 | virtual void sustain(MidiMessage msg){} 17 | virtual void modulate(MidiMessage msg){} 18 | virtual void pitchbend(MidiMessage msg){} 19 | virtual void controlChange(MidiMessage msg){} 20 | virtual void channelPressure(MidiMessage msg){} 21 | virtual void polyKeyPressure(MidiMessage msg){} 22 | virtual void process(MidiMessage msg) { 23 | if(msg.isNoteOn()) { 24 | noteOn(msg); 25 | }else if(msg.isNoteOff()) { 26 | noteOff(msg); 27 | }else if(msg.isPitchBend()) { 28 | pitchbend(msg); 29 | }else if(msg.isControlChange()) { 30 | controlChange(msg); 31 | }else if(msg.isChannelPressure()) { 32 | channelPressure(msg); 33 | }else if(msg.isChannelPressure()) { 34 | channelPressure(msg); 35 | }else if(msg.isPolyKeyPressure()) { 36 | polyKeyPressure(msg); 37 | } 38 | } 39 | }; 40 | 41 | #endif // __MidiProcessor_h__ 42 | -------------------------------------------------------------------------------- /LibSource/MonochromeScreenPatch.h: -------------------------------------------------------------------------------- 1 | #include "Patch.h" 2 | #include "ScreenBuffer.h" 3 | 4 | #define BLACK 0 5 | #define WHITE 1 6 | 7 | typedef uint8_t Colour; 8 | typedef ScreenBuffer MonochromeScreenBuffer; 9 | 10 | /** 11 | * Abstract base class for patches that use a monochrome screen. 12 | * Compatible OLED drivers: SSD1309 13 | */ 14 | class MonochromeScreenPatch : public Patch { 15 | public: 16 | MonochromeScreenPatch(); 17 | virtual ~MonochromeScreenPatch(); 18 | uint16_t getScreenWidth(); 19 | uint16_t getScreenHeight(); 20 | virtual void processScreen(MonochromeScreenBuffer& screen) = 0; 21 | }; 22 | -------------------------------------------------------------------------------- /LibSource/MonophonicProcessor.h: -------------------------------------------------------------------------------- 1 | #ifndef __MonophonicProcessor_h__ 2 | #define __MonophonicProcessor_h__ 3 | 4 | #include "MidiProcessor.h" 5 | #include "SignalGenerator.h" 6 | #include "VoiceAllocator.h" 7 | 8 | template 9 | class MonophonicProcessor : public VoiceAllocator { 10 | typedef VoiceAllocator Allocator; 11 | protected: 12 | uint8_t notes[16]; 13 | uint8_t lastNote = 0; 14 | public: 15 | MonophonicProcessor() {} 16 | virtual void noteOn(MidiMessage msg){ 17 | if(lastNote < 16) 18 | notes[lastNote++] = msg.getNote(); 19 | Allocator::voice[0]->noteOn(msg); 20 | } 21 | virtual void noteOff(MidiMessage msg){ 22 | uint8_t note = msg.getNote(); 23 | int i; 24 | for(i = 0; i < lastNote; ++i) { 25 | if(notes[i] == note) 26 | break; 27 | } 28 | if(lastNote > 1) { 29 | lastNote--; 30 | while (i < lastNote) { 31 | notes[i] = notes[i + 1]; 32 | i++; 33 | } 34 | Allocator::voice[0]->setNote(notes[lastNote - 1]); 35 | }else{ 36 | if(!Allocator::dosustain) 37 | Allocator::voice[0]->gate(false); 38 | lastNote = 0; 39 | } 40 | } 41 | void allNotesOn() { 42 | Allocator::voice[0]->gate(true); 43 | } 44 | void allNotesOff() { 45 | Allocator::voice[0]->gate(false); 46 | lastNote = 0; 47 | } 48 | virtual void sustainOff(){ 49 | if(lastNote == 0) 50 | Allocator::voice[0]->gate(false); 51 | } 52 | // void sustain(MidiMessage msg){} // todo 53 | void modulate(MidiMessage msg){ 54 | Allocator::voice[0]->modulate(msg); 55 | } 56 | void pitchbend(MidiMessage msg){ 57 | Allocator::voice[0]->pitchbend(msg); 58 | } 59 | }; 60 | 61 | #endif // __MonophonicProcessor_h__ 62 | -------------------------------------------------------------------------------- /LibSource/NoiseOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef NOISE_OSCILLATOR_HPP 2 | #define NOISE_OSCILLATOR_HPP 3 | 4 | #include "Oscillator.h" 5 | 6 | /** 7 | * The NoiseOscillator generates random values in the range [-1, 1] at 8 | * a given frequency. 9 | * It behaves like a white noise generator going into a sample and hold. 10 | */ 11 | class NoiseOscillator : public OscillatorTemplate { 12 | protected: 13 | float sample = 0; 14 | public: 15 | static constexpr float begin_phase = 0; 16 | static constexpr float end_phase = 1; 17 | NoiseOscillator(){} 18 | NoiseOscillator(float sr){ 19 | setSampleRate(sr); 20 | } 21 | float getSample(){ 22 | return sample; 23 | } 24 | float generate() { 25 | phase += incr; 26 | if(phase >= 1){ 27 | sample = randf()*2 - 1; 28 | phase -= 1; 29 | } 30 | return sample; 31 | } 32 | using OscillatorTemplate::generate; 33 | void reset(){ 34 | sample = randf()*2 - 1; 35 | phase = 0; 36 | } 37 | using SignalGenerator::generate; 38 | }; 39 | 40 | #endif /* NOISE_OSCILLATOR_HPP */ 41 | -------------------------------------------------------------------------------- /LibSource/OpenWareLibrary.h: -------------------------------------------------------------------------------- 1 | #ifndef __OpenWareLibrary_h__ 2 | #define __OpenWareLibrary_h__ 3 | 4 | #include "AbstractSynth.h" 5 | #include "AgnesiOscillator.h" 6 | #include "AudioBuffer.h" 7 | #include "BiquadFilter.h" 8 | #include "ChirpOscillator.h" 9 | #include "CircularBuffer.h" 10 | #include "ComplexFloatArray.h" 11 | #include "ComplexFourierTransform.h" 12 | #include "ComplexShortArray.h" 13 | #include "Control.h" 14 | #include "CrossFadingCircularBuffer.h" 15 | #include "DcBlockingFilter.h" 16 | #include "DelayProcessor.h" 17 | #include "DryWetProcessor.h" 18 | #include "Envelope.h" 19 | #include "ExponentialDecayEnvelope.h" 20 | #include "FastFourierTransform.h" 21 | #include "FeedbackProcessor.h" 22 | #include "FractionalCircularBuffer.h" 23 | #include "FirFilter.h" 24 | #include "FloatArray.h" 25 | #include "FloatMatrix.h" 26 | #include "IntArray.h" 27 | #include "Interpolator.h" 28 | #include "InterpolatingCircularBuffer.h" 29 | #include "AdsrEnvelope.h" 30 | #include "MidiProcessor.h" 31 | #include "MidiPolyphonicExpressionProcessor.h" 32 | #include "MidiStatus.h" 33 | #include "MorphingOscillator.h" 34 | #include "MonophonicProcessor.h" 35 | #include "NoiseGenerator.h" 36 | #include "NoiseOscillator.h" 37 | #include "OpenWareMidiControl.h" 38 | #include "Oscillator.h" 39 | #include "Patch.h" 40 | #include "PatchParameter.h" 41 | #include "PitchDetector.h" 42 | #include "PolyBlepOscillator.h" 43 | #include "PolyphonicProcessor.h" 44 | #include "RampOscillator.h" 45 | #include "Resample.h" 46 | #include "Resource.h" 47 | #include "SampleOscillator.h" 48 | #include "ShortArray.h" 49 | #include "ShortFastFourierTransform.h" 50 | #include "SignalGenerator.h" 51 | #include "SignalProcessor.h" 52 | #include "SineOscillator.h" 53 | #include "SmoothValue.h" 54 | #include "SmoothingFilter.h" 55 | #include "StateVariableFilter.h" 56 | #include "SquareWaveOscillator.h" 57 | #include "Synth.h" 58 | #include "TapTempo.h" 59 | #include "TriangleOscillator.h" 60 | #include "VariableShapeOscillator.h" 61 | #include "VoltsPerOctave.h" 62 | #include "VelocityCurve.h" 63 | #include "VosimOscillator.h" 64 | #include "WavFile.h" 65 | #include "WavetableOscillator.h" 66 | #include "Window.h" 67 | 68 | #endif /* __OpenWareLibrary_h__ */ 69 | -------------------------------------------------------------------------------- /LibSource/PatchParameter.cpp: -------------------------------------------------------------------------------- 1 | #include "PatchParameter.h" 2 | #include "PatchProcessor.h" 3 | #include "SmoothValue.h" 4 | #include "message.h" 5 | 6 | PatchProcessor* getInitialisingPatchProcessor(); 7 | 8 | #define PATCH_PARAMETER_NO_PID -1 9 | 10 | template 11 | PatchParameter::PatchParameter() : pid(PATCH_PARAMETER_NO_PID){} 12 | 13 | // copy ctors: superceded by assignment operators 14 | /* PatchParameter(PatchParameter& other); */ 15 | /* PatchParameter(const PatchParameter& other); */ 16 | 17 | // template 18 | // PatchParameter::PatchParameter(PatchParameter& other) : 19 | // pid(other.pid), value(other.value) { 20 | // // copy ctor 21 | // // register for update callback in copy constructor 22 | // if(pid != PATCH_PARAMETER_NO_PID) 23 | // getInitialisingPatchProcessor()->setPatchParameter(pid, this); 24 | // } 25 | 26 | // template 27 | // PatchParameter::PatchParameter(const PatchParameter& other) : 28 | // pid(other.pid), value(other.value) { 29 | // // copy ctor 30 | // // register for update callback in copy constructor 31 | // if(pid != PATCH_PARAMETER_NO_PID) 32 | // getInitialisingPatchProcessor()->setPatchParameter(pid, this); 33 | // } 34 | 35 | template 36 | PatchParameter& PatchParameter::operator=(const PatchParameter& other){ 37 | pid = other.pid; 38 | value = other.value; 39 | if(pid != PATCH_PARAMETER_NO_PID) 40 | getInitialisingPatchProcessor()->setPatchParameter(pid, this); 41 | return *this; 42 | } 43 | 44 | template class PatchParameter; 45 | template class PatchParameter; 46 | -------------------------------------------------------------------------------- /LibSource/PatchParameter.h: -------------------------------------------------------------------------------- 1 | #ifndef __PatchParameter_h__ 2 | #define __PatchParameter_h__ 3 | 4 | template 5 | class PatchParameter { 6 | private: 7 | int pid; 8 | T value; 9 | public: 10 | PatchParameter(); 11 | PatchParameter(int parameterId) : pid(parameterId){} 12 | /* assignment operator */ 13 | PatchParameter& operator=( const PatchParameter& other ); 14 | void update(T newValue){ 15 | value = newValue; 16 | } 17 | T getValue(){ 18 | return value; 19 | } 20 | operator T(){ 21 | return getValue(); 22 | } 23 | }; 24 | 25 | typedef PatchParameter FloatParameter; 26 | typedef PatchParameter IntParameter; 27 | 28 | #endif /* __PatchParameter_h__ */ 29 | -------------------------------------------------------------------------------- /LibSource/PolyBlepOscillator.cpp: -------------------------------------------------------------------------------- 1 | #include "PolyBlepOscillator.h" 2 | #include "basicmaths.h" 3 | 4 | PolyBlepOscillator::PolyBlepOscillator(float sr): 5 | mul(1.0f/sr), 6 | nfreq(0.0f), 7 | shape(0.5f), 8 | pw(0.5f) { 9 | osc.Init(); 10 | } 11 | 12 | PolyBlepOscillator::PolyBlepOscillator(float freq, float sr): 13 | mul(1.0f/sr), 14 | shape(0.5f), 15 | pw(0.5f) { 16 | setFrequency(freq); 17 | osc.Init(); 18 | } 19 | 20 | void PolyBlepOscillator::setSampleRate(float sr){ 21 | mul = 1.0f/sr; 22 | } 23 | 24 | float PolyBlepOscillator::getSampleRate(){ 25 | return 1.0f/mul; 26 | } 27 | 28 | void PolyBlepOscillator::setFrequency(float freq){ 29 | nfreq = mul*freq; 30 | } 31 | 32 | float PolyBlepOscillator::getFrequency(){ 33 | return nfreq/mul; 34 | } 35 | 36 | void PolyBlepOscillator::setShape(float value){ 37 | shape = value; 38 | } 39 | 40 | float PolyBlepOscillator::getShape(){ 41 | return shape; 42 | } 43 | 44 | void PolyBlepOscillator::setPulseWidth(float value){ 45 | pw = value; 46 | } 47 | 48 | float PolyBlepOscillator::getPulseWidth(){ 49 | return pw; 50 | } 51 | 52 | float PolyBlepOscillator::getPhase(){ 53 | return osc.getMasterPhase()*2*M_PI; 54 | } 55 | 56 | void PolyBlepOscillator::setPhase(float phase){ 57 | osc.setMasterPhase(phase/(2*M_PI)); 58 | } 59 | 60 | float PolyBlepOscillator::generate(){ 61 | float sample; 62 | osc.Render(nfreq, pw, shape, &sample, 1); 63 | return sample; 64 | } 65 | 66 | float PolyBlepOscillator::generate(float fm){ 67 | float sample; 68 | osc.Render(nfreq*(1+fm), pw, shape, &sample, 1); 69 | return sample; 70 | } 71 | 72 | void PolyBlepOscillator::generate(FloatArray output){ 73 | osc.Render(nfreq, pw, shape, output, output.getSize()); 74 | } 75 | 76 | void PolyBlepOscillator::generate(FloatArray output, FloatArray fm){ 77 | output.copyFrom(fm); 78 | output.multiply(nfreq); // scale by base frequency 79 | output.add(nfreq); // add base frequency : freq = nfreq + nfreq*fm 80 | osc.Render(output, pw, shape, output, output.getSize()); 81 | } 82 | 83 | void PolyBlepOscillator::getSamples(FloatArray output, FloatArray freqs){ 84 | freqs.multiply(mul); // normalise frequencies 85 | osc.Render(freqs, pw, shape, output, output.getSize()); 86 | } 87 | 88 | PolyBlepOscillator* PolyBlepOscillator::create(float sr){ 89 | return new PolyBlepOscillator(sr); 90 | } 91 | 92 | PolyBlepOscillator* PolyBlepOscillator::create(float freq, float sr){ 93 | return new PolyBlepOscillator(freq, sr); 94 | } 95 | 96 | void PolyBlepOscillator::destroy(PolyBlepOscillator* osc){ 97 | delete osc; 98 | } 99 | -------------------------------------------------------------------------------- /LibSource/PolyBlepOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __PolyBlepOscillator_h__ 2 | #define __PolyBlepOscillator_h__ 3 | 4 | #include "FloatArray.h" 5 | #include "polyblep/dsp/oscillator.h" 6 | #include "Oscillator.h" 7 | 8 | class PolyBlepOscillator : public Oscillator { 9 | private: 10 | float mul; 11 | stmlib::Oscillator osc; 12 | float nfreq, shape, pw; 13 | public: 14 | PolyBlepOscillator(float sr=48000); 15 | PolyBlepOscillator(float freq, float sr); 16 | void setSampleRate(float sr); 17 | float getSampleRate(); 18 | void setFrequency(float freq); 19 | float getFrequency(); 20 | /** set waveform shape: 0.0 for saw, 1.0 for square wave */ 21 | void setShape(float value); 22 | float getShape(); 23 | /** set square wave pulse width: 0.0 to 1.0 for 0% to 100% */ 24 | void setPulseWidth(float value); 25 | float getPulseWidth(); 26 | void setPhase(float phase); 27 | float getPhase(); 28 | void reset(){ 29 | setPhase(0); 30 | } 31 | float generate(); 32 | float generate(float fm); 33 | /* put a block of output samples into @param output */ 34 | void generate(FloatArray output); 35 | /* put a block of output samples into @param output, frequency modulated by @param fm */ 36 | void generate(FloatArray output, FloatArray fm); 37 | /* put a block of output samples into @param samples, 38 | with frequency determined by samples in @param frequency */ 39 | void getSamples(FloatArray output, FloatArray freq); 40 | static PolyBlepOscillator* create(float sr); 41 | static PolyBlepOscillator* create(float freq, float sr); 42 | static void destroy(PolyBlepOscillator* osc); 43 | }; 44 | 45 | #endif /* __PolyBlepOscillator_h__ */ 46 | -------------------------------------------------------------------------------- /LibSource/RampOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __RampOscillator_h 2 | #define __RampOscillator_h 3 | 4 | #include "Oscillator.h" 5 | 6 | /** 7 | * Ramp oscillator generates rising output values from -1 to 1. 8 | */ 9 | class RampOscillator : public OscillatorTemplate { 10 | public: 11 | static constexpr float begin_phase = -1; 12 | static constexpr float end_phase = 1; 13 | RampOscillator(){} 14 | RampOscillator(float sr){ 15 | setSampleRate(sr); 16 | } 17 | float getSample(){ 18 | return phase; 19 | } 20 | }; 21 | 22 | /** 23 | * Inverted ramp oscillator generates falling output values from 1 to -1. 24 | */ 25 | class InvertedRampOscillator : public OscillatorTemplate { 26 | public: 27 | static constexpr float begin_phase = -1; 28 | static constexpr float end_phase = 1; 29 | InvertedRampOscillator(){} 30 | InvertedRampOscillator(float sr){ 31 | setSampleRate(sr); 32 | } 33 | float getSample(){ 34 | return -phase; 35 | } 36 | }; 37 | 38 | class AntialiasedRampOscillator : public OscillatorTemplate { 39 | protected: 40 | float lastblep; 41 | public: 42 | static constexpr float begin_phase = 0; 43 | static constexpr float end_phase = 1; 44 | AntialiasedRampOscillator(){} 45 | AntialiasedRampOscillator(float sr){ 46 | setSampleRate(sr); 47 | } 48 | void setPhase(float ph){ 49 | lastblep = 0; 50 | OscillatorTemplate::setPhase(ph); 51 | } 52 | void reset(){ 53 | lastblep = 0; 54 | OscillatorTemplate::reset(); 55 | } 56 | float getSample(){ 57 | float sample = 2*phase-1; // naive ramp 58 | sample -= polyblep(phase, incr); 59 | return sample; 60 | } 61 | /** 62 | * Note: mixing sample based and block based generate() calls is not supported 63 | * by this class. 64 | */ 65 | void generate(FloatArray output){ 66 | size_t len = output.getSize(); 67 | float blep = lastblep; 68 | for(size_t i=0; i= 1){ 73 | // wrap phase 74 | phase -= 1; 75 | // correct current sample 76 | float t = (phase - incr) / incr; 77 | sample -= t*t + t+t + 1; 78 | // correct next sample 79 | t = phase / incr; 80 | blep = t+t - t*t - 1; 81 | }else{ 82 | blep = 0; 83 | } 84 | output[i] = sample; 85 | } 86 | lastblep = blep; // carry over polyblep correction 87 | } 88 | using OscillatorTemplate::generate; 89 | }; 90 | 91 | #endif /* __RampOscillator_h */ 92 | -------------------------------------------------------------------------------- /LibSource/Resource.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Resource.h" 4 | #include "OpenWareMidiControl.h" 5 | #include "ServiceCall.h" 6 | #include "ProgramVector.h" 7 | 8 | template 9 | Array Resource::asArray(size_t offset, size_t max_size) { 10 | // Data is expected to be aligned 11 | if (max_size > size - offset) 12 | max_size = size - offset; 13 | return Array((Element*)(data + offset), max_size / sizeof(Element)); 14 | } 15 | 16 | template FloatArray Resource::asArray(size_t offset, size_t max_size); 17 | 18 | void Resource::destroy(Resource* resource) { 19 | if(resource && resource->allocated) 20 | delete[] resource->data; 21 | delete resource; 22 | } 23 | 24 | Resource* Resource::open(const char* name){ 25 | uint8_t* data = NULL; 26 | size_t offset = 0; 27 | size_t size = 0; 28 | void* args[] = { 29 | (void*)name, (void*)&data, (void*)&offset, (void*)&size 30 | }; 31 | if(getProgramVector()->serviceCall(OWL_SERVICE_LOAD_RESOURCE, args, 4) == OWL_SERVICE_OK) 32 | return new Resource(name, size, data); 33 | return NULL; 34 | } 35 | 36 | Resource* Resource::load(const char* name){ 37 | Resource* resource = Resource::open(name); 38 | if(resource && !resource->hasData()){ 39 | size_t offset = 0; 40 | size_t size = resource->size; 41 | uint8_t* data = new uint8_t[size]; 42 | void* args[] = { 43 | (void*)name, (void*)&data, (void*)&offset, (void*)&size 44 | }; 45 | if (getProgramVector()->serviceCall(OWL_SERVICE_LOAD_RESOURCE, args, 4) == OWL_SERVICE_OK){ 46 | resource->data = data; 47 | resource->size = size; 48 | resource->allocated = true; 49 | }else{ 50 | resource->size = 0; 51 | delete[] data; 52 | } 53 | } 54 | return resource; 55 | } 56 | 57 | size_t Resource::read(void* dest, size_t len, size_t offset){ 58 | if(this->data == NULL){ 59 | void* args[] = { 60 | (void*)this->name, (void*)&dest, (void*)&offset, (void*)&len 61 | }; 62 | if (getProgramVector()->serviceCall(OWL_SERVICE_LOAD_RESOURCE, args, 4) == OWL_SERVICE_OK){ 63 | return len; 64 | }else{ 65 | return 0; 66 | } 67 | }else{ 68 | len = std::min(this->size-offset, len); 69 | memcpy(dest, (uint8_t*)this->data+offset, len); 70 | return len; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /LibSource/Resource.h: -------------------------------------------------------------------------------- 1 | #ifndef __RESOURCE_STORAGE_H__ 2 | #define __RESOURCE_STORAGE_H__ 3 | 4 | #include 5 | #include 6 | #include "FloatArray.h" 7 | 8 | class Resource { 9 | public: 10 | /** 11 | * Check if data is available 12 | */ 13 | bool hasData() const { 14 | return data != NULL; 15 | } 16 | 17 | /** 18 | * Get pointer to data. This may be NULL if no buffer is assigned yet. 19 | */ 20 | void* getData() { 21 | return data; 22 | } 23 | 24 | /** 25 | * Get buffer size in bytes 26 | */ 27 | size_t getSize() const { 28 | return size; 29 | } 30 | 31 | bool exists() const { 32 | return size != 0; 33 | } 34 | 35 | bool isMutable() const { 36 | return allocated; 37 | } 38 | 39 | /** 40 | * Get resource name 41 | */ 42 | const char* getName() const { 43 | return name; 44 | } 45 | 46 | /** 47 | * Array conversion. 48 | * 49 | * @param offset: offset in bytes 50 | * @param max_size maximum size, actual size can be smaller depending on object size 51 | */ 52 | template 53 | Array asArray(size_t offset = 0, size_t max_size = 0xFFFFFFFF); 54 | 55 | FloatArray asFloatArray(size_t offset = 0, size_t max_size = 0xFFFFFFFF){ 56 | return asArray(offset, max_size); 57 | } 58 | 59 | /** 60 | * Get resource from storage. 61 | * Returned object must be garbage collected with Resource::destroy() 62 | * 63 | * @param name resource name 64 | * @return NULL if resource does not exist or can't be read. 65 | */ 66 | static Resource* open(const char* name); 67 | 68 | /** 69 | * Open resource and load data. 70 | * Allocates extra memory to hold the resource if required. 71 | * Returned object must be garbage collected with Resource::destroy() 72 | * 73 | * @param name resource name 74 | * @return NULL if resource does not exist or can't be read. 75 | */ 76 | static Resource* load(const char* name); 77 | 78 | /** 79 | * Clean up used memory resources. 80 | */ 81 | static void destroy(Resource* resource); 82 | 83 | /** 84 | * Read data from resource into memory 85 | * 86 | * @param len maximum number of bytes to read 87 | * @param offset index of first byte to read from 88 | * 89 | * @return number of bytes actually read 90 | */ 91 | size_t read(void* dest, size_t len, size_t offset=0); 92 | 93 | Resource(): name(NULL), size(0), data(NULL), allocated(false) {} 94 | ~Resource(){} 95 | protected: 96 | Resource(const char* name, size_t size, void* data) 97 | : name(name), size(size), data((uint8_t*)data), allocated(false) {} 98 | const char* name; 99 | size_t size; 100 | uint8_t* data; 101 | bool allocated; 102 | }; 103 | #endif 104 | -------------------------------------------------------------------------------- /LibSource/SignalGenerator.h: -------------------------------------------------------------------------------- 1 | #ifndef __SignalGenerator_h__ 2 | #define __SignalGenerator_h__ 3 | 4 | #include "FloatArray.h" 5 | #include "ComplexFloatArray.h" 6 | #include "AudioBuffer.h" 7 | 8 | /** 9 | * Base class for signal generators such as Oscillators. 10 | * A SignalGenerator produces samples from -1 to 1 unless 11 | * otherwise stated. 12 | */ 13 | class SignalGenerator { 14 | public: 15 | virtual ~SignalGenerator(){} 16 | /** 17 | * Produce the next consecutive sample. 18 | */ 19 | virtual float generate(){ 20 | return 0; 21 | } 22 | /** 23 | * Produce a block of samples 24 | */ 25 | virtual void generate(FloatArray output){ 26 | for(size_t i=0; i { 7 | public: 8 | static constexpr float begin_phase = 0; 9 | static constexpr float end_phase = 2*M_PI; 10 | SineOscillator(){} 11 | SineOscillator(float sr){ 12 | setSampleRate(sr); 13 | } 14 | float getSample(){ 15 | return sinf(phase); 16 | } 17 | void generate(FloatArray output){ 18 | size_t len = output.getSize(); 19 | for(size_t i=0; i::generate; 35 | }; 36 | 37 | #endif /* SINE_OSCILLATOR_H */ 38 | -------------------------------------------------------------------------------- /LibSource/SmoothValue.cpp: -------------------------------------------------------------------------------- 1 | #include "SmoothValue.h" 2 | #include "basicmaths.h" 3 | 4 | template<> 5 | SmoothFloat::SmoothValue() 6 | : value(0.0), lambda(0.9) {} 7 | 8 | template<> 9 | SmoothFloat::SmoothValue(float l) 10 | : value(0.0), lambda(l) {} 11 | 12 | template<> 13 | SmoothFloat::SmoothValue(float l, float initialValue) 14 | : value(initialValue), lambda(l) {} 15 | 16 | template<> 17 | SmoothInt::SmoothValue(int divider) 18 | : value(0), lambda(divider) { 19 | // lambda = 1 - 1/divider 20 | // divider 4:0.75, 5:0.8, 6:0.833, 7:0.857, 8:0.875, 9:0.888, 10:0.9 et c 21 | } 22 | 23 | template<> 24 | SmoothInt::SmoothValue(int divider, int initialValue) 25 | : value(initialValue), lambda(divider) {} 26 | 27 | template<> 28 | void SmoothFloat::update(float newValue){ 29 | value = value*lambda + newValue*(1.0f - lambda); 30 | } 31 | 32 | template<> 33 | void SmoothInt::update(int newValue){ 34 | value = (value*lambda + newValue)/(lambda+1); 35 | } 36 | 37 | template<> 38 | void SmoothStiffFloat::update(float newValue){ 39 | if(abs(value-newValue) >= delta) 40 | value = value*lambda + newValue*(1.0f - lambda); 41 | } 42 | 43 | template<> 44 | void SmoothStiffInt::update(int newValue){ 45 | if(abs(value-newValue) >= delta) 46 | value = (value*lambda + newValue)/(lambda+1); 47 | } 48 | 49 | template<> 50 | float SmoothValue::normal(float lambda, int blocksize){ 51 | return lambda*128.0f/blocksize; 52 | } 53 | 54 | template<> 55 | int SmoothValue::normal(float lambda, int blocksize){ 56 | return (1.0f/(1.0-lambda))*128.0f/blocksize; 57 | } 58 | 59 | template<> 60 | float StiffValue::normal(float delta){ 61 | return delta; 62 | } 63 | 64 | template<> 65 | int StiffValue::normal(float delta){ 66 | return delta; 67 | } 68 | 69 | template class SmoothValue; 70 | template class SmoothValue; 71 | template class SmoothStiffValue; 72 | template class SmoothStiffValue; 73 | -------------------------------------------------------------------------------- /LibSource/SmoothingFilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __SmoothingFilter_h__ 2 | #define __SmoothingFilter_h__ 3 | 4 | #include "FloatArray.h" 5 | #include "SignalProcessor.h" 6 | 7 | /** 8 | * AC Blocking IIR filter, the Leaky Integrator. Used for signal smoothing. 9 | */ 10 | class SmoothingFilter : public SignalProcessor { 11 | private: 12 | const float lambda; 13 | float y; 14 | public: 15 | SmoothingFilter(float lambda = 0.995): lambda(lambda), y(0) {} 16 | 17 | /* process a single sample and return the result */ 18 | float process(float x){ 19 | y = y*lambda + x*(1.0f - lambda); 20 | return y; 21 | } 22 | 23 | void process(float* input, float* output, size_t size){ 24 | float x; 25 | while(size--){ 26 | x = *input++; 27 | y = y*lambda + x*(1.0f - lambda); 28 | *output++ = y; 29 | } 30 | } 31 | 32 | /* perform in-place processing */ 33 | void process(float* buf, int size){ 34 | process(buf, buf, size); 35 | } 36 | 37 | void process(FloatArray in){ 38 | process(in, in, in.getSize()); 39 | } 40 | 41 | void process(FloatArray in, FloatArray out){ 42 | ASSERT(out.getSize() >= in.getSize(), "output array must be at least as long as input"); 43 | process(in, out, in.getSize()); 44 | } 45 | 46 | static SmoothingFilter* create(float lambda){ 47 | return new SmoothingFilter(lambda); 48 | } 49 | 50 | static void destroy(SmoothingFilter* obj){ 51 | delete obj; 52 | } 53 | }; 54 | 55 | class StereoSmoothingFilter : public MultiSignalProcessor { 56 | private: 57 | SmoothingFilter left, right; 58 | public: 59 | StereoSmoothingFilter(float lambda = 0.995): left(lambda), right(lambda) {} 60 | void process(AudioBuffer& input, AudioBuffer& output){ 61 | left.process(input.getSamples(LEFT_CHANNEL), output.getSamples(LEFT_CHANNEL)); 62 | right.process(input.getSamples(RIGHT_CHANNEL), output.getSamples(RIGHT_CHANNEL)); 63 | } 64 | 65 | static StereoSmoothingFilter* create(float lambda){ 66 | return new StereoSmoothingFilter(lambda); 67 | } 68 | 69 | static void destroy(StereoSmoothingFilter* obj){ 70 | delete obj; 71 | } 72 | }; 73 | 74 | #endif // __SmoothingFilter_h__ 75 | -------------------------------------------------------------------------------- /LibSource/SquareOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __SquareOscillator_h 2 | #define __SquareOscillator_h 3 | 4 | #include "SquareWaveOscillator.h" 5 | 6 | #warning "SquareOscillator.h is deprecated, use SquareWaveOscillator.h instead" 7 | 8 | typedef SquareWaveOscillator SquareOscillator; 9 | typedef InvertedSquareWaveOscillator InvertedSquareOscillator; 10 | typedef AntialiasedSquareWaveOscillator AntialiasedSquareOscillator; 11 | 12 | #endif /* __SquareOscillator_h */ 13 | -------------------------------------------------------------------------------- /LibSource/StompBox.h: -------------------------------------------------------------------------------- 1 | #ifndef __StompBox_h__ 2 | #define __StompBox_h__ 3 | 4 | /* #warning The file StompBox.h is deprecated, please use Patch.h instead */ 5 | #include "Patch.h" 6 | 7 | #endif // __StompBox_h__ 8 | -------------------------------------------------------------------------------- /LibSource/Synth.h: -------------------------------------------------------------------------------- 1 | #ifndef __Synth_h__ 2 | #define __Synth_h__ 3 | 4 | #include 5 | 6 | class Synth { 7 | public: 8 | virtual ~Synth(){} 9 | virtual void setFrequency(float freq) = 0; 10 | virtual void setGain(float gain) = 0; 11 | virtual void gate(bool state) = 0; 12 | virtual void trigger() = 0; 13 | /** 14 | * Set a Synth parameter. The definition of each parameter is determined by the Synth. 15 | */ 16 | virtual void setParameter(uint8_t parameter_id, float value){} 17 | }; 18 | 19 | #endif // __Synth_h__ 20 | -------------------------------------------------------------------------------- /LibSource/TemplatePatch.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 4 | LICENSE: 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | 21 | /* created by the OWL team 2013 */ 22 | 23 | #ifndef __TemplatePatch_hpp__ 24 | #define __TemplatePatch_hpp__ 25 | 26 | #include "OpenWareLibrary.h" 27 | 28 | class TemplatePatch : public Patch { 29 | public: 30 | TemplatePatch(){ 31 | registerParameter(PARAMETER_A, "My Knob A"); 32 | registerParameter(PARAMETER_B, "My Knob B"); 33 | registerParameter(PARAMETER_C, "My Knob C"); 34 | registerParameter(PARAMETER_D, "My Knob D"); 35 | } 36 | void processAudio(AudioBuffer &buffer){ 37 | // put your code here! 38 | } 39 | }; 40 | 41 | #endif // __TemplatePatch_hpp__ 42 | -------------------------------------------------------------------------------- /LibSource/TriangleOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __TriangleOscillator_h 2 | #define __TriangleOscillator_h 3 | 4 | #include "Oscillator.h" 5 | 6 | class TriangleOscillator : public OscillatorTemplate { 7 | public: 8 | static constexpr float begin_phase = -1; 9 | static constexpr float end_phase = 1; 10 | TriangleOscillator(){} 11 | TriangleOscillator(float sr){ 12 | setSampleRate(sr); 13 | } 14 | float getSample(){ 15 | return -2 * (fabsf(phase) - 0.5); 16 | } 17 | }; 18 | 19 | class AntialiasedTriangleOscillator : public OscillatorTemplate { 20 | protected: 21 | float previousSample = 0; 22 | public: 23 | static constexpr float begin_phase = 0; 24 | static constexpr float end_phase = 1; 25 | float getSample(){ 26 | float sample = phase < 0.5f ? 1 : -1; // naive square wave 27 | sample += polyblep(phase, incr); 28 | sample -= polyblep(fmod(phase + 0.5f, 1), incr); // polyblep square wave 29 | // Leaky integrator: y[n] = A * x[n] + (1 - A) * y[n-1] = A * (x[n] - y[n-1]) + y[n-1] 30 | float lambda = incr*2*M_PI; 31 | sample = lambda * (sample - previousSample) + previousSample; 32 | previousSample = sample; 33 | return sample; 34 | } 35 | }; 36 | 37 | #endif /* __TriangleOscillator_h */ 38 | -------------------------------------------------------------------------------- /LibSource/VariableShapeOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __VariableShapeOscillator_h 2 | #define __VariableShapeOscillator_h 3 | 4 | #include "Oscillator.h" 5 | 6 | /** 7 | * Oscillator with a waveshape that is variable from saw to square, with adjustable pulse width 8 | */ 9 | class VariableShapeOscillator : public OscillatorTemplate { 10 | protected: 11 | float waveshape = 0; 12 | float pw = 0.5f; 13 | public: 14 | static constexpr float begin_phase = 0; 15 | static constexpr float end_phase = 1; 16 | /** 17 | * Set pulse width to a value between 0 (for saw) and 1 (for square) 18 | */ 19 | void setWaveshape(float value){ 20 | waveshape = value; 21 | } 22 | /** 23 | * Set pulse width to a value between 0 and 1 24 | */ 25 | void setPulseWidth(float value){ 26 | pw = value; 27 | } 28 | float getSample(){ 29 | float square = phase < pw ? 0 : 1; 30 | float saw = phase; 31 | float sample = saw + (square - saw) * waveshape; 32 | return sample * 2 - 1; 33 | } 34 | }; 35 | 36 | #endif /* __VariableShapeOscillator_h */ 37 | -------------------------------------------------------------------------------- /LibSource/VelocityCurve.h: -------------------------------------------------------------------------------- 1 | #ifndef __VelocityCurve_h__ 2 | #define __VelocityCurve_h__ 3 | 4 | #include "basicmaths.h" 5 | 6 | /** 7 | * General MIDI DLS Level 1 Specification: 8 | * The MIDI Note Velocity value is converted to attenuation in dB by the Concave Transform 9 | * attenuation = 20*log10(127^2/velocity^2) 10 | * so gain = velocity^2/127^2 11 | * Adjustable for dynamic range. 12 | * ref: https://www.cs.cmu.edu/~rbd/papers/velocity-icmc2006.pdf 13 | */ 14 | class VelocityCurve { 15 | private: 16 | // defaults for 72dB range: r=10^(72/20), b=127/(126*sqrt(r)) - 1/126, m=(1-b)/127 17 | float b = 0.00803821f; 18 | float m = 0.00781072f; 19 | public: 20 | void setDynamicRange(float db){ 21 | float r = exp10f(db/20); 22 | b = 127/(126*sqrtf(r)) - 1.0f/126; 23 | m = (1-b)/127; 24 | } 25 | float velocityToGain(float v){ 26 | /* a = peak RMS value, v is velocity */ 27 | /* a = (m*v+b)^2 */ 28 | float root = m*v+b; 29 | return root*root; 30 | } 31 | }; 32 | 33 | #endif // __VelocityCurve_h__ 34 | -------------------------------------------------------------------------------- /LibSource/VoltsPerOctave.cpp: -------------------------------------------------------------------------------- 1 | #include "VoltsPerOctave.h" 2 | #include "message.h" 3 | #include "ProgramVector.h" 4 | #include "ServiceCall.h" 5 | #include 6 | 7 | VoltsPerOctave::VoltsPerOctave(float o, float m) 8 | : tune(0.0), offset(o), multiplier(m) { 9 | } 10 | 11 | VoltsPerOctave::VoltsPerOctave(bool input) : tune(0.0) { 12 | int32_t volts_offset = 0, volts_scalar = 0; 13 | void* args[] = { 14 | (void*)(input ? "IO" : "OO"), (void*)&volts_offset, 15 | (void*)(input ? "IS" : "OS"), (void*)&volts_scalar 16 | }; 17 | int ret = getProgramVector()->serviceCall(OWL_SERVICE_GET_PARAMETERS, args, 4); 18 | if(ret == OWL_SERVICE_OK){ 19 | multiplier = (float)volts_scalar/UINT16_MAX; 20 | offset = (float)volts_offset/UINT16_MAX; 21 | }else{ 22 | if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE){ 23 | if(input){ 24 | multiplier = -4.29; 25 | offset = -0.06382; 26 | }else{ 27 | multiplier = -4.642; 28 | offset = 0.1208; 29 | } 30 | }else{ 31 | multiplier = 2.0f; 32 | offset = 0.0f; 33 | } 34 | } 35 | } 36 | 37 | void VoltsPerOctave::getFrequency(FloatArray samples, FloatArray output){ 38 | ASSERT(output.getSize() >= samples.getSize(), "Output buffer too short"); 39 | // Block based implementation - this is giving ~1% higher CPU usage, tested on Magus 40 | /* 41 | output.copyFrom(samples); 42 | output.subtract(offset); 43 | output.multiply(multiplier); 44 | output.add(tune); 45 | for(size_t i = 0; i < samples.getSize(); ++i) 46 | output[i] = exp2f(output[i]); 47 | output.multiply(440.f); 48 | */ 49 | 50 | // Sample by sample processing 51 | for(size_t i=0; i= frequencies.getSize(), "Output buffer too short"); 61 | // Block based implementation - this gives the same CPU load as sample 62 | // by sample processing, so probably no reason to use it 63 | /* 64 | for (size_t i = 0; i < output.getSize(); i++) 65 | //output[i] = tune - hertzToVolts(output[i]); 66 | output[i] = log2f(output[i]); 67 | output.add(tune - log2f(440.0f)); 68 | output.multiply(1.0f / multiplier); 69 | output.add(offset); 70 | */ 71 | 72 | // Sample by sample processing 73 | for(size_t i=0; i < frequencies.getSize(); ++i) 74 | output[i] = getSample(frequencies[i]); 75 | } 76 | void VoltsPerOctave::getSample(FloatArray frequencies){ 77 | getSample(frequencies, frequencies); 78 | } 79 | -------------------------------------------------------------------------------- /LibSource/VoltsPerOctave.h: -------------------------------------------------------------------------------- 1 | #ifndef __VoltsPerOctave_hpp__ 2 | #define __VoltsPerOctave_hpp__ 3 | 4 | #include "FloatArray.h" 5 | #include "basicmaths.h" 6 | 7 | /* 8 | * Converts samples into volts and frequencies, following 1V/octave tuning. 9 | * Tuned to 440Hz. Change base note with setTune(float octave). 10 | */ 11 | class VoltsPerOctave { 12 | private: 13 | float tune; 14 | public: 15 | float offset; 16 | float multiplier; 17 | VoltsPerOctave(bool input = true); 18 | VoltsPerOctave(float offset, float multiplier); 19 | // Tune the frequency converter to octaves up or down. 20 | // For semitones divide by 12. For cents divide by 1200. 21 | void setTune(float octaves){ 22 | tune = octaves; 23 | } 24 | void setMidiNote(float note){ 25 | tune = (note-69)/12.0f; // 440Hz == A4 == MIDI Note 69 26 | } 27 | float getFrequency(float sample){ 28 | return voltsToHertz(sampleToVolts(sample) + tune); 29 | } 30 | float getSample(float frequency){ 31 | return voltsToSample(hertzToVolts(frequency) + tune); 32 | } 33 | float sampleToVolts(float sample){ 34 | return (sample-offset) * multiplier; 35 | } 36 | static float voltsToHertz(float volts){ 37 | return 440.f * exp2f(volts); 38 | } 39 | static float hertzToNote(float freq){ 40 | return 12 * log2f(freq/440.f) + 69; 41 | } 42 | static float noteToHertz(float note){ 43 | return 440.0f * exp2f((note - 69) / 12); 44 | } 45 | float voltsToSample(float volts){ 46 | return volts / multiplier + offset; 47 | } 48 | static float hertzToVolts(float hertz){ 49 | return log2f(hertz/440.0f); 50 | } 51 | void getFrequency(FloatArray samples, FloatArray output); 52 | void getFrequency(FloatArray samples); 53 | void getSample(FloatArray frequencies, FloatArray output); 54 | void getSample(FloatArray frequencies); 55 | }; 56 | 57 | #endif /* __VoltsPerOctave_hpp__ */ 58 | -------------------------------------------------------------------------------- /LibSource/WavetableOscillator.cpp: -------------------------------------------------------------------------------- 1 | #include "WavetableOscillator.h" 2 | #include 3 | 4 | WavetableOscillator::WavetableOscillator(float sr, const FloatArray wavetable): 5 | mul(1.0f/sr), 6 | wave(wavetable), 7 | acc(0.0f), inc(0.1f) 8 | {} 9 | 10 | void WavetableOscillator::setSampleRate(float sr){ 11 | mul = 1.0f/sr; 12 | } 13 | 14 | float WavetableOscillator::getSampleRate(){ 15 | return 1.0f/mul; 16 | } 17 | 18 | void WavetableOscillator::setFrequency(float freq){ 19 | inc = freq*mul; 20 | } 21 | 22 | float WavetableOscillator::getFrequency(){ 23 | return inc/mul; 24 | } 25 | 26 | float WavetableOscillator::getSample(float phase){ 27 | uint32_t size = wave.getSize(); 28 | uint32_t index = phase*(size-1); 29 | index = min(index, size-1); 30 | return wave[index]; 31 | } 32 | 33 | void WavetableOscillator::setPhase(float phase){ 34 | acc = phase/(2*M_PI); 35 | } 36 | 37 | float WavetableOscillator::getPhase(){ 38 | return acc*2*M_PI; 39 | } 40 | 41 | float WavetableOscillator::generate(){ 42 | float s = getSample(acc); 43 | acc += inc; 44 | if(acc >= 1.0f) 45 | acc -= 1.0f; 46 | return s; 47 | } 48 | 49 | float WavetableOscillator::generate(float fm){ 50 | float s = getSample(acc); 51 | acc += inc * (1 + fm); 52 | if(acc > 1.0f) 53 | acc -= 1.0f; 54 | return s; 55 | } 56 | 57 | void WavetableOscillator::generate(FloatArray samples){ 58 | for(size_t i=0; i 1.0f) 67 | acc -= 1.0f; 68 | } 69 | } 70 | 71 | WavetableOscillator* WavetableOscillator::create(float sr, size_t size) { 72 | FloatArray wave = FloatArray::create(size); 73 | for(size_t i=0; iwave); 80 | delete osc; 81 | } 82 | -------------------------------------------------------------------------------- /LibSource/WavetableOscillator.h: -------------------------------------------------------------------------------- 1 | #ifndef __WavetableOscillator_h__ 2 | #define __WavetableOscillator_h__ 3 | 4 | #include "FloatArray.h" 5 | #include "Oscillator.h" 6 | 7 | class WavetableOscillator : public Oscillator { 8 | private: 9 | float mul; 10 | FloatArray wave; 11 | float acc; 12 | float inc; 13 | public: 14 | WavetableOscillator(float sr, const FloatArray wavetable); 15 | void setSampleRate(float sr); 16 | float getSampleRate(); 17 | void setFrequency(float freq); 18 | float getFrequency(); 19 | float getSample(float phase); 20 | void setPhase(float phase); 21 | void reset(){ 22 | setPhase(0); 23 | } 24 | float getPhase(); 25 | float generate(); 26 | float generate(float fm); 27 | void generate(FloatArray samples); 28 | void generate(FloatArray output, FloatArray fm); 29 | static WavetableOscillator* create(float sr, size_t size); 30 | static void destroy(WavetableOscillator* osc); 31 | }; 32 | 33 | #endif /* __WavetableOscillator_h__ */ 34 | -------------------------------------------------------------------------------- /LibSource/Window.cpp: -------------------------------------------------------------------------------- 1 | #include "Window.h" 2 | 3 | void Window::applyWindow(float *signalIn, float *window, float *signalOut, int size){ 4 | #ifdef ARM_CORTEX 5 | /* despite not explicitely documented in the CMSIS documentation, 6 | this has been tested to behave properly even when pSrcA==pDst 7 | void arm_mult_f32 (float32_t *pSrcA, float32_t *pSrcB, float32_t *pDst, uint32_t blockSize) 8 | */ 9 | arm_mult_f32(signalIn, window, signalOut, size); 10 | #else 11 | for(int n=0; n 25 | 26 | /* Creates the ICSILog lookup table. Must be called 27 | once before any call to icsi_log(). 28 | n is the number of bits to be taken from the mantissa 29 | (0<=n<=23) 30 | lookup_table is a pointer to a floating point array of 2^n positions. 31 | */ 32 | void fill_icsi_log_table(float* lookup_table, const uint32_t precision){ 33 | /* step along table elements and x-axis positions 34 | (start with extra half increment, so the steps intersect at their midpoints.) */ 35 | float oneToTwo = 1.0f + (1.0f / (float)( 1 <<(precision + 1) )); 36 | int32_t i; 37 | for(i = 0; i < (1 << precision); ++i){ 38 | // make y-axis value for table element 39 | lookup_table[i] = logf(oneToTwo) / 0.69314718055995f; 40 | oneToTwo += 1.0f / (float)( 1 << precision ); 41 | } 42 | } 43 | 44 | float icsi_log(float arg, const float* lookup_table, const uint32_t precision){ 45 | /* get access to float bits */ 46 | register const int32_t* const pVal = (const int32_t*)(&arg); 47 | /* extract exponent and mantissa (quantized) */ 48 | register const int32_t exp = ((*pVal >> 23) & 255) - 127; 49 | register const int32_t man = (*pVal & 0x7FFFFF) >> (23 - precision); 50 | /* exponent plus lookup refinement */ 51 | return ((float)(exp) + lookup_table[man]) * 0.69314718055995f; 52 | } 53 | -------------------------------------------------------------------------------- /LibSource/fastlog.h: -------------------------------------------------------------------------------- 1 | #ifndef __fastlog_h__ 2 | #define __fastlog_h__ 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void fill_icsi_log_table(float* lookup_table, const uint32_t precision); 11 | float icsi_log(const float val, const float* lookup_table, const uint32_t precision); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif // __basicmaths_h__ 18 | -------------------------------------------------------------------------------- /LibSource/fastpow.h: -------------------------------------------------------------------------------- 1 | #ifndef __fastpow_h__ 2 | #define __fastpow_h__ 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void powFastSetTable(uint32_t* const pTable, const uint32_t precision); 11 | float powFastLookup(const float val, const float ilog2, const uint32_t* pTable, const uint32_t precision); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif // __basicmaths_h__ 18 | -------------------------------------------------------------------------------- /LibSource/message.h: -------------------------------------------------------------------------------- 1 | #ifndef __MESSAGE_H 2 | #define __MESSAGE_H 3 | 4 | #include 5 | 6 | /* #ifdef DDEBUG */ 7 | /* #define DEBUG_ASSERT(cond, msg) if(!(cond)){debugAssertFailed(msg, __FILE__, __LINE__);} */ 8 | /* #else */ 9 | /* #define DEBUG_ASSERT(x, y) */ 10 | /* #endif */ 11 | /* #define ASSERT_TRUE(cond) if(!(cond)){debugAssertFailed("Assertion failed", __PRETTY_FUNCTION__, __LINE__);} */ 12 | /* #define ASSERT_FALSE(cond) if(cond){debugAssertFailed("Assertion failed", __PRETTY_FUNCTION__, __LINE__);} */ 13 | /* #define ASSERT(cond, msg) if(!(cond)){debugAssertFailed(msg, __PRETTY_FUNCTION__, __LINE__);} */ 14 | 15 | #ifndef NDEBUG 16 | #define ASSERT(cond, msg) if(!(cond)){assert_failed(msg, __PRETTY_FUNCTION__, __LINE__);} 17 | #else 18 | #define ASSERT(cond, msg) 19 | #endif 20 | 21 | #ifndef CHECKSUM_ERROR_STATUS 22 | #define CHECKSUM_ERROR_STATUS -10 23 | #endif 24 | #ifndef OUT_OF_MEMORY_ERROR_STATUS 25 | #define OUT_OF_MEMORY_ERROR_STATUS -20 26 | #endif 27 | #ifndef CONFIGURATION_ERROR_STATUS 28 | #define CONFIGURATION_ERROR_STATUS -30 29 | #endif 30 | #ifndef PROGRAM_ERROR_STATUS 31 | #define PROGRAM_ERROR_STATUS -40 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | char* msg_itoa(int val, int base); 39 | char* msg_ftoa(float val, int base); 40 | 41 | void debugMessage(const char* msg); 42 | void error(int8_t code, const char* reason); 43 | void assert_failed(const char* msg, const char* location, int line); 44 | 45 | #ifdef __cplusplus 46 | } 47 | 48 | void debugMessage(const char* msg, int); 49 | void debugMessage(const char* msg, int, int); 50 | void debugMessage(const char* msg, int, int, int); 51 | void debugMessage(const char* msg, float); 52 | void debugMessage(const char* msg, float, float); 53 | void debugMessage(const char* msg, float, float, float); 54 | void assert_failed(uint8_t* location, uint32_t line); 55 | 56 | #endif 57 | 58 | #endif /* __MESSAG£_H */ 59 | -------------------------------------------------------------------------------- /LibSource/qint.h: -------------------------------------------------------------------------------- 1 | #ifndef __QINT_H__ 2 | #define __QINT_H__ 3 | 4 | #include 5 | 6 | #ifdef ARM_CORTEX 7 | #include "arm_math.h" 8 | #define Q15_MUL_Q15(a,b) (__SSAT(((q31_t)(a)*(b))>>15, 16)) 9 | #define Q31_MUL_Q31(a,b) (__SSAT(((q63_t)(a)*(b))>>31, 32)) 10 | #define FLOAT_TO_Q7(a) (__SSAT((q15_t)((a)*128.0f), 8)) 11 | #define FLOAT_TO_Q15(a) (__SSAT((q31_t)((a)*32768.0f), 16)) 12 | #define FLOAT_TO_Q31(a) clip_q63_to_q31((q63_t)((a)*2147483648.0f)) 13 | #else 14 | #define Q7_CLIP(a) ((a) > Q7_MAX ? Q7_MAX : (a) < Q7_MIN ? Q7_MIN : (a)) 15 | #define Q15_CLIP(a) ((a) > Q15_MAX ? Q15_MAX : (a) < Q15_MIN ? Q15_MIN : (a)) 16 | #define Q31_CLIP(a) ((a) > Q31_MAX ? Q31_MAX : (a) < Q31_MIN ? Q31_MIN : (a)) 17 | #define Q15_MUL_Q15(a,b) Q15_CLIP(((q63_t)(a)*(b))>>15) 18 | #define Q31_MUL_Q31(a,b) Q31_CLIP(((q63_t)(a)*(b))>>31) 19 | #define FLOAT_TO_Q7(a) Q7_CLIP((q15_t)((a)*128.0f)) 20 | #define FLOAT_TO_Q15(a) Q15_CLIP((q63_t)((a)*32768.0f)) 21 | #define FLOAT_TO_Q31(a) Q31_CLIP((q63_t)((a)*2147483648.0f)) 22 | #endif 23 | 24 | typedef int8_t q7_t; 25 | typedef int16_t q15_t; 26 | typedef int32_t q31_t; 27 | typedef int64_t q63_t; 28 | 29 | #ifndef Q7_MIN 30 | #define Q7_MIN INT8_MIN 31 | #endif 32 | #ifndef Q7_MAX 33 | #define Q7_MAX INT8_MAX 34 | #endif 35 | #ifndef Q15_MIN 36 | #define Q15_MIN INT16_MIN 37 | #endif 38 | #ifndef Q15_MAX 39 | #define Q15_MAX INT16_MAX 40 | #endif 41 | #ifndef Q31_MIN 42 | #define Q31_MIN INT32_MIN 43 | #endif 44 | #ifndef Q31_MAX 45 | #define Q31_MAX INT32_MAX 46 | #endif 47 | 48 | #define Q15_DIV_Q15(a,b) (((q31_t)(a)<<15)/(b)) /* non-rounding */ 49 | #define Q15_RECIPROCAL(a) (((q31_t)Q15_MAX<<15)/(a)) 50 | 51 | #define Q7_TO_FLOAT(a) ((float)(a)/128.0f) 52 | #define Q15_TO_FLOAT(a) ((float)(a)/32768.0f) 53 | #define Q31_TO_FLOAT(a) ((float)(a)/2147483648.0f) 54 | #define Q63_TO_FLOAT(a) ((float)(a)/9223372036854775808.0f) 55 | 56 | #endif /* defined(__QINT_H__) */ 57 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/BasicMathFunctions/BasicMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: BasicMathFunctions.c 4 | * Description: Combination of all basic math function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_abs_f32.c" 30 | #include "arm_abs_q15.c" 31 | #include "arm_abs_q31.c" 32 | #include "arm_abs_q7.c" 33 | #include "arm_add_f32.c" 34 | #include "arm_add_q15.c" 35 | #include "arm_add_q31.c" 36 | #include "arm_add_q7.c" 37 | #include "arm_dot_prod_f32.c" 38 | #include "arm_dot_prod_q15.c" 39 | #include "arm_dot_prod_q31.c" 40 | #include "arm_dot_prod_q7.c" 41 | #include "arm_mult_f32.c" 42 | #include "arm_mult_q15.c" 43 | #include "arm_mult_q31.c" 44 | #include "arm_mult_q7.c" 45 | #include "arm_negate_f32.c" 46 | #include "arm_negate_q15.c" 47 | #include "arm_negate_q31.c" 48 | #include "arm_negate_q7.c" 49 | #include "arm_offset_f32.c" 50 | #include "arm_offset_q15.c" 51 | #include "arm_offset_q31.c" 52 | #include "arm_offset_q7.c" 53 | #include "arm_scale_f32.c" 54 | #include "arm_scale_q15.c" 55 | #include "arm_scale_q31.c" 56 | #include "arm_scale_q7.c" 57 | #include "arm_shift_q15.c" 58 | #include "arm_shift_q31.c" 59 | #include "arm_shift_q7.c" 60 | #include "arm_sub_f32.c" 61 | #include "arm_sub_q15.c" 62 | #include "arm_sub_q31.c" 63 | #include "arm_sub_q7.c" 64 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/CommonTables/CommonTables.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: CommonTables.c 4 | * Description: Combination of all common table source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_common_tables.c" 30 | #include "arm_const_structs.c" 31 | 32 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/ComplexMathFunctions/ComplexMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: CompexMathFunctions.c 4 | * Description: Combination of all comlex math function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_cmplx_conj_f32.c" 30 | #include "arm_cmplx_conj_q15.c" 31 | #include "arm_cmplx_conj_q31.c" 32 | #include "arm_cmplx_dot_prod_f32.c" 33 | #include "arm_cmplx_dot_prod_q15.c" 34 | #include "arm_cmplx_dot_prod_q31.c" 35 | #include "arm_cmplx_mag_f32.c" 36 | #include "arm_cmplx_mag_q15.c" 37 | #include "arm_cmplx_mag_q31.c" 38 | #include "arm_cmplx_mag_squared_f32.c" 39 | #include "arm_cmplx_mag_squared_q15.c" 40 | #include "arm_cmplx_mag_squared_q31.c" 41 | #include "arm_cmplx_mult_cmplx_f32.c" 42 | #include "arm_cmplx_mult_cmplx_q15.c" 43 | #include "arm_cmplx_mult_cmplx_q31.c" 44 | #include "arm_cmplx_mult_real_f32.c" 45 | #include "arm_cmplx_mult_real_q15.c" 46 | #include "arm_cmplx_mult_real_q31.c" 47 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/ControllerFunctions/ControllerFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: ControllerFunctions.c 4 | * Description: Combination of all controller function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_pid_init_f32.c" 30 | #include "arm_pid_init_q15.c" 31 | #include "arm_pid_init_q31.c" 32 | #include "arm_pid_reset_f32.c" 33 | #include "arm_pid_reset_q15.c" 34 | #include "arm_pid_reset_q31.c" 35 | #include "arm_sin_cos_f32.c" 36 | #include "arm_sin_cos_q31.c" 37 | 38 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_init_f32.c 4 | * Description: Floating-point PID Control initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Initialization function for the floating-point PID Control. 38 | @param[in,out] S points to an instance of the PID structure 39 | @param[in] resetStateFlag 40 | - value = 0: no change in state 41 | - value = 1: reset state 42 | @return none 43 | 44 | @par Details 45 | The resetStateFlag specifies whether to set state to zero or not. \n 46 | The function computes the structure fields: A0, A1 A2 47 | using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd) 48 | also sets the state variables to all zeros. 49 | */ 50 | 51 | void arm_pid_init_f32( 52 | arm_pid_instance_f32 * S, 53 | int32_t resetStateFlag) 54 | { 55 | /* Derived coefficient A0 */ 56 | S->A0 = S->Kp + S->Ki + S->Kd; 57 | 58 | /* Derived coefficient A1 */ 59 | S->A1 = (-S->Kp) - ((float32_t) 2.0 * S->Kd); 60 | 61 | /* Derived coefficient A2 */ 62 | S->A2 = S->Kd; 63 | 64 | /* Check whether state needs reset or not */ 65 | if (resetStateFlag) 66 | { 67 | /* Reset state to zero, The size will be always 3 samples */ 68 | memset(S->state, 0, 3U * sizeof(float32_t)); 69 | } 70 | 71 | } 72 | 73 | /** 74 | @} end of PID group 75 | */ 76 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_f32.c 4 | * Description: Floating-point PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the floating-point PID Control. 38 | @param[in,out] S points to an instance of the floating-point PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_f32( 46 | arm_pid_instance_f32 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(float32_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q15.c 4 | * Description: Q15 PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q15 PID Control. 38 | @param[in,out] S points to an instance of the Q15 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q15( 46 | arm_pid_instance_q15 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q15_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q31.c 4 | * Description: Q31 PID Control reset function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @addtogroup PID 33 | @{ 34 | */ 35 | 36 | /** 37 | @brief Reset function for the Q31 PID Control. 38 | @param[in,out] S points to an instance of the Q31 PID structure 39 | @return none 40 | 41 | @par Details 42 | The function resets the state buffer to zeros. 43 | */ 44 | 45 | void arm_pid_reset_q31( 46 | arm_pid_instance_q31 * S) 47 | { 48 | /* Reset state to zero, The size will be always 3 samples */ 49 | memset(S->state, 0, 3U * sizeof(q31_t)); 50 | } 51 | 52 | /** 53 | @} end of PID group 54 | */ 55 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FastMathFunctions/FastMathFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: FastMathFunctions.c 4 | * Description: Combination of all fast math function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_cos_f32.c" 30 | #include "arm_cos_q15.c" 31 | #include "arm_cos_q31.c" 32 | #include "arm_sin_f32.c" 33 | #include "arm_sin_q15.c" 34 | #include "arm_sin_q31.c" 35 | #include "arm_sqrt_q15.c" 36 | #include "arm_sqrt_q31.c" 37 | 38 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FastMathFunctions/arm_sin_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sin_q15.c 4 | * Description: Fast sine calculation for Q15 values 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup sin 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric sine function for Q15 data. 43 | @param[in] x Scaled input value in radians 44 | @return sin(x) 45 | 46 | The Q15 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q15_t arm_sin_q15( 50 | q15_t x) 51 | { 52 | q15_t sinVal; /* Temporary input, output variables */ 53 | int32_t index; /* Index variable */ 54 | q15_t a, b; /* Two nearest output values */ 55 | q15_t fract; /* Temporary values for fractional values */ 56 | 57 | /* Calculate the nearest index */ 58 | index = (uint32_t)x >> FAST_MATH_Q15_SHIFT; 59 | 60 | /* Calculation of fractional value */ 61 | fract = (x - (index << FAST_MATH_Q15_SHIFT)) << 9; 62 | 63 | /* Read two nearest values of input value from the sin table */ 64 | a = sinTable_q15[index]; 65 | b = sinTable_q15[index+1]; 66 | 67 | /* Linear interpolation process */ 68 | sinVal = (q31_t) (0x8000 - fract) * a >> 16; 69 | sinVal = (q15_t) ((((q31_t) sinVal << 16) + ((q31_t) fract * b)) >> 16); 70 | 71 | /* Return output value */ 72 | return (sinVal << 1); 73 | } 74 | 75 | /** 76 | @} end of sin group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FastMathFunctions/arm_sin_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_sin_q31.c 4 | * Description: Fast sine calculation for Q31 values 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | #include "arm_common_tables.h" 31 | 32 | /** 33 | @ingroup groupFastMath 34 | */ 35 | 36 | /** 37 | @addtogroup sin 38 | @{ 39 | */ 40 | 41 | /** 42 | @brief Fast approximation to the trigonometric sine function for Q31 data. 43 | @param[in] x Scaled input value in radians 44 | @return sin(x) 45 | 46 | The Q31 input value is in the range [0 +0.9999] and is mapped to a radian value in the range [0 2*PI). 47 | */ 48 | 49 | q31_t arm_sin_q31( 50 | q31_t x) 51 | { 52 | q31_t sinVal; /* Temporary variables for input, output */ 53 | int32_t index; /* Index variable */ 54 | q31_t a, b; /* Two nearest output values */ 55 | q31_t fract; /* Temporary values for fractional values */ 56 | 57 | /* Calculate the nearest index */ 58 | index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; 59 | 60 | /* Calculation of fractional value */ 61 | fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; 62 | 63 | /* Read two nearest values of input value from the sin table */ 64 | a = sinTable_q31[index]; 65 | b = sinTable_q31[index+1]; 66 | 67 | /* Linear interpolation process */ 68 | sinVal = (q63_t) (0x80000000 - fract) * a >> 32; 69 | sinVal = (q31_t) ((((q63_t) sinVal << 32) + ((q63_t) fract * b)) >> 32); 70 | 71 | /* Return output value */ 72 | return (sinVal << 1); 73 | } 74 | 75 | /** 76 | @} end of sin group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_f32.c 4 | * Description: Floating-point FIR Lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point FIR lattice filter. 42 | @param[in] S points to an instance of the floating-point FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_f32( 50 | arm_fir_lattice_instance_f32 * S, 51 | uint16_t numStages, 52 | const float32_t * pCoeffs, 53 | float32_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(float32_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q15.c 4 | * Description: Q15 FIR Lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q15 FIR lattice filter. 42 | @param[in] S points to an instance of the Q15 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q15( 50 | arm_fir_lattice_instance_q15 * S, 51 | uint16_t numStages, 52 | const q15_t * pCoeffs, 53 | q15_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q15_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FilteringFunctions/arm_fir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fir_lattice_init_q31.c 4 | * Description: Q31 FIR lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup FIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 FIR lattice filter. 42 | @param[in] S points to an instance of the Q31 FIR lattice structure 43 | @param[in] numStages number of filter stages 44 | @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages 45 | @param[in] pState points to the state buffer. The array is of length numStages 46 | @return none 47 | */ 48 | 49 | void arm_fir_lattice_init_q31( 50 | arm_fir_lattice_instance_q31 * S, 51 | uint16_t numStages, 52 | const q31_t * pCoeffs, 53 | q31_t * pState) 54 | { 55 | /* Assign filter taps */ 56 | S->numStages = numStages; 57 | 58 | /* Assign coefficient pointer */ 59 | S->pCoeffs = pCoeffs; 60 | 61 | /* Clear state buffer and size is always numStages */ 62 | memset(pState, 0, (numStages) * sizeof(q31_t)); 63 | 64 | /* Assign state pointer */ 65 | S->pState = pState; 66 | } 67 | 68 | /** 69 | @} end of FIR_Lattice group 70 | */ 71 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FilteringFunctions/arm_iir_lattice_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_f32.c 4 | * Description: Floating-point IIR lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the floating-point IIR lattice filter. 42 | @param[in] S points to an instance of the floating-point IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_f32( 52 | arm_iir_lattice_instance_f32 * S, 53 | uint16_t numStages, 54 | float32_t * pkCoeffs, 55 | float32_t * pvCoeffs, 56 | float32_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(float32_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FilteringFunctions/arm_iir_lattice_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_q15.c 4 | * Description: Q15 IIR lattice filter initialization function 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q15 IIR lattice filter. 42 | @param[in] S points to an instance of the Q15 IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_q15( 52 | arm_iir_lattice_instance_q15 * S, 53 | uint16_t numStages, 54 | q15_t * pkCoeffs, 55 | q15_t * pvCoeffs, 56 | q15_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(q15_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/FilteringFunctions/arm_iir_lattice_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_iir_lattice_init_q31.c 4 | * Description: Initialization function for the Q31 IIR lattice filter 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupFilters 33 | */ 34 | 35 | /** 36 | @addtogroup IIR_Lattice 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Initialization function for the Q31 IIR lattice filter. 42 | @param[in] S points to an instance of the Q31 IIR lattice structure 43 | @param[in] numStages number of stages in the filter 44 | @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages 45 | @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1 46 | @param[in] pState points to state buffer. The array is of length numStages+blockSize 47 | @param[in] blockSize number of samples to process 48 | @return none 49 | */ 50 | 51 | void arm_iir_lattice_init_q31( 52 | arm_iir_lattice_instance_q31 * S, 53 | uint16_t numStages, 54 | q31_t * pkCoeffs, 55 | q31_t * pvCoeffs, 56 | q31_t * pState, 57 | uint32_t blockSize) 58 | { 59 | /* Assign filter taps */ 60 | S->numStages = numStages; 61 | 62 | /* Assign reflection coefficient pointer */ 63 | S->pkCoeffs = pkCoeffs; 64 | 65 | /* Assign ladder coefficient pointer */ 66 | S->pvCoeffs = pvCoeffs; 67 | 68 | /* Clear state buffer and size is always blockSize + numStages */ 69 | memset(pState, 0, (numStages + blockSize) * sizeof(q31_t)); 70 | 71 | /* Assign state pointer */ 72 | S->pState = pState; 73 | } 74 | 75 | /** 76 | @} end of IIR_Lattice group 77 | */ 78 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/MatrixFunctions/MatrixFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: MatrixFunctions.c 4 | * Description: Combination of all matrix function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_mat_add_f32.c" 30 | #include "arm_mat_add_q15.c" 31 | #include "arm_mat_add_q31.c" 32 | #include "arm_mat_cmplx_mult_f32.c" 33 | #include "arm_mat_cmplx_mult_q15.c" 34 | #include "arm_mat_cmplx_mult_q31.c" 35 | #include "arm_mat_init_f32.c" 36 | #include "arm_mat_init_q15.c" 37 | #include "arm_mat_init_q31.c" 38 | #include "arm_mat_inverse_f32.c" 39 | #include "arm_mat_inverse_f64.c" 40 | #include "arm_mat_mult_f32.c" 41 | #include "arm_mat_mult_fast_q15.c" 42 | #include "arm_mat_mult_fast_q31.c" 43 | #include "arm_mat_mult_q15.c" 44 | #include "arm_mat_mult_q31.c" 45 | #include "arm_mat_scale_f32.c" 46 | #include "arm_mat_scale_q15.c" 47 | #include "arm_mat_scale_q31.c" 48 | #include "arm_mat_sub_f32.c" 49 | #include "arm_mat_sub_q15.c" 50 | #include "arm_mat_sub_q31.c" 51 | #include "arm_mat_trans_f32.c" 52 | #include "arm_mat_trans_q15.c" 53 | #include "arm_mat_trans_q31.c" 54 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_f32.c 4 | * Description: Floating-point matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | Initializes the underlying matrix data structure. 39 | The functions set the numRows, 40 | numCols, and pData fields 41 | of the matrix data structure. 42 | */ 43 | 44 | /** 45 | @addtogroup MatrixInit 46 | @{ 47 | */ 48 | 49 | /** 50 | @brief Floating-point matrix initialization. 51 | @param[in,out] S points to an instance of the floating-point matrix structure 52 | @param[in] nRows number of rows in the matrix 53 | @param[in] nColumns number of columns in the matrix 54 | @param[in] pData points to the matrix data array 55 | @return none 56 | */ 57 | 58 | void arm_mat_init_f32( 59 | arm_matrix_instance_f32 * S, 60 | uint16_t nRows, 61 | uint16_t nColumns, 62 | float32_t * pData) 63 | { 64 | /* Assign Number of Rows */ 65 | S->numRows = nRows; 66 | 67 | /* Assign Number of Columns */ 68 | S->numCols = nColumns; 69 | 70 | /* Assign Data pointer */ 71 | S->pData = pData; 72 | } 73 | 74 | /** 75 | @} end of MatrixInit group 76 | */ 77 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q15.c 4 | * Description: Q15 matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @addtogroup MatrixInit 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Q15 matrix initialization. 42 | @param[in,out] S points to an instance of the floating-point matrix structure 43 | @param[in] nRows number of rows in the matrix 44 | @param[in] nColumns number of columns in the matrix 45 | @param[in] pData points to the matrix data array 46 | @return none 47 | */ 48 | 49 | void arm_mat_init_q15( 50 | arm_matrix_instance_q15 * S, 51 | uint16_t nRows, 52 | uint16_t nColumns, 53 | q15_t * pData) 54 | { 55 | /* Assign Number of Rows */ 56 | S->numRows = nRows; 57 | 58 | /* Assign Number of Columns */ 59 | S->numCols = nColumns; 60 | 61 | /* Assign Data pointer */ 62 | S->pData = pData; 63 | } 64 | 65 | /** 66 | @} end of MatrixInit group 67 | */ 68 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q31.c 4 | * Description: Q31 matrix initialization 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | @defgroup MatrixInit Matrix Initialization 37 | 38 | */ 39 | 40 | /** 41 | @addtogroup MatrixInit 42 | @{ 43 | */ 44 | 45 | /** 46 | @brief Q31 matrix initialization. 47 | @param[in,out] S points to an instance of the Q31 matrix structure 48 | @param[in] nRows number of rows in the matrix 49 | @param[in] nColumns number of columns in the matrix 50 | @param[in] pData points to the matrix data array 51 | @return none 52 | */ 53 | 54 | void arm_mat_init_q31( 55 | arm_matrix_instance_q31 * S, 56 | uint16_t nRows, 57 | uint16_t nColumns, 58 | q31_t * pData) 59 | { 60 | /* Assign Number of Rows */ 61 | S->numRows = nRows; 62 | 63 | /* Assign Number of Columns */ 64 | S->numCols = nColumns; 65 | 66 | /* Assign Data pointer */ 67 | S->pData = pData; 68 | } 69 | 70 | /** 71 | @} end of MatrixInit group 72 | */ 73 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/StatisticsFunctions/StatisticsFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: StatisticsFunctions.c 4 | * Description: Combination of all statistics function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_max_f32.c" 30 | #include "arm_max_q15.c" 31 | #include "arm_max_q31.c" 32 | #include "arm_max_q7.c" 33 | #include "arm_mean_f32.c" 34 | #include "arm_mean_q15.c" 35 | #include "arm_mean_q31.c" 36 | #include "arm_mean_q7.c" 37 | #include "arm_min_f32.c" 38 | #include "arm_min_q15.c" 39 | #include "arm_min_q31.c" 40 | #include "arm_min_q7.c" 41 | #include "arm_power_f32.c" 42 | #include "arm_power_q15.c" 43 | #include "arm_power_q31.c" 44 | #include "arm_power_q7.c" 45 | #include "arm_rms_f32.c" 46 | #include "arm_rms_q15.c" 47 | #include "arm_rms_q31.c" 48 | #include "arm_std_f32.c" 49 | #include "arm_std_q15.c" 50 | #include "arm_std_q31.c" 51 | #include "arm_var_f32.c" 52 | #include "arm_var_q15.c" 53 | #include "arm_var_q31.c" 54 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/SupportFunctions/SupportFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: SupportFunctions.c 4 | * Description: Combination of all support function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_copy_f32.c" 30 | #include "arm_copy_q15.c" 31 | #include "arm_copy_q31.c" 32 | #include "arm_copy_q7.c" 33 | #include "arm_fill_f32.c" 34 | #include "arm_fill_q15.c" 35 | #include "arm_fill_q31.c" 36 | #include "arm_fill_q7.c" 37 | #include "arm_float_to_q15.c" 38 | #include "arm_float_to_q31.c" 39 | #include "arm_float_to_q7.c" 40 | #include "arm_q15_to_float.c" 41 | #include "arm_q15_to_q31.c" 42 | #include "arm_q15_to_q7.c" 43 | #include "arm_q31_to_float.c" 44 | #include "arm_q31_to_q15.c" 45 | #include "arm_q31_to_q7.c" 46 | #include "arm_q7_to_float.c" 47 | #include "arm_q7_to_q15.c" 48 | #include "arm_q7_to_q31.c" 49 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/SupportFunctions/arm_copy_q7.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_copy_q7.c 4 | * Description: Copies the elements of a Q7 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup copy 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Copies the elements of a Q7 vector. 42 | @param[in] pSrc points to input vector 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_copy_q7( 49 | const q7_t * pSrc, 50 | q7_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | 57 | /* Loop unrolling: Compute 4 outputs at a time */ 58 | blkCnt = blockSize >> 2U; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = A */ 63 | 64 | /* read 4 samples at a time */ 65 | write_q7x4_ia (&pDst, read_q7x4_ia ((q7_t **) &pSrc)); 66 | 67 | /* Decrement loop counter */ 68 | blkCnt--; 69 | } 70 | 71 | /* Loop unrolling: Compute remaining outputs */ 72 | blkCnt = blockSize % 0x4U; 73 | 74 | #else 75 | 76 | /* Initialize blkCnt with number of samples */ 77 | blkCnt = blockSize; 78 | 79 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 80 | 81 | while (blkCnt > 0U) 82 | { 83 | /* C = A */ 84 | 85 | /* Copy and store result in destination buffer */ 86 | *pDst++ = *pSrc++; 87 | 88 | /* Decrement loop counter */ 89 | blkCnt--; 90 | } 91 | } 92 | 93 | /** 94 | @} end of BasicCopy group 95 | */ 96 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/SupportFunctions/arm_fill_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_fill_q31.c 4 | * Description: Fills a constant value into a Q31 vector 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.6.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | @ingroup groupSupport 33 | */ 34 | 35 | /** 36 | @addtogroup Fill 37 | @{ 38 | */ 39 | 40 | /** 41 | @brief Fills a constant value into a Q31 vector. 42 | @param[in] value input value to be filled 43 | @param[out] pDst points to output vector 44 | @param[in] blockSize number of samples in each vector 45 | @return none 46 | */ 47 | 48 | void arm_fill_q31( 49 | q31_t value, 50 | q31_t * pDst, 51 | uint32_t blockSize) 52 | { 53 | uint32_t blkCnt; /* Loop counter */ 54 | 55 | #if defined (ARM_MATH_LOOPUNROLL) 56 | 57 | /* Loop unrolling: Compute 4 outputs at a time */ 58 | blkCnt = blockSize >> 2U; 59 | 60 | while (blkCnt > 0U) 61 | { 62 | /* C = value */ 63 | 64 | /* Fill value in destination buffer */ 65 | *pDst++ = value; 66 | *pDst++ = value; 67 | *pDst++ = value; 68 | *pDst++ = value; 69 | 70 | /* Decrement loop counter */ 71 | blkCnt--; 72 | } 73 | 74 | /* Loop unrolling: Compute remaining outputs */ 75 | blkCnt = blockSize % 0x4U; 76 | 77 | #else 78 | 79 | /* Initialize blkCnt with number of samples */ 80 | blkCnt = blockSize; 81 | 82 | #endif /* #if defined (ARM_MATH_LOOPUNROLL) */ 83 | 84 | while (blkCnt > 0U) 85 | { 86 | /* C = value */ 87 | 88 | /* Fill value in destination buffer */ 89 | *pDst++ = value; 90 | 91 | /* Decrement loop counter */ 92 | blkCnt--; 93 | } 94 | } 95 | 96 | /** 97 | @} end of Fill group 98 | */ 99 | -------------------------------------------------------------------------------- /Libraries/CMSIS/DSP/Source/TransformFunctions/TransformFunctions.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: TransformFunctions.c 4 | * Description: Combination of all transform function source files. 5 | * 6 | * $Date: 18. March 2019 7 | * $Revision: V1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2019 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_bitreversal.c" 30 | #include "arm_bitreversal2.c" 31 | #include "arm_cfft_f32.c" 32 | #include "arm_cfft_q15.c" 33 | #include "arm_cfft_q31.c" 34 | #include "arm_cfft_radix2_f32.c" 35 | #include "arm_cfft_radix2_init_f32.c" 36 | #include "arm_cfft_radix2_init_q15.c" 37 | #include "arm_cfft_radix2_init_q31.c" 38 | #include "arm_cfft_radix2_q15.c" 39 | #include "arm_cfft_radix2_q31.c" 40 | #include "arm_cfft_radix4_f32.c" 41 | #include "arm_cfft_radix4_init_f32.c" 42 | #include "arm_cfft_radix4_init_q15.c" 43 | #include "arm_cfft_radix4_init_q31.c" 44 | #include "arm_cfft_radix4_q15.c" 45 | #include "arm_cfft_radix4_q31.c" 46 | #include "arm_cfft_radix8_f32.c" 47 | #include "arm_dct4_f32.c" 48 | #include "arm_dct4_init_f32.c" 49 | #include "arm_dct4_init_q15.c" 50 | #include "arm_dct4_init_q31.c" 51 | #include "arm_dct4_q15.c" 52 | #include "arm_dct4_q31.c" 53 | #include "arm_rfft_f32.c" 54 | #include "arm_rfft_fast_f32.c" 55 | #include "arm_rfft_fast_init_f32.c" 56 | #include "arm_rfft_init_f32.c" 57 | #include "arm_rfft_init_q15.c" 58 | #include "arm_rfft_init_q31.c" 59 | #include "arm_rfft_q15.c" 60 | #include "arm_rfft_q31.c" 61 | -------------------------------------------------------------------------------- /Libraries/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.3 5 | * @date 24. June 2019 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2019 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 3U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /Libraries/KissFFT/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003-2010 Mark Borgerding 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /Libraries/polyblep/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 olivier gillet 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 all 13 | 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 THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Libraries/polyblep/README: -------------------------------------------------------------------------------- 1 | Experimental VA oscillator code based on polyBLEP. Hardsync, PWM, waveform continuously variable between sawtooth and square. -------------------------------------------------------------------------------- /Maximilian/MaximilianPatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __MaximilianPatch_hpp__ 2 | #define __MaximilianPatch_hpp__ 3 | 4 | #include "Patch.h" 5 | #include "maximilian.h" 6 | 7 | #define MAX_MAXIPARAMS 20 8 | static maxiParam* maxiParameters[MAX_MAXIPARAMS]; 9 | static unsigned int maxiParameterCount = 0; 10 | maxiParam::maxiParam() : value(0.5), minValue(0.0), maxValue(1.0), 11 | name(NULL), pid(maxiParameterCount){ 12 | if(maxiParameterCount < MAX_MAXIPARAMS) 13 | maxiParameters[maxiParameterCount++] = this; 14 | } 15 | 16 | void maxiParam::update(double v){ 17 | #ifdef ARM_CORTEX 18 | const static double lambda = 0.9; // factor for exponential smoothing 19 | #else 20 | const static double lambda = 0.5; // factor for exponential smoothing 21 | #endif 22 | value = value*lambda + scale(v)*(1-lambda); 23 | } 24 | 25 | class MaximilianPatch : public Patch { 26 | private: 27 | #include "maximilian-patch.h" 28 | float output[2]; 29 | public: 30 | MaximilianPatch(){ 31 | maxiSettings::sampleRate = getSampleRate(); 32 | maxiSettings::channels = 2; 33 | maxiSettings::bufferSize = getBlockSize(); 34 | setup(); 35 | char name[] = "A"; 36 | for(size_t i=0; iname == NULL){ 38 | name[0] = 'A'+maxiParameters[i]->pid; 39 | registerParameter((PatchParameterId)(maxiParameters[i]->pid), name); 40 | }else{ 41 | registerParameter((PatchParameterId)(maxiParameters[i]->pid), maxiParameters[i]->name); 42 | } 43 | float min = maxiParameters[i]->minValue; 44 | float max = maxiParameters[i]->maxValue; 45 | float value = (maxiParameters[i]->value - min)/(max-min); 46 | setParameterValue((PatchParameterId)(maxiParameters[i]->pid), value); 47 | } 48 | } 49 | void processAudio(AudioBuffer &buffer) { 50 | float* left = buffer.getSamples(LEFT_CHANNEL); 51 | float* right = buffer.getSamples(RIGHT_CHANNEL); 52 | for(size_t i=0; iupdate(getParameterValue((PatchParameterId)(maxiParameters[i]->pid))); 54 | for(size_t i=0; i 4 | #include 5 | 6 | class MemoryBuffer : public AudioBuffer { 7 | protected: 8 | float* buffer; 9 | size_t channels; 10 | size_t size; 11 | public: 12 | MemoryBuffer(float* buf, size_t ch, size_t sz): buffer(buf), channels(ch), size(sz) {} 13 | virtual ~MemoryBuffer(){} 14 | void clear() { 15 | memset(buffer, 0, size*channels*sizeof(float)); 16 | } 17 | FloatArray getSamples(int channel) { 18 | ASSERT((size_t)channel < channels, "Invalid channel"); 19 | return FloatArray(buffer+channel*size, size); 20 | } 21 | int getChannels() { 22 | return channels; 23 | } 24 | int getSize() { 25 | return size; 26 | } 27 | }; 28 | 29 | class ManagedMemoryBuffer : public MemoryBuffer { 30 | public: 31 | ManagedMemoryBuffer(size_t ch, size_t sz) : 32 | MemoryBuffer(new float[ch*sz], ch, sz) { 33 | if(buffer == NULL) 34 | error(OUT_OF_MEMORY_ERROR_STATUS, "Out of memory"); 35 | } 36 | ~ManagedMemoryBuffer(){ 37 | delete[] buffer; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /Source/PatchMetadata.cpp: -------------------------------------------------------------------------------- 1 | #include "PatchMetadata.h" 2 | 3 | #define __weak __attribute__((weak)) 4 | 5 | __weak const char* PatchMetadata::name = PATCHNAME; 6 | __weak const int PatchMetadata::channels_in = 2; 7 | __weak const int PatchMetadata::channels_out = 2; 8 | __weak const int PatchMetadata::parameter_count = 0; 9 | __weak const int PatchMetadata::button_count = 0; 10 | __weak const PatchMetadata::Control PatchMetadata::parameters[] = {}; 11 | __weak const PatchMetadata::Control PatchMetadata::buttons[] = {}; 12 | -------------------------------------------------------------------------------- /Source/PatchMetadata.h: -------------------------------------------------------------------------------- 1 | #ifndef __PatchMetadata_h 2 | #define __PatchMetadata_h 3 | 4 | #define CONTROL_INPUT 0 5 | #define CONTROL_OUTPUT 1 6 | #define CONTROL_UNIPOLAR 0 7 | #define CONTROL_BIPOLAR 2 8 | 9 | #define CONTROL_BUTTON 4 10 | #define CONTROL_TOGGLE 8 11 | 12 | #define NOF_PARAMETERS 20 13 | #define NOF_BUTTONS 20 14 | 15 | struct PatchMetadata { 16 | public: 17 | struct Control { 18 | uint8_t id; 19 | uint8_t flags; 20 | const char* name; 21 | }; 22 | static const char* name; 23 | static const int channels_in; 24 | static const int channels_out; 25 | static const int parameter_count; 26 | static const int button_count; 27 | static const Control parameters[NOF_PARAMETERS]; 28 | static const Control buttons[NOF_BUTTONS]; 29 | }; 30 | 31 | #endif /* __PatchMetadata_h */ 32 | -------------------------------------------------------------------------------- /Source/PatchProcessor.h: -------------------------------------------------------------------------------- 1 | #ifndef __PatchProcessor_h__ 2 | #define __PatchProcessor_h__ 3 | 4 | #include 5 | #include "Patch.h" 6 | #include "device.h" 7 | 8 | class ParameterUpdater { 9 | public: 10 | virtual ~ParameterUpdater(){} 11 | virtual void update(int16_t value) = 0; 12 | virtual void setParameter(IntParameter* p){} 13 | virtual void setParameter(FloatParameter* p){} 14 | }; 15 | 16 | class PatchProcessor { 17 | public: 18 | PatchProcessor(); 19 | ~PatchProcessor(); 20 | void clear(); 21 | void setPatch(Patch* patch, const char* name); 22 | const char* getPatchName(){ 23 | return name; 24 | } 25 | int getBlockSize(); 26 | double getSampleRate(); 27 | void setParameterValues(int16_t* parameters); 28 | Patch* patch; 29 | uint8_t index; 30 | void setPatchParameter(int pid, FloatParameter* param); 31 | void setPatchParameter(int pid, IntParameter* param); 32 | template 33 | PatchParameter getParameter(const char* name, T min, T max, T defaultValue, float lambda, float delta, float skew); 34 | private: 35 | void setDefaultValue(int pid, float value); 36 | void setDefaultValue(int pid, int value); 37 | uint8_t bufferCount; 38 | ParameterUpdater* parameters[MAX_NUMBER_OF_PARAMETERS]; 39 | uint8_t parameterCount; 40 | AudioBuffer* buffers[MAX_BUFFERS_PER_PATCH]; 41 | const char* name; 42 | }; 43 | 44 | 45 | #endif // __PatchProcessor_h__ 46 | 47 | -------------------------------------------------------------------------------- /Source/ServiceCall.h: -------------------------------------------------------------------------------- 1 | #define OWL_SERVICE_VERSION_V1 0x0001 2 | #define OWL_SERVICE_ARM_RFFT_FAST_INIT_F32 0x0100 3 | #define OWL_SERVICE_ARM_CFFT_INIT_F32 0x0110 4 | #define OWL_SERVICE_GET_PARAMETERS 0x1000 5 | #define OWL_SERVICE_LOAD_RESOURCE 0x1001 6 | #define OWL_SERVICE_GET_ARRAY 0x1010 7 | #define OWL_SERVICE_REGISTER_CALLBACK 0x1100 8 | #define OWL_SERVICE_REQUEST_CALLBACK 0x1101 9 | #define OWL_SERVICE_OK 0x000 10 | #define OWL_SERVICE_INVALID_ARGS -1 11 | 12 | #define SYSTEM_TABLE_LOG "SLG" 13 | #define SYSTEM_TABLE_POW "SPW" 14 | #define SYSTEM_FUNCTION_DRAW "DRW" 15 | #define SYSTEM_FUNCTION_MIDI "MDI" 16 | 17 | #define OWL_SERVICE_VERSION OWL_SERVICE_VERSION_V1 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | int serviceCall(int service, void** params, int len); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | -------------------------------------------------------------------------------- /Source/ShortPatchProgram.cpp: -------------------------------------------------------------------------------- 1 | #include "ProgramVector.h" 2 | #include "ServiceCall.h" 3 | #include "ShortBuffer.hpp" 4 | #include "PatchProcessor.h" 5 | #include "message.h" 6 | #include "Patch.h" 7 | #include "registerpatch.h" 8 | #include "main.h" 9 | #include "heap.h" 10 | 11 | PatchProcessor processor; 12 | 13 | PatchProcessor* getInitialisingPatchProcessor(){ 14 | return &processor; 15 | } 16 | 17 | void doSetPatchParameter(uint8_t id, int16_t value){ 18 | ProgramVector* vec = getProgramVector(); 19 | if(vec->checksum >= PROGRAM_VECTOR_CHECKSUM_V12 && 20 | vec->setPatchParameter != NULL && vec->parameters[id] != value) 21 | vec->setPatchParameter(id, value); 22 | } 23 | 24 | void doSetButton(uint8_t id, uint16_t value, uint16_t samples){ 25 | ProgramVector* vec = getProgramVector(); 26 | if(vec->checksum >= PROGRAM_VECTOR_CHECKSUM_V12 && 27 | vec->setButton != NULL && 28 | // if it is not a MIDI note, check that value has changed 29 | (id > 31 || (bool)(vec->buttons&(1<setButton((PatchButtonId)id, value, samples); 31 | } 32 | 33 | void onButtonChanged(uint8_t id, uint16_t value, uint16_t samples){ 34 | if(processor.patch != NULL) 35 | processor.patch->buttonChanged((PatchButtonId)id, value, samples); 36 | } 37 | 38 | void onEncoderChanged(uint8_t id, int16_t delta, uint16_t samples){ 39 | if(processor.patch != NULL) 40 | processor.patch->encoderChanged((PatchParameterId)id, delta, samples); 41 | } 42 | 43 | #define REGISTER_PATCH(T, STR, IN, OUT) registerPatch(STR, IN, OUT, new T) 44 | 45 | void registerPatch(const char* name, uint8_t inputs, uint8_t outputs, Patch* patch){ 46 | if(patch == NULL) 47 | error(OUT_OF_MEMORY_ERROR_STATUS, "Out of memory"); 48 | if(getProgramVector()->registerPatch != NULL) 49 | getProgramVector()->registerPatch(name, inputs, outputs); 50 | processor.setPatch(patch); 51 | } 52 | 53 | ShortBuffer* samples; 54 | void setup(ProgramVector* pv){ 55 | #ifdef DEBUG_MEM 56 | #ifdef ARM_CORTEX 57 | size_t before = xPortGetFreeHeapSize(); 58 | #endif 59 | #endif 60 | #include "registerpatch.cpp" 61 | #ifdef DEBUG_MEM 62 | // todo xPortGetFreeHeapSize() before and after 63 | // extern uint32_t total_heap_used; 64 | // pv->heap_bytes_used = total_heap_used; 65 | #ifdef ARM_CORTEX 66 | getProgramVector()->heap_bytes_used = before - xPortGetFreeHeapSize(); 67 | #endif 68 | #endif 69 | // samples = new SampleBuffer(getBlockSize()); 70 | samples = new ShortBuffer(); 71 | } 72 | 73 | void processBlock(ProgramVector* pv){ 74 | samples->split(pv->audio_input, pv->audio_blocksize); 75 | processor.setParameterValues(pv->parameters); 76 | processor.patch->processAudio(*samples); 77 | samples->comb(pv->audio_output); 78 | } 79 | -------------------------------------------------------------------------------- /Source/device.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define USE_MIDI_CALLBACK 4 | 5 | #if !defined OWL_CLASSIC 6 | #define AUDIO_SATURATE_SAMPLES 7 | #endif 8 | 9 | #define DEBUG_MEM 10 | /* #define STARTUP_CODE */ 11 | 12 | #define AUDIO_BIGEND 13 | /* #define AUDIO_SATURATE_SAMPLES // SATURATE adds almost 500 cycles to 24-bit mode */ 14 | #define AUDIO_CHANNELS 2 15 | #define AUDIO_BITDEPTH 24 /* bits per sample */ 16 | #ifndef AUDIO_MAX_BLOCK_SIZE 17 | #define AUDIO_MAX_BLOCK_SIZE 1024 18 | #endif 19 | 20 | #define MAX_BUFFERS_PER_PATCH 8 21 | #define MAX_NUMBER_OF_PARAMETERS 42 22 | 23 | #ifdef USE_FULL_ASSERT 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | void assert_failed(const char* msg, const char* location, int line); 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, "", __LINE__)) 32 | #endif 33 | -------------------------------------------------------------------------------- /Source/heap.h: -------------------------------------------------------------------------------- 1 | #ifndef __heap_h 2 | #define __heap_h 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define configUSE_MALLOC_FAILED_HOOK 1 11 | #define portBYTE_ALIGNMENT 8 12 | #if portBYTE_ALIGNMENT == 8 13 | #define portBYTE_ALIGNMENT_MASK ( 0x0007 ) 14 | #endif 15 | #define configASSERT( x ) 16 | 17 | typedef struct HeapRegion 18 | { 19 | uint8_t *pucStartAddress; 20 | size_t xSizeInBytes; 21 | } HeapRegion_t; 22 | 23 | typedef long BaseType_t; 24 | 25 | void *pvPortMalloc( size_t xWantedSize ); 26 | void vPortFree( void *pv ); 27 | size_t xPortGetFreeHeapSize( void ); 28 | size_t xPortGetMinimumEverFreeHeapSize( void ); 29 | void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ); 30 | int vPortGetSizeBlock (void *pv); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* __heap_h */ 37 | -------------------------------------------------------------------------------- /Source/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ProgramVector.h" 4 | #include "ServiceCall.h" 5 | #include "device.h" 6 | #include "main.h" 7 | #include "heap.h" 8 | #include "message.h" 9 | 10 | #ifdef STARTUP_CODE 11 | extern char _sbss[]; 12 | extern char _ebss[]; 13 | extern char _sidata[]; 14 | extern char _sdata[]; 15 | extern char _edata[]; 16 | extern "C" void __libc_init_array(); 17 | #endif /* STARTUP_CODE */ 18 | 19 | ProgramVector programVector __attribute__ ((section (".pv"))); 20 | // ProgramVector* getProgramVector() { return &programVector; } 21 | 22 | extern "C" { 23 | void vApplicationMallocFailedHook( void ){ 24 | error(OUT_OF_MEMORY_ERROR_STATUS, "Memory overflow"); 25 | } 26 | } 27 | 28 | int main(void){ 29 | #ifdef STARTUP_CODE 30 | memcpy(_sidata, _sdata, _sdata-_edata); // Copy the data segment initializers 31 | memset(_sbss, 0, _ebss-_sbss); // zero fill the BSS segment 32 | #endif /* STARTUP_CODE */ 33 | 34 | ProgramVector* pv = getProgramVector(); 35 | HeapRegion_t regions[5]; 36 | if(pv->checksum >= PROGRAM_VECTOR_CHECKSUM_V13 && pv->heapLocations != NULL){ 37 | int cnt = 0; 38 | MemorySegment* seg = pv->heapLocations; 39 | while(seg != NULL && seg->location != NULL && cnt < 5){ 40 | regions[cnt++] = { seg->location, seg->size }; 41 | seg++; 42 | } 43 | regions[cnt] = {NULL, 0}; // terminate the array 44 | }else{ 45 | /* Defined by the linker */ 46 | extern char _fastheap, _fasteheap; // internal RAM dedicated to heap 47 | extern char _eprogram, _eram; // remaining program space 48 | extern char _heap, _eheap; // external memory 49 | int cnt = 0; 50 | regions[cnt++] = { (uint8_t*)&_fastheap, (size_t)(&_fasteheap - &_fastheap) }; 51 | regions[cnt++] = { (uint8_t*)&_eprogram, (size_t)(&_eram - &_eprogram) }; 52 | regions[cnt++] = { (uint8_t*)&_heap, (size_t)(&_eheap - &_heap) }; 53 | regions[cnt] = {NULL, 0}; // terminate the array 54 | } 55 | vPortDefineHeapRegions(regions); // call before static initialisers to allow heap use 56 | 57 | #ifdef STARTUP_CODE 58 | __libc_init_array(); // Call static constructors 59 | #endif /* STARTUP_CODE */ 60 | 61 | if(pv->checksum >= PROGRAM_VECTOR_CHECKSUM_V12){ 62 | // set event callbacks 63 | pv->buttonChangedCallback = onButtonChanged; 64 | }else if(pv->checksum >= PROGRAM_VECTOR_CHECKSUM_V11){ 65 | // no event callbacks 66 | }else{ 67 | error(CHECKSUM_ERROR_STATUS, "ProgramVector checksum error"); 68 | return -1; 69 | } 70 | 71 | size_t before = xPortGetFreeHeapSize(); 72 | setup(pv); 73 | pv->heap_bytes_used = before - xPortGetFreeHeapSize(); 74 | 75 | run(pv); // never returns 76 | return 0; 77 | } 78 | -------------------------------------------------------------------------------- /Source/main.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAIN_H 2 | #define __MAIN_H 3 | 4 | #include "ProgramVector.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void setup(ProgramVector* pv); 11 | void run(ProgramVector* pv); 12 | 13 | void doSetPatchParameter(uint8_t id, int16_t value); 14 | void doSetButton(uint8_t id, uint16_t state, uint16_t samples); 15 | void onButtonChanged(uint8_t bid, uint16_t state, uint16_t samples); 16 | void onDrawCallback(uint8_t* pixels, uint16_t width, uint16_t height); 17 | 18 | #ifdef USE_MIDI_CALLBACK 19 | void doMidiSend(uint8_t port, uint8_t d0, uint8_t d1, uint8_t d2); 20 | #endif /* USE_MIDI_CALLBACK */ 21 | 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif /* __MAIN_H */ 28 | -------------------------------------------------------------------------------- /Source/operators.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "heap.h" 3 | #include "message.h" 4 | 5 | extern "C" void *__gxx_personality_v0; 6 | extern "C" void __cxa_end_cleanup (void); 7 | extern "C" void __cxa_pure_virtual(){} 8 | 9 | void * operator new(size_t size) { return pvPortMalloc(size); } 10 | void * operator new(size_t, void * p) { return p ; } 11 | void * operator new[](size_t size) { return pvPortMalloc(size); } 12 | void operator delete(void* ptr) { vPortFree(ptr); } 13 | void operator delete(void* ptr, unsigned int) { vPortFree(ptr); } 14 | void operator delete[](void * ptr) { vPortFree(ptr); } 15 | void operator delete[](void* ptr, unsigned int) { vPortFree(ptr); } 16 | //int _gettimeofday(struct timeval *__p, void *__tz){return 0;} 17 | 18 | // Static initialisation thread safety guards 19 | // Returns 1 if the initialization is not yet complete; 0 otherwise. 20 | extern "C" int __cxa_guard_acquire ( __int64_t *guard_object ){ return !*(char *)(guard_object); } 21 | // Sets the first byte of the guard object to a non-zero value. 22 | extern "C" void __cxa_guard_release ( __int64_t *guard_object ){ *(char *)guard_object = 1; } 23 | extern "C" void __cxa_guard_abort ( __int64_t *guard_object ){} 24 | 25 | namespace std { 26 | void __throw_bad_alloc (void) { error(PROGRAM_ERROR_STATUS, "bad alloc"); while(1); } 27 | void __throw_bad_function_call() { error(PROGRAM_ERROR_STATUS, "bad func"); while(1); } 28 | void __throw_length_error (const char *) { error(PROGRAM_ERROR_STATUS, "bad len"); while(1); } 29 | } 30 | -------------------------------------------------------------------------------- /Source/sbrk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | extern int errno; 5 | #include "message.h" 6 | 7 | // #define DOUBLE_HEAP 8 | #define FAST_HEAP_SIZE (32*1024) 9 | uint32_t total_heap_used = 0; 10 | caddr_t _sbrk(int incr) 11 | { 12 | /* while(incr & 0x03) */ 13 | /* incr++; // word align */ 14 | char *prev_heap_end; 15 | extern char _heap, _eheap; /* Defined by the linker */ 16 | static char *heap_end = &_heap; 17 | #ifdef DOUBLE_HEAP 18 | if(incr < 0) 19 | // newlib nano malloc doesn't deallocate 20 | error(0x60, "Deallocating heap not allowed"); 21 | static char fast_heap[FAST_HEAP_SIZE] __attribute__ ((section (".ccmdata"))); 22 | static char *fast_heap_end = fast_heap; 23 | static char* fast_eheap = fast_heap+FAST_HEAP_SIZE; 24 | /* if(incr < 1*1024 && fast_heap_end+incr <= fast_eheap){ */ 25 | if(heap_end == &_heap && fast_heap_end+incr <= fast_eheap){ 26 | /* if(fast_heap_end+incr <= fast_eheap){ */ 27 | prev_heap_end = fast_heap_end; 28 | fast_heap_end += incr; 29 | total_heap_used += incr; 30 | return (caddr_t) prev_heap_end; 31 | } 32 | #endif 33 | prev_heap_end = heap_end; 34 | if (heap_end+incr > &_eheap) 35 | { 36 | errno = ENOMEM; 37 | error(0x60, "Heap overflow"); 38 | return (caddr_t)0; 39 | } 40 | heap_end += incr; 41 | total_heap_used += incr; 42 | return (caddr_t) prev_heap_end; 43 | } 44 | -------------------------------------------------------------------------------- /Source/startup.s: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .cpu cortex-m3 3 | .fpu softvfp 4 | .thumb 5 | 6 | .global g_pfnVectors 7 | ;; .global ProgramVector 8 | ;; .global vector 9 | 10 | 11 | /* start address for the initialization values of the .data section. 12 | defined in linker script */ 13 | .word _sidata 14 | /* start address for the .data section. defined in linker script */ 15 | .word _sdata 16 | /* end address for the .data section. defined in linker script */ 17 | .word _edata 18 | /* start address for the .bss section. defined in linker script */ 19 | .word _sbss 20 | /* end address for the .bss section. defined in linker script */ 21 | .word _ebss 22 | /* stack used for SystemInit_ExtMemCtl; always internal RAM used */ 23 | 24 | .section .text.Reset_Handler 25 | .weak Reset_Handler 26 | .type Reset_Handler, %function 27 | Reset_Handler: 28 | /* Copy the data segment initializers from flash to SRAM */ 29 | movs r1, #0 30 | b LoopCopyDataInit 31 | CopyDataInit: 32 | ldr r3, =_sidata 33 | ldr r3, [r3, r1] 34 | str r3, [r0, r1] 35 | adds r1, r1, #4 36 | LoopCopyDataInit: 37 | ldr r0, =_sdata 38 | ldr r3, =_edata 39 | adds r2, r0, r1 40 | cmp r2, r3 41 | bcc CopyDataInit 42 | 43 | /* Zero fill the bss segment. */ 44 | ldr r2, =_sbss 45 | b LoopFillZerobss 46 | FillZerobss: 47 | movs r3, #0 48 | str r3, [r2], #4 49 | LoopFillZerobss: 50 | ldr r3, = _ebss 51 | cmp r2, r3 52 | bcc FillZerobss 53 | 54 | /* Call static constructors */ 55 | bl __libc_init_array 56 | /* 57 | ldr r12,=__libc_init_array 58 | mov lr,pc 59 | bx r12 60 | */ 61 | /* Call the application's entry point.*/ 62 | bl main 63 | /* 64 | lrd r12,=main 65 | mov lr,pc 66 | bx r12 67 | */ 68 | bx lr 69 | .size Reset_Handler, .-Reset_Handler 70 | 71 | .section .program_header,"a",%progbits 72 | .type g_pfnVectors, %object 73 | .size g_pfnVectors, .-g_pfnVectors 74 | 75 | g_pfnVectors: 76 | .word 0XDADAC0DE /* magic */ 77 | .word _startprog /* link base address */ 78 | .word _endprog /* end of program */ 79 | .word Reset_Handler /* code entry point */ 80 | .word _stack /* stack start */ 81 | .word _estack /* stack end */ 82 | .word _programvector 83 | .include "progname.s" 84 | -------------------------------------------------------------------------------- /Source/system_tables.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "system_tables.h" 3 | #include "ServiceCall.h" 4 | #include "FastPowTable.h" 5 | #include "FastLogTable.h" 6 | #include "basicmaths.h" 7 | 8 | void setSystemTables(ProgramVector* pv){ 9 | void* array; 10 | int size; 11 | void* args[] = {(void*)SYSTEM_TABLE_LOG, (void*)&array, (void*)&size}; 12 | int ret = 0; 13 | ret = getProgramVector()->serviceCall(OWL_SERVICE_GET_ARRAY, args, 3); 14 | if(ret == OWL_SERVICE_OK && array != NULL && size > 0) 15 | fast_log_set_table((const float*)array, size); 16 | else 17 | fast_log_set_table(fast_log_table, fast_log_table_size); 18 | args[0] = (void*)SYSTEM_TABLE_POW; 19 | ret = getProgramVector()->serviceCall(OWL_SERVICE_GET_ARRAY, args, 3); 20 | if(ret == OWL_SERVICE_OK && array != NULL && size > 0) 21 | fast_pow_set_table((const uint32_t*)array, size); 22 | else 23 | fast_pow_set_table(fast_pow_table, fast_pow_table_size); 24 | } 25 | -------------------------------------------------------------------------------- /Source/system_tables.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYSTEM_TABLES_H 2 | #define __SYSTEM_TABLES_H 3 | 4 | #include "ProgramVector.h" 5 | 6 | void setSystemTables(ProgramVector* pv); 7 | 8 | #endif /* __SYSTEM_TABLES_H */ 9 | -------------------------------------------------------------------------------- /TestPatches/ComplexFourierTransformTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __ComplexFourierTransformTestPatch_hpp__ 2 | #define __ComplexFourierTransformTestPatch_hpp__ 3 | 4 | #include "StompBox.h" 5 | #include "ComplexFourierTransform.h" 6 | class ComplexFourierTransformTestPatch : public Patch { 7 | private: 8 | bool success; 9 | int passed; 10 | int failed; 11 | int fftsize; 12 | ComplexFourierTransform fftArm; 13 | // ComplexFourierTransform fftGeneric; 14 | bool assertt(float first, float second, const char *message){ //assert with tolerance 15 | bool cond=false; 16 | float tol=0.0000001; 17 | if(abs(second-first)=0) 29 | debugMessage(message, n); 30 | else 31 | debugMessage(message); 32 | ASSERT(condition, message); //this actually causes the program to exit and the LED to turn red 33 | //but if you comment out the line above you can get nice acoustic feedback instead (sinewave for success, noise for error) 34 | failed++; 35 | } else { 36 | passed++; 37 | } 38 | return condition; 39 | } 40 | ComplexFloatArray inout; 41 | public: 42 | ComplexFourierTransformTestPatch(){ 43 | fftsize=getBlockSize(); 44 | fftArm.init(fftsize); 45 | inout=ComplexFloatArray::create(fftsize); 46 | 47 | }; 48 | void processAudio(AudioBuffer &buffer){ 49 | FloatArray samples=buffer.getSamples(0); 50 | inout.fromFloat(samples); // copies only real values 51 | fftArm.fft(inout); 52 | fftArm.ifft(inout); 53 | inout.getRealValues(samples); 54 | samples.multiply(0.2); 55 | 56 | } 57 | }; 58 | 59 | #endif // __ComplexFourierTransformTestPatch_hpp__ 60 | -------------------------------------------------------------------------------- /TestPatches/ComplexShortArrayTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #include "TestPatch.hpp" 2 | #include "ShortArray.h" 3 | #include "ComplexShortArray.h" 4 | 5 | class ComplexShortArrayTestPatch : public TestPatch { 6 | public: 7 | ComplexShortArrayTestPatch(){ 8 | { 9 | TEST("sizeof"); 10 | CHECK(sizeof(ComplexShortArray) == sizeof(ComplexShort*)+sizeof(size_t)); 11 | } 12 | { 13 | TEST("Default ctor"); 14 | ComplexShortArray empty; 15 | CHECK_EQUAL(empty.getSize(), 0); 16 | CHECK((ComplexShort*)empty == NULL); 17 | ComplexShortArray::destroy(empty); 18 | } 19 | { 20 | TEST("create"); 21 | ComplexShortArray array = ComplexShortArray::create(512); 22 | CHECK_EQUAL(array.getSize(), 512); 23 | REQUIRE(array.getData() != NULL); 24 | ComplexShortArray::destroy(array); 25 | } 26 | { 27 | TEST("getSize"); 28 | size_t size = 123; 29 | ComplexShortArray array = ComplexShortArray::create(size); 30 | CHECK_EQUAL(size, array.getSize()); 31 | ComplexShortArray::destroy(array); 32 | } 33 | { 34 | TEST("ComplexByComplexMultiplication"); 35 | ComplexShortArray cfa = ComplexShortArray::create(1000); 36 | ComplexShortArray tempc = ComplexShortArray::create(1000); 37 | ComplexShortArray tempc2 = ComplexShortArray::create(1000); 38 | cfa[0].re = 10000; 39 | cfa[0].im = 12000; 40 | cfa[1].re = 14000; 41 | cfa[1].im = 23000; 42 | cfa.complexByComplexMultiplication(tempc, tempc2); 43 | for(size_t n=0; n < cfa.getSize(); ++n){ 44 | CHECK_CLOSE(tempc2[n].re, (cfa[n].re*tempc[n].re - cfa[n].im*tempc[n].im) >> 17, 4); 45 | CHECK_CLOSE(tempc2[n].im, (cfa[n].re*tempc[n].im + cfa[n].im*tempc[n].re) >> 17, 4); 46 | } 47 | ComplexShortArray::destroy(cfa); 48 | ComplexShortArray::destroy(tempc); 49 | ComplexShortArray::destroy(tempc2); 50 | } 51 | } 52 | }; 53 | -------------------------------------------------------------------------------- /TestPatches/CppTest/CppTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __CppTestPatch_hpp__ 2 | #define __CppTestPatch_hpp__ 3 | 4 | #include "OpenWareLibrary.h" 5 | 6 | class CppTestPatch : public Patch { 7 | public: 8 | CppTestPatch(){ 9 | registerParameter(PARAMETER_A, "Gain"); 10 | setParameterValue(PARAMETER_A, 0.5); 11 | } 12 | void processAudio(AudioBuffer &buffer){ 13 | float gain = getParameterValue(PARAMETER_A)*2; 14 | for(size_t ch=0; chInit(getSampleRate()); 14 | osc->SetFreq(100); 15 | } 16 | ~DaisySPTestPatch() { 17 | delete osc; 18 | } 19 | void processAudio(AudioBuffer& buffer) { 20 | FloatArray chan = buffer.getSamples(0); 21 | for (int i = 0; i < chan.getSize(); i++) { 22 | chan[i] = osc->Process(); 23 | } 24 | } 25 | }; 26 | 27 | #endif // __DaisySPTestPatch_hpp__ 28 | -------------------------------------------------------------------------------- /TestPatches/FastExpTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #include "TestPatch.hpp" 2 | 3 | #ifdef expf 4 | #undef expf 5 | #endif 6 | #include 7 | 8 | class FastExpTestPatch : public TestPatch { 9 | public: 10 | FastExpTestPatch(){ 11 | { 12 | TEST("FastExp"); 13 | float maxPerc = 0; 14 | #ifdef ARM_CORTEX 15 | float threshold = 0.02; 16 | #else 17 | float threshold = 0.544; // maximum relative error accepted: 0.02 for big tables, 0.544 for small 18 | #endif 19 | int errs = 0; 20 | int tests = 0; 21 | for(int n = -90; n < 90; n++){ 22 | float x = randf() * n; 23 | float approx = fast_expf(x); 24 | float exact = expf(x); 25 | float err = fabsf(approx - exact); 26 | float perc = (exact == 0.00 || std::isfinite(exact)) == 0 ? err*100 : (err/exact)*100; 27 | CHECK(perc perc ? maxPerc : perc; 29 | if(fabsf(perc) > threshold) 30 | errs++; 31 | tests++; 32 | } 33 | debugMessage("threshold / errors %:", threshold, 100.0f*errs/tests); 34 | debugMessage("max error %:", maxPerc); 35 | } 36 | } 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /TestPatches/FastLogTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #include "TestPatch.hpp" 2 | 3 | #ifdef logf 4 | #undef logf 5 | #endif 6 | 7 | class FastLogTestPatch : public TestPatch { 8 | public: 9 | FastLogTestPatch(){ 10 | { 11 | TEST("FastLog"); 12 | float maxPerc = 0; 13 | #ifdef ARM_CORTEX 14 | float threshold = 0.025; 15 | #else 16 | float threshold = 0.8283; // maximum relative error accepted: 0.025 for big tables, 0.8283 for small 17 | #endif 18 | int errs = 0; 19 | int tests = 0; 20 | for(int n = 10; n <= 10000; n++){ 21 | float x = rand()/(float)RAND_MAX * n; 22 | // float x = randf() * n; 23 | float approx = fast_logf(x); 24 | float exact = logf(x); 25 | float err = fabsf(approx - exact); 26 | float perc = err/exact * 100; 27 | CHECK(perc perc ? maxPerc : perc; 29 | if(fabsf(perc) > threshold) 30 | errs++; 31 | tests++; 32 | } 33 | debugMessage("threshold / errors %:", threshold, 100.0f*errs/tests); 34 | debugMessage("max error %:", maxPerc); 35 | } 36 | } 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /TestPatches/FastPowTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #include "TestPatch.hpp" 2 | 3 | #ifdef powf 4 | #undef powf 5 | #endif 6 | 7 | class FastPowTestPatch : public TestPatch { 8 | public: 9 | FastPowTestPatch(){ 10 | { 11 | TEST("FastPow"); 12 | float maxPerc = 0; 13 | #ifdef ARM_CORTEX 14 | float threshold = 0.04; 15 | #else 16 | float threshold = 0.544; // maximum relative error accepted: 0.04 for big tables, 0.544 for small 17 | #endif 18 | int errs = 0; 19 | int tests = 0; 20 | for(int n = -1000; n < 1000; n++){ 21 | float base = randf() * 10; 22 | float exponent = n*10/1000.f; 23 | float approx = fast_powf(base, exponent); 24 | float exact = powf(base, exponent); 25 | float err = fabsf(approx - exact); 26 | float perc = err/exact * 100; 27 | CHECK(perc perc ? maxPerc : perc; 30 | if(fabsf(perc) > threshold) 31 | errs++; 32 | tests++; 33 | } 34 | debugMessage("threshold / errors %:", threshold, 100.0f*errs/tests); 35 | debugMessage("max error %:", maxPerc); 36 | } 37 | } 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /TestPatches/FaustTest/FaustTest.dsp: -------------------------------------------------------------------------------- 1 | import("music.lib"); 2 | 3 | btn1 = checkbox("btn1[OWL:B1]"); 4 | led1 = hbargraph("led2>[OWL:B1]", 0, 1); 5 | 6 | process = attach(osc(1000) * btn1, 1-btn1 : led1); 7 | -------------------------------------------------------------------------------- /TestPatches/FirFilterPerformanceTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __FirFilterPerformanceTestPatch_hpp__ 2 | #define __FirFilterPerformanceTestPatch_hpp__ 3 | 4 | #include "StompBox.h" 5 | #include "FirFilter.h" 6 | class FirFilterPerformanceTestPatch : public Patch { 7 | public: 8 | FirFilter *filter; 9 | const static int numTaps = 600; 10 | FloatArray coefficients; 11 | FirFilterPerformanceTestPatch(){ 12 | filter = FirFilter::create(numTaps, getBlockSize()); 13 | coefficients = filter->getCoefficients(); 14 | #include "FirInit.h" //initializes coefficients 15 | } 16 | ~FirFilterPerformanceTestPatch(){ 17 | FirFilter::destroy(filter); 18 | } 19 | void processAudio(AudioBuffer &buffer){ 20 | FloatArray left = buffer.getSamples(LEFT_CHANNEL); 21 | filter->process(left, left); 22 | } 23 | }; 24 | 25 | #endif // __FirFilterPerformanceTestPatch_hpp__ 26 | -------------------------------------------------------------------------------- /TestPatches/FirFilterTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __FirFilterTestPatch_hpp__ 2 | #define __FirFilterTestPatch_hpp__ 3 | 4 | #include "StompBox.h" 5 | #include "FirFilter.h" 6 | class FirFilterTestPatch : public Patch { 7 | public: 8 | FirFilter *filter; 9 | int numTaps=64; 10 | FloatArray temp; 11 | FloatArray coefficients; 12 | FirFilterTestPatch(){ 13 | filter=FirFilter::create(numTaps, getBlockSize()); 14 | coefficients = filter->getCoefficients(); 15 | #include "FirInit.h" //initializes coefficients 16 | temp=FloatArray::create(getBlockSize()); 17 | } 18 | ~FirFilterTestPatch(){ 19 | FloatArray::destroy(temp); 20 | } 21 | void processAudio(AudioBuffer &buffer){ 22 | FloatArray fa=buffer.getSamples(0); 23 | // fa.noise(); 24 | filter->process(fa, temp); 25 | // fa.copyFrom(temp); 26 | // debugMessage("max value",fa.getMaxValue()); 27 | } 28 | }; 29 | 30 | #endif // __FirFilterTestPatch_hpp__ 31 | -------------------------------------------------------------------------------- /TestPatches/HeavyTest/HeavyTest.pd: -------------------------------------------------------------------------------- 1 | #N canvas 0 66 1920 1014 10; 2 | #X obj 52 110 *~ 2000; 3 | #X obj 91 182 osc~; 4 | #X obj 222 166 osc~; 5 | #X obj 92 255 *~ 0.3; 6 | #X obj 252 213 *~ 0.3; 7 | #X obj 382 187 osc~; 8 | #X obj 344 248 *~ 0.3; 9 | #X obj 227 383 dac~; 10 | #X obj 422 95 print hello; 11 | #X obj 60 41 r Osc1 @owl A; 12 | #X obj 18 76 s Send1 @owl F; 13 | #X obj 230 334 +~; 14 | #X obj 246 74 s Send2 @owl G; 15 | #X obj 224 42 r Osc2 @owl B 0.25 0.75 0.5; 16 | #X obj 234 120 *~ 2000; 17 | #X obj 415 41 r Osc3 @owl C @owl_min 400 @owl_max 4000 @owl_default 18 | 800; 19 | #X connect 0 0 1 0; 20 | #X connect 1 0 3 0; 21 | #X connect 2 0 4 0; 22 | #X connect 3 0 11 0; 23 | #X connect 4 0 11 0; 24 | #X connect 5 0 6 0; 25 | #X connect 6 0 11 0; 26 | #X connect 9 0 0 0; 27 | #X connect 9 0 10 0; 28 | #X connect 11 0 7 0; 29 | #X connect 11 0 7 1; 30 | #X connect 13 0 12 0; 31 | #X connect 13 0 14 0; 32 | #X connect 14 0 2 0; 33 | #X connect 15 0 5 0; 34 | #X connect 15 0 8 0; 35 | -------------------------------------------------------------------------------- /TestPatches/MidiMessageTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #include "TestPatch.hpp" 2 | #include "MidiMessage.h" 3 | 4 | class MidiMessageTestPatch : public TestPatch { 5 | public: 6 | MidiMessageTestPatch(){ 7 | { 8 | TEST("ctor"); 9 | MidiMessage msg; 10 | CHECK_EQUAL(sizeof(msg), sizeof(uint32_t)); 11 | CHECK_EQUAL(msg.packed, 0); 12 | msg = MidiMessage(1, 2, 3, 4); 13 | CHECK_EQUAL(msg.data[0], 1); 14 | CHECK_EQUAL(msg.data[1], 2); 15 | CHECK_EQUAL(msg.data[2], 3); 16 | CHECK_EQUAL(msg.data[3], 4); 17 | } 18 | { 19 | TEST("pb"); 20 | MidiMessage msg = MidiMessage::pb(15, -1234); 21 | CHECK(msg.isPitchBend()); 22 | CHECK_EQUAL(msg.getChannel(), 15); 23 | CHECK_EQUAL(msg.getPitchBend(), -1234); 24 | } 25 | { 26 | TEST("cc"); 27 | MidiMessage msg = MidiMessage::cc(3, 55, 127); 28 | CHECK(msg.isControlChange()); 29 | CHECK_EQUAL(msg.getChannel(), 3); 30 | CHECK_EQUAL(msg.getControllerNumber(), 55); 31 | CHECK_EQUAL(msg.getControllerValue(), 127); 32 | } 33 | { 34 | TEST("pc"); 35 | MidiMessage msg = MidiMessage::pc(12, 39); 36 | CHECK(msg.isProgramChange()); 37 | CHECK_EQUAL(msg.getChannel(), 12); 38 | CHECK_EQUAL(msg.getProgramChange(), 39); 39 | } 40 | { 41 | TEST("note off"); 42 | MidiMessage msg = MidiMessage::note(1, 39, 0); 43 | CHECK(msg.isNote()); 44 | CHECK(msg.isNoteOff()); 45 | CHECK_EQUAL(msg.getChannel(), 1); 46 | CHECK_EQUAL(msg.getNote(), 39); 47 | CHECK_EQUAL(msg.getVelocity(), 0); 48 | } 49 | { 50 | TEST("note on"); 51 | MidiMessage msg = MidiMessage::note(7, 44, 89); 52 | CHECK(msg.isNote()); 53 | CHECK(msg.isNoteOn()); 54 | CHECK_EQUAL(msg.getChannel(), 7); 55 | CHECK_EQUAL(msg.getNote(), 44); 56 | CHECK_EQUAL(msg.getVelocity(), 89); 57 | } 58 | { 59 | TEST("cp"); 60 | MidiMessage msg = MidiMessage::cp(7, 119); 61 | CHECK(msg.isChannelPressure()); 62 | CHECK_EQUAL(msg.getChannel(), 7); 63 | CHECK_EQUAL(msg.getChannelPressure(), 119); 64 | } 65 | { 66 | TEST("at"); 67 | MidiMessage msg = MidiMessage::at(7, 119, 125); 68 | CHECK(msg.isPolyKeyPressure()); 69 | CHECK_EQUAL(msg.getChannel(), 7); 70 | CHECK_EQUAL(msg.getNote(), 119); 71 | CHECK_EQUAL(msg.getPolyKeyPressure(), 125); 72 | } 73 | } 74 | }; 75 | -------------------------------------------------------------------------------- /TestPatches/PatchTest.cpp: -------------------------------------------------------------------------------- 1 | #include "malloc.h" 2 | #include "heap.h" 3 | void *pvPortMalloc( size_t xWantedSize ){ 4 | return malloc(xWantedSize); 5 | } 6 | void vPortFree( void *pv ){ 7 | free(pv); 8 | } 9 | #include "basicmaths.h" 10 | #include "message.h" 11 | #include "TestPatch.hpp" 12 | #include "ProgramVector.h" 13 | #include "PatchProcessor.h" 14 | #include "MemoryBuffer.hpp" 15 | #include 16 | 17 | #include "registerpatch.h" 18 | 19 | #define SAMPLE_RATE 48000 20 | #define CHANNELS 2 21 | #define BLOCKSIZE 64 22 | 23 | #include "DummyPatch.hpp" 24 | 25 | PatchProcessor processor; 26 | ProgramVector programVector; 27 | extern int errorcode; 28 | 29 | PatchProcessor* getInitialisingPatchProcessor(){ 30 | return &processor; 31 | } 32 | 33 | void registerPatch(const char* name, uint8_t inputs, uint8_t outputs, Patch* patch){ 34 | getInitialisingPatchProcessor()->setPatch(patch, name); 35 | } 36 | 37 | #define REGISTER_PATCH(T, STR, IN, OUT) registerPatch(STR, IN, OUT, new T) 38 | 39 | int main(int argc, char** argv){ 40 | errorcode = 0; 41 | programVector.serviceCall = serviceCall; 42 | #include "registerpatch.cpp" 43 | ASSERT(getInitialisingPatchProcessor()->patch != NULL, "Missing test patch"); 44 | AudioBuffer* samples = AudioBuffer::create(CHANNELS, BLOCKSIZE); 45 | getInitialisingPatchProcessor()->patch->processAudio(*samples); 46 | AudioBuffer::destroy(samples); 47 | delete getInitialisingPatchProcessor()->patch; 48 | return errorcode; 49 | } 50 | -------------------------------------------------------------------------------- /TestPatches/ResampleTestPatch.hpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | 3 | /* 4 | 5 | 6 | LICENSE: 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | 20 | */ 21 | 22 | 23 | /* created by the OWL team 2015 */ 24 | 25 | 26 | //////////////////////////////////////////////////////////////////////////////////////////////////// 27 | 28 | 29 | #ifndef __ResampleTestPatch_hpp__ 30 | #define __ResampleTestPatch_hpp__ 31 | 32 | #include "Patch.h" 33 | #include "Resample.h" 34 | 35 | class ResampleTestPatch : public Patch { 36 | public: 37 | Resampler resampler; 38 | FloatArray up; 39 | FloatArray temp; 40 | int factor; 41 | ResampleTestPatch(){ 42 | registerParameter(PARAMETER_A, "do_resample"); 43 | registerParameter(PARAMETER_B, "gain"); 44 | registerParameter(PARAMETER_C, "master"); 45 | factor=4; 46 | int blockSize=getBlockSize(); 47 | up=FloatArray::create(factor*blockSize); 48 | } 49 | ~ResampleTestPatch(){ 50 | FloatArray::destroy(up); 51 | } 52 | void processAudio(AudioBuffer &buffer){ 53 | FloatArray samples=buffer.getSamples(0); 54 | if(getParameterValue(PARAMETER_A)<0.5){ 55 | // debugMessage("oversample",downsample.getCoefficients()[3]); 56 | return; 57 | } 58 | // debugMessage("oversample",downsample.getCoefficients()[0],downsample.getCoefficients()[1],downsample.getCoefficients()[2]); 59 | resampler.upsample(samples,up); 60 | 61 | resampler.downsample(up, samples); 62 | // samples.multiply(getParameterValue(PARAMETER_B)); 63 | } 64 | }; 65 | 66 | #endif // __ResampleTestPatch_hpp__ 67 | -------------------------------------------------------------------------------- /TestPatches/ShortFastFourierTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __ShortFastFourierTestPatch_hpp__ 2 | #define __ShortFastFourierTestPatch_hpp__ 3 | 4 | #include 5 | #include 6 | #include "Patch.h" 7 | #include "ShortFastFourierTransform.h" 8 | 9 | void prettyPrint(ComplexShortArray X){ 10 | printf("["); 11 | for(int n = 0; n < X.getSize(); ++n){ 12 | printf("%d + %di; ", X[n].re, X[n].im); 13 | } 14 | printf("];\n\n"); 15 | } 16 | void prettyPrint(ShortArray x){ 17 | printf("["); 18 | for(int n = 0; n < x.getSize(); ++n){ 19 | printf("%d; ", x[n]); 20 | } 21 | printf("];\n\n"); 22 | } 23 | class ShortFastFourierTestPatch : public TestPatch { 24 | private: 25 | ShortFastFourierTransform transform; 26 | ComplexShortArray X; 27 | ShortArray x; 28 | public: 29 | ShortFastFourierTestPatch(){ 30 | int fftSize = 512; 31 | transform.init(fftSize); 32 | X = ComplexShortArray::create(fftSize); 33 | x = ShortArray::create(fftSize); 34 | // matlab code: 35 | /* 36 | fftSize = 512; 37 | x = mod( (0:fftSize-1)' * 4096, 32768) - 16384; 38 | X = fft(x)/fftSize; 39 | */ 40 | for(int n = 0; n < x.getSize(); ++n){ 41 | x[n] = ((n * 4096) % 32768 ) - 16384; 42 | } 43 | transform.fft(x, X); 44 | ShortArray data((int16_t*)X.getData(), X.getSize() * 2); 45 | printf("Xc="); 46 | // At this point the values of X are pretty similar to the ones in matlab. 47 | // But their magnitude is pretty small (~2048). 48 | // You could try to left shift them to increase the magnitude again and 49 | // reduce the rounding error that will be caused by the ifft: 50 | // data.shift(16 - log2(data.getMaxValue())); 51 | // but this would most likely cause saturation when you do ifft ! 52 | prettyPrint(X); 53 | transform.ifft(X, x); 54 | // shift back to 1.15 55 | x.shift(log2(fftSize)); 56 | // At this point, with infinite precision, x should be back to being exactly 57 | // the same as the one we started with, instead there are some large errors 58 | // (~1024) 59 | printf("xc="); 60 | prettyPrint(x); 61 | } 62 | ~ShortFastFourierTestPatch(){ 63 | ComplexShortArray::destroy(X); 64 | } 65 | }; 66 | 67 | #endif // __ShortFastFourierTestPatch_hpp__ 68 | -------------------------------------------------------------------------------- /TestPatches/SineOscillatorTestPatch.hpp: -------------------------------------------------------------------------------- 1 | #include "TestPatch.hpp" 2 | #include "SineOscillator.h" 3 | 4 | class SineOscillatorTestPatch : public TestPatch { 5 | public: 6 | SineOscillatorTestPatch(){ 7 | { 8 | TEST("ctor"); 9 | SineOscillator osc; 10 | osc.setSampleRate(16000); 11 | osc.setFrequency(440); 12 | CHECK_EQUAL(osc.getSampleRate(), 16000); 13 | CHECK_EQUAL((int)osc.getFrequency(), 440); 14 | osc = SineOscillator(); 15 | osc.setSampleRate(32000); 16 | CHECK_EQUAL(osc.getFrequency(), 0.0f); 17 | CHECK_EQUAL(osc.getSampleRate(), 32000); 18 | } 19 | { 20 | TEST("create"); 21 | SineOscillator* osc = SineOscillator::create(32000); 22 | osc->setFrequency(120); 23 | CHECK_EQUAL(osc->getSampleRate(), 32000); 24 | CHECK_EQUAL(osc->getFrequency(), 120); 25 | SineOscillator::destroy(osc); 26 | } 27 | { 28 | TEST("setSampleRate"); 29 | SineOscillator* osc = SineOscillator::create(44100); 30 | osc->setFrequency(321); 31 | CHECK_EQUAL(osc->getSampleRate(), 44100); 32 | CHECK_EQUAL(osc->getFrequency(), 321); 33 | osc->setSampleRate(48000); 34 | CHECK_EQUAL((int)osc->getSampleRate(), 48000); 35 | CHECK_EQUAL(osc->getFrequency(), 321); // check that frequency is the same 36 | SineOscillator::destroy(osc); 37 | } 38 | { 39 | TEST("compareBlockAndSampleBased"); 40 | SineOscillator* osc1 = SineOscillator::create(48000); 41 | SineOscillator* osc2 = SineOscillator::create(48000); 42 | osc1->setFrequency(480); 43 | osc2->setFrequency(480); 44 | FloatArray s1 = FloatArray::create(1000); 45 | FloatArray s2 = FloatArray::create(1000); 46 | osc1->generate(s1); 47 | for(size_t i=0; i<1000; ++i) 48 | s2[i] = osc2->generate(); 49 | for(size_t i=0; i<1000; ++i) 50 | CHECK_CLOSE(s1[i], s2[i], 0.00002); 51 | osc1->generate(s1); 52 | for(size_t i=0; i<1000; ++i) 53 | s2[i] = osc2->generate(); 54 | for(size_t i=0; i<1000; ++i) 55 | CHECK_CLOSE(s1[i], s2[i], 0.00002); 56 | FloatArray::destroy(s1); 57 | FloatArray::destroy(s2); 58 | SineOscillator::destroy(osc1); 59 | SineOscillator::destroy(osc2); 60 | } 61 | } 62 | }; 63 | 64 | -------------------------------------------------------------------------------- /TestPatches/SoulTest/soul.hpp: -------------------------------------------------------------------------------- 1 | #include "SineSynth.hpp" 2 | #define SOULPATCH SineSynth 3 | -------------------------------------------------------------------------------- /TestPatches/TestPatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TestPatch_hpp__ 2 | #define __TestPatch_hpp__ 3 | 4 | #include 5 | #include "Patch.h" 6 | 7 | #define TEST(name) do{ errormessage = (char*)("Test " name " failed line"); }while(0) 8 | #define CHECK(cond) if(!(cond)){ fail("CHECK(" #cond ") fail", __LINE__); }else{ pass(); } 9 | #define CHECK_RELATIVE(a, b, c) if(abs(((a)-(b))/(a))>(c)){ fail("CHECK_RELATIVE(" #a ", " #b ", " #c ") fail", __LINE__); }else{ pass(); } 10 | #define REQUIRE(cond) if(!(cond)){ assert_failed("REQUIRE(" #cond ") fail", "", __LINE__); }else{ pass(); } 11 | 12 | // #define CHECK_EQUAL(a, b) if((a) != (b)){ fail("CHECK_EQUAL(" #a ", " #b ") fail", __LINE__); }else{ pass(); } 13 | // #define CHECK_CLOSE(a, b, c) if(abs((a)-(b))>(c)){ fail("CHECK_CLOSE(" #a ", " #b ", " #c ") fail", __LINE__); }else{ pass(); } 14 | #define CHECK_EQUAL(a, b) check_equal(a, b, "CHECK_EQUAL(" #a ", " #b ") fail", __LINE__) 15 | #define CHECK_CLOSE(a, b, c) check_close(a, b, c, "CHECK_CLOSE(" #a ", " #b ", " #c ") fail", __LINE__) 16 | 17 | /** Abstract base class for tests */ 18 | class TestPatch : public Patch { 19 | public: 20 | const float DEFAULT_TOLERANCE = 2*FLT_EPSILON; 21 | const char* DEFAULT_MESSAGE = (char*)"Tests passed/failed"; 22 | bool success; 23 | int passed; 24 | int failed; 25 | char* errormessage; 26 | void pass(){ 27 | passed++; 28 | } 29 | void fail(const char* condition, int line){ 30 | debugMessage(condition); 31 | debugMessage(errormessage, line); 32 | success = false; 33 | failed++; 34 | } 35 | bool check_equal(float a, float b, const char* msg, int line){ 36 | if(a != b){ 37 | debugMessage("CHECK_EQUAL", a, b); 38 | fail(msg, line); 39 | return false; 40 | }else{ 41 | pass(); 42 | return true; 43 | } 44 | } 45 | bool check_close(float a, float b, float c, const char* msg, int line){ 46 | if(abs((a)-(b))>(c)){ 47 | debugMessage("CHECK_CLOSE", a, b, c); 48 | fail(msg, line); 49 | return false; 50 | }else{ 51 | pass(); 52 | return true; 53 | } 54 | } 55 | TestPatch(): success(true), passed(0), failed(0), errormessage((char*)DEFAULT_MESSAGE){ 56 | } 57 | 58 | void processAudio(AudioBuffer &buffer){ 59 | FloatArray sig = buffer.getSamples(LEFT_CHANNEL); 60 | if(success){ 61 | static float phase = 0; 62 | float inc = 2*M_PI/200.0f; 63 | for(int n=0; n2*M_PI ? phase-2*M_PI : phase; 67 | } 68 | }else{ 69 | for(int n=0; n. 19 | 20 | */ 21 | 22 | 23 | /* created by the OWL team 2013 */ 24 | 25 | 26 | //////////////////////////////////////////////////////////////////////////////////////////////////// 27 | 28 | 29 | #ifndef __ZeroCrossingPitchDetectorTestPatch_hpp__ 30 | #define __ZeroCrossingPitchDetectorTestPatch_hpp__ 31 | 32 | #include "StompBox.h" 33 | #include "PitchDetector.h" 34 | 35 | class ZeroCrossingPitchDetectorTestPatch : public Patch { 36 | public: 37 | ZeroCrossingPitchDetector zcc; 38 | ZeroCrossingPitchDetectorTestPatch() : zcc(getSampleRate(), getBlockSize()){ 39 | registerParameter(PARAMETER_A, "Mix"); 40 | registerParameter(PARAMETER_B, "HP cutoff"); 41 | registerParameter(PARAMETER_C, "LP cutoff"); 42 | registerParameter(PARAMETER_D, "gain"); 43 | } 44 | void processAudio(AudioBuffer &buffer){ 45 | FloatArray fa=buffer.getSamples(0); 46 | float mix=getParameterValue(PARAMETER_A); 47 | zcc.setHighPassCutoff(getParameterValue(PARAMETER_B)*15000+150); 48 | zcc.setLowPassCutoff(getParameterValue(PARAMETER_C)*500+50); 49 | zcc.process(fa); 50 | float frequency=zcc.getFrequency(); 51 | float envelope=fa.getRms(); 52 | fa.multiply(1-mix); 53 | for(size_t n=0;n 2.0 * M_PI) 58 | phase -= 2.0 * M_PI; 59 | if(phase > 4.0*M_PI) 60 | phase=0; 61 | envelope=0.1*envelope + pastEnvelope*0.9; 62 | pastEnvelope=envelope; 63 | fa[n]+=sin(phase)*mix*envelope; 64 | } 65 | fa.multiply(getParameterValue(PARAMETER_D)*10); 66 | fa.copyTo(buffer.getSamples(1)); 67 | debugMessage("frequency/envelope: ", frequency, envelope); 68 | // float *coeffs=zcc.getFilter()->getFilterStage(0).getCoefficients(); 69 | // debugMessage("coeffs: ", coeffs[3], coeffs[4], coeffs[2] ); 70 | } 71 | }; 72 | 73 | #endif // __ZeroCrossingPitchDetectorTestPatch_hpp__ 74 | -------------------------------------------------------------------------------- /TestPatches/fileio.h: -------------------------------------------------------------------------------- 1 | #ifndef __fileio_h__ 2 | #define __fileio_h__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | extern "C"{ 16 | int filestat(const char *file_name){ 17 | return access(file_name, R_OK); 18 | } 19 | size_t fileread(const char *file_name, uint8_t** data, size_t size){ 20 | FILE* fd; 21 | if(!file_name) 22 | errx(1, "Filename not specified"); 23 | if((fd = fopen(file_name, "rb")) == NULL) 24 | errx(1, "Error opening file"); 25 | if(*data){ 26 | if(fread(*data, 1, size, fd) < size) 27 | errx(1, "File read failed"); 28 | }else{ 29 | fseek(fd, 0L, SEEK_END); 30 | size = ftell(fd); 31 | rewind(fd); 32 | } 33 | fclose(fd); 34 | return size; 35 | } 36 | size_t filewrite(const char *file_name, uint8_t* data, size_t size){ 37 | int fd; 38 | if (!file_name) 39 | errx(1, "Filename not specified"); 40 | if (!data) 41 | errx(1, "Data buffer not specified"); 42 | if ((fd = creat(file_name, 0666)) < 1) 43 | errx(1, "Error creating file"); 44 | if (write(fd, data, size) < ssize_t(size)) 45 | errx(1, "Error writing samples"); 46 | close(fd); 47 | return size; 48 | } 49 | } 50 | 51 | #endif // __fileio_h__ 52 | -------------------------------------------------------------------------------- /Tests/ShortArrayTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | g++ -ILibSource -ISource -I/opt/local/include -L/opt/local/lib -std=c++11 Tests/ShortArrayTest.cpp LibSource/ShortArray.cpp -std=gnu++11 -lboost_unit_test_framework -o ShortArrayTest && ./ShortArrayTest 3 | */ 4 | #define BOOST_TEST_DYN_LINK 5 | #define BOOST_TEST_MODULE Test 6 | #include 7 | #include 8 | #include "ShortArray.h" 9 | 10 | extern "C"{ 11 | void assert_failed(const char* msg, const char* location, int line){ 12 | BOOST_CHECK_MESSAGE(false, msg); 13 | } 14 | } 15 | 16 | BOOST_AUTO_TEST_CASE(universeInOrder){ 17 | BOOST_CHECK(2+2 == 4); 18 | } 19 | 20 | BOOST_AUTO_TEST_CASE(testDefaultConstructor){ 21 | ShortArray empty; 22 | BOOST_CHECK_EQUAL(empty.getSize(), 0); 23 | BOOST_CHECK_EQUAL((short*)empty, (short*)0); 24 | } 25 | -------------------------------------------------------------------------------- /Tools/Heavy_owl_constants.tpl.h: -------------------------------------------------------------------------------- 1 | {% for param, name, typ, namehash, minvalue, maxvalue, defvalue, button in jdata %} 2 | // {{param}} {{name}} {{typ}} {{namehash}} 3 | #define HV_NAME_CHANNEL_{{param}} "{{name}}" 4 | #define HV_HASH_{{typ}}_CHANNEL_{{param}} {{namehash}} 5 | #define HV_MIN_CHANNEL_{{param}} {{minvalue}} 6 | #define HV_MAX_CHANNEL_{{param}} {{maxvalue}} 7 | {% if defvalue != None %} 8 | #define HV_DEFAULT_CHANNEL_{{param}} {{(defvalue-minvalue)/(maxvalue-minvalue)}} 9 | {% endif %} 10 | {% endfor %} 11 | -------------------------------------------------------------------------------- /Tools/MakeLogTable.c: -------------------------------------------------------------------------------- 1 | /** 2 | * gcc LibSource/fastlog.c Tools/MakeLogTable.c -lm -o log 3 | */ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "../LibSource/fastlog.h" 9 | 10 | #define DEFAULT_PRECISION 14 11 | 12 | int main(int argc, char** argv) { 13 | uint32_t precision = DEFAULT_PRECISION; 14 | if(argc > 1) 15 | precision = atoi(argv[1]); 16 | if(precision > 18) 17 | errx(1, "Invalid precision %d, must be [0,18]", precision); 18 | float* lookup_table; 19 | int table_size = (1 << precision); 20 | lookup_table = (float*)malloc(sizeof(float)*table_size); 21 | fill_icsi_log_table(lookup_table, precision); 22 | printf("/* fast log lookup table, precision %d, size %d */\n", precision, table_size); 23 | printf("const uint32_t fast_log_precision = %d;\n", precision); 24 | printf("const uint32_t fast_log_table_size = %d;\n", table_size); 25 | printf("const float fast_log_table[%d] = {\n", table_size); 26 | int32_t i; 27 | for(i=0; i 5 | #include 6 | #include 7 | #include 8 | #include "../LibSource/fastpow.h" 9 | #include 10 | 11 | #define DEFAULT_PRECISION 11 12 | 13 | int main(int argc, char** argv) { 14 | uint32_t precision = DEFAULT_PRECISION; 15 | if(argc > 1) 16 | precision = atoi(argv[1]); 17 | if(precision > 18) 18 | errx(1, "Invalid precision %d, must be [0,18]", precision); 19 | unsigned int* lookup_table; 20 | int table_size = (1 << precision); 21 | lookup_table = (unsigned int*)malloc(sizeof(unsigned int)*table_size); 22 | powFastSetTable(lookup_table, precision); 23 | printf("/* fast pow lookup table, precision %u, size %u */\n", precision, table_size); 24 | printf("const uint32_t fast_pow_precision = %u;\n", precision); 25 | printf("const uint32_t fast_pow_table_size = %u;\n", table_size); 26 | printf("const uint32_t fast_pow_table[%u] = {\n", table_size); 27 | int32_t i; 28 | for(i=0; i&2 19 | exit 1 20 | fi 21 | 22 | cd $BUILD_DIR && zip -q -r patch.zip */* 23 | 24 | if [ -d "$TARGET_DIR" ] 25 | then 26 | cp $BUILD_DIR/patch.zip $TARGET_DIR/patch.zip 27 | fi 28 | -------------------------------------------------------------------------------- /faust.mk: -------------------------------------------------------------------------------- 1 | BUILDROOT ?= . 2 | BUILD ?= $(BUILDROOT)/Build 3 | PATCHSOURCE ?= $(BUILDROOT)/PatchSource 4 | FAUSTSOURCE ?= $(BUILDROOT)/FaustSource 5 | 6 | FAUSTCC ?= faust 7 | FAUSTFLAGS ?= -light 8 | FAUSTCODE = FaustCode 9 | 10 | faust: $(BUILD)/Source/FaustPatch.hpp 11 | 12 | $(BUILD)/Source/FaustPatch.hpp: $(PATCHSOURCE)/$(FAUST).dsp 13 | @$(FAUSTCC) $(FAUSTFLAGS) -I $(PATCHSOURCE) -i -inpl -mem -a FaustSource/owl.cpp -fm faustmath.h $< $(FAUSTSOURCE)/owl.lib -o $@ 14 | @cp $(FAUSTSOURCE)/*.h $(BUILD)/Source 15 | 16 | $(BUILD)/Source/%Patch.hpp: $(PATCHSOURCE)/%.dsp 17 | @$(FAUSTCC) $(FAUSTFLAGS) -I $(PATCHSOURCE) -i -inpl -mem -a $(FAUSTSOURCE)/owl.cpp -fm faustmath.h $< -o $@ 18 | 19 | -------------------------------------------------------------------------------- /gen.mk: -------------------------------------------------------------------------------- 1 | GENSRC ?= $(BUILDROOT)/GenSource 2 | 3 | .PHONY: .FORCE gen 4 | 5 | $(BUILD)/Source/gen.h: .FORCE 6 | @echo "#include \"$(GEN).h\"" > $@ 7 | @echo "namespace gen = $(GEN);" >> $@ 8 | 9 | gen: $(BUILD)/Source/gen.h 10 | @cp $(GENSRC)/* $(BUILD)/Source 11 | -------------------------------------------------------------------------------- /heavy.mk: -------------------------------------------------------------------------------- 1 | HEAVYFILE ?= $(HEAVY).pd 2 | HEAVYNAME ?= owl 3 | HEAVYSRC ?= $(BUILDROOT)/HeavySource 4 | HEAVYDIR ?= $(BUILD)/Heavy 5 | HEAVYARGS ?= -g c -n $(HEAVYNAME) -p $(HEAVYDIR) -o $(BUILD) 6 | HVCC ?= $(BUILDROOT)/Tools/hvcc/hvcc.py 7 | HVCC_OWL ?= $(BUILDROOT)/Tools/build_send_receive_constants.py 8 | 9 | $(HEAVYDIR)/_main.pd: $(PATCHSOURCE)/$(HEAVYFILE) 10 | @mkdir -p $(HEAVYDIR) 11 | @cp -f $(PATCHSOURCE)/*.pd $(HEAVYDIR) 12 | @cp -f $< $@ 13 | 14 | $(BUILD)/Source/Heavy_owl.h: $(HEAVYDIR)/_main.pd 15 | @python2.7 $(HVCC) $(HEAVYDIR)/_main.pd $(HEAVYARGS) 16 | @mv -f $(BUILD)/c/* $(BUILD)/Source 17 | @cp -f $(HEAVYSRC)/HvUtils.h $(HEAVYSRC)/HvMessage.c $(BUILD)/Source 18 | @python2.7 $(HVCC_OWL) $(BUILD)/ir/owl.heavy.ir.json $(BUILD)/Source/Heavy_$(HEAVYNAME)_constants.h 19 | 20 | heavy: $(BUILD)/Source/Heavy_owl.h 21 | -------------------------------------------------------------------------------- /listpatches.sh: -------------------------------------------------------------------------------- 1 | for nm in OwlPatches/*Patch.hpp 2 | do echo $nm|sed 's:OwlPatches/\(.*\)Patch.hpp:\1:g' 3 | done 4 | -------------------------------------------------------------------------------- /maximilian.mk: -------------------------------------------------------------------------------- 1 | MAXIMILIANSRC ?= $(BUILDROOT)/Maximilian 2 | 3 | .PHONY: .FORCE 4 | 5 | $(BUILD)/Source/maximilian-patch.h: .FORCE 6 | @echo "#include \"$(MAXIMILIAN).cpp\"" > $@ 7 | # @echo "namespace gen = $(GEN);" >> $@ 8 | 9 | maximilian: $(BUILD)/Source/maximilian-patch.h 10 | @cp $(MAXIMILIANSRC)/maximilian.h $(MAXIMILIANSRC)/maximilian.cpp $(MAXIMILIANSRC)/MaximilianPatch.hpp $(BUILD)/Source 11 | -------------------------------------------------------------------------------- /soul.mk: -------------------------------------------------------------------------------- 1 | SOULSRC ?= $(BUILDROOT)/SoulSource 2 | SOULCC ?= Tools/soul 3 | SOULINC = $(BUILD)/Source/soul.hpp 4 | 5 | vpath %.soul $(PATCHSOURCE) 6 | vpath %.soulpatch $(PATCHSOURCE) 7 | 8 | .PHONY: .FORCE soul 9 | 10 | $(SOULINC): .FORCE 11 | @echo "#include \"$(SOULHPP)\"" > $@ 12 | @echo "#define SOULPATCH $(SOULCLASS)" >> $@ 13 | 14 | $(BUILD)/Source/$(SOULHPP): $(SOULFILE) 15 | @$(SOULCC) generate --cpp $< --output=$@ 16 | 17 | soul: $(SOULINC) $(BUILD)/Source/$(SOULHPP) 18 | @cp $(SOULSRC)/* $(BUILD)/Source 19 | -------------------------------------------------------------------------------- /sources.mk: -------------------------------------------------------------------------------- 1 | C_SRC += Source/font.c 2 | C_SRC += $(wildcard LibSource/*.c) 3 | CPP_SRC += $(wildcard LibSource/*.cpp) 4 | -------------------------------------------------------------------------------- /tables.mk: -------------------------------------------------------------------------------- 1 | BUILDROOT ?= . 2 | 3 | POW_PRECISION = 6 4 | LOG_PRECISION = 8 5 | 6 | tables: $(BUILDROOT)/LibSource/FastPowTable.h $(BUILDROOT)/LibSource/FastLogTable.h 7 | 8 | $(BUILDROOT)/Tools/mkpow: LibSource/fastpow.h LibSource/fastpow.c Tools/MakePowTable.c 9 | $(CC) $? -o $@ -lm 10 | 11 | $(BUILDROOT)/LibSource/FastPowTable.h: $(BUILDROOT)/Tools/mkpow 12 | $(BUILDROOT)/Tools/mkpow $(POW_PRECISION) > $@ 13 | 14 | $(BUILDROOT)/Tools/mklog: LibSource/fastlog.h LibSource/fastlog.c Tools/MakeLogTable.c 15 | $(CC) $? -o $@ -lm 16 | 17 | $(BUILDROOT)/LibSource/FastLogTable.h: $(BUILDROOT)/Tools/mklog 18 | $(BUILDROOT)/Tools/mklog $(LOG_PRECISION) > $@ 19 | 20 | clean: 21 | rm -f $(BUILDROOT)/Tools/mkpow $(BUILDROOT)/Tools/mklog $(BUILDROOT)/LibSource/FastPowTable.h $(BUILDROOT)/LibSource/FastLogTable.h 22 | --------------------------------------------------------------------------------