zenilib: zenilib/jni/external/zenilib/zeni_audio/Sound_Renderer_SLES.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Sound_Renderer_SLES.cpp
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2 * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3 *
4 * zenilib is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * zenilib is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <zeni_audio.h>
19
20 #include <iostream>
21 #include <vector>
22 #include <iomanip>
23
24 #ifdef ENABLE_SLES
25
26 namespace Zeni {
27
28 Sound_Renderer_SLES::Sound_Renderer_SLES()
29 : engineObject(NULL),
30 engineEngine(NULL),
31 outputMixObject(NULL)
32 {
33 // create engine
34 if(slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL) != SL_RESULT_SUCCESS)
35 throw Sound_Init_Failure();
36
37 // realize the engine
38 if((*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE) != SL_RESULT_SUCCESS)
39 throw Sound_Init_Failure();
40
41 // get the engine interface, which is needed in order to create other objects
42 if((*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine) != SL_RESULT_SUCCESS)
43 throw Sound_Init_Failure();
44
45 // create output mix
46 if((*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, NULL, NULL) != SL_RESULT_SUCCESS)
47 throw Sound_Init_Failure();
48
49 // realize the output mix
50 if((*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE) != SL_RESULT_SUCCESS)
51 throw Sound_Init_Failure();
52 }
53
54 Sound_Renderer_SLES::~Sound_Renderer_SLES() {
55 // destroy output mix object, and invalidate all associated interfaces
56 if(outputMixObject != NULL) {
57 (*outputMixObject)->Destroy(outputMixObject);
58 outputMixObject = NULL;
59 }
60
61 // destroy engine object, and invalidate all associated interfaces
62 if(engineObject != NULL) {
63 (*engineObject)->Destroy(engineObject);
64 engineObject = NULL;
65 engineEngine = NULL;
66 }
67 }
68
69 SLEngineItf & Sound_Renderer_SLES::get_engineEngine() {
70 return engineEngine;
71 }
72
73 SLObjectItf & Sound_Renderer_SLES::get_outputMixObject() {
74 return outputMixObject;
75 }
76
77 void Sound_Renderer_SLES::set_listener_position(const Point3f &) {
78 }
79
80 void Sound_Renderer_SLES::set_listener_velocity(const Vector3f &) {
81 }
82
83 void Sound_Renderer_SLES::set_listener_forward_and_up(const Vector3f &, const Vector3f &) {
84 }
85
86 void Sound_Renderer_SLES::set_listener_gain(const float &gain) {
87 }
88
89 std::pair<Vector3f, Vector3f> Sound_Renderer_SLES::get_listener_forward_and_up() const {
90 return std::make_pair(Vector3f(), Vector3f());
91 }
92
93 }
94
95 #else
96
97 namespace Zeni {
98 void * this_pointer_is_silent_sound_too = (void *)0xDEADBEEF;
99 }
100
101 #endif
NULL
#define NULL
Definition: ftobjs.h:61
Zeni::this_pointer_is_silent_sound_too
void * this_pointer_is_silent_sound_too
Definition: Sound_Renderer_SLES.cpp:98
zeni_audio.h