vasingleton.cpp 17.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 *  --------------------------------------------------------------------------------------------
 *
 *    VVV        VVV A           Virtual Acoustics (VA) | http://www.virtualacoustics.org
 *     VVV      VVV AAA          Licensed under the Apache License, Version 2.0
 *      VVV    VVV   AAA
 *       VVV  VVV     AAA        Copyright 2015-2018
 *        VVVVVV       AAA       Institute of Technical Acoustics (ITA)
 *         VVVV         AAA      RWTH Aachen University
 *
 *  --------------------------------------------------------------------------------------------
 */

14 15 16
#include <Python.h>

#include "vasingletondoc.hpp"
17

18
// All Python to VA methods. Also pulls in g_pVAError (Python error trace instance)
19 20 21 22 23 24 25
#include "vasingletonmethods.hpp"

// VA methods that will appear in Python if they are added to the following table
// It's corresponding C++ functions are implemented here: vasingletonmethods.hpp

static struct PyMethodDef va_methods[] =
{
26 27 28 29 30
	{ "connect", ( PyCFunction ) connect, METH_FASTCALL, connect_doc },
	{ "disconnect", ( PyCFunction ) disconnect, METH_FASTCALL, no_doc },
	{ "is_connected", ( PyCFunction ) is_connected, METH_FASTCALL, no_doc },
	{ "reset", ( PyCFunction ) reset, METH_FASTCALL, no_doc },

31
	{ "get_version", ( PyCFunction ) get_version, METH_FASTCALL, no_doc },
32 33
	{ "get_modules", ( PyCFunction ) get_modules, METH_FASTCALL, no_doc },
	{ "call_module", ( PyCFunction ) call_module, METH_FASTCALL, no_doc },
34 35

	{ "get_search_paths", ( PyCFunction ) get_search_paths, METH_FASTCALL, no_doc },
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
	{ "add_search_path", ( PyCFunction ) add_search_path, METH_FASTCALL, no_doc },

	{ "create_directivity_from_file", ( PyCFunction ) create_directivity_from_file, METH_FASTCALL, no_doc },
	{ "delete_directivity", ( PyCFunction ) delete_directivity, METH_FASTCALL, no_doc },
	{ "get_directivity_info", ( PyCFunction ) get_directivity_info, METH_FASTCALL, no_doc },
	{ "get_directivity_infos", ( PyCFunction ) get_directivity_infos, METH_FASTCALL, no_doc },

	{ "create_signal_source_buffer_from_file", ( PyCFunction ) create_signal_source_buffer_from_file, METH_FASTCALL, no_doc },
	{ "create_signal_source_text_to_speech", ( PyCFunction ) create_signal_source_text_to_speech, METH_FASTCALL, no_doc },
	{ "create_signal_source_sequencer", ( PyCFunction ) create_signal_source_sequencer, METH_FASTCALL, no_doc },
	{ "create_signal_source_network_stream", ( PyCFunction ) create_signal_source_network_stream, METH_FASTCALL, no_doc },
	{ "create_signal_source_engine", ( PyCFunction ) create_signal_source_engine, METH_FASTCALL, no_doc },
	{ "create_signal_source_machine", ( PyCFunction ) create_signal_source_machine, METH_FASTCALL, no_doc },
	{ "delete_signal_source", ( PyCFunction ) delete_signal_source, METH_FASTCALL, no_doc },
	{ "get_signal_source_info", ( PyCFunction ) get_signal_source_info, METH_FASTCALL, no_doc },
	{ "get_signal_source_infos", ( PyCFunction ) get_signal_source_infos, METH_FASTCALL, no_doc },
	{ "get_signal_source_buffer_playback_state", ( PyCFunction ) get_signal_source_buffer_playback_state, METH_FASTCALL, no_doc },
	{ "get_signal_source_buffer_playback_state_str", ( PyCFunction ) get_signal_source_buffer_playback_state_str, METH_FASTCALL, no_doc },
	{ "set_signal_source_buffer_playback_action", ( PyCFunction ) set_signal_source_buffer_playback_action, METH_FASTCALL, no_doc },
	{ "set_signal_source_buffer_playback_action_str", ( PyCFunction ) set_signal_source_buffer_playback_action_str, METH_FASTCALL, no_doc },
	{ "set_signal_source_buffer_playback_position", ( PyCFunction ) set_signal_source_buffer_playback_position, METH_FASTCALL, no_doc },
	{ "get_signal_source_buffer_looping", ( PyCFunction ) get_signal_source_buffer_looping, METH_FASTCALL, no_doc },
	{ "set_signal_source_buffer_looping", ( PyCFunction ) set_signal_source_buffer_looping, METH_FASTCALL, no_doc },
	{ "set_signal_source_machine_start_machine", ( PyCFunction ) set_signal_source_machine_start_machine, METH_FASTCALL, no_doc },
	{ "set_signal_source_machine_halt_machine", ( PyCFunction ) set_signal_source_machine_halt_machine, METH_FASTCALL, no_doc },
	{ "get_signal_source_machine_state_str", ( PyCFunction ) get_signal_source_machine_state_str, METH_FASTCALL, no_doc },
	{ "set_signal_source_machine_speed", ( PyCFunction ) set_signal_source_machine_speed, METH_FASTCALL, no_doc },
	{ "get_signal_source_machine_speed", ( PyCFunction ) get_signal_source_machine_speed, METH_FASTCALL, no_doc },
	{ "set_signal_source_machine_start_file", ( PyCFunction ) set_signal_source_machine_start_file, METH_FASTCALL, no_doc },
	{ "set_signal_source_machine_idle_file", ( PyCFunction ) set_signal_source_machine_idle_file, METH_FASTCALL, no_doc },
	{ "set_signal_source_machine_stop_file", ( PyCFunction ) set_signal_source_machine_stop_file, METH_FASTCALL, no_doc },
	{ "set_signal_source_parameters", ( PyCFunction ) set_signal_source_parameters, METH_FASTCALL, no_doc },
	{ "get_signal_source_parameters", ( PyCFunction ) get_signal_source_parameters, METH_FASTCALL, no_doc },

