summaryrefslogtreecommitdiff
path: root/fonts
ModeNameSize
-rw-r--r--Arimo-LICENSE.txt114logplain
-rw-r--r--Arimo-Regular.ttf436876logplain
-rw-r--r--Cousine-LICENSE.txt118logplain
-rw-r--r--Cousine-Regular.ttf309040logplain
-rw-r--r--DroidSansFallbackFull-LICENSE.txt577logplain
-rw-r--r--DroidSansFallbackFull.ttf4529044logplain
-rw-r--r--mono_dejavu_sans_10.xml257014logplain
-rw-r--r--mono_dejavu_sans_100.png56121logplain
-rw-r--r--mono_dejavu_sans_11.xml263644logplain
-rw-r--r--mono_dejavu_sans_110.png67613logplain
-rw-r--r--mono_dejavu_sans_12.xml268932logplain
-rw-r--r--mono_dejavu_sans_120.png73938logplain
-rw-r--r--mono_dejavu_sans_14.xml269188logplain
-rw-r--r--mono_dejavu_sans_140.png89073logplain
-rw-r--r--mono_dejavu_sans_16.xml275642logplain
-rw-r--r--mono_dejavu_sans_160.png101939logplain
-rw-r--r--mono_dejavu_sans_18.xml279962logplain
-rw-r--r--mono_dejavu_sans_180.png122274logplain
-rw-r--r--mono_dejavu_sans_20.xml282588logplain
-rw-r--r--mono_dejavu_sans_200.png138662logplain
-rw-r--r--mono_dejavu_sans_22.xml283950logplain
-rw-r--r--mono_dejavu_sans_220.png152844logplain
-rw-r--r--mono_dejavu_sans_24.xml286626logplain
-rw-r--r--mono_dejavu_sans_240.png170247logplain
-rw-r--r--mono_dejavu_sans_26.xml289710logplain
-rw-r--r--mono_dejavu_sans_260.png190156logplain
-rw-r--r--mono_dejavu_sans_28.xml292596logplain
-rw-r--r--mono_dejavu_sans_280.png200848logplain
-rw-r--r--mono_dejavu_sans_4.xml237740logplain
-rw-r--r--mono_dejavu_sans_40.png15668logplain
-rw-r--r--mono_dejavu_sans_6.xml245472logplain
-rw-r--r--mono_dejavu_sans_60.png29291logplain
-rw-r--r--mono_dejavu_sans_8.xml251876logplain
-rw-r--r--mono_dejavu_sans_80.png45552logplain
-rw-r--r--mono_dejavu_sans_9.xml254016logplain
-rw-r--r--mono_dejavu_sans_90.png50995logplain
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
OpenAL support based on work by:
Copyright (C) 2011 Sebastian 'Bahamada' Rühl
Copyright (C) 2011 Cyriaque 'Cisoun' Skrapits <cysoun@gmail.com>
Copyright (C) 2011 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; ifnot, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "sound_openal.h"

#if defined(_WIN32)
	#include <al.h>
	#include <alc.h>
	//#include <alext.h>
#elif defined(__APPLE__)
	#include <OpenAL/al.h>
	#include <OpenAL/alc.h>
	//#include <OpenAL/alext.h>
#else
	#include <AL/al.h>
	#include <AL/alc.h>
	#include <AL/alext.h>
#endif
#include <vorbis/vorbisfile.h>
#include <assert.h>
#include "log.h"
#include "util/numeric.h" // myrand()
#include "porting.h"
#include <vector>
#include <fstream>
#include "util/cpp11_container.h"

#define BUFFER_SIZE 30000

static const char *alcErrorString(ALCenum err)
{
	switch (err) {
	case ALC_NO_ERROR:
		return "no error";
	case ALC_INVALID_DEVICE:
		return "invalid device";
	case ALC_INVALID_CONTEXT:
		return "invalid context";
	case ALC_INVALID_ENUM:
		return "invalid enum";
	case ALC_INVALID_VALUE:
		return "invalid value";
	case ALC_OUT_OF_MEMORY:
		return "out of memory";
	default:
		return "<unknown OpenAL error>";
	}
}

static const char *alErrorString(ALenum err)
{
	switch (err) {
	case AL_NO_ERROR:
		return "no error";
	case AL_INVALID_NAME:
		return "invalid name";
	case AL_INVALID_ENUM:
		return "invalid enum";
	case AL_INVALID_VALUE:
		return "invalid value";
	case AL_INVALID_OPERATION:
		return "invalid operation";
	case AL_OUT_OF_MEMORY:
		return "out of memory";
	default:
		return "<unknown OpenAL error>";
	}
}

static ALenum warn_if_error(ALenum err, const char *desc)
{
	if(err == AL_NO_ERROR)
		return err;
	warningstream<<desc<<": "<<alErrorString(err)<<std::endl;
	return err;
}

void f3_set(ALfloat *f3, v3f v)
{
	f3[0] = v.X;
	f3[1] = v.Y;
	f3[2] = v.Z;
}

struct SoundBuffer
{
	ALenum format;
	ALsizei freq;
	ALuint buffer_id;
	std::vector<char> buffer;
};

SoundBuffer *load_opened_ogg_file(OggVorbis_File *oggFile,
		const std::string &filename_for_logging)
{
	int endian = 0; // 0 for Little-Endian, 1 for Big-Endian
	int bitStream;
	long bytes;
	char array[BUFFER_SIZE]; // Local fixed size array