I simplified the code and made it into a small example with the same behaviour,
The "start" function now only reads
const QAudioDevice &defaultDevice =
QMediaDevices::defaultAudioOutput ();
m_audioSink = new QAudioSink (defaultDevice, m_settings);
connect (m_audioSink, &QAudioSink::stateChanged,
this, &Qt_Audio::state_changed);
theIODevice. start ();
m_audioSink -> start (&theIODevice);
QtAudio::Error err = m_audioSink -> error ();
fprintf (stderr, "Errorcode %d\n", (int)(err));
const QAudioDevice &defaultDevice =
QMediaDevices::defaultAudioOutput ();
m_audioSink = new QAudioSink (defaultDevice, m_settings);
connect (m_audioSink, &QAudioSink::stateChanged,
this, &Qt_Audio::state_changed);
theIODevice. start ();
m_audioSink -> start (&theIODevice);
QtAudio::Error err = m_audioSink -> error ();
fprintf (stderr, "Errorcode %d\n", (int)(err));
To copy to clipboard, switch view to plain text mode
The behaviour is the same, in the example I just generate a tone of 600 Hz, and add per 100 msec a buffer
Under Linux the tone is OK, the status report tells the the AudioSink is active
Under Windows no errors, state is Idle, and the read function is NOT called
void Qt_AudioDevice::start () {
}
// we always return "maxSize" bytes
qint64 Qt_AudioDevice::readData (char* buffer, qint64 maxSize) {
qint64 amount = 0;
static int64_t teller = 0;
amount = Buffer -> getDataFromBuffer (buffer, maxSize);
if (amount < maxSize) {
for (int i = amount; i < maxSize; i ++)
buffer [i] = (char)(0);
}
return maxSize;
}
void Qt_AudioDevice::start () {
bool b = open (QIODevice::ReadOnly);
}
// we always return "maxSize" bytes
qint64 Qt_AudioDevice::readData (char* buffer, qint64 maxSize) {
qint64 amount = 0;
static int64_t teller = 0;
amount = Buffer -> getDataFromBuffer (buffer, maxSize);
if (amount < maxSize) {
for (int i = amount; i < maxSize; i ++)
buffer [i] = (char)(0);
}
return maxSize;
}
To copy to clipboard, switch view to plain text mode
Fot me the question is, why is the state "Idle" in Windows, when in Linux it is "Active"
suggestions?
best
jan
Bookmarks