added some todos to readme.linux, added play file to mic in feature
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 19 Nov 2012 09:56:56 +0000 (09:56 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 19 Nov 2012 09:56:56 +0000 (09:56 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1030 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/README.linux
fdmdv2/src/dlg_audiooptions.cpp
fdmdv2/src/dlg_audiooptions.h
fdmdv2/src/fdmdv2_main.cpp
fdmdv2/src/fdmdv2_main.h
fdmdv2/src/topFrame.cpp
fdmdv2/src/topFrame.h
fdmdv2/tests/image/image.cpp

index b1a984e3d6c547995dbeeb19cc1a0e6203f28704..37b3e43d4cd3c78324606bc3264a8178d5c248a3 100644 (file)
@@ -113,6 +113,20 @@ TODO
     [ ] if you press start and headphones unplugged (ie one sound card missing), it
         shouldn't crash
     [ ] do we keep/put effort into getting working ./configure && Makefile?
+    [ ] debug printfs
+    [ ] about
+    [ ] src file credits
+    [ ] hook up squelch
+    [ ] test with simulated AWGN/burst error channels
+        + see if sync needs tuning to not fall over too quickly
+        + nasty noises
+    [ ] version number
+    [ ] buffer sizes, maybe make a config number
+    [ ] read comments and make sure still valid
+    [ ] rig control
+    [ ] click tune and split
+    [ ] tool tip help for audio config dialog
+    [ ] rm loopback buttons
 
 IDEAS
 =====
index 703e888af2aca5ae391c0b4ad70b39e93f647099..2701b8220002deddafdf6fc3b0b0bc7eeade9c85 100644 (file)
@@ -41,7 +41,7 @@ void AudioOptsDialog::Pa_Init(void)
 
 
 void AudioOptsDialog::buildTestControls(PlotScalar **plotScalar, wxButton **btnTest, 
-                                        wxPanel *parentPanel, wxBoxSizer *bSizer, char buttonLabel[])
+                                        wxPanel *parentPanel, wxBoxSizer *bSizer, wxString buttonLabel)
 {
     wxBoxSizer* bSizer1 = new wxBoxSizer(wxVERTICAL);
 
@@ -50,7 +50,7 @@ void AudioOptsDialog::buildTestControls(PlotScalar **plotScalar, wxButton **btnT
     (*plotScalar)->SetClientSize(wxSize(TEST_WAVEFORM_X,TEST_WAVEFORM_Y));
     bSizer1->Add(panel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 8);
 
-    *btnTest = new wxButton(parentPanel, wxID_ANY, wxString(buttonLabel), wxDefaultPosition, wxDefaultSize);
+    *btnTest = new wxButton(parentPanel, wxID_ANY, buttonLabel, wxDefaultPosition, wxDefaultSize);
     bSizer1->Add(*btnTest, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
 
     bSizer->Add(bSizer1, 0, wxALIGN_CENTER_HORIZONTAL |wxALIGN_CENTER_VERTICAL );
@@ -103,7 +103,7 @@ AudioOptsDialog::AudioOptsDialog(wxWindow* parent, wxWindowID id, const wxString
     bSizer811a->Add(bSizer811, 0, wxEXPAND, 5);
 
     sbSizer2->Add(bSizer811a, 1, wxEXPAND, 2);
-    buildTestControls(&m_plotScalarRxIn, &m_btnRxInTest, m_panelRx, sbSizer2, "Rec 2s");
+    buildTestControls(&m_plotScalarRxIn, &m_btnRxInTest, m_panelRx, sbSizer2, _("Rec 2s"));
 
     gSizer4->Add(sbSizer2, 1, wxEXPAND, 5);
 
@@ -133,7 +133,7 @@ AudioOptsDialog::AudioOptsDialog(wxWindow* parent, wxWindowID id, const wxString
     bSizer81a->Add(bSizer81, 0, wxEXPAND, 5);
 
     sbSizer3->Add(bSizer81a, 1, wxEXPAND, 2);
-    buildTestControls(&m_plotScalarRxOut, &m_btnRxOutTest, m_panelRx, sbSizer3, "Play 2s");
+    buildTestControls(&m_plotScalarRxOut, &m_btnRxOutTest, m_panelRx, sbSizer3, _("Play 2s"));
  
     gSizer4->Add(sbSizer3, 1, wxEXPAND, 2);
     bSizer20->Add(gSizer4, 1, wxEXPAND, 1);
@@ -175,7 +175,7 @@ AudioOptsDialog::AudioOptsDialog(wxWindow* parent, wxWindowID id, const wxString
     bSizer83a->Add(bSizer83, 0, wxEXPAND, 5);
 
     sbSizer22->Add(bSizer83a, 1, wxEXPAND, 2);
-    buildTestControls(&m_plotScalarTxIn, &m_btnTxInTest, m_panelTx, sbSizer22, "Rec 2s");
+    buildTestControls(&m_plotScalarTxIn, &m_btnTxInTest, m_panelTx, sbSizer22, _("Rec 2s"));
 
     gSizer2->Add(sbSizer22, 1, wxEXPAND, 5);
 
@@ -204,7 +204,7 @@ AudioOptsDialog::AudioOptsDialog(wxWindow* parent, wxWindowID id, const wxString
     bSizer82a->Add(bSizer82, 0, wxEXPAND, 5);
 
     sbSizer21->Add(bSizer82a, 1, wxEXPAND, 2);
-    buildTestControls(&m_plotScalarTxOut, &m_btnTxOutTest, m_panelTx, sbSizer21, "Play 2s");
+    buildTestControls(&m_plotScalarTxOut, &m_btnTxOutTest, m_panelTx, sbSizer21, _("Play 2s"));
 
     gSizer2->Add(sbSizer21, 1, wxEXPAND, 5);
     bSizer18->Add(gSizer2, 1, wxEXPAND, 1);
index e83f3a8e37b2e06f20a164d1fcfb9551cbc185a9..b770d7ec455e7fe152d3482d7c7415a60d255052 100644 (file)
@@ -56,7 +56,7 @@ class AudioOptsDialog : public wxDialog
         int             txOutAudioDeviceNum;
 
         void buildTestControls(PlotScalar **plotScalar, wxButton **btnTest, 
-                               wxPanel *parentPanel, wxBoxSizer *bSizer,char buttonLabel[]);
+                               wxPanel *parentPanel, wxBoxSizer *bSizer, wxString buttonLabel);
         void plotDeviceInputForAFewSecs(int devNum, PlotScalar *plotScalar);
         void plotDeviceOutputForAFewSecs(int devNum, PlotScalar *plotScalar);
 
index 090b17b0ae71c5c92099aeec9466626f148ae344..7487e1ef6088986c68c5f2c374b9e2eb56b0704e 100644 (file)
@@ -50,14 +50,12 @@ int   g_SquelchActive;
 float g_SquelchLevel;
 int   g_analog;
 
-// rx processing states
+// tx/rx processing states
 int                 g_nRxIn = FDMDV_NOM_SAMPLES_PER_FRAME;
 int                 g_CodecBits[2 * FDMDV_BITS_PER_FRAME];
 int                 g_State;
-
 paCallBackData     *g_rxUserdata;
 
-
 // FIFOs used for plotting waveforms
 struct FIFO        *g_plotDemodInFifo;
 struct FIFO        *g_plotSpeechOutFifo;
@@ -72,6 +70,11 @@ int                 g_soundCard2InDeviceNum;
 int                 g_soundCard2OutDeviceNum;
 int                 g_soundCard2SampleRate;
 
+// playing and recording from sound files
+SNDFILE            *g_sfFile;
+bool                g_playFileToMicIn;
+bool                g_loopPlayFileToMicIn;
+
 // Click to tune rx frequency offset states
 float               g_RxFreqOffsetHz;
 COMP                g_RxFreqOffsetPhaseRect;
@@ -80,8 +83,6 @@ COMP                g_RxFreqOffsetFreqRect;
 // DRs debug variables, will be cleaned up eventually
 int cb_cnt, cb1, cb2;
 int mute_mic = 0;
-int read_file = 0;
-FILE *g_file;
 int write_file = 0;
 FILE *g_write_file;
 int sc1, sc2;
@@ -125,9 +126,6 @@ public:
 //-------------------------------------------------------------------------
 bool MainApp::OnInit()
 {
-    g_file = fopen("../../codec2-dev/raw/hts1a.raw","rb");
-    if (g_file == NULL)
-        printf("reading hts1a disabled...\n");
 
     if(!wxApp::OnInit())
     {
@@ -170,7 +168,6 @@ int MainApp::OnExit()
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
 MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
 {
-    m_sfFile            = NULL;
     m_zoom              = 1.;
 
     tools->AppendSeparator();
@@ -288,6 +285,8 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     wxGetApp().m_strRigCtrlStopbits = pConfig->Read("/Rig/StopBits",            wxT("1"));
     wxGetApp().m_strRigCtrlParity   = pConfig->Read("/Rig/Parity",              wxT("n"));
 
+    wxGetApp().m_playFileToMicInPath = pConfig->Read("/File/playFileToMicInPath", wxT(""));
+
     pConfig->SetPath(wxT("/"));
 
 //    this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
@@ -330,6 +329,10 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
 #ifdef _USE_ONIDLE
     Connect(wxEVT_IDLE, wxIdleEventHandler(MainFrame::OnIdle), NULL, this);
 #endif //_USE_TIMER
+
+    g_sfFile = NULL;
+    g_playFileToMicIn = false;
+    g_loopPlayFileToMicIn = false;
 }
 
 //-------------------------------------------------------------------------
@@ -379,7 +382,10 @@ MainFrame::~MainFrame()
         pConfig->Write(wxT("/Rig/DataBits"),            wxGetApp().m_strRigCtrlDatabits);
         pConfig->Write(wxT("/Rig/StopBits"),            wxGetApp().m_strRigCtrlStopbits);
         pConfig->Write(wxT("/Rig/Parity"),              wxGetApp().m_strRigCtrlParity);
+
+        pConfig->Write(wxT("/File/playFileToMicInPath"), wxGetApp().m_playFileToMicInPath);
     }
+
     m_togRxID->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnRxIDUI), NULL, this);
     m_togTxID->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTxIDUI), NULL, this);
     m_togBtnOnOff->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnOnOffUI), NULL, this);
@@ -387,10 +393,14 @@ MainFrame::~MainFrame()
     m_togBtnAnalog->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnAnalogClickUI), NULL, this);
     //m_togBtnALC->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnALCClickUI), NULL, this);
     m_btnTogTX->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTXClickUI), NULL, this);
