Qaudiooutput Double values



  • Hi. I am a newbie to qt and c++. I am writing a simple signal generator right now. ı am tryimg to create a qbytearray from doubles but qbytearray changes all of the doubles to integer. So i lose precision on the sound waves. How can i make qbytearray store double or float variables?
    My code is like this which generates a simple sinewave
    @
    int len= m_seconds*SAMPLE_RATE;

    sinbuf.resize(len);
    
    for(int i=0;i<len;i++){
        qreal t = m_freq*i;
        t *= FREQ_CONST;
        t = t+ m_ph;
        t = qSin(t);
        t*= m_amp;
    
        sinbuf[i] = t;
    }
    
    sininput.setBuffer(&sinbuf);
    sininput.open(QIODevice::ReadWrite);
    

    @

    It just invludes integers from -100 to 100. I need it to include floats or doubles. I tried populating a qvector and stream it to the array via qdatastream but it just made every element put randomly and also integers.
    Thamks for your help