Example #1
0
	static bool _initialize(bool with_context, int argc, char** argv)
	{
		bool result = with_context
		?(OALPLUS_ALFUNC(alut,Init)(&argc, argv) == AL_TRUE)
		:(OALPLUS_ALFUNC(alut,InitWithoutContext)(&argc, argv)==AL_TRUE);
		OALPLUS_CHECK_ALUT(OALPLUS_ERROR_INFO(alut, Init));
		return result;

	}
Example #2
0
	/**
	 *  @see Position
	 *  @see Velocity
	 *  @see Orientation
	 *  @see OrientationUp
	 *
	 *  @alsymbols
	 *  @alfunref{Listenerfv}
	 *  @aldefref{ORIENTATION}
	 */
	static ListenerOrientation Orientation(void)
	{
		ListenerOrientation result;
		OALPLUS_ALFUNC(GetListenerfv)(AL_ORIENTATION, result._v);
		OALPLUS_VERIFY_SIMPLE(GetListenerfv);
		return result;
	}
Example #3
0
	/**
	 *  @alsymbols
	 *  @alutfunref{Exit}
	 */
	~ALUtilityToolkit(void)
	{
		if(_initialized)
		{
			OALPLUS_ALFUNC(alut,Exit)();
		}
	}
Example #4
0
	/**
	 *  @see Position
	 *  @see Velocity
	 *  @see OrientationAt
	 *
	 *  @alsymbols
	 *  @alfunref{Listenerfv}
	 *  @aldefref{ORIENTATION}
	 */
	static Vec3f OrientationUp(void)
	{
		ALfloat v[6];
		OALPLUS_ALFUNC(GetListenerfv)(AL_ORIENTATION, v);
		OALPLUS_VERIFY_SIMPLE(GetListenerfv);
		return Vec3f(v+3, 3);
	}
Example #5
0
	/** This version loads both the raw data and the normalized samples
	 *  into two buffers and also returns the format and the sampling
	 *  frequency.
	 *
	 *  @see LoadMemoryFromFileNormalized
	 *  @see LoadMemoryHelloWorldNormalized
	 *
	 *  @alsymbols
	 *  @alutfunref{LoadMemoryFromFile}
	 */
	void LoadMemoryFromFile(
		std::vector<ALubyte>& raw,
		std::vector<ALfloat>& norm,
		const ALchar* file_path,
		DataFormat* data_format,
		ALfloat* frequency
	) const
	{
		::ALenum format = 0;
		::ALsizei size = 0;
		::ALvoid* ptr = OALPLUS_ALFUNC(alut,LoadMemoryFromFile)(
			file_path,
			&format,
			&size,
			frequency
		);
		OALPLUS_CHECK_ALUT(OALPLUS_ERROR_INFO(alut, LoadMemoryFromFile));

		_free_on_scope_exit cleaner = { ptr };
		OALPLUS_FAKE_USE(cleaner);

		if(data_format) *data_format = DataFormat(format);

		raw = _load_memory(ptr, size);
		norm = _load_mem_norm(ptr, format, size);
	}
Example #6
0
	/**
	 *  @see CreateBufferFromFile
	 *
	 *  @alsymbols
	 *  @alutfunref{CreateBufferHelloWorld}
	 */
	Buffer CreateBufferHelloWorld(void) const
	{
		assert(_initialized);
		ALuint name = OALPLUS_ALFUNC(alut,CreateBufferHelloWorld)();
		OALPLUS_VERIFY_ALUT(OALPLUS_ERROR_INFO(alut, CreateBufferHelloWorld));
		return Buffer::FromRawName(name);
	}
Example #7
0
	/**
	 *  @see CreateBufferHelloWorld
	 *
	 *  @alsymbols
	 *  @alutfunref{CreateBufferFromFile}
	 */
	Buffer CreateBufferFromFile(const ALchar* file_path) const
	{
		assert(_initialized);
		ALuint name = OALPLUS_ALFUNC(alut,CreateBufferFromFile)(file_path);
		OALPLUS_VERIFY_ALUT(OALPLUS_ERROR_INFO(alut, CreateBufferFromFile));
		return Buffer::FromRawName(name);
	}
Example #8
0
	static ALboolean IsA(ALuint name)
	{
		assert(name != 0);
		ALboolean result = OALPLUS_ALFUNC(IsBuffer)(name);
		OALPLUS_VERIFY_SIMPLE(IsBuffer);
		return result;
	}
Example #9
0
	/**
	 *  @see Position
	 *  @see Orientation
	 *  @throws Error
	 *
	 *  @alsymbols
	 *  @alfunref{Listenerfv}
	 *  @aldefref{VELOCITY}
	 */
	static void Velocity(const Vec3f& velocity)
	{
		OALPLUS_ALFUNC(Listenerfv)(
			AL_VELOCITY,
			velocity.Data()
		);
		OALPLUS_VERIFY_SIMPLE(Listenerfv);
	}
