cintitak2's picture

Need a starter guide

Hi! i'm a little newbie about openAL. I've to make a program that plays simultanouslly two diferent sound files (by the time, they're in wave format), with independet gain control under Visual C++ .Net.

By this time, i've done it but calling an executable that i've made from the example PlayWave from OpenAL on Native C++, BUT it is a little uggly for my users to see a console appearing every time they push a play button.

I know it is simople, but every code i found related with OpenTK is oriented to C#.

The point is: is there any OpenTK in Visual C++ .Net for dummies or something like that, some little examples, nothing complicated, as a startning point, for just playing some sound files??

I've developed the rest of the program under Visual Studio 2005 in C++ .Net.

Thanks a lot, I'd really appreciate your help!



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

OpenTK cannot be used from pure C++, so I assume you mean C++/CLI?

Noone has contributed any C++/CLI examples, but the code is simple enough that you should be able to port it even if you don't know C#.

The basic idea is that you create an AudioContext^ to initialize OpenAL and one or more AudioReader^ instances to load wav files. You can then play back the audio using AL::BufferData, AL::Source and AL::SourcePlay.

cintitak2's picture

you're right the tree didn't let me see the forest. Added the references, the code was as simpke as this:

AudioContext^ audio;
audio = gcnew AudioContext();
AudioReader^ arch1 = gcnew AudioReader("DW01.wav");
int buff1 = AL::GenBuffer();
int sour1 = AL::GenSource();
AL::BufferData(buff1, arch1->ReadToEnd());
AL::Source(sour1, ALSourcei::Buffer, buff1);

well, thanks for make me take some confidence in myself!