Hi,
I’m trying to use 2 audio input sources as independent controls for a project. I created a class based on ofSoundStream, adding the ability to choose a device.
The problem is: when I connect 2 webcams, only one of them works. The same code works with 1 webcam and 1 microphone (connected to the PC’s mic input), but not with 2 webcams. I thought the problem could be related with the callback mechanism and changed it to tickStream, but it gives me same results.
#include "SoundStream.h"
SoundStream::SoundStream( int deviceID, int numInputChannels )
{
this->deviceID = deviceID;
this->numInputChannels = numInputChannels;
try
{
int bufferSize = 256;
audio = new RtAudio;
audio->openStream( 0, 0, deviceID, numInputChannels, RTAUDIO_FLOAT32, 44100, &bufferSize, 4 );
buffer = (float *) audio->getStreamBuffer();
audio->startStream();
}
catch (RtError &error)
{
error.printMessage();
}
}
SoundStream::~SoundStream()
{
}
void SoundStream::start()
{
try
{
audio->startStream();
}
catch (RtError &error)
{
error.printMessage();
}
}
void SoundStream::stop()
{
try
{
audio->stopStream();
}
catch (RtError &error)
{
error.printMessage();
}
}
void SoundStream::close()
{
try
{
audio->stopStream();
audio->closeStream();
}
catch (RtError &error)
{
error.printMessage();
}
delete audio;
}
void SoundStream::tick()
{
audio->tickStream();
}
I tested both webcams with Audacity and they work fine for sound recording.
What am I missing?
Thanks in advance.