Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - OofingBomb

Pages: [1]
1
Audio / Sound Stream Processing Interval
« on: August 23, 2021, 12:30:45 pm »
Hi!

I'm working on audio synthesis right now. I've been trying to implement a synthesizer with SoundStream class. Here's the basic code:
class AudioStream : public SoundStream {
    private:
    unsigned int m_rate;
    short* m_samples;
    int m_sampleCount;

    public:
    AudioStream (int sampleRate) {
        m_rate = sampleRate;
        initialize(1, sampleRate);
    };
    void make(int freq) {
        m_sampleCount = m_rate / freq;
        int dc = m_sampleCount / 2;
        m_samples = new short[m_sampleCount];

        for (int i = 0; i < m_sampleCount; i++) {
            m_samples[i] = (i < dc) ? -4096 : 4095;
        };
    };

    protected:
    virtual bool onGetData(Chunk& data) {
        data.sampleCount = m_sampleCount;
        data.samples = m_samples;

        return true;
    };
    virtual void onSeek(Time) {
        // not supported
        return;
    };
};
Upon running this code, the output sounds like half of it is muted. As far as I know, that's because of SoundStream processing interval. However there's no function to change it, despite it being included in the GitHub SFML page.

So is there any way to have this function in the code (I want to disable the interval)?
Thanks for answers in advance!

Pages: [1]