stripped samplerate from constructors
This commit is contained in:
@@ -10,17 +10,13 @@ namespace trnr {
|
|||||||
template <typename t_voice>
|
template <typename t_voice>
|
||||||
class midi_synth : public voice_allocator<t_voice> {
|
class midi_synth : public voice_allocator<t_voice> {
|
||||||
public:
|
public:
|
||||||
midi_synth(int _n_voices, double _samplerate, int _block_size)
|
midi_synth(int _n_voices)
|
||||||
: voice_allocator<t_voice> { _samplerate }
|
: m_voices_active { false }
|
||||||
, m_samplerate { _samplerate }
|
|
||||||
, m_block_size { _block_size }
|
|
||||||
, m_voices_active { false }
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_samplerate(double _samplerate, int _block_size)
|
void set_samplerate_blocksize(double _samplerate, int _block_size)
|
||||||
{
|
{
|
||||||
m_samplerate = _samplerate;
|
|
||||||
m_block_size = _block_size;
|
m_block_size = _block_size;
|
||||||
voice_allocator::set_samplerate(_samplerate);
|
voice_allocator::set_samplerate(_samplerate);
|
||||||
}
|
}
|
||||||
@@ -87,7 +83,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<note_event> m_event_queue;
|
std::vector<note_event> m_event_queue;
|
||||||
double m_samplerate;
|
|
||||||
int m_block_size;
|
int m_block_size;
|
||||||
bool m_voices_active;
|
bool m_voices_active;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ public:
|
|||||||
float release1_level;
|
float release1_level;
|
||||||
float release2_rate;
|
float release2_rate;
|
||||||
|
|
||||||
tx_envelope(double _samplerate)
|
tx_envelope()
|
||||||
: samplerate { _samplerate }
|
: samplerate { 44100. }
|
||||||
, attack1_rate { 0 }
|
, attack1_rate { 0 }
|
||||||
, attack1_level { 0 }
|
, attack1_level { 0 }
|
||||||
, attack2_rate { 0 }
|
, attack2_rate { 0 }
|
||||||
|
|||||||
@@ -5,11 +5,9 @@
|
|||||||
namespace trnr {
|
namespace trnr {
|
||||||
class tx_operator {
|
class tx_operator {
|
||||||
public:
|
public:
|
||||||
tx_operator(double samplerate)
|
tx_operator()
|
||||||
: ratio { 1 }
|
: ratio { 1 }
|
||||||
, amplitude { 1.0f }
|
, amplitude { 1.0f }
|
||||||
, envelope(samplerate)
|
|
||||||
, oscillator(samplerate)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ class tx_sineosc {
|
|||||||
public:
|
public:
|
||||||
bool phase_reset;
|
bool phase_reset;
|
||||||
|
|
||||||
tx_sineosc(double _samplerate)
|
tx_sineosc()
|
||||||
: samplerate { _samplerate }
|
: samplerate { 44100 }
|
||||||
, phase_resolution { 16.f }
|
, phase_resolution { 16.f }
|
||||||
, phase { 0. }
|
, phase { 0. }
|
||||||
, history { 0. }
|
, history { 0. }
|
||||||
|
|||||||
@@ -8,15 +8,10 @@ namespace trnr {
|
|||||||
|
|
||||||
class tx_voice {
|
class tx_voice {
|
||||||
public:
|
public:
|
||||||
tx_voice(double samplerate)
|
tx_voice()
|
||||||
: algorithm { 0 }
|
: algorithm { 0 }
|
||||||
, pitch_env_amt { 0.f }
|
, pitch_env_amt { 0.f }
|
||||||
, feedback_amt { 0.f }
|
, feedback_amt { 0.f }
|
||||||
, pitch_env(samplerate)
|
|
||||||
, feedback_osc(samplerate)
|
|
||||||
, op1(samplerate)
|
|
||||||
, op2(samplerate)
|
|
||||||
, op3(samplerate)
|
|
||||||
, bit_resolution(12.f)
|
, bit_resolution(12.f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ class voice_allocator {
|
|||||||
public:
|
public:
|
||||||
std::vector<t_voice> voices;
|
std::vector<t_voice> voices;
|
||||||
|
|
||||||
voice_allocator(const double& _samplerate)
|
voice_allocator()
|
||||||
: samplerate { _samplerate }
|
: voices(8, t_voice())
|
||||||
, voices(8, t_voice(_samplerate))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,14 +82,12 @@ public:
|
|||||||
|
|
||||||
void set_samplerate(double _samplerate)
|
void set_samplerate(double _samplerate)
|
||||||
{
|
{
|
||||||
this->samplerate = _samplerate;
|
|
||||||
for (int i = 0; i < voices.size(); i++) {
|
for (int i = 0; i < voices.size(); i++) {
|
||||||
voices.at(i).set_samplerate(_samplerate);
|
voices.at(i).set_samplerate(_samplerate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double samplerate;
|
|
||||||
std::vector<note_event> input_queue;
|
std::vector<note_event> input_queue;
|
||||||
|
|
||||||
t_voice* get_free_voice(float frequency)
|
t_voice* get_free_voice(float frequency)
|
||||||
|
|||||||
Reference in New Issue
Block a user