-    if(m_sfFile != NULL)
+
+    if (m_RxRunning)
+        stopRxStream();
+
+    if(g_sfFile != NULL)
     {
-        sf_close(m_sfFile);
-        m_sfFile = NULL;
+        sf_close(g_sfFile);
+        g_sfFile = NULL;
     }
 #ifdef _USE_TIMER
     if(m_plotTimer.IsRunning())
@@ -626,17 +636,6 @@ void MainFrame::OnTogBtnTxID(wxCommandEvent& event)
 }
 
 void MainFrame::OnTogBtnSplitClick(wxCommandEvent& event) {
-    if (write_file == 0) {
-    write_file = 1;
-    g_write_file = fopen("tmp.raw","wb");
-    assert(g_write_file != NULL);
-    printf("recording to tmp.raw ...\n");
-    }
-    else {
-    fclose(g_write_file);
-    printf("recording stopped.\n");
-    write_file = 0;
-    }
     event.Skip();
 }
 
@@ -665,69 +664,93 @@ void MainFrame::OnTogBtnALCClick(wxCommandEvent& event)
 }
 #endif
 
+MyExtraPlayFilePanel::MyExtraPlayFilePanel(wxWindow *parent): wxPanel(parent)
+{
+    m_cb = new wxCheckBox(this, -1, wxT("Loop"));
+    m_cb->SetToolTip(_("When checked file will repeat forever"));
+    m_cb->SetValue(g_loopPlayFileToMicIn);
+    wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
+    sizerTop->Add(m_cb, 11, wxALIGN_CENTER_HORIZONTAL);
+    SetSizerAndFit(sizerTop);
+    wxLogDebug("MyExtraPlayFilePanel");
+    this->SetSizer(sizerTop);
+
+}
+
+static wxWindow* createMyExtraPlayFilePanel(wxWindow *parent)
+{
+    return new MyExtraPlayFilePanel(parent);
+}
+
 //-------------------------------------------------------------------------
 // OnOpen()
 //-------------------------------------------------------------------------
