Hi,
I was playing around with the obs-studio code, trying to build another audio plugin, but I am stuck at obs_source_audio.data.
>>>>>>>>>>>>>
/**
* Source audio output structure. Used with obs_source_output_audio to output
* source audio. Audio is automatically resampled and remixed as necessary.
*/
struct obs_source_audio {
const uint8_t *data[MAX_AV_PLANES];
uint32_t frames;
enum speaker_layout speakers;
enum audio_format format;
uint32_t samples_per_sec;
uint64_t timestamp;
};
<<<<<<<<<<<<
so... I am passing data.
I was assuming *data[] is a "data-array" for each channel, like
data[0] = leftChannel; //512 float size data
data[1] = rightChannel; //512 float size data
speakers = SPEAKERS_STEREO;
frames = 512;
format = AUDIO_FORMAT_FLOAT;
samples_per_sec = 48000;
timestamp = ...
but that does not seem to be the case, I happen to pass only "0" to data[0] and "noise" to data[1]
and obs-studio did not recognize the input, like it got nothing.
so I am kinda stuck, is data[x] not the channel number? Or should "frames" be the number of uint8_t frames? Or is it frames*channels? Or does the timestamp somehow need to change in multichannel case?
btw, if I change it to mono everything works fine, but just mono.
data[0] = leftChannel; //512 float size data
speakers = SPEAKERS_MONO;
frames = 512;
format = AUDIO_FORMAT_FLOAT;
samples_per_sec = 48000;
timestamp = ...
if anyone could solve my confusion... it would be great, thanks in advance :)
(using todays git master obs-studio under linux)
I was playing around with the obs-studio code, trying to build another audio plugin, but I am stuck at obs_source_audio.data.
>>>>>>>>>>>>>
/**
* Source audio output structure. Used with obs_source_output_audio to output
* source audio. Audio is automatically resampled and remixed as necessary.
*/
struct obs_source_audio {
const uint8_t *data[MAX_AV_PLANES];
uint32_t frames;
enum speaker_layout speakers;
enum audio_format format;
uint32_t samples_per_sec;
uint64_t timestamp;
};
<<<<<<<<<<<<
so... I am passing data.
I was assuming *data[] is a "data-array" for each channel, like
data[0] = leftChannel; //512 float size data
data[1] = rightChannel; //512 float size data
speakers = SPEAKERS_STEREO;
frames = 512;
format = AUDIO_FORMAT_FLOAT;
samples_per_sec = 48000;
timestamp = ...
but that does not seem to be the case, I happen to pass only "0" to data[0] and "noise" to data[1]
and obs-studio did not recognize the input, like it got nothing.
so I am kinda stuck, is data[x] not the channel number? Or should "frames" be the number of uint8_t frames? Or is it frames*channels? Or does the timestamp somehow need to change in multichannel case?
btw, if I change it to mono everything works fine, but just mono.
data[0] = leftChannel; //512 float size data
speakers = SPEAKERS_MONO;
frames = 512;
format = AUDIO_FORMAT_FLOAT;
samples_per_sec = 48000;
timestamp = ...
if anyone could solve my confusion... it would be great, thanks in advance :)
(using todays git master obs-studio under linux)