Example #10
0
	/**
	 *
	 *  @alsymbols
	 *  @alfunref{Listenerf}
	 *  @aldefref{GAIN}
	 */
	static void Gain(ALfloat value)
	{
		OALPLUS_ALFUNC(Listenerf)(
			AL_GAIN,
			value
		);
		OALPLUS_VERIFY_SIMPLE(Listenerf);
	}
Example #11
0
	/**
	 *  @see Velocity
	 *  @see Orientation
	 *  @throws Error
	 *
	 *  @alsymbols
	 *  @alfunref{Listenerfv}
	 *  @aldefref{POSITION}
	 */
	static void Position(const Vec3f& position)
	{
		OALPLUS_ALFUNC(Listenerfv)(
			AL_POSITION,
			position.Data()
		);
		OALPLUS_VERIFY_SIMPLE(Listenerfv);
	}
Example #12
0
	/**
	 *  @see Position
	 *  @see Orientation
	 *  @throws Error
	 *
	 *  @alsymbols
	 *  @alfunref{Listener3f}
	 *  @aldefref{VELOCITY}
	 */
	static void Velocity(ALfloat x, ALfloat y, ALfloat z)
	{
		OALPLUS_ALFUNC(Listener3f)(
			AL_VELOCITY,
			x, y, z
		);
		OALPLUS_VERIFY_SIMPLE(Listener3f);
	}
Example #13
0
	/**
	 *  @see Velocity
	 *  @see Orientation
	 *  @throws Error
	 *
	 *  @alsymbols
	 *  @alfunref{Listener3f}
	 *  @aldefref{POSITION}
	 */
	static void Position(ALfloat x, ALfloat y, ALfloat z)
	{
		OALPLUS_ALFUNC(Listener3f)(
			AL_POSITION,
			x, y, z
		);
		OALPLUS_VERIFY_SIMPLE(Listener3f);
	}
Example #14
0
	/**
	 *  @see Position
	 *  @see Velocity
	 *  @throws Error
	 *
	 *  @alsymbols
	 *  @alfunref{Listenerfv}
	 *  @aldefref{ORIENTATION}
	 */
	static void Orientation(const Vec3f& at, const Vec3f& up)
	{
		ALfloat v[6] = {
			at[0], at[1], at[2],
			up[0], up[1], up[2],
		};
		OALPLUS_ALFUNC(Listenerfv)(AL_ORIENTATION, v);
		OALPLUS_VERIFY_SIMPLE(Listenerfv);
	}
Example #15
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetFloatv}
	 *  @aldefref{SPEED_OF_SOUND}
	 */
	static ALfloat SpeedOfSound(void)
	{
		ALfloat result;
		OALPLUS_ALFUNC(GetFloatv(
			AL_SPEED_OF_SOUND,
			&result
		));
		OALPLUS_VERIFY_SIMPLE(GetFloatv);
		return result;
	}
Example #16
0
	/**
	 *  @see Velocity
	 *  @see Orientation
	 *
	 *  @alsymbols
	 *  @alfunref{GetListenerfv}
	 *  @aldefref{POSITION}
	 */
	static Vec3f Position(void)
	{
		ALfloat result[3];
		OALPLUS_ALFUNC(GetListenerfv)(
			AL_POSITION,
			result
		);
		OALPLUS_VERIFY_SIMPLE(GetListenerfv);
		return Vec3f(result);
	}
Example #17
0
	/**
	 *
	 *  @alsymbols
	 *  @alfunref{GetListenerfv}
	 *  @aldefref{GAIN}
	 */
	static ALfloat Gain(void)
	{
		ALfloat result;
		OALPLUS_ALFUNC(GetListenerfv)(
			AL_GAIN,
			&result
		);
		OALPLUS_VERIFY_SIMPLE(GetListenerfv);
		return result;
	}
Example #18
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetFloatv}
	 *  @aldefref{DOPPLER_FACTOR}
	 */
	static ALfloat DopplerFactor(void)
	{
		ALfloat result;
		OALPLUS_ALFUNC(GetFloatv(
			AL_DOPPLER_FACTOR,
			&result
		));
		OALPLUS_VERIFY_SIMPLE(GetFloatv);
		return result;
	}
Example #19
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetIntegerv}
	 *  @aldefref{DISTANCE_MODEL}
	 */
	static oalplus::DistanceModel DistanceModel(void)
	{
		ALint result;
		OALPLUS_ALFUNC(GetIntegerv(
			AL_DISTANCE_MODEL,
			&result
		));
		OALPLUS_VERIFY_SIMPLE(GetIntegerv);
		return oalplus::DistanceModel(result);
	}
Example #20
0
	/**
	 *  @see Position
	 *  @see Orientation
	 *
	 *  @alsymbols
	 *  @alfunref{GetListenerfv}
	 *  @aldefref{VELOCITY}
	 */
	static Vec3f Velocity(void)
	{
		ALfloat result[3];
		OALPLUS_ALFUNC(GetListenerfv)(
			AL_VELOCITY,
			result
		);
		OALPLUS_VERIFY_SIMPLE(GetListenerfv);
		return Vec3f(result);
	}
