Ejemplo n.º 1
0
DeviceFrame::DeviceFrame(audiere::AudioDevicePtr device)
: wxMDIParentFrame(0, -1, wxT("Audio Device - " + CStr2wxString( device->getName() )),
                   wxDefaultPosition, wxSize(400, 500))
{
  m_device = device;

  wxMenu* deviceMenu = new wxMenu();
  deviceMenu->Append(DEVICE_NEW_DEVICE,           wxT("&New Device..."));
  deviceMenu->Append(DEVICE_NEW_CDDEVICE,         wxT("New C&D Device..."));
  deviceMenu->Append(DEVICE_NEW_MIDIDEVICE,       wxT("New &MIDI Device..."));
  deviceMenu->AppendSeparator();
  deviceMenu->Append(DEVICE_OPEN_STREAM,          wxT("&Open Stream..."));
  deviceMenu->Append(DEVICE_OPEN_SOUND,           wxT("Open &Sound..."));
  deviceMenu->AppendSeparator();
  deviceMenu->Append(DEVICE_CREATE_TONE,          wxT("Create &Tone..."));
  deviceMenu->Append(DEVICE_CREATE_SQUARE_WAVE,   wxT("Create S&quare Wave..."));
  deviceMenu->Append(DEVICE_CREATE_WHITE_NOISE,   wxT("Create &White Noise"));
  deviceMenu->Append(DEVICE_CREATE_PINK_NOISE,    wxT("Create &Pink Noise"));
  deviceMenu->AppendSeparator();
  deviceMenu->Append(DEVICE_OPEN_SINGLE_EFFECT,   wxT("Open &Effect (Single)..."));
  deviceMenu->Append(DEVICE_OPEN_MULTIPLE_EFFECT, wxT("Open Effect (&Multiple)..."));
  deviceMenu->AppendSeparator();
  deviceMenu->Append(DEVICE_CLOSE_WINDOW,         wxT("Close C&urrent Window"));
  deviceMenu->Append(DEVICE_CLOSE,                wxT("&Close Device"));

  wxMenu* helpMenu = new wxMenu();
  helpMenu->Append(HELP_ABOUT, wxT("&About..."));

  wxMenuBar* menuBar = new wxMenuBar();
  menuBar->Append(deviceMenu, wxT("&Device"));
  menuBar->Append(helpMenu,   wxT("&Help"));
  SetMenuBar(menuBar);

  SetFocus();
}
Ejemplo n.º 2
0
wxString DeviceFrame::GetSoundFile() {
  std::vector<audiere::FileFormatDesc> formats;
  audiere::GetSupportedFileFormats(formats);

  // combine all of the supported extensions into one collection
  std::set<std::string> all_extensions;
  {
    for (unsigned i = 0; i < formats.size(); ++i) {
      for (unsigned j = 0; j < formats[i].extensions.size(); ++j) {
        all_extensions.insert("*." + formats[i].extensions[j]);
      }
    }
  }

  // build a string of wildcards for wxWindows
  std::string wildcards;
  wildcards = "Sound Files (" + Join(all_extensions, ",") + ")|";
  wildcards += Join(all_extensions, ";") + "|";

  {
    for (unsigned i = 0; i < formats.size(); ++i) {
      audiere::FileFormatDesc& ffd = formats[i];
      wildcards += ffd.description + " ";
      wildcards += "(" + Join(ffd.extensions, ",", "*.") + ")|";
      wildcards += Join(ffd.extensions, ";", "*.") + "|";
    }
  }

  wildcards += "All Files (*.*)|*.*";

  return wxFileSelector(
    wxT("Select a sound file"), wxT(""), wxT(""), wxT(""),
    CStr2wxString(wildcards.c_str()), wxOPEN, this);
}
Ejemplo n.º 3
0
void wxPlayer::ShowAboutDialog(wxWindow* parent) {
  wxString message =
    wxT("wxPlayer\n")
    wxT("Copyright (c) Chad Austin 2002-2004\n\n")
    wxT("Audiere Version: ");
  message += CStr2wxString(audiere::GetVersion());
  wxMessageBox(message, wxT("About wxPlayer"), wxOK | wxCENTRE, parent);
}
Ejemplo n.º 4
0
NewDeviceDialog::NewDeviceDialog(wxWindow* parent)
  : wxDialog(parent, -1, wxString(wxT("New Device")))
{
  // size of text controls
  static const wxSize size(300, 22);

  audiere::GetSupportedAudioDevices(m_devices);
  // create vertical sizer
  wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);

  m_device = new wxChoice(this, -1, wxDefaultPosition, size);
  m_device->Append(wxT("autodetect: Choose default device"));
  for (unsigned i = 0; i < m_devices.size(); ++i) {
    m_device->Append((CStr2wxString(m_devices[i].name.c_str()) + wxT(": ") + CStr2wxString(m_devices[i].description.c_str())));
  }
  m_device->SetSelection(0);
  sizer->Add(m_device,     0, wxALIGN_CENTER | wxALL, 5);

  // create parameters box
  m_parameters = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, size);
  sizer->Add(m_parameters, 0, wxALIGN_CENTER | wxALL, 5);

  // button bar
  wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
  m_ok     = new wxButton(this, wxID_OK, wxT("OK"));
  buttonSizer->Add(m_ok,     0, wxALIGN_CENTER | wxALL, 5);
  m_cancel = new wxButton(this, wxID_CANCEL, wxT("Cancel"));
  buttonSizer->Add(m_cancel, 0, wxALIGN_CENTER | wxALL, 5);
  sizer->Add(buttonSizer, 0, wxALIGN_CENTER | wxALL, 4);

  SetAutoLayout(true);
  SetSizer(sizer);

  m_device->SetFocus();
  m_ok->SetDefault();

  sizer->Fit(this);
  sizer->SetSizeHints(this);
}
Ejemplo n.º 5
0
void StreamFrame::OnViewInfo(wxCommandEvent&) {
  int channel_count, sample_rate;
  audiere::SampleFormat format;
  m_source->getFormat(channel_count, sample_rate, format);

  const char* format_name;
  if (format == audiere::SF_U8) {
    format_name = "SF_U8";
  } else if (format == audiere::SF_S16) {
    format_name = "SF_S16";
  } else {
    format_name = "Unknown";
  }

  std::stringstream ss;
  ss << "Channel Count: " << channel_count << std::endl;
  ss << "Sample Rate: " << sample_rate << std::endl;
  ss << "Format: " << format_name << std::endl;
  wxMessageBox(CStr2wxString(ss.str().c_str()), wxT("Stream Info"), wxOK, this);
}