File: dlg_audiooptions.h

package info (click to toggle)
freedv 1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,440 kB
  • sloc: cpp: 8,723; ansic: 3,564; python: 42; makefile: 10; sh: 7
file content (176 lines) | stat: -rw-r--r-- 6,491 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//=========================================================================
// Name:          AudioInfoDisplay.h
// Purpose:       Declares simple wxWidgets application with GUI
//                created using wxFormBuilder.
// Authors:         David Rowe, David Witten
// 
// License:
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License version 2.1,
//  as published by the Free Software Foundation.  This program is
//  distributed in the hope that it will be useful, but WITHOUT ANY
//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
//  License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, see <http://www.gnu.org/licenses/>.
//
//=========================================================================
#ifndef __AudioOptsDialog__
#define __AudioOptsDialog__

#include "fdmdv2_main.h"

#define ID_AUDIO_OPTIONS    1000
#define AUDIO_IN            0
#define AUDIO_OUT           1

#include "portaudio.h"
#ifdef WIN32
#if PA_USE_ASIO
#include "pa_asio.h"
#endif
#endif
#include "codec2_fifo.h"

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
// AudioInfoDisplay
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
class AudioInfoDisplay
{
    public:
        wxListCtrl*     m_listDevices;
        int             direction;
        wxTextCtrl*     m_textDevice;
        wxComboBox*     m_cbSampleRate;
};

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
// class AudioOptsDialog
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
class AudioOptsDialog : public wxDialog
{
    private:

    protected:
        PaError         pa_err;
        bool            m_isPaInitialized;

        int             rxInAudioDeviceNum;
        int             rxOutAudioDeviceNum;
        int             txInAudioDeviceNum;
        int             txOutAudioDeviceNum;

        void buildTestControls(PlotScalar **plotScalar, wxButton **btnTest, 
                               wxPanel *parentPanel, wxBoxSizer *bSizer, wxString buttonLabel);
        void plotDeviceInputForAFewSecs(int devNum, PlotScalar *plotScalar);
        void plotDeviceOutputForAFewSecs(int devNum, PlotScalar *plotScalar);

        int buildListOfSupportedSampleRates(wxComboBox *cbSampleRate, int devNum, int in_out);
        void populateParams(AudioInfoDisplay);
        void showAPIInfo();
        int setTextCtrlIfDevNumValid(wxTextCtrl *textCtrl, wxListCtrl *listCtrl, int devNum);
        void Pa_Init(void);
        void OnDeviceSelect(wxComboBox *cbSampleRate, 
                            wxTextCtrl *textCtrl, 
                            int        *devNum, 
                            wxListCtrl *listCtrlDevices, 
                            int         index,
                            int         in_out);

        AudioInfoDisplay m_RxInDevices;
        AudioInfoDisplay m_RxOutDevices;
        AudioInfoDisplay m_TxInDevices;
        AudioInfoDisplay m_TxOutDevices;
        wxPanel* m_panel1;
        wxNotebook* m_notebook1;

        wxPanel* m_panelRx;

        wxListCtrl* m_listCtrlRxInDevices;
        wxStaticText* m_staticText51;
        wxTextCtrl* m_textCtrlRxIn;
        wxStaticText* m_staticText6;
        wxComboBox* m_cbSampleRateRxIn;

        wxButton* m_btnRxInTest;
        PlotScalar* m_plotScalarRxIn;

        wxListCtrl* m_listCtrlRxOutDevices;
        wxStaticText* m_staticText9;
        wxTextCtrl* m_textCtrlRxOut;
        wxStaticText* m_staticText10;
        wxComboBox* m_cbSampleRateRxOut;

        wxButton* m_btnRxOutTest;
        PlotScalar* m_plotScalarRxOut;

        wxPanel* m_panelTx;

        wxListCtrl* m_listCtrlTxInDevices;
        wxStaticText* m_staticText12;
        wxTextCtrl* m_textCtrlTxIn;
        wxStaticText* m_staticText11;
        wxComboBox* m_cbSampleRateTxIn;

        wxButton* m_btnTxInTest;
        PlotScalar* m_plotScalarTxIn;

        wxListCtrl* m_listCtrlTxOutDevices;
        wxStaticText* m_staticText81;
        wxTextCtrl* m_textCtrlTxOut;
        wxStaticText* m_staticText71;
        wxComboBox* m_cbSampleRateTxOut;

        wxButton* m_btnTxOutTest;
        PlotScalar* m_plotScalarTxOut;

        wxPanel* m_panelAPI;

        wxStaticText* m_staticText7;
        wxStaticText* m_textStringVer;
        wxStaticText* m_staticText8;
        wxStaticText* m_textIntVer;
        wxStaticText* m_staticText5;
        wxStaticText* m_textCDevCount;
        wxStaticText* m_staticText4;
        wxStaticText* m_textAPICount;
        wxButton* m_btnRefresh;
        wxStdDialogButtonSizer* m_sdbSizer1;
        wxButton* m_sdbSizer1OK;
        wxButton* m_sdbSizer1Apply;
        wxButton* m_sdbSizer1Cancel;

        // Virtual event handlers, overide them in your derived class
        //virtual void OnActivateApp( wxActivateEvent& event ) { event.Skip(); }
//        virtual void OnCloseFrame( wxCloseEvent& event ) { event.Skip(); }

        void OnRxInDeviceSelect( wxListEvent& event );

        void OnRxInTest( wxCommandEvent& event );
        void OnRxOutTest( wxCommandEvent& event );
        void OnTxInTest( wxCommandEvent& event );
        void OnTxOutTest( wxCommandEvent& event );

        void OnRxOutDeviceSelect( wxListEvent& event );
        void OnTxInDeviceSelect( wxListEvent& event );
        void OnTxOutDeviceSelect( wxListEvent& event );
        void OnRefreshClick( wxCommandEvent& event );
        void OnApplyAudioParameters( wxCommandEvent& event );
        void OnCancelAudioParameters( wxCommandEvent& event );
        void OnOkAudioParameters( wxCommandEvent& event );
        // Virtual event handlers, overide them in your derived class
        void OnClose( wxCloseEvent& event ) { event.Skip(); }
        void OnHibernate( wxActivateEvent& event ) { event.Skip(); }
        void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
        void OnInitDialog( wxInitDialogEvent& event );

    public:

        AudioOptsDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Audio Config"), const wxPoint& pos = wxPoint(1,1), const wxSize& size = wxSize( 800, 650 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
        ~AudioOptsDialog();
        int ExchangeData(int inout);
};
#endif //__AudioOptsDialog__