Example #21
0
	/**
	 *  @see Position
	 *  @see Velocity
	 *  @throws Error
	 *  @see OrientationAt
	 *  @see OrientationUp
	 *
	 *  @alsymbols
	 *  @alfunref{Listenerfv}
	 *  @aldefref{ORIENTATION}
	 */
	static void Orientation(
		ALfloat at_x,
		ALfloat at_y,
		ALfloat at_z,
		ALfloat up_x,
		ALfloat up_y,
		ALfloat up_z
	)
	{
		ALfloat v[6] = {at_x, at_y, at_z, up_x, up_y, up_z};
		OALPLUS_ALFUNC(Listenerfv)(AL_ORIENTATION, v);
		OALPLUS_VERIFY_SIMPLE(Listenerfv);
	}
Example #22
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetBuffer}
	 *  @aldefref{CHANNELS}
	 */
	ALsizei Channels(void) const
	{
		ALint result = 0;
		OALPLUS_ALFUNC(GetBufferiv)(
			_name,
			AL_CHANNELS,
			&result
		);
		OALPLUS_VERIFY(
			GetBufferiv,
			ObjectError,
			Object(*this)
		);
		return ALsizei(result);
	}
Example #23
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetBuffer}
	 *  @aldefref{SIZE}
	 */
	ALsizei Size(void) const
	{
		ALint result = 0;
		OALPLUS_ALFUNC(GetBufferiv)(
			_name,
			AL_SIZE,
			&result
		);
		OALPLUS_VERIFY(
			GetBufferiv,
			ObjectError,
			Object(*this)
		);
		return ALsizei(result);
	}
Example #24
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetBuffer}
	 *  @aldefref{FREQUENCY}
	 */
	ALsizei Frequency(void) const
	{
		ALint result = 0;
		OALPLUS_ALFUNC(GetBufferiv)(
			_name,
			AL_FREQUENCY,
			&result
		);
		OALPLUS_VERIFY(
			GetBufferiv,
			ObjectError,
			Object(*this)
		);
		return ALsizei(result);
	}
Example #25
0
	/**
	 *  @alsymbols
	 *  @alfunref{BufferData}
	 */
	void Data(
		DataFormat format,
		const ALvoid* data,
		ALsizei size,
		ALsizei frequency
	)
	{
		OALPLUS_ALFUNC(BufferData)(
			ALuint(this->_name),
			ALenum(format),
			data,
			size,
			frequency
		);
		OALPLUS_CHECK(
			BufferData,
			ObjectError,
			Object(*this)
		);
	}
Example #26
0
	/** This version normalizes the sound samples.
	 *
	 *  @see LoadMemoryFromFileNormalized
	 *
	 *  @alsymbols
	 *  @alutfunref{LoadMemoryHelloWorld}
	 */
	std::vector<ALfloat> LoadMemoryHelloWorldNormalized(
		DataFormat* data_format,
		ALfloat* frequency
	) const
	{
		::ALenum format = 0;
		::ALsizei size = 0;
		::ALvoid* ptr = OALPLUS_ALFUNC(alut,LoadMemoryHelloWorld)(
			&format,
			&size,
			frequency
		);
		OALPLUS_CHECK_ALUT(OALPLUS_ERROR_INFO(alut, LoadMemoryHelloWorld));

		_free_on_scope_exit cleaner = { ptr };
		OALPLUS_FAKE_USE(cleaner);

		if(data_format) *data_format = DataFormat(format);

		return _load_mem_norm(ptr, format, size);
	}
Example #27
0
	/**
	 *  @alsymbols
	 *  @alfunref{GetString}
	 */
	static const ALchar* GetString(StringQuery query)
	{
		const ALchar* str = OALPLUS_ALFUNC(GetString)(ALenum(query));
		OALPLUS_VERIFY_SIMPLE(GetString);
		return str;
	}
Example #28
0
	/**
	 *  @alsymbols
	 *  @alfunref{SpeedOfSound}
	 */
	static void SpeedOfSound(ALfloat speed_of_sound)
	{
		OALPLUS_ALFUNC(SpeedOfSound(speed_of_sound));
		OALPLUS_CHECK_SIMPLE(SpeedOfSound);
	}
Example #29
0
	/**
	 *  @alsymbols
	 *  @alfunref{DopplerFactor}
	 */
	static void DopplerFactor(ALfloat doppler_factor)
	{
		OALPLUS_ALFUNC(DopplerFactor(doppler_factor));
		OALPLUS_CHECK_SIMPLE(DopplerFactor);
	}
Example #30
0
	/**
	 *  @alsymbols
	 *  @alfunref{DistanceModel}
	 */
	static void DistanceModel(oalplus::DistanceModel dist_model)
	{
		OALPLUS_ALFUNC(DistanceModel(ALenum(dist_model)));
		OALPLUS_VERIFY_SIMPLE(DistanceModel);
	}