[ ] 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
=====
void AudioOptsDialog::buildTestControls(PlotScalar **plotScalar, wxButton **btnTest,
- wxPanel *parentPanel, wxBoxSizer *bSizer, char buttonLabel[])
+ wxPanel *parentPanel, wxBoxSizer *bSizer, wxString buttonLabel)
{
wxBoxSizer* bSizer1 = new wxBoxSizer(wxVERTICAL);
(*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 );
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);
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);
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);
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);
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);
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;
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;
// 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;
//-------------------------------------------------------------------------
bool MainApp::OnInit()
{
- g_file = fopen("../../codec2-dev/raw/hts1a.raw","rb");
- if (g_file == NULL)
- printf("reading hts1a disabled...\n");
if(!wxApp::OnInit())
{
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
{
- m_sfFile = NULL;
m_zoom = 1.;
tools->AppendSeparator();
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));
#ifdef _USE_ONIDLE
Connect(wxEVT_IDLE, wxIdleEventHandler(MainFrame::OnIdle), NULL, this);
#endif //_USE_TIMER
+
+ g_sfFile = NULL;
+ g_playFileToMicIn = false;
+ g_loopPlayFileToMicIn = false;
}
//-------------------------------------------------------------------------
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);
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())
}
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();
}
}
#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()
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)
{
//----------------------------------------------------------
void MainFrame::OnTogBtnLoopTx( wxCommandEvent& event )
{
- if (read_file == 0)
- read_file = 1;
- else
- read_file = 0;
}
void MainFrame::destroy_fifos(void)
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);
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);
#define _DUMMY_DATA 1
//#define _AUDIO_PASSTHROUGH 1
#define _REFRESH_TIMER_PERIOD (DT*1000)
-#define _READ_WITH_SNDFILE 1
enum {
ID_START = wxID_HIGHEST,
wxString m_strRigCtrlStopbits;
wxString m_strRigCtrlParity;
+ wxString m_playFileToMicInPath;
+
int m_show_wf;
int m_show_spect;
int m_show_scatter;
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;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
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 );
#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__
// 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);
file->Append(m_menuItemClose);
file->AppendSeparator();
+#endif
wxMenuItem* m_menuItemExit;
m_menuItemExit = new wxMenuItem(file, ID_EXIT, wxString(_("E&xit")) , _("Exit Program"), wxITEM_NORMAL);
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);
m_menuItemPaste->Enable(false);
m_menubarMain->Append(edit, _("&Edit"));
+#endif
tools = new wxMenu();
wxMenuItem* m_menuItemAudio;
tools->AppendSeparator();
+#ifdef UNIMPLEMENTED
wxMenuItem* m_menuItemCaptRxInStream;
m_menuItemCaptRxInStream = new wxMenuItem(tools, wxID_ANY, wxString(_("Capture Rx Input Stream")), wxEmptyString, wxITEM_NORMAL);
#ifdef __WXMSW__
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"));
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));
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));
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(); }
///////////////////////////////////////////////////////////////////////////////
#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"
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"));
{
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()
};