Loading src/audio.cpp +6 −9 Original line number Original line Diff line number Diff line /** /** * @file FILENAME * @file audio.cpp * @brief BRIEF DESCRIPTION * @brief Provides audio interface for streamer * @copyright Copyright (C) YEAR Elphel Inc. * @copyright Copyright (C) 2017 Elphel Inc. * @author AUTHOR <EMAIL> * @author AUTHOR <EMAIL> * * * @par License: * @par License: Loading @@ -27,10 +27,6 @@ #include <sys/ioctl.h> #include <sys/ioctl.h> #include <arpa/inet.h> #include <arpa/inet.h> #include <asm/elphel/c313a.h> #include "parameters.h" #undef AUDIO_DEBUG #undef AUDIO_DEBUG //#define AUDIO_DEBUG //#define AUDIO_DEBUG #undef AUDIO_DEBUG_2 #undef AUDIO_DEBUG_2 Loading @@ -54,12 +50,13 @@ using namespace std; using namespace std; Audio::Audio(bool enable, int sample_rate, int channels) { Audio::Audio(bool enable, Parameters *pars, int sample_rate, int channels) { //cerr << "Audio::Audio()" << endl; //cerr << "Audio::Audio()" << endl; snd_pcm_hw_params_t *hw_params; snd_pcm_hw_params_t *hw_params; snd_pcm_sw_params_t *sw_params; snd_pcm_sw_params_t *sw_params; _present = false; _present = false; stream_name = "audio"; stream_name = "audio"; params = pars; // normalize audio settings // normalize audio settings if(sample_rate == 0) sample_rate = SAMPLE_RATE; if(sample_rate == 0) sample_rate = SAMPLE_RATE; Loading Loading @@ -216,7 +213,7 @@ D( cerr << "Audio ---> Start !!!" << endl;) //cerr << "Audio ---> Start !!! - done" << endl; //cerr << "Audio ---> Start !!! - done" << endl; // get FPGA/sys time delta // get FPGA/sys time delta Parameters *params = Parameters::instance(); // Parameters *params = Parameters::instance(); unsigned long write_data[6]; unsigned long write_data[6]; write_data[0] = FRAMEPARS_GETFPGATIME; write_data[0] = FRAMEPARS_GETFPGATIME; write_data[1] = 0; write_data[1] = 0; Loading src/audio.h +12 −9 Original line number Original line Diff line number Diff line /** /** * @file FILENAME * @file audio.h * @brief BRIEF DESCRIPTION * @brief Provides audio interface for streamer * @copyright Copyright (C) YEAR Elphel Inc. * @copyright Copyright (C) 2017 Elphel Inc. * @author AUTHOR <EMAIL> * @author AUTHOR <EMAIL> * * * @par License: * @par License: Loading @@ -23,10 +23,15 @@ #define _AUDIO__H_ #define _AUDIO__H_ #include <string> #include <string> #ifdef __cplusplus #undef __cplusplus #endif #define __cplusplus 1 #define __cplusplus 1 #include <alsa/asoundlib.h> #include <alsa/asoundlib.h> #include <pthread.h> #include <pthread.h> #include "rtp_stream.h" #include "rtp_stream.h" #include "parameters.h" using namespace std; using namespace std; Loading @@ -35,7 +40,7 @@ using namespace std; class Audio : public RTP_Stream { class Audio : public RTP_Stream { public: public: Audio(bool enable, int sample_rate = SAMPLE_RATE, int channels = SAMPLE_CHANNELS); Audio(bool enable, Parameters *pars, int sample_rate = SAMPLE_RATE, int channels = SAMPLE_CHANNELS); virtual ~Audio(void); virtual ~Audio(void); long sample_rate(void) { return _sample_rate; }; long sample_rate(void) { return _sample_rate; }; long channels(void) { return _channels; }; long channels(void) { return _channels; }; Loading Loading @@ -66,6 +71,4 @@ bool is_first; bool is_first2; bool is_first2; }; }; //extern Audio *audio; #endif // _AUDIO__H_ #endif // _AUDIO__H_ Loading
src/audio.cpp +6 −9 Original line number Original line Diff line number Diff line /** /** * @file FILENAME * @file audio.cpp * @brief BRIEF DESCRIPTION * @brief Provides audio interface for streamer * @copyright Copyright (C) YEAR Elphel Inc. * @copyright Copyright (C) 2017 Elphel Inc. * @author AUTHOR <EMAIL> * @author AUTHOR <EMAIL> * * * @par License: * @par License: Loading @@ -27,10 +27,6 @@ #include <sys/ioctl.h> #include <sys/ioctl.h> #include <arpa/inet.h> #include <arpa/inet.h> #include <asm/elphel/c313a.h> #include "parameters.h" #undef AUDIO_DEBUG #undef AUDIO_DEBUG //#define AUDIO_DEBUG //#define AUDIO_DEBUG #undef AUDIO_DEBUG_2 #undef AUDIO_DEBUG_2 Loading @@ -54,12 +50,13 @@ using namespace std; using namespace std; Audio::Audio(bool enable, int sample_rate, int channels) { Audio::Audio(bool enable, Parameters *pars, int sample_rate, int channels) { //cerr << "Audio::Audio()" << endl; //cerr << "Audio::Audio()" << endl; snd_pcm_hw_params_t *hw_params; snd_pcm_hw_params_t *hw_params; snd_pcm_sw_params_t *sw_params; snd_pcm_sw_params_t *sw_params; _present = false; _present = false; stream_name = "audio"; stream_name = "audio"; params = pars; // normalize audio settings // normalize audio settings if(sample_rate == 0) sample_rate = SAMPLE_RATE; if(sample_rate == 0) sample_rate = SAMPLE_RATE; Loading Loading @@ -216,7 +213,7 @@ D( cerr << "Audio ---> Start !!!" << endl;) //cerr << "Audio ---> Start !!! - done" << endl; //cerr << "Audio ---> Start !!! - done" << endl; // get FPGA/sys time delta // get FPGA/sys time delta Parameters *params = Parameters::instance(); // Parameters *params = Parameters::instance(); unsigned long write_data[6]; unsigned long write_data[6]; write_data[0] = FRAMEPARS_GETFPGATIME; write_data[0] = FRAMEPARS_GETFPGATIME; write_data[1] = 0; write_data[1] = 0; Loading
src/audio.h +12 −9 Original line number Original line Diff line number Diff line /** /** * @file FILENAME * @file audio.h * @brief BRIEF DESCRIPTION * @brief Provides audio interface for streamer * @copyright Copyright (C) YEAR Elphel Inc. * @copyright Copyright (C) 2017 Elphel Inc. * @author AUTHOR <EMAIL> * @author AUTHOR <EMAIL> * * * @par License: * @par License: Loading @@ -23,10 +23,15 @@ #define _AUDIO__H_ #define _AUDIO__H_ #include <string> #include <string> #ifdef __cplusplus #undef __cplusplus #endif #define __cplusplus 1 #define __cplusplus 1 #include <alsa/asoundlib.h> #include <alsa/asoundlib.h> #include <pthread.h> #include <pthread.h> #include "rtp_stream.h" #include "rtp_stream.h" #include "parameters.h" using namespace std; using namespace std; Loading @@ -35,7 +40,7 @@ using namespace std; class Audio : public RTP_Stream { class Audio : public RTP_Stream { public: public: Audio(bool enable, int sample_rate = SAMPLE_RATE, int channels = SAMPLE_CHANNELS); Audio(bool enable, Parameters *pars, int sample_rate = SAMPLE_RATE, int channels = SAMPLE_CHANNELS); virtual ~Audio(void); virtual ~Audio(void); long sample_rate(void) { return _sample_rate; }; long sample_rate(void) { return _sample_rate; }; long channels(void) { return _channels; }; long channels(void) { return _channels; }; Loading Loading @@ -66,6 +71,4 @@ bool is_first; bool is_first2; bool is_first2; }; }; //extern Audio *audio; #endif // _AUDIO__H_ #endif // _AUDIO__H_