So in general my code is super simple - I am triing to write Microphone Echo programm and this is its start (as it seems to me - I am wary new to OpenAL)
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <conio.开发者_StackOverflow中文版h>
#include <math.h>
#include <stdio.h>
#include <al.h>
#include <alc.h>
#include <alut.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cin.get();
return 0;
}
void BlockingCapture(ALCdevice *mCaptureDevice, ALCubyte *pBuffer,
ALCint iSamplesToGet)
{
ALCint capturedSamples = 0;
while(capturedSamples < iSamplesToGet)
{
ALCint avail;
alcGetIntegerv(mCaptureDevice, ALC_CAPTURE_SAMPLES, 1, &avail);
if(avail > 0/*or some threshold*/)
{
avail = min(avail, iSamplesToGet-capturedSamples);
alcCaptureSamples(mCaptureDevice, pBuffer, avail);
capturedSamples += avail;
pBuffer += avail;
}
else
Sleep(0);
}
}
when I try to compile it it gives me 3 errors
1) Error 1 error LNK2019: ссылка на неразрешенный внешний символ __imp__alcCaptureSamples в функции "void __cdecl BlockingCapture(struct ALCdevice_struct *,unsigned char *,int)" (?BlockingCapture@@YAXPAUALCdevice_struct@@PAEH@Z) HelloOpenALMic.obj HelloOpenALMic
2) Error 2 error LNK2019: ссылка на неразрешенный внешний символ __imp__alcGetIntegerv в функции "void __cdecl BlockingCapture(struct ALCdevice_struct *,unsigned char *,int)" (?BlockingCapture@@YAXPAUALCdevice_struct@@PAEH@Z) HelloOpenALMic.obj HelloOpenALMic
3) Error 3 fatal error LNK1120: 2 неразрешенных внешних элементов C:\Users\Avesta\Documents\Visual Studio 2008\Projects\OJ\OJ\V3\Debug\HelloOpenALMic.exe HelloOpenALMic
BTW:(I have taken this post as starting point for my code.)
How to get rid of them?
You need to link the OpenAL library to your application.
Go into project properties->Linker->Input and add openal32.lib to the list.
精彩评论