	{ "get_sound_source_ids", ( PyCFunction ) get_sound_source_ids, METH_FASTCALL, no_doc },
	{ "create_sound_source", ( PyCFunction ) create_sound_source, METH_FASTCALL, no_doc },
	{ "create_sound_source_explicit_renderer", ( PyCFunction ) create_sound_source_explicit_renderer, METH_FASTCALL, no_doc },
	{ "delete_sound_source", ( PyCFunction ) delete_sound_source, METH_FASTCALL, no_doc },
	{ "set_sound_source_enabled", ( PyCFunction ) set_sound_source_enabled, METH_FASTCALL, no_doc },
	{ "get_sound_source_enabled", ( PyCFunction ) get_sound_source_enabled, METH_FASTCALL, no_doc },
	{ "get_sound_source_name", ( PyCFunction ) get_sound_source_name, METH_FASTCALL, no_doc },
	{ "set_sound_source_enabled", ( PyCFunction ) set_sound_source_enabled, METH_FASTCALL, no_doc },
	{ "get_sound_source_signal_source", ( PyCFunction ) get_sound_source_signal_source, METH_FASTCALL, no_doc },
	{ "set_sound_source_signal_source", ( PyCFunction ) set_sound_source_signal_source, METH_FASTCALL, no_doc },
	{ "remove_sound_source_signal_source", ( PyCFunction ) remove_sound_source_signal_source, METH_FASTCALL, no_doc },
	{ "get_sound_source_auralization_mode", ( PyCFunction ) get_sound_source_auralization_mode, METH_FASTCALL, no_doc },
	{ "set_sound_source_auralization_mode", ( PyCFunction ) set_sound_source_auralization_mode, METH_FASTCALL, no_doc },
	{ "set_sound_source_parameters", ( PyCFunction ) set_sound_source_parameters, METH_FASTCALL, no_doc },
	{ "get_sound_source_parameters", ( PyCFunction ) get_sound_source_parameters, METH_FASTCALL, no_doc },
	{ "get_sound_source_directivity", ( PyCFunction ) get_sound_source_directivity, METH_FASTCALL, no_doc },
	{ "set_sound_source_directivity", ( PyCFunction ) set_sound_source_directivity, METH_FASTCALL, no_doc },
	{ "get_sound_source_sound_power", ( PyCFunction ) get_sound_source_sound_power, METH_FASTCALL, no_doc },
	{ "set_sound_source_sound_power", ( PyCFunction ) set_sound_source_sound_power, METH_FASTCALL, no_doc },
	{ "get_sound_source_muted", ( PyCFunction ) get_sound_source_muted, METH_FASTCALL, no_doc },
	{ "set_sound_source_muted", ( PyCFunction ) set_sound_source_muted, METH_FASTCALL, no_doc },
	{ "get_sound_source_position", ( PyCFunction ) get_sound_source_position, METH_FASTCALL, no_doc },
	{ "set_sound_source_position", ( PyCFunction ) set_sound_source_position, METH_FASTCALL, no_doc },
	{ "get_sound_source_orientation_vu", ( PyCFunction ) get_sound_source_orientation_vu, METH_FASTCALL, no_doc },
	{ "set_sound_source_orientation_vu", ( PyCFunction ) set_sound_source_orientation_vu, METH_FASTCALL, no_doc },
	{ "get_sound_source_orientation_q", ( PyCFunction ) not_implemented, METH_FASTCALL, no_doc },
	{ "set_sound_source_orientation_q", ( PyCFunction ) not_implemented, METH_FASTCALL, no_doc },

	{ "get_sound_receiver_ids", ( PyCFunction ) get_sound_receiver_ids, METH_FASTCALL, no_doc },
	{ "create_sound_receiver", ( PyCFunction ) create_sound_receiver, METH_FASTCALL, no_doc },
	{ "create_sound_receiver_explicit_renderer", ( PyCFunction ) create_sound_receiver_explicit_renderer, METH_FASTCALL, no_doc },
	{ "delete_sound_receiver", ( PyCFunction ) delete_sound_receiver, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_enabled", ( PyCFunction ) set_sound_receiver_enabled, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_enabled", ( PyCFunction ) get_sound_receiver_enabled, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_name", ( PyCFunction ) get_sound_receiver_name, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_enabled", ( PyCFunction ) set_sound_receiver_enabled, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_auralization_mode", ( PyCFunction ) get_sound_receiver_auralization_mode, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_auralization_mode", ( PyCFunction ) set_sound_receiver_auralization_mode, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_parameters", ( PyCFunction ) set_sound_receiver_parameters, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_parameters", ( PyCFunction ) get_sound_receiver_parameters, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_directivity", ( PyCFunction ) get_sound_receiver_directivity, METH_FASTCALL, no_doc },
111
	{ "set_sound_receiver_directivity", ( PyCFunction ) set_sound_receiver_directivity, METH_FASTCALL, no_doc },
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
	{ "get_sound_receiver_position", ( PyCFunction ) get_sound_receiver_position, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_position", ( PyCFunction ) set_sound_receiver_position, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_orientation_vu", ( PyCFunction ) get_sound_receiver_orientation_vu, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_orientation_vu", ( PyCFunction ) set_sound_receiver_orientation_vu, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_orientation_q", ( PyCFunction ) not_implemented, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_orientation_q", ( PyCFunction ) not_implemented, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_real_world_position", ( PyCFunction ) get_sound_receiver_real_world_position, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_real_world_position", ( PyCFunction ) set_sound_receiver_real_world_position, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_real_world_orientation_vu", ( PyCFunction ) get_sound_receiver_real_world_orientation_vu, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_real_world_orientation_vu", ( PyCFunction ) set_sound_receiver_real_world_orientation_vu, METH_FASTCALL, no_doc },
	{ "get_sound_receiver_real_world_orientation_q", ( PyCFunction ) not_implemented, METH_FASTCALL, no_doc },
	{ "set_sound_receiver_real_world_orientation_q", ( PyCFunction ) not_implemented, METH_FASTCALL, no_doc },

	{ "get_sound_portal_ids", ( PyCFunction ) get_sound_portal_ids, METH_FASTCALL, no_doc },
	{ "get_sound_portal_name", ( PyCFunction ) get_sound_portal_name, METH_FASTCALL, no_doc },
	{ "set_sound_portal_name", ( PyCFunction ) set_sound_portal_name, METH_FASTCALL, no_doc },
	{ "get_sound_portal_enabled", ( PyCFunction ) get_sound_portal_enabled, METH_FASTCALL, no_doc },
	{ "set_sound_portal_enabled", ( PyCFunction ) set_sound_portal_enabled, METH_FASTCALL, no_doc },

131 132 133 134 135
	{ "get_homogeneous_medium_sound_speed", ( PyCFunction ) get_homogeneous_medium_sound_speed, METH_FASTCALL, no_doc },
	{ "set_homogeneous_medium_sound_speed", ( PyCFunction ) set_homogeneous_medium_sound_speed, METH_FASTCALL, no_doc },
	{ "get_homogeneous_medium_temperature", ( PyCFunction ) get_homogeneous_medium_temperature, METH_FASTCALL, no_doc },
	{ "set_homogeneous_medium_temperature", ( PyCFunction ) set_homogeneous_medium_temperature, METH_FASTCALL, no_doc },
	{ "get_homogeneous_medium_static_pressure", ( PyCFunction ) get_homogeneous_medium_static_pressure, METH_FASTCALL, no_doc },
136
	{ "set_homogeneous_medium_static_pressure", ( PyCFunction ) set_homogeneous_medium_static_pressure, METH_FASTCALL, no_doc },
137 138 139 140 141 142 143
	{ "get_homogeneous_medium_relative_humidity", ( PyCFunction ) get_homogeneous_medium_relative_humidity, METH_FASTCALL, no_doc },
	{ "set_homogeneous_medium_relative_humidity", ( PyCFunction ) set_homogeneous_medium_relative_humidity, METH_FASTCALL, no_doc },
	{ "get_homogeneous_medium_shift_speed", ( PyCFunction ) get_homogeneous_medium_shift_speed, METH_FASTCALL, no_doc },
	{ "set_homogeneous_medium_shift_speed", ( PyCFunction ) set_homogeneous_medium_shift_speed, METH_FASTCALL, no_doc },
	{ "get_homogeneous_medium_parameters", ( PyCFunction ) get_homogeneous_medium_parameters, METH_FASTCALL, no_doc },
	{ "set_homogeneous_medium_parameters", ( PyCFunction ) set_homogeneous_medium_parameters, METH_FASTCALL, no_doc },

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
144

145
	{ "create_acoustic_material", ( PyCFunction ) create_acoustic_material, METH_FASTCALL, no_doc },
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
146
	{ "create_acoustic_material_from_file", ( PyCFunction ) create_acoustic_material_from_file, METH_FASTCALL, no_doc },
147
	{ "create_acoustic_material_from_parameters", ( PyCFunction ) create_acoustic_material_from_parameters, METH_FASTCALL, no_doc },
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
148 149 150
	{ "get_acoustic_material_infos", ( PyCFunction ) get_acoustic_material_infos, METH_FASTCALL, no_doc },


151 152
	{ "get_rendering_modules", ( PyCFunction ) get_rendering_modules, METH_FASTCALL, no_doc },
	{ "set_rendering_module_muted", ( PyCFunction ) set_rendering_module_muted, METH_FASTCALL, no_doc },
153
	{ "get_rendering_module_muted", ( PyCFunction ) get_rendering_module_muted, METH_FASTCALL, no_doc },
154 155
	{ "set_rendering_module_gain", ( PyCFunction ) set_rendering_module_gain, METH_FASTCALL, no_doc },
	{ "get_rendering_module_gain", ( PyCFunction ) get_rendering_module_gain, METH_FASTCALL, no_doc },
156 157 158 159
	{ "get_rendering_module_auralization_mode", ( PyCFunction ) get_rendering_module_auralization_mode, METH_FASTCALL, no_doc },
	{ "set_rendering_module_auralization_mode", ( PyCFunction ) set_rendering_module_auralization_mode, METH_FASTCALL, no_doc },
	{ "get_rendering_module_parameters", ( PyCFunction ) get_rendering_module_parameters, METH_FASTCALL, no_doc },
	{ "set_rendering_module_parameters", ( PyCFunction ) set_rendering_module_parameters, METH_FASTCALL, no_doc },
160

161 162 163 164 165
	{ "get_reproduction_modules", ( PyCFunction ) get_reproduction_modules, METH_FASTCALL, no_doc },
	{ "set_reproduction_module_muted", ( PyCFunction ) set_reproduction_module_muted, METH_FASTCALL, no_doc },
	{ "get_reproduction_module_muted", ( PyCFunction ) get_reproduction_module_muted, METH_FASTCALL, no_doc },
	{ "set_reproduction_module_gain", ( PyCFunction ) set_reproduction_module_gain, METH_FASTCALL, no_doc },
	{ "get_reproduction_module_gain", ( PyCFunction ) get_reproduction_module_gain, METH_FASTCALL, no_doc },
166
	{ "get_reproduction_module_parameters", ( PyCFunction ) get_reproduction_module_parameters, METH_FASTCALL, no_doc },
167
	{ "set_reproduction_module_parameters", ( PyCFunction ) set_reproduction_module_parameters, METH_FASTCALL, no_doc },
168

169 170 171 172 173

	{ "lock_update", ( PyCFunction ) lock_update, METH_FASTCALL, no_doc },
	{ "unlock_update", ( PyCFunction ) unlock_update, METH_FASTCALL, no_doc },
	{ "get_update_locked", ( PyCFunction ) get_update_locked, METH_FASTCALL, no_doc },

174 175
	{ "get_input_gain", ( PyCFunction ) get_input_gain, METH_FASTCALL, no_doc },
	{ "set_input_gain", ( PyCFunction ) set_input_gain, METH_FASTCALL, no_doc },
176
	{ "get_input_muted", ( PyCFunction ) get_input_muted, METH_FASTCALL, no_doc },
177 178 179
	{ "set_input_muted", ( PyCFunction ) set_input_muted, METH_FASTCALL, no_doc },
	{ "get_output_gain", ( PyCFunction ) get_output_gain, METH_FASTCALL, no_doc },
	{ "set_output_gain", ( PyCFunction ) set_output_gain, METH_FASTCALL, no_doc },
180
	{ "get_output_muted", ( PyCFunction ) get_output_muted, METH_FASTCALL, no_doc },
181 182 183 184 185 186 187 188 189
	{ "set_output_muted", ( PyCFunction ) set_output_muted, METH_FASTCALL, no_doc },
	{ "get_global_auralization_mode", ( PyCFunction ) get_global_auralization_mode, METH_FASTCALL, no_doc },
	{ "set_global_auralization_mode", ( PyCFunction ) set_global_auralization_mode, METH_FASTCALL, no_doc },
	{ "get_active_sound_receiver", ( PyCFunction ) get_active_sound_receiver, METH_FASTCALL, no_doc },
	{ "set_active_sound_receiver", ( PyCFunction ) set_active_sound_receiver, METH_FASTCALL, no_doc },
	{ "get_active_sound_receiver_explicit_renderer", ( PyCFunction ) get_active_sound_receiver_explicit_renderer, METH_FASTCALL, no_doc },
	{ "set_active_sound_receiver_explicit_renderer", ( PyCFunction ) set_active_sound_receiver_explicit_renderer, METH_FASTCALL, no_doc },
	{ "get_core_clock", ( PyCFunction ) get_core_clock, METH_FASTCALL, no_doc },
	{ "set_core_clock", ( PyCFunction ) set_core_clock, METH_FASTCALL, no_doc },
190

191 192
	{ "substitute_macro", ( PyCFunction ) substitute_macro, METH_FASTCALL, no_doc },
	{ "find_file_path", ( PyCFunction ) find_file_path, METH_FASTCALL, no_doc },
193
	
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
194 195 196
	{ "get_core_configuration", ( PyCFunction ) get_core_configuration, METH_FASTCALL, no_doc },
	{ "get_hardware_configuration", ( PyCFunction ) get_hardware_configuration, METH_FASTCALL, no_doc },
	{ "get_file_list", ( PyCFunction ) get_file_list, METH_FASTCALL, no_doc },
197 198 199 200 201 202 203 204
	{ "get_log_level_str", ( PyCFunction ) get_log_level_str, METH_FASTCALL, no_doc },
	{ "parse_auralization_mode_str", ( PyCFunction ) parse_auralization_mode_str, METH_FASTCALL, no_doc },
	{ "get_auralization_mode_str", ( PyCFunction ) get_auralization_mode_str, METH_FASTCALL, no_doc },
	{ "get_volume_str_decibel", ( PyCFunction ) get_volume_str_decibel, METH_FASTCALL, no_doc },
	{ "parse_playback_state_str", ( PyCFunction ) parse_playback_state_str, METH_FASTCALL, no_doc },
	{ "get_playback_state_str", ( PyCFunction ) get_playback_state_str, METH_FASTCALL, no_doc },
	{ "parse_playback_action_str", ( PyCFunction ) parse_playback_action_str, METH_FASTCALL, no_doc },
	{ "get_playback_action_str", ( PyCFunction ) get_playback_action_str, METH_FASTCALL, no_doc },
205

206 207 208 209 210 211 212
	{ NULL,  NULL }
};

static struct PyModuleDef vamoduledef =
{
	PyModuleDef_HEAD_INIT,
	"va",
213
	module_doc,
214 215 216 217 218 219 220 221 222 223
	-1,
	va_methods,
	NULL,
	NULL,
	NULL,
	NULL
};

PyMODINIT_FUNC PyInit_va( void )
{
224 225 226
	PyObject* pModule = PyModule_Create( &vamoduledef );
	g_pVAError = PyErr_NewException( "va.error", NULL, NULL );
	Py_INCREF( g_pVAError );
227

228 229
	//PyAdd
	return pModule;
230
}