Пример #1
0
int main(int argc, char **argv)
{
  ALboolean ok = AL_FALSE;

  alutInit(&argc, argv);

#ifdef ALUT_API_MAJOR_VERSION
  if (alutGetMajorVersion() != ALUT_API_MAJOR_VERSION || alutGetMinorVersion() != ALUT_API_MINOR_VERSION)
  {
    fprintf(stderr,
            "WARNING: The ALUT library is version %d.%d.x but <AL/alut.h> says it's %d.%d.x!\n",
            alutGetMajorVersion(), alutGetMinorVersion(), ALUT_API_MAJOR_VERSION, ALUT_API_MINOR_VERSION);
  }
  else
  {
    fprintf(stderr, "The ALUT library is at version %d.%d.x.\n", alutGetMajorVersion(), alutGetMinorVersion());
    ok = AL_TRUE;
  }
#else
  fprintf(stderr, "WARNING: Your copy of <AL/alut.h> is pre-1.0.0,\n");
  fprintf(stderr, "but you are running the ALUT test suite from ALUT\n");
  fprintf(stderr, "version 1.0.0 or later.\n");
#endif

  alutExit();
  return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
Пример #2
0
Handle<Value> ALUTGetMinorVersionCallback(const Arguments& args) {
	//if less that nbr of formal parameters then do nothing
	if (args.Length() < 0)
		return v8::Undefined();
	
	//get arguments

	//make call
	alutGetMinorVersion();
	
	return v8::Undefined();
}
Пример #3
0
static void
printALUTInfo (void)
{
  ALint major, minor;
  const char *s;

  major = alutGetMajorVersion ();
  minor = alutGetMinorVersion ();
  checkForErrors ();
  printf ("ALUT version: %d.%d\n", (int) major, (int) minor);

  s = alutGetMIMETypes (ALUT_LOADER_BUFFER);
  checkForErrors ();
  printExtensions ("ALUT buffer loaders", ',', s);

  s = alutGetMIMETypes (ALUT_LOADER_MEMORY);
  checkForErrors ();
  printExtensions ("ALUT memory loaders", ',', s);
}
Пример #4
0
// virtual
bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata)
{
	mWindGen = NULL;
	LLAudioEngine::init(num_channels, userdata);

	if(!alutInit(NULL, NULL))
	{
		LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL;
		return false;
	}

	LL_INFOS("OpenAL") << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << LL_ENDL;

	LL_INFOS("OpenAL") << "OpenAL version: "
		<< ll_safe_string(alGetString(AL_VERSION)) << LL_ENDL;
	LL_INFOS("OpenAL") << "OpenAL vendor: "
		<< ll_safe_string(alGetString(AL_VENDOR)) << LL_ENDL;
	LL_INFOS("OpenAL") << "OpenAL renderer: "
		<< ll_safe_string(alGetString(AL_RENDERER)) << LL_ENDL;

	ALint major = alutGetMajorVersion ();
	ALint minor = alutGetMinorVersion ();
	LL_INFOS("OpenAL") << "ALUT version: " << major << "." << minor << LL_ENDL;

	ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext());

	alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major);
	alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor);
	LL_INFOS("OpenAL") << "ALC version: " << major << "." << minor << LL_ENDL;

	LL_INFOS("OpenAL") << "ALC default device: "
		<< ll_safe_string(alcGetString(device,
					       ALC_DEFAULT_DEVICE_SPECIFIER))
		<< LL_ENDL;

	return true;
}
// virtual
bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata)
{
	mWindGen = NULL;
	LLAudioEngine::init(num_channels, userdata);

	if (!alutInit(NULL, NULL))
	{
		llwarns << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << llendl;
		return false;
	}

	// check for extensions
	const ALCchar* device_list(NULL);
	const ALCchar* device_default(NULL);
	if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") == AL_TRUE)
	{
		device_default = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
		device_list = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
		llinfos << "Results for ALC_ENUMERATION_EXT:\n" 
				<< ll_safe_string(device_list)
				<< llendl;

	}

	// initialize device
    ALCdevice* mDevice = alcOpenDevice(NULL); 
    if (mDevice == NULL)
	{
		llinfos << "Could not find a default device, trying to open default manually: " 
				<< ll_safe_string(device_default) 
				<< llendl;
		mDevice = alcOpenDevice(device_default);
		if (mDevice == NULL)
		{
			const ALCchar* device_list_walk = device_list;
			do
			{
				mDevice = alcOpenDevice(device_list_walk);
				if (mDevice != NULL)
				{
					break;
				}
				else
				{
					device_list_walk += strlen(device_list_walk)+1;
				}
			}
			while (device_list_walk[0] != '\0');

			if (mDevice == NULL)
			{
				llinfos << "OpenAL could not find an installed audio device. Aborting" << llendl;
				ALCenum error = alcGetError(mDevice);
				if (error != ALC_NO_ERROR)
				{
					llinfos << "ALC error: " << ll_safe_string(alcGetString(mDevice, error)) << llendl;
				}
				return false;
			}
		}
	}

	// create context
	ALCcontext* mContext = alcCreateContext(mDevice, NULL);
	if (mContext != NULL)
	{
		if (!alcMakeContextCurrent(mContext))
		{
			ALenum error = alGetError();
			if (error != AL_NO_ERROR)
			{
				llinfos << "ALC error: " << convertALErrorToString(error) << ". Could not set current context!" << llendl;
			}
			alcDestroyContext(mContext);
			return false;
		}
	}
	else
	{
		llinfos << "ALC error: could not create context from device!" << llendl;
		alcCloseDevice(mDevice);
		return false;
	}

	llinfos << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << llendl;

	llinfos << "ALC default device: " 
			<< ll_safe_string(alcGetString(mDevice, ALC_DEFAULT_DEVICE_SPECIFIER)) 
			<< llendl;

	llinfos << "OpenAL version: "
		<< ll_safe_string(alGetString(AL_VERSION)) << llendl;
	llinfos << "OpenAL vendor: "
		<< ll_safe_string(alGetString(AL_VENDOR)) << llendl;
	llinfos << "OpenAL renderer: "
		<< ll_safe_string(alGetString(AL_RENDERER)) << llendl;

	ALint major = alutGetMajorVersion();
	ALint minor = alutGetMinorVersion();
	llinfos << "ALUT version: " << major << "." << minor << llendl;

	alcGetIntegerv(mDevice, ALC_MAJOR_VERSION, 1, &major);
	alcGetIntegerv(mDevice, ALC_MINOR_VERSION, 1, &minor);
	llinfos << "ALC version: " << major << "." << minor << llendl;

	return true;
}