-void MainFrame::OnOpen(wxCommandEvent& event)
+void MainFrame::OnPlayFileToMicIn(wxCommandEvent& event)
 {
-    wxUnusedVar(event);
-    wxFileDialog openFileDialog(
+    if (g_playFileToMicIn) {
+        g_mutexProtectingCallbackData.Lock();
+        g_playFileToMicIn = false;
+        sf_close(g_sfFile);
+        g_mutexProtectingCallbackData.Unlock();
+    }
+    else {
+
+        wxString    soundFile;
+        SF_INFO     sfInfo;
+
+        wxUnusedVar(event);
+        wxFileDialog openFileDialog(
                                     this,
-                                    wxT("Open Sound File"),
-                                    wxEmptyString,
+                                    wxT("Play File to Mic In"),
+                                    wxGetApp().m_playFileToMicInPath,
                                     wxEmptyString,
-//                                    (const wxChar *)NULL,
                                     wxT("RAW files (*.raw)|*.raw|")
                                     wxT("WAV files (*.wav)|*.wav|")
-                                    wxT("Octave 2.0 files (*.mat4)|*.mat4|")
-                                    wxT("Octave 2.1 files (*.mat5)|*.mat5|")
-                                    wxT("FLAC files (*.flc)|*.flc|")
                                     wxT("All files (*.*)|*.*"),
                                     wxFD_OPEN | wxFD_FILE_MUST_EXIST
-                                );
-    if(openFileDialog.ShowModal() == wxID_CANCEL)
-    {
-        return;     // the user changed their mind...
-    }
-    wxString extension;
-    m_soundFile = openFileDialog.GetPath();
-    wxFileName::SplitPath(m_soundFile, NULL, NULL, &extension);
-    //wxLogError("Cannot open file '%s'.", openFileDialog.GetPath());
-#ifdef _READ_WITH_SNDFILE
-    m_sfInfo.format = 0;
-    if(!extension.IsEmpty())
-    {
-        extension.LowerCase();
-        if(extension == wxT("raw"))
+                                    );
+
+        // add the loop check box
+        openFileDialog.SetExtraControlCreator(&createMyExtraPlayFilePanel);
+        if(openFileDialog.ShowModal() == wxID_CANCEL)
         {
-            m_sfInfo.format     = SF_FORMAT_RAW | SF_FORMAT_PCM_U8;
-            m_sfInfo.channels   = 2;
-            m_sfInfo.samplerate = 8000;
+            return;     // the user changed their mind...
         }
+
+        wxString fileName, extension;
+        soundFile = openFileDialog.GetPath();
+        wxFileName::SplitPath(soundFile, &wxGetApp().m_playFileToMicInPath, &fileName, &extension);
+        wxLogDebug("m_playFileToMicInPath: %s", wxGetApp().m_playFileToMicInPath);
+        sfInfo.format = 0;
+
+        if(!extension.IsEmpty())
+        {
+            extension.LowerCase();
+            if(extension == wxT("raw"))
+            {
+                sfInfo.format     = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
+                sfInfo.channels   = 1;
+                sfInfo.samplerate = FS;
+            }
+        }
+        g_sfFile = sf_open(soundFile, SFM_READ, &sfInfo);
+        if(g_sfFile == NULL)
+        {
+            wxString strErr = sf_strerror(NULL);
+            wxMessageBox(strErr, wxT("Couldn't open sound file"), wxOK);
+            return;
+        }
+        
+        wxWindow * const ctrl = openFileDialog.GetExtraControl();
+        // Huh?! I just copied wxWidgets-2.9.4/samples/dialogs ....
+        g_loopPlayFileToMicIn = static_cast<MyExtraPlayFilePanel*>(ctrl)->getLoopPlayFileToMicIn();
+        printf(" g_loopPlayFileToMicIn: %d\n", (int) g_loopPlayFileToMicIn);
+        SetStatusText(wxT("Playing File: ") + fileName + wxT(" to Mic Input") , 0);
+        g_playFileToMicIn = true;
     }
-    m_sfFile    = sf_open(m_soundFile, SFM_READ, &m_sfInfo);
-    if(m_sfFile == NULL)
-    {
-        wxString strErr = sf_strerror(NULL);
-        wxMessageBox(strErr, wxT("File Error"), wxOK);
-        return;
-    }
-#endif // _READ_WITH_SNDFILE
-    SetStatusText(wxT("File: ") + m_soundFile, 0);
-//    bool saved = false;
 }
 
-//-------------------------------------------------------------------------
-// OnPlayAudioFile()
-//-------------------------------------------------------------------------
-void MainFrame::OnPlayAudioFile(wxCommandEvent& event)
-{
-    wxUnusedVar(event);
-/*
-    // proceed loading the file chosen by the user;
-    m_sound->Play(openFileDialog.GetPath());
-*/
-}
 
 //-------------------------------------------------------------------------
 // OnSave()
@@ -771,13 +794,12 @@ void MainFrame::OnClose(wxCommandEvent& event)
     wxUnusedVar(event);
 
 #ifdef _USE_TIMER
-    //DMW Reenable for the nonce...
     m_plotTimer.Stop();
 #endif // _USE_TIMER
-    if(m_sfFile != NULL)
+    if(g_sfFile != NULL)
     {
-        sf_close(m_sfFile);
-        m_sfFile = NULL;
+        sf_close(g_sfFile);
+        g_sfFile = NULL;
     }
     if(m_RxRunning)
     {
@@ -1137,10 +1159,6 @@ void MainFrame::OnTogBtnLoopRx( wxCommandEvent& event )
 //----------------------------------------------------------
 void MainFrame::OnTogBtnLoopTx( wxCommandEvent& event )
 {
-    if (read_file == 0)
-        read_file = 1;
-    else
-        read_file = 0;
 }
 
 void MainFrame::destroy_fifos(void)
@@ -1562,7 +1580,7 @@ void txRxProcessing()
         per_frame_rx_processing(cbData->rxoutfifo, g_CodecBits, cbData->rxinfifo, &g_nRxIn, &g_State, g_pCodec2);
 
         // if demod out of sync or we are in analog mode just pass thru
-        // audio so we can hear SSB radio ouput as an aid to tuning
+        // audio so we can hear SSB radio output as an aid to tuning
 
         if ((g_State == 0) || g_analog)
             memcpy(out8k_short, in8k_short, sizeof(short)*n8k);
@@ -1621,12 +1639,19 @@ void txRxProcessing()
                 fwrite( in8k_short, sizeof(short), nout, g_write_file);
             }
 
-            if (read_file  && (g_file != NULL)) {
-                int n = fread( in8k_short , sizeof(short), 2*N8, g_file);
+            g_mutexProtectingCallbackData.Lock();
+            if (g_playFileToMicIn && (g_sfFile != NULL)) {
+                int n = sf_read_short(g_sfFile, in8k_short, 2*N8);
                 if (n != 2*N8) {
-                    rewind(g_file);
+                    if (g_loopPlayFileToMicIn)
+                        sf_seek(g_sfFile, 0, SEEK_SET);
+                    else {
+                        sf_close(g_sfFile); g_sfFile = NULL;
+                        g_playFileToMicIn = false;
+                    }
                 }
             }
+            g_mutexProtectingCallbackData.Unlock();
 
             resample_for_plot(g_plotSpeechInFifo, in8k_short, nout);
 
index 87a8c971c3ab571746ecf496fd3a620e572c8209..43bc2ec2260dc0f856c26524a650cc75803a6928 100644 (file)
@@ -53,7 +53,6 @@
 #define _DUMMY_DATA             1
 //#define _AUDIO_PASSTHROUGH    1
 #define _REFRESH_TIMER_PERIOD   (DT*1000)
-#define _READ_WITH_SNDFILE      1
 
 enum {
         ID_START = wxID_HIGHEST,
@@ -109,6 +108,8 @@ class MainApp : public wxApp
         wxString            m_strRigCtrlStopbits;
         wxString            m_strRigCtrlParity;
 
+        wxString            m_playFileToMicInPath;
+
         int                 m_show_wf;
         int                 m_show_spect;
         int                 m_show_scatter;
@@ -161,6 +162,17 @@ typedef struct
     int             inputChannels1, inputChannels2;
 } paCallBackData;
 
+// panel with custom control for play file dialog
+class MyExtraPlayFilePanel : public wxPanel
+{
+public:
+    MyExtraPlayFilePanel(wxWindow *parent);
+    void setLoopPlayFileToMicIn(bool checked) { m_cb->SetValue(checked); }
+    bool getLoopPlayFileToMicIn(void) { return m_cb->GetValue(); }
+private:
+    wxCheckBox *m_cb;
+};
+
 class txRxThread;
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
@@ -264,7 +276,7 @@ class MainFrame : public TopFrame
         void OnToolsOptionsUI( wxUpdateUIEvent& event );
         //void OnCaptureRxStream( wxCommandEvent& event );
        // void OnCaptureTxStream( wxCommandEvent& event );
-        void OnPlayAudioFile( wxCommandEvent& event );
+        void OnPlayFileToMicIn( wxCommandEvent& event );
         void OnHelpCheckUpdates( wxCommandEvent& event );
         void OnHelpCheckUpdatesUI( wxUpdateUIEvent& event );
         void OnHelpAbout( wxCommandEvent& event );
@@ -307,10 +319,6 @@ class MainFrame : public TopFrame
 #endif
 //        wxString LoadUserImage(wxImage& image);
     private:
-        bool CreateSound(wxSound& snd) const;
-        wxString    m_soundFile;
-        SF_INFO     m_sfInfo;
-        SNDFILE     *m_sfFile;
 #ifdef __WXMSW__
 //        wxString    m_soundRes;
 #endif // __WXMSW__
index 74f18bae4375c50ec5ead4306fdba969ed8b35a2..739e8d014eba202ec79b079e0417eb3f1c324024 100644 (file)
@@ -22,6 +22,8 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     // Menubar Setup
     m_menubarMain = new wxMenuBar(wxMB_DOCKABLE);
     file = new wxMenu();
+
+#ifdef UNIMPLEMENTED
     wxMenuItem* m_menuItemOpen;
     m_menuItemOpen = new wxMenuItem(file, ID_OPEN, wxString(_("&Open")) , _("Open File"), wxITEM_NORMAL);
     file->Append(m_menuItemOpen);
@@ -35,6 +37,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     file->Append(m_menuItemClose);
 
     file->AppendSeparator();
+#endif
 
     wxMenuItem* m_menuItemExit;
     m_menuItemExit = new wxMenuItem(file, ID_EXIT, wxString(_("E&xit")) , _("Exit Program"), wxITEM_NORMAL);
@@ -42,6 +45,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
 
     m_menubarMain->Append(file, _("&File"));
 
+#ifdef UNIMPLEMENTED
     edit = new wxMenu();
     wxMenuItem* m_menuItemCopy;
     m_menuItemCopy = new wxMenuItem(edit, ID_COPY, wxString(_("&Copy")) , _("Copy selection"), wxITEM_NORMAL);
@@ -59,6 +63,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     m_menuItemPaste->Enable(false);
 
     m_menubarMain->Append(edit, _("&Edit"));
+#endif
 
     tools = new wxMenu();
     wxMenuItem* m_menuItemAudio;
@@ -75,6 +80,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
 
     tools->AppendSeparator();
 
+#ifdef UNIMPLEMENTED
     wxMenuItem* m_menuItemCaptRxInStream;
     m_menuItemCaptRxInStream = new wxMenuItem(tools, wxID_ANY, wxString(_("Capture Rx Input Stream")), wxEmptyString, wxITEM_NORMAL);
 #ifdef __WXMSW__
@@ -112,10 +118,11 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     tools->Append(m_menuItemCaptTxOutStream);
 
     tools->AppendSeparator();
+#endif
 
-    wxMenuItem* m_menuItemPlayAudioFile;
-    m_menuItemPlayAudioFile = new wxMenuItem(tools, wxID_ANY, wxString(_("Play File")) , wxEmptyString, wxITEM_NORMAL);
-    tools->Append(m_menuItemPlayAudioFile);
+    wxMenuItem* m_menuItemPlayFileToMicIn;
+    m_menuItemPlayFileToMicIn = new wxMenuItem(tools, wxID_ANY, wxString(_("Start/Stop Play File to Mic In")) , wxEmptyString, wxITEM_NORMAL);
+    tools->Append(m_menuItemPlayFileToMicIn);
 
     m_menubarMain->Append(tools, _("&Tools"));
 
@@ -383,28 +390,36 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     this->Connect(wxEVT_PAINT, wxPaintEventHandler(TopFrame::topFrame_OnPaint));
     this->Connect(wxEVT_SIZE, wxSizeEventHandler(TopFrame::topFrame_OnSize));
     this->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::topFrame_OnUpdateUI));
+#ifdef UNIMPLEMENTED
     this->Connect(m_menuItemOpen->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnOpen));
     this->Connect(m_menuItemOpen->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnOpenUpdateUI));
     this->Connect(m_menuItemSave->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnSave));
     this->Connect(m_menuItemSave->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnSaveUpdateUI));
     this->Connect(m_menuItemClose->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnClose));
     this->Connect(m_menuItemClose->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnCloseUpdateUI));
+#endif
     this->Connect(m_menuItemExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnExit));
+#ifdef UNIMPLEMENTED
     this->Connect(m_menuItemCopy->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCopy));
     this->Connect(m_menuItemCopy->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnCopyUpdateUI));
     this->Connect(m_menuItemCut->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCut));
     this->Connect(m_menuItemCut->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnCutUpdateUI));
     this->Connect(m_menuItemPaste->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPaste));
     this->Connect(m_menuItemPaste->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnPasteUpdateUI));
+#endif
     this->Connect(m_menuItemAudio->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsAudio));
     this->Connect(m_menuItemAudio->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsAudioUI));
     this->Connect(m_menuItemRigCtrlCfg->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsComCfg));
     this->Connect(m_menuItemRigCtrlCfg->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsComCfgUI));
     this->Connect(m_menuItemOptions->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsOptions));
     this->Connect(m_menuItemOptions->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsOptionsUI));
+#ifdef UNIMPLEMENTED
 //    this->Connect(m_menuItemCaptRxStream->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCaptureRxStream));
 //    this->Connect(m_menuItemCaptTxStream->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCaptureTxStream));
-    this->Connect(m_menuItemPlayAudioFile->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayAudioFile));
+#endif
+
+    this->Connect(m_menuItemPlayFileToMicIn->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileToMicIn));
+
     this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpCheckUpdates));
     this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
     this->Connect(m_menuItemAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpAbout));
@@ -444,28 +459,36 @@ TopFrame::~TopFrame()
     this->Disconnect(wxEVT_PAINT, wxPaintEventHandler(TopFrame::topFrame_OnPaint));
     this->Disconnect(wxEVT_SIZE, wxSizeEventHandler(TopFrame::topFrame_OnSize));
     this->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::topFrame_OnUpdateUI));
+#ifdef UNIMPLEMENTED
     this->Disconnect(ID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnOpen));
     this->Disconnect(ID_OPEN, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnOpenUpdateUI));
     this->Disconnect(ID_SAVE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnSave));
     this->Disconnect(ID_SAVE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnSaveUpdateUI));
     this->Disconnect(ID_CLOSE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnClose));
     this->Disconnect(ID_CLOSE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnCloseUpdateUI));
+#endif
     this->Disconnect(ID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnExit));
+#ifdef UNIMPLEMENTED
     this->Disconnect(ID_COPY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCopy));
     this->Disconnect(ID_COPY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnCopyUpdateUI));
     this->Disconnect(ID_CUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCut));
     this->Disconnect(ID_CUT, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnCutUpdateUI));
     this->Disconnect(ID_PASTE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPaste));
     this->Disconnect(ID_PASTE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnPasteUpdateUI));
+#endif
     this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsAudio));
     this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsAudioUI));
     this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsComCfg));
     this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsComCfgUI));
     this->Disconnect(ID_OPTIONS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnToolsOptions));
     this->Disconnect(ID_OPTIONS, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnToolsOptionsUI));
+#ifdef UNIMPLEMENTED
 //    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCaptureRxStream));
 //    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnCaptureTxStream));
-    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayAudioFile));
+#endif
+
+    this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnPlayFileToMicIn));
+
     this->Disconnect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpCheckUpdates));
     this->Disconnect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
     this->Disconnect(ID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnHelpAbout));
index 16aca4e32d6d1b300772a24a4f1f12c505d2b793..e261e5db378034914710d0f7df42b188265bdfcd 100644 (file)
@@ -82,28 +82,35 @@ class TopFrame : public wxFrame
         virtual void topFrame_OnPaint( wxPaintEvent& event ) { event.Skip(); }
         virtual void topFrame_OnSize( wxSizeEvent& event ) { event.Skip(); }
         virtual void topFrame_OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
