is possible to link to rtAudio in ASIO mode ?

hi all …

i’m trying to work out a demanding sound in application which plays extensively with audio in buffers.

I’ve been experiencing some “inconsistances” and jerky errors with the current of link of rt_audio …

has anybody tried to make the soundStrem work under ASIO API instead of the Windows_DS ?

i’ve a not fancy sound card, a Realtek ack’97 and i’ve installed the “ASIO4all” free drivers … is it possible to use rt_audio ASIO capabilities with this setup ??

as u see i’m a bit lost on these sound landscapes, my sound mates told me to try with ASIO to win buffer proficiency and consistence …

thanks for any idea about it … i’ve seen other ASIO comments on the forum but didn’t find out if it could be possible to work in OF with ASIO setup …
e*

i was not able to compile and run it in asio mode. so i gave up.
sorry.

joerg

you will need to recompile rtAudio with the #define for selected audio system to ASIO. in addition, you will need to download the asio libraries to link against. I’d ask around on the rtAudio mailing list and try to get their sample code to work w/ asio first, before bring into OF. much of the info you will need will be found on the rtAudio web page.

hope that helps!
zach

you will need to recompile rtAudio with the #define for selected audio system to ASIO.

i’ve downloaded the rtAudio 4.04 zip. i open a new dinamyic library project in dev c++. i imported RtAudio.cpp / .h / RtError.h + (all the ASIO ones : asio.cpp / .h , asiodrv.cpp / .h … etc

i made a compilation and got a “.a” file of 202 kb …

so then i hacked (for testing) the ofSoundStreamSetup(…)
i’ve been trying with the RtAudio website information to construct correctly this function but i didn’t succed at all …

  
//---------------------------------------------------------  
void ofSoundStreamSetup(int nOutputs, int nInputs, ofSimpleApp * OFSA, int sampleRate, int bufferSize, int nBuffers){  
  
	nInputChannels 		=  nInputs;  
	nOutputChannels 	=  nOutputs;  
	int device 			=  0;        // default  
	OFSAptr 			=  OFSA;  
  
	bufferSize = ofNextPow2(bufferSize);	// must be pow2  
  
	try {  
		audio = new RtAudio(RtAudio::WINDOWS_ASIO);          
                int numDevices = audio->getDeviceCount();  
		printf("... RtAudio DONE !! devices =%i \n",numDevices);  
                RtAudio::DeviceInfo dinfo;  
  
               std::vector<RtAudio::Api> compiledApis;  
               audio->getCompiledApi(compiledApis);  
               for(int i=0;i<compiledApis.size();i++)  
               {  
                   printf("[%d]___ compiledApis  \n",i);  
                }  
               
                for(int i=0;i<numDevices;i++)  
               {  
                   dinfo = audio->getDeviceInfo(i);  
                }  
  
  // Set our stream parameters for output only.  
  unsigned int bufferFrames;  
  
  bufferFrames = bufferSize;  
  RtAudio::StreamParameters oParams, iParams;  
  
  oParams.deviceId = 1;  
  oParams.nChannels = NULL; //nOutputChannels;  
  oParams.firstChannel = 0;  
  
  iParams.deviceId = 1;  
  iParams.nChannels = nInputChannels;  
  iParams.firstChannel = 0;  
  
  RtAudio::StreamOptions options;  
  options.flags = RTAUDIO_MINIMIZE_LATENCY;  
  
  float* data;  
  
  audio->openStream( NULL, &iParams, RTAUDIO_FLOAT32, (unsigned int) sampleRate, (unsigned int*)&bufferFrames,(RtAudioCallback)&receiveAudioBufferAndCallSimpleApp,(float*)data,&options);//, (void *));  
  
	} catch (RtError &error) {  
		error.printMessage();  
		//std::exit(EXIT_FAILURE); // need case here  
	}  
  
	try {  
		    //audio->setStreamCallback(&receiveAudioBufferAndCallSimpleApp, (void *)NULL);  
	       audio->startStream();  
	} catch (RtError &error) {  
		error.printMessage();  
	}  
  
}  

so what i got with this code and the compiled .a is that ASIO4ALL appears as one of the available devices, but when i try to acces it it’s crashing …

does anybody see my error ?

did you compile one of the rtAudio examples first to see that the library you made is working and working with asio ?

hi zach …

i’ve compiled the “audioprobe.cpp” from RtAudio-4.04 linked with the RtAudio.a i pre-compiled and yes … it seems that it’s working .

it tells me that i’ve 2 devices :

1// Adobe Default Windows Sound (which i don’t know where it comes from)
2// Asio4All

both devices have Probe Status = Succesful …

so i think that i’ve an ASIO4all device ready to work .
i think that in the RtAudio_4.04 something has changed from the version that OF0.04 came with and that was my basic doubt … how to re-implement (hack) ofSoundStreamSetup …

thanks

e*

don’t know, but the example code in rtAudio must be able to provide a good reference. I’d comment out backwards and see what line causes the crash.

you can also just download the earlier version, compile it for asio and it should just work.

good luck ! – z

Waking up an old topic…

I as well would like to use more than 2 audio input channels with OF.

Did anyone already come up with a solution for this, or is trying to get rtAdio to work with ASIO still the challenge?

Kind regards,

Jarno

It depends on the default driver (DirectSound or MMS for Windows), you should be able to list in the number of inputs and outputs you have available. RtAudio will be able to use multiple inputs if your driver provides them.

ASIO just gives much lower latencies, but you will need to use the Steinberg SDK in order to use it:
http://www.steinberg.net/en/company/developer.html