예제 #1
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);
	}
예제 #2
0
파일: error.hpp 프로젝트: GLDRorg/oglplus
	void Trace(const ErrorInfo& info)
	{
#if !OALPLUS_ERROR_NO_PROPAGATION_INFO
		_propagation.push_back(info);
#else
		OALPLUS_FAKE_USE(info);
#endif
		throw;
	}
예제 #3
0
파일: error.hpp 프로젝트: GLDRorg/oglplus
/**
 *  The result of this function is also influenced by the
 *  #OALPLUS_ERROR_INFO_NO_LINE preprocessor configuration option.
 *  If set to zero this function behaves as described above, otherwise it
 *  returns zero.
 *
 *  @see ErrorInfo
 *  @see ErrorALSymbol()
 *  @see ErrorFile()
 *  @see ErrorFunc()
 *  @see ErrorClassName()
 *  @see ErrorBindTarget()
 *  @see ErrorObjectDescription()
 *
 *  @ingroup error_handling
 */
inline unsigned ErrorLine(const ErrorInfo& info)
{
#if !OALPLUS_ERROR_INFO_NO_LINE
	return info._line;
#else
	OALPLUS_FAKE_USE(info);
	return 0;
#endif
}
예제 #4
0
파일: error.hpp 프로젝트: GLDRorg/oglplus
/**
 *  The result of this function is also influenced by the
 *  #OALPLUS_ERROR_INFO_NO_FUNC preprocessor configuration option.
 *  If set to zero this function behaves as described above, otherwise it
 *  returns an empty C string.
 *
 *  @see ErrorInfo
 *  @see ErrorALSymbol()
 *  @see ErrorFile()
 *  @see ErrorLine()
 *  @see ErrorClassName()
 *  @see ErrorBindTarget()
 *  @see ErrorObjectDescription()
 *
 *  @ingroup error_handling
 */
inline const char* ErrorFunc(const ErrorInfo& info)
{
#if !OALPLUS_ERROR_INFO_NO_FUNC
	return info._func;
#else
	OALPLUS_FAKE_USE(info);
	return "";
#endif
}
예제 #5
0
파일: error.hpp 프로젝트: GLDRorg/oglplus
/**
 *  The result of this function is also influenced by the
 *  #OALPLUS_ERROR_INFO_NO_FILE preprocessor configuration option.
 *  If set to zero this function behaves as described above, otherwise it
 *  returns an empty C string.
 *
 *  @see ErrorInfo
 *  @see ErrorALSymbol()
 *  @see ErrorFunc()
 *  @see ErrorLine()
 *  @see ErrorClassName()
 *  @see ErrorBindTarget()
 *  @see ErrorObjectDescription()
 *
 *  @ingroup error_handling
 */
inline const char* ErrorFile(const ErrorInfo& info)
{
#if !OALPLUS_ERROR_INFO_NO_FILE
	return info._file;
#else
	OALPLUS_FAKE_USE(info);
	return "";
#endif
}
예제 #6
0
파일: error.hpp 프로젝트: GLDRorg/oglplus
/**
 *  The result of this function is also influenced by the
 *  #OALPLUS_ERROR_INFO_NO_CLASS_NAME preprocessor configuration option.
 *  If set to zero this function behaves as described above, otherwise it
 *  returns the string "UnknownClass".
 *
 *  @see ErrorInfo
 *  @see ErrorALSymbol()
 *  @see ErrorFile()
 *  @see ErrorFunc()
 *  @see ErrorLine()
 *  @see ErrorBindTarget()
 *  @see ErrorObjectDescription()
 *
 *  @ingroup error_handling
 */
inline const char* ErrorClassName(const ErrorInfo& info)
{
#if !OALPLUS_ERROR_INFO_NO_CLASS_NAME
	return (info._cls_name && *info._cls_name) ?
		info._cls_name :
		"UnknownClass";
#else
	OALPLUS_FAKE_USE(info);
	return "UnknownClass";
#endif
}
예제 #7
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_ALUTFUNC(LoadMemoryHelloWorld)(&format, &size, frequency);
        OALPLUS_CHECK_SIMPLE_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);
    }
예제 #8
0
    /**
     *  @see LoadMemoryFromFileNormalized
     *  @see LoadMemoryHelloWorldNormalized
     *
     *  @alsymbols
     *  @alutfunref{LoadMemoryFromFile}
     */
    std::vector<ALubyte> LoadMemoryFromFile(
      const StrCRef& file_path,
      DataFormat* data_format,
      ALfloat* frequency) const {
        ::ALenum format = 0;
        ::ALsizei size = 0;
        ::ALvoid* ptr = OALPLUS_ALUTFUNC(LoadMemoryFromFile)(
          file_path.is_nts() ? file_path.c_str() : file_path.str().c_str(),
          &format,
          &size,
          frequency);
        OALPLUS_CHECK_SIMPLE_ALUT(LoadMemoryFromFile);

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

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

        return _load_memory(ptr, size);
    }