1 /*
2  *  zlib License
3  *  
4  *  (C) 2016 jython234
5  *  
6  *  This software is provided 'as-is', without any express or implied
7  *  warranty.  In no event will the authors be held liable for any damages
8  *  arising from the use of this software.
9  *  
10  *  Permission is granted to anyone to use this software for any purpose,
11  *  including commercial applications, and to alter it and redistribute it
12  *  freely, subject to the following restrictions:
13  *  
14  *  1. The origin of this software must not be misrepresented; you must not
15  *     claim that you wrote the original software. If you use this software
16  *     in a product, an acknowledgment in the product documentation would be
17  *     appreciated but is not required.
18  *  2. Altered source versions must be plainly marked as such, and must not be
19  *     misrepresented as being the original software.
20  *  3. This notice may not be removed or altered from any source distribution.
21 */
22 module blocksound.core;
23 
24 import derelict.openal.al;
25 import derelict.sndfile.sndfile;
26 
27 public import blocksound.util;
28 
29 /// Library Version
30 immutable string VERSION = "v1.0-rc2";
31 
32 package shared bool INIT = false;
33 
34 /++
35     Init the library. This must be called before any other library
36     features are used.
37 +/
38 void init() @trusted {
39     debug(blocksound_verbose) {
40         import std.stdio : writeln;
41         import blocksound.backend.types : BACKEND;
42 
43         writeln("\n[BlockSound]: BlockSound ", VERSION, " compiled with ", BACKEND, " backend.");
44         writeln("[BlockSound]: Loading libraries...");
45     }
46 
47     version(blocksound_ALBackend) {
48         import blocksound.backend.openal : loadLibraries;
49         loadLibraries(); //TODO: skipALload, skipSFload
50     } else {
51         writeln("[BlockSound]: WARNING: No backend detected! Try compiling blocksound with the \"openal-backend\" configuration!");
52     }
53 
54     INIT = true;
55 
56     debug(blocksound_verbose) {
57         import std.stdio : writeln;
58         writeln("[BlockSound]: Libraries loaded.\n");
59     }
60 }