+
+#ifdef UNIMPLEMENTED
         virtual void OnOpen( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnOpenUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
         virtual void OnSave( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnSaveUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
         virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnCloseUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
+#endif
         virtual void OnExit( wxCommandEvent& event ) { event.Skip(); }
+#ifdef UNIMPLEMENTED
         virtual void OnCopy( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnCopyUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
         virtual void OnCut( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnCutUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
         virtual void OnPaste( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnPasteUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
+#endif
         virtual void OnToolsAudio( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnToolsAudioUI( wxUpdateUIEvent& event ) { event.Skip(); }
         virtual void OnToolsComCfg( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnToolsComCfgUI( wxUpdateUIEvent& event ) { event.Skip(); }
         virtual void OnToolsOptions( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnToolsOptionsUI( wxUpdateUIEvent& event ) { event.Skip(); }
+#ifdef UNIMPLEMENTED
         //virtual void OnCaptureRxStream( wxCommandEvent& event ) { event.Skip(); }
         //virtual void OnCaptureTxStream( wxCommandEvent& event ) { event.Skip(); }
-        virtual void OnPlayAudioFile( wxCommandEvent& event ) { event.Skip(); }
+#endif
+        virtual void OnPlayFileToMicIn( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnHelpCheckUpdates( wxCommandEvent& event ) { event.Skip(); }
         virtual void OnHelpCheckUpdatesUI( wxUpdateUIEvent& event ) { event.Skip(); }
         virtual void OnHelpAbout( wxCommandEvent& event ) { event.Skip(); }
index 7903e759e210556913d6df024b8b9653325a869e..6015272a96decb3e58b4d5fb24626e72238c2b5f 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 #include "wx/wx.h"
 #include "wx/image.h"
-#include "wx/file.h"
-#include "wx/filename.h"
 #include "wx/graphics.h"
-#include "wx/mstream.h"
-#include "wx/wfstream.h"
-#include "wx/quantize.h"
-#include "wx/scopedptr.h"
-#include "wx/stopwatch.h"
 #include "wx/versioninfo.h"
 #include "wx/rawbmp.h"
 
@@ -48,16 +41,22 @@ public:
         m_alphaBitmap(SIZE, SIZE, 32)
     */
 
-    MyRawBitmapFrame(): wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxImage sample"), wxPoint(20, 20), wxSize(950, 700)), m_bitmap(SIZE, SIZE, 24)
+    MyRawBitmapFrame(): wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxImage sample"),
+                               wxPoint(20, 20), wxSize(950, 700) )
     {
-        SetClientSize(SIZE, SIZE * 2 + 25);
+       m_pBitmap = new wxBitmap(SIZE, SIZE, 24);
         InitBitmap();
+        SetClientSize(SIZE, SIZE*2+25);
+
+    }
+    ~MyRawBitmapFrame() {
+       delete m_pBitmap;
     }
 
     void InitBitmap()
     {
         // draw some colourful stripes without alpha
-        wxNativePixelData data(m_bitmap);
+        wxNativePixelData data(*m_pBitmap);
         if ( !data )
         {
             wxLogError(wxT("Failed to gain raw access to bitmap data"));
@@ -88,15 +87,13 @@ public:
     {
         wxPaintDC dc( this );
         dc.DrawText(wxT("This is alpha and raw bitmap test"), 0, BORDER);
-        dc.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE/2 - BORDER);
-        dc.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE - 2*BORDER);
 
         dc.DrawText(wxT("Raw bitmap access without alpha"), 0, SIZE+5);
-        dc.DrawBitmap( m_bitmap, 0, SIZE+5+dc.GetCharHeight());
+        dc.DrawBitmap( *m_pBitmap, 0, SIZE+5+dc.GetCharHeight());
     }
 
 private:
-    wxBitmap m_bitmap;
+    wxBitmap *m_pBitmap;
 
     DECLARE_EVENT_TABLE()
 };