Skip to content

fSampleRate is not initialized in SubContainers #1151

@crop2000

Description

@crop2000
import("stdfaust.lib");
process = rdtable(100,ma.SR,ba.time%100);

produces:

class mydspSIG0 {
	
  private:
	
	int fSampleRate;
	float fConst0;
	
  public:
	
	int getNumInputsmydspSIG0() {
		return 0;
	}
	int getNumOutputsmydspSIG0() {
		return 1;
	}
	
	void instanceInitmydspSIG0(int sample_rate) {
		fConst0 = std::min<float>(1.92e+05f, std::max<float>(1.0f, float(fSampleRate)));
	}
	
	void fillmydspSIG0(int count, float* table) {
		for (int i1 = 0; i1 < count; i1 = i1 + 1) {
			table[i1] = fConst0;
		}
	}

};

static mydspSIG0* newmydspSIG0() { return (mydspSIG0*)new mydspSIG0(); }
static void deletemydspSIG0(mydspSIG0* dsp) { delete dsp; }

static float ftbl0mydspSIG0[100];

the subcontainer does not initialize the sample rate.

I would suggest to restrict the use of fSampleRate in tables. So that this problem doesn't stays unnoticed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions