From fad6536fe157666fd5b1c4390c11d1688401158c Mon Sep 17 00:00:00 2001 From: psuedo finnish Date: Sat, 21 Oct 2017 17:16:30 -0700 Subject: [PATCH 1/2] fixed x11 linkage error --- modules/motion_sense/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/motion_sense/config.py b/modules/motion_sense/config.py index fc8cd761ffaf..7c4045d7c055 100644 --- a/modules/motion_sense/config.py +++ b/modules/motion_sense/config.py @@ -9,7 +9,9 @@ def configure(env): env.Append(CXXFLAGS=['-mavx']) #env.Append(CCFLAGS=["-DLIB_NO_GUI_SUPPORT=1", "-DUSE_AVX_INSTRUCTIONS=1" ]) - #env.ParseConfig('pkg-config opencv --cflags --libs') + # if env['platform'] == 'osx': + env.ParseConfig('pkg-config opencv --cflags --libs') env.Append(CPPPATH=["/opt/X11/include/"]) env.Append(LIBS=["X11"]) + env.Append(LIBPATH=["/opt/X11/lib"]) From edfb3fccf279d7a1ebdec23b90af2ce73c7e826e Mon Sep 17 00:00:00 2001 From: psuedo finnish Date: Mon, 23 Oct 2017 12:14:29 -0700 Subject: [PATCH 2/2] deleted mumble module --- modules/mumble/.gitignore | 4 - modules/mumble/SCsub | 259 ------------------------------ modules/mumble/callback.cpp | 48 ------ modules/mumble/callback.h | 40 ----- modules/mumble/config.py | 8 - modules/mumble/mumble.cpp | 97 ----------- modules/mumble/mumble.h | 44 ----- modules/mumble/register_types.cpp | 16 -- modules/mumble/register_types.h | 6 - modules/mumble/utils.cpp | 39 ----- modules/mumble/utils.h | 13 -- 11 files changed, 574 deletions(-) delete mode 100644 modules/mumble/.gitignore delete mode 100644 modules/mumble/SCsub delete mode 100644 modules/mumble/callback.cpp delete mode 100644 modules/mumble/callback.h delete mode 100644 modules/mumble/config.py delete mode 100644 modules/mumble/mumble.cpp delete mode 100644 modules/mumble/mumble.h delete mode 100644 modules/mumble/register_types.cpp delete mode 100644 modules/mumble/register_types.h delete mode 100644 modules/mumble/utils.cpp delete mode 100644 modules/mumble/utils.h diff --git a/modules/mumble/.gitignore b/modules/mumble/.gitignore deleted file mode 100644 index 06833525e1e2..000000000000 --- a/modules/mumble/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.backup -*.back -*.pyc -*.o diff --git a/modules/mumble/SCsub b/modules/mumble/SCsub deleted file mode 100644 index 4db58109ca2c..000000000000 --- a/modules/mumble/SCsub +++ /dev/null @@ -1,259 +0,0 @@ -# SCsub - -Import('env') - - -mumble_env = env.Clone() -if (env['builtin_opus'] != 'no'): - thirdparty_dir = "#thirdparty/opus/" - - thirdparty_sources = [ - "silk/tables_other.c", - "silk/sum_sqr_shift.c", - "silk/PLC.c", - "silk/dec_API.c", - "silk/decode_pulses.c", - "silk/inner_prod_aligned.c", - "silk/init_encoder.c", - "silk/interpolate.c", - "silk/stereo_encode_pred.c", - "silk/decode_frame.c", - "silk/NLSF_del_dec_quant.c", - "silk/VAD.c", - "silk/resampler_private_AR2.c", - "silk/NLSF_unpack.c", - "silk/resampler_down2.c", - "silk/sort.c", - "silk/resampler_private_IIR_FIR.c", - "silk/resampler_down2_3.c", - "silk/resampler_private_up2_HQ.c", - "silk/tables_gain.c", - "silk/stereo_find_predictor.c", - "silk/stereo_quant_pred.c", - "silk/NLSF_stabilize.c", - "silk/ana_filt_bank_1.c", - "silk/check_control_input.c", - "silk/bwexpander.c", - "silk/A2NLSF.c", - "silk/LPC_inv_pred_gain.c", - "silk/log2lin.c", - "silk/process_NLSFs.c", - "silk/sigm_Q15.c", - "silk/VQ_WMat_EC.c", - "silk/quant_LTP_gains.c", - "silk/resampler_private_down_FIR.c", - "silk/NLSF_decode.c", - "silk/control_codec.c", - "silk/NLSF_VQ_weights_laroia.c", - "silk/decode_pitch.c", - "silk/stereo_decode_pred.c", - "silk/tables_pulses_per_block.c", - "silk/init_decoder.c", - "silk/table_LSF_cos.c", - "silk/decode_core.c", - "silk/code_signs.c", - "silk/enc_API.c", - "silk/tables_LTP.c", - "silk/pitch_est_tables.c", - "silk/biquad_alt.c", - "silk/encode_indices.c", - "silk/tables_NLSF_CB_WB.c", - "silk/debug.c", - "silk/decode_parameters.c", - "silk/tables_pitch_lag.c", - "silk/NLSF2A.c", - "silk/resampler.c", - "silk/decode_indices.c", - "silk/NLSF_VQ.c", - "silk/bwexpander_32.c", - "silk/tables_NLSF_CB_NB_MB.c", - "silk/encode_pulses.c", - "silk/NSQ_del_dec.c", - "silk/control_SNR.c", - "silk/shell_coder.c", - "silk/NLSF_encode.c", - "silk/stereo_MS_to_LR.c", - "silk/stereo_LR_to_MS.c", - "silk/HP_variable_cutoff.c", - "silk/LPC_analysis_filter.c", - "silk/CNG.c", - "silk/decoder_set_fs.c", - "silk/resampler_rom.c", - "silk/control_audio_bandwidth.c", - "silk/lin2log.c", - "silk/LP_variable_cutoff.c", - "silk/NSQ.c", - "silk/gain_quant.c", - "celt/laplace.c", - "celt/vq.c", - "celt/quant_bands.c", - "celt/kiss_fft.c", - "celt/entcode.c", - "celt/entenc.c", - "celt/celt_lpc.c", - "celt/pitch.c", - "celt/rate.c", - "celt/mathops.c", - #"celt/arm/armcpu.c", - #"celt/arm/celt_neon_intr.c", - #"celt/arm/celt_ne10_mdct.c", - #"celt/arm/celt_ne10_fft.c", - #"celt/arm/arm_celt_map.c", - "celt/celt_encoder.c", - "celt/celt.c", - "celt/bands.c", - "celt/cwrs.c", - "celt/entdec.c", - "celt/celt_decoder.c", - "celt/mdct.c", - "celt/modes.c", - "repacketizer.c", - "mlp_data.c", - "opus_multistream.c", - "opusfile.c", - "opus_encoder.c", - "analysis.c", - "mlp.c", - "info.c", - "stream.c", - "opus_decoder.c", - "internal.c", - "wincerts.c", - "opus.c", - "opus_multistream_encoder.c", - "http.c", - "opus_multistream_decoder.c" - ] - - opus_sources_silk = [] - - if("opus_fixed_point" in env and env.opus_fixed_point == "yes"): - mumble_env.Append(CFLAGS=["-DFIXED_POINT"]) - opus_sources_silk = [ - "silk/fixed/schur64_FIX.c", - "silk/fixed/residual_energy16_FIX.c", - "silk/fixed/encode_frame_FIX.c", - "silk/fixed/regularize_correlations_FIX.c", - "silk/fixed/apply_sine_window_FIX.c", - "silk/fixed/solve_LS_FIX.c", - "silk/fixed/schur_FIX.c", - "silk/fixed/pitch_analysis_core_FIX.c", - "silk/fixed/noise_shape_analysis_FIX.c", - "silk/fixed/find_LTP_FIX.c", - "silk/fixed/vector_ops_FIX.c", - "silk/fixed/autocorr_FIX.c", - "silk/fixed/warped_autocorrelation_FIX.c", - "silk/fixed/find_pitch_lags_FIX.c", - "silk/fixed/k2a_Q16_FIX.c", - "silk/fixed/LTP_scale_ctrl_FIX.c", - "silk/fixed/corrMatrix_FIX.c", - "silk/fixed/prefilter_FIX.c", - "silk/fixed/find_LPC_FIX.c", - "silk/fixed/residual_energy_FIX.c", - "silk/fixed/process_gains_FIX.c", - "silk/fixed/LTP_analysis_filter_FIX.c", - "silk/fixed/k2a_FIX.c", - "silk/fixed/burg_modified_FIX.c", - "silk/fixed/find_pred_coefs_FIX.c" - ] - else: - opus_sources_silk = [ - "silk/float/LTP_scale_ctrl_FLP.c", - "silk/float/regularize_correlations_FLP.c", - "silk/float/corrMatrix_FLP.c", - "silk/float/LPC_analysis_filter_FLP.c", - "silk/float/levinsondurbin_FLP.c", - "silk/float/schur_FLP.c", - "silk/float/scale_vector_FLP.c", - "silk/float/apply_sine_window_FLP.c", - "silk/float/pitch_analysis_core_FLP.c", - "silk/float/wrappers_FLP.c", - "silk/float/bwexpander_FLP.c", - "silk/float/warped_autocorrelation_FLP.c", - "silk/float/solve_LS_FLP.c", - "silk/float/find_LPC_FLP.c", - "silk/float/autocorrelation_FLP.c", - "silk/float/find_pred_coefs_FLP.c", - "silk/float/find_pitch_lags_FLP.c", - "silk/float/burg_modified_FLP.c", - "silk/float/find_LTP_FLP.c", - "silk/float/energy_FLP.c", - "silk/float/sort_FLP.c", - "silk/float/LPC_inv_pred_gain_FLP.c", - "silk/float/k2a_FLP.c", - "silk/float/noise_shape_analysis_FLP.c", - "silk/float/inner_product_FLP.c", - "silk/float/process_gains_FLP.c", - "silk/float/encode_frame_FLP.c", - "silk/float/scale_copy_vector_FLP.c", - "silk/float/residual_energy_FLP.c", - "silk/float/LTP_analysis_filter_FLP.c", - "silk/float/prefilter_FLP.c" - ] - - thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk] - - mumble_env.add_source_files(env.modules_sources, thirdparty_sources) - mumble_env.Append(CFLAGS=["-DHAVE_CONFIG_H"]) - - thirdparty_include_paths = [ - "", - "celt", - "opus", - "silk", - "silk/fixed", - "silk/float", - ] - mumble_env.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) - - # also requires libogg - if (env['builtin_libogg'] != 'no'): - mumble_env.Append(CPPPATH=["#thirdparty/libogg"]) - - -sources = [ - "register_types.cpp", - "mumble.cpp" - "callback.cpp" - "utils.cpp" -] - - -thirdparty_dir = "#thirdparty" - -third_party_includes = [ - "mumlib/include", - "mumlib/build" -] -third_party_sources = [ - "mumlib/src/Audio.cpp", - "mumlib/src/Callback.cpp", - "mumlib/src/CryptState.cpp", - "mumlib/src/Transport.cpp", - "mumlib/src/VarInt.cpp", - "mumlib/src/mumlib.cpp", - "mumlib/build/Mumble.pb.cc" -] -third_party_system_include = [ - "/usr/include", - "/usr/include/boost" -] -build_mumlib_proto = "pushd ../../thirdparty/mumlib; mkdir build;" + \ -"protoc --proto_path=. --cpp_out=build/ Mumble.proto; popd;" - -import subprocess -def subprocess_cmd(command): - process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True, executable='/bin/bash') - proc_stdout = process.communicate()[0].strip() - -## build .pb.h files -subprocess_cmd(build_mumlib_proto) - -#mumble_env.Append(LIBPATH=third_party_system_lib) -#mumble_env.Append(CPPPATH=third_party_system_include) -#mumble_env.Append(LIBS=['protobuf', 'log4cpp']) - -mumble_env.Append(CPPPATH=[ thirdparty_dir + "/" + dir for dir in third_party_includes]) -mumble_env.add_source_files(env.modules_sources, [ thirdparty_dir + '/' + dir for dir in third_party_sources ]) -mumble_env.add_source_files(env.modules_sources,"*.cpp") -mumble_env.Append(CXXFLAGS=['-O2', '-std=c++11']) diff --git a/modules/mumble/callback.cpp b/modules/mumble/callback.cpp deleted file mode 100644 index e0ded848a0fe..000000000000 --- a/modules/mumble/callback.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "callback.h" -#include "utils.h" -#include "variant.h" -#include "print_string.h" -#include "math/vector3.h" -#include "scene/resources/audio_stream_sample.h" - - - -void MyCallBack::audio( int target, - int sessionId, int sequenceNumber, int16_t *pcm_data, - uint32_t pcm_data_size, float position[3]){ - Variant sid(sessionId); - Variant snum(sequenceNumber); - Ref sam = Ref(utils::pcm2Sample(pcm_data, pcm_data_size)); - Variant pcm(sam); - Variant tar(target); - Vector3 pos(position[0],position[1],position[2]); -// Variant::CallError err; - Variant result = _mumble_ref.emit_signal( "audio_message", pcm, pos, tar, sid ); -} - - -void MyCallBack::textMessage( - uint32_t actor, - std::vector session, - std::vector channel_id, - std::vector tree_id, - std::string message) { - Variant s = utils::cpp_uint32vec2Variant(session); - Variant c = utils::cpp_uint32vec2Variant(channel_id); - Variant t = utils::cpp_uint32vec2Variant(tree_id); - Variant a(actor); - Variant m(String(message.c_str())); -// Variant::CallError err; -// const Variant *args[5] = {&a, &s, &c, &t, &m}; - Variant result = _mumble_ref.emit_signal( "text_message", m, a ); - -} -void MyCallBack::version( - uint16_t major, - uint8_t minor, - uint8_t patch, - std::string release, - std::string os, - std::string os_version){ } - - diff --git a/modules/mumble/callback.h b/modules/mumble/callback.h deleted file mode 100644 index 3ebe3fbd252d..000000000000 --- a/modules/mumble/callback.h +++ /dev/null @@ -1,40 +0,0 @@ -/* callback.h */ -#ifndef SimpleCALLBACK_H -#define SimpleCALLBACK_H - -#include "reference.h" -#include -#include -#include - -class MyCallBack : public mumlib::Callback{ - -public: - MyCallBack( Object &o ): _mumble_ref(o){ - }; - virtual void audio(int target, - int sessionId, - int sequenceNumber, - int16_t *pcm_data, - uint32_t pcm_data_size, - float position [3]); - virtual void textMessage( - uint32_t actor, - std::vector session, - std::vector channel_id, - std::vector tree_id, - std::string message); - - virtual void version( - uint16_t major, - uint8_t minor, - uint8_t patch, - std::string release, - std::string os, - std::string os_version); -private: - Object &_mumble_ref; -}; - - -#endif diff --git a/modules/mumble/config.py b/modules/mumble/config.py deleted file mode 100644 index 506f2765fc76..000000000000 --- a/modules/mumble/config.py +++ /dev/null @@ -1,8 +0,0 @@ -# config.py - -def can_build(platform): - return True - -def configure(env): - env.Append(LIBS=['boost_system', 'protobuf', 'log4cpp']) - diff --git a/modules/mumble/mumble.cpp b/modules/mumble/mumble.cpp deleted file mode 100644 index ac093a663239..000000000000 --- a/modules/mumble/mumble.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* mumble.cpp */ - -#include "mumble.h" -#include "callback.h" -#include "utils.h" -#include "os/thread.h" -#include "print_string.h" -#include -#include -#include "scene/main/timer.h" - -Mumble::Mumble() : _cb(*this) { - _pMumble = Ref<_PrivateMumble>(memnew(_PrivateMumble(_cb))); -} - -Mumble::_PrivateMumble::_PrivateMumble( mumlib::Callback & c) : _mum(c) { -} -void Mumble::_PrivateMumble::engage(String host, int port, String user, String password){ - std::string h = utils::gstr2cpp_str(host); - std::string u = utils::gstr2cpp_str(user); - std::string p = utils::gstr2cpp_str(password); - this->_mum.connect(h, port, u, p); - this -> start(); -} -void Mumble::_PrivateMumble::start(){ - while(true){ - try{ - this->_mum.run(); - }catch (mumlib::TransportException &exp) { - print_line( "Mumble: error " + utils::cpp_str2gstr(exp.what())); - print_line( "Mumble: attempting to reconnect in 5s. "); - Timer * sleep = memnew(Timer); - sleep -> set_wait_time(5.0); - sleep -> start(); - memdelete(sleep); - } - } -} - - - -void Mumble::_PrivateMumble::sendText(const String text){ - _mum.sendTextMessage( utils::gstr2cpp_str(text) ); -} - -void Mumble::_PrivateMumble::send16bAudio(const PoolByteArray & sample){ - uint32_t pcm_len = sample.size()/2; - int16_t pcm[50000]; - for(int i = 0; i < pcm_len; i++){ - uint16_t low = (uint16_t) sample[2*i]; - uint16_t hi = (uint16_t) sample[2*i+1]; - pcm[i] = ( low | ( hi << 8)); - } - _mum.sendAudioData(pcm, pcm_len); -} - -void Mumble::_bind_methods() { - ClassDB::bind_method(D_METHOD("engage", "host", "port", "user", "password"), &Mumble::engage); - ClassDB::bind_method(D_METHOD("disengage"), &Mumble::disengage); -// ClassDB::bind_method(D_METHOD("start"), &Mumble::start); - - ClassDB::bind_method(D_METHOD("sendText", "text"), &Mumble::sendText); - ClassDB::bind_method(D_METHOD("sendAudio", "sample"), &Mumble::sendAudio); - ADD_SIGNAL(MethodInfo("audio_message", PropertyInfo(Variant::OBJECT, "audio_sample"), PropertyInfo(Variant::VECTOR3, "position"), PropertyInfo(Variant::INT, "target"), PropertyInfo(Variant::INT, "session_id"))); - ADD_SIGNAL(MethodInfo("text_message", PropertyInfo(Variant::STRING, "message"), PropertyInfo(Variant::INT, "actor"))); - -} -void Mumble::engage(String host, int port, String user, String password) { - _pMumble -> engage( host, port, user, password); -} - -void Mumble::disengage(){ - _pMumble->disengage(); -} -void Mumble::start(){ - _pMumble->start(); -} -void Mumble::sendText(const String text){ - _pMumble -> sendText( text ); -} - -void Mumble::sendAudio(Ref sample){ - - const PoolByteArray data = sample->get_data(); - - - if(data.size() > 0){ - switch(sample->get_format()){ - case AudioStreamSample::FORMAT_16_BITS: - _pMumble->send16bAudio(data); - default: - return; - } - } - -} - diff --git a/modules/mumble/mumble.h b/modules/mumble/mumble.h deleted file mode 100644 index 601890b2e9ce..000000000000 --- a/modules/mumble/mumble.h +++ /dev/null @@ -1,44 +0,0 @@ -/* mumble.h */ -#ifndef MUMBLE_H -#define MUMBLE_H - -#include "reference.h" -#include -#include "scene/resources/audio_stream_sample.h" -#include "variant.h" -#include "callback.h" - -class Mumble : public Reference { - GDCLASS(Mumble,Reference); -private: - class _PrivateMumble: public Reference { - GDCLASS(_PrivateMumble,Reference); - private: - mumlib::Mumlib _mum; - public: - _PrivateMumble(mumlib::Callback & c); - void engage(String host, int port, String user, String password); - void sendText(const String text); - void send16bAudio(const PoolByteArray & arr); - void disengage() { _mum.disconnect(); } - void start(); - }; - Ref<_PrivateMumble> _pMumble; - -protected: - static void _bind_methods(); - -public: - - void engage(String host, int port, String user, String password); - void disengage(); - void start(); - void sendText(const String message); - void sendAudio(Ref sample); - Mumble(); -// ~Mumble(); -private: - MyCallBack _cb; -}; - -#endif diff --git a/modules/mumble/register_types.cpp b/modules/mumble/register_types.cpp deleted file mode 100644 index d67ac9ee0fe2..000000000000 --- a/modules/mumble/register_types.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* register_types.cpp */ - -#include "register_types.h" -#include "class_db.h" -#include "mumble.h" -#include "callback.h" - -void register_mumble_types() { - - ClassDB::register_class(); -} - -void unregister_mumble_types() { - //nothing to do here -} - diff --git a/modules/mumble/register_types.h b/modules/mumble/register_types.h deleted file mode 100644 index 2febdf657abc..000000000000 --- a/modules/mumble/register_types.h +++ /dev/null @@ -1,6 +0,0 @@ -/* register_types.h */ - -void register_mumble_types(); -void unregister_mumble_types(); -/* yes, the word in the middle must be the same as the module folder name */ - diff --git a/modules/mumble/utils.cpp b/modules/mumble/utils.cpp deleted file mode 100644 index 6c8162904d98..000000000000 --- a/modules/mumble/utils.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "utils.h" -#include "variant.h" -#include "vector.h" - - - -std::string utils::gstr2cpp_str(String s){ - std::wstring ws(s.c_str()); - std::string str(ws.begin(), ws.end()); - return str; -}; -String utils::cpp_str2gstr(std::string s){ - return String(s.c_str()); -} -Variant utils::cpp_uint32vec2Variant( const std::vector &v ){ - Vector ret; - ret.resize(v.size()); - for( int i = 0; i < v.size(); i++){ - ret[i] = (Variant( (uint64_t)v[i])); - } - return ret; -} - - -AudioStreamSample *utils::pcm2Sample( const int16_t * pcm_data, uint32_t size){ - PoolByteArray d; - d.resize(size * 2); - AudioStreamSample *sam = memnew(AudioStreamSample); - sam->set_format(AudioStreamSample::FORMAT_16_BITS); - sam->set_loop_mode(AudioStreamSample::LOOP_DISABLED); - for( int i=0; i < size; i++){ - uint16_t sh = (uint16_t) pcm_data[i]; - d.set( i*2 , (uint8_t) (sh & 0xFF) ); - d.set( i*2+1, (uint8_t) (sh >> 8)); - } - - sam->set_data(d); - return sam; -} diff --git a/modules/mumble/utils.h b/modules/mumble/utils.h deleted file mode 100644 index 78ad0e0b039b..000000000000 --- a/modules/mumble/utils.h +++ /dev/null @@ -1,13 +0,0 @@ -#include "ustring.h" -#include "array.h" -#include -#include -#include "scene/resources/audio_stream_sample.h" -#include "variant.h" - -namespace utils{ - std::string gstr2cpp_str(String s); - String cpp_str2gstr(std::string s); - Variant cpp_uint32vec2Variant( const std::vector &v ); - AudioStreamSample *pcm2Sample( const int16_t * pcm_data, uint32_t size); -}