| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2006 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE AutomaticGainControl. |
|---|
| 6 | |
|---|
| 7 | OSSIE AutomaticGainControl is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE AutomaticGainControl is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE AutomaticGainControl; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | #ifndef AUTOMATICGAINCONTROL_IMPL_H |
|---|
| 25 | #define AUTOMATICGAINCONTROL_IMPL_H |
|---|
| 26 | |
|---|
| 27 | #include <stdlib.h> |
|---|
| 28 | #include "ossie/cf.h" |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | #include "ossie/PortTypes.h" |
|---|
| 32 | #include "standardinterfaces/complexShort.h" |
|---|
| 33 | #include "standardinterfaces/complexShort_u.h" |
|---|
| 34 | #include "standardinterfaces/complexShort_p.h" |
|---|
| 35 | |
|---|
| 36 | #include "ossie/Resource_impl.h" |
|---|
| 37 | #include "sigproc/SigProc.h" |
|---|
| 38 | |
|---|
| 39 | class AutomaticGainControl_i; |
|---|
| 40 | |
|---|
| 41 | void process_data(void *data); |
|---|
| 42 | |
|---|
| 43 | class AutomaticGainControl_i : public virtual Resource_impl |
|---|
| 44 | { |
|---|
| 45 | |
|---|
| 46 | //friend void process_data(void *data); |
|---|
| 47 | |
|---|
| 48 | public: |
|---|
| 49 | AutomaticGainControl_i(const char *uuid, omni_condition *sem); |
|---|
| 50 | ~AutomaticGainControl_i(void); |
|---|
| 51 | |
|---|
| 52 | void start() throw (CF::Resource::StartError, CORBA::SystemException); |
|---|
| 53 | void stop() throw (CF::Resource::StopError, CORBA::SystemException); |
|---|
| 54 | static void run(void *data); |
|---|
| 55 | |
|---|
| 56 | CORBA::Object_ptr getPort( const char* portName ) throw (CF::PortSupplier::UnknownPort, CORBA::SystemException); |
|---|
| 57 | |
|---|
| 58 | void releaseObject() throw (CF::LifeCycle::ReleaseError, CORBA::SystemException); |
|---|
| 59 | |
|---|
| 60 | void initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException); |
|---|
| 61 | void configure(const CF::Properties&) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration); |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | private: |
|---|
| 65 | AutomaticGainControl_i(); |
|---|
| 66 | AutomaticGainControl_i(AutomaticGainControl_i&); |
|---|
| 67 | |
|---|
| 68 | void run_loop(); |
|---|
| 69 | |
|---|
| 70 | omni_condition *component_running; // for component shutdown |
|---|
| 71 | omni_thread *processing_thread; // for component writer function |
|---|
| 72 | omni_mutex accessPrivateData; // for asynchronous configure() invocation |
|---|
| 73 | |
|---|
| 74 | //list components provides and uses ports |
|---|
| 75 | standardInterfaces_i::complexShort_u *dataOut_0; |
|---|
| 76 | standardInterfaces_i::complexShort_p *dataIn_0; |
|---|
| 77 | |
|---|
| 78 | // algorithm variables |
|---|
| 79 | float energy_lo; // low energy threshold |
|---|
| 80 | float energy_hi; // high energy threshold |
|---|
| 81 | float k_attack; // attack time constant |
|---|
| 82 | float k_release; // release time constant |
|---|
| 83 | float g_max; // maximum gain |
|---|
| 84 | float g_min; // minimum gain |
|---|
| 85 | |
|---|
| 86 | }; |
|---|
| 87 | #endif |
|---|