void DeviceFrame::OnDeviceOpenSound(wxCommandEvent &) { wxString filename(GetSoundFile()); if (filename.empty()) { return; } audiere::SampleSourcePtr source = audiere::OpenSampleSource(wxString2CStr(filename)); if (!source) { wxMessageBox( wxT("Could not open source: ") + filename, wxT("Open Sound"), wxOK | wxCENTRE, this); return; } audiere::OutputStreamPtr stream = audiere::OpenSound(m_device, source); if (!stream) { wxMessageBox( wxT("Could not open sound: ") + filename, wxT("Open Sound"), wxOK | wxCENTRE, this); return; } // get the basename of the path for the window title wxString basename = wxFileNameFromPath(filename); new StreamFrame(this, wxT("Sound: ") + basename, stream.get(), source.get()); }
void MIDIDeviceDialog::OnButton(wxCommandEvent& event) { if (event.GetEventObject() == m_ok) { m_name_str = wxString2CStr(m_name->GetValue()); EndModal(wxID_OK); } else if (event.GetEventObject() == m_cancel) { EndModal(wxID_CANCEL); } }
void NewDeviceDialog::OnButton(wxCommandEvent& event) { if (event.GetEventObject() == m_ok) { int value = m_device->GetSelection(); if (value == 0) { m_device_str = "autodetect"; } else { m_device_str = m_devices[value - 1].name; } m_parameters_str = wxString2CStr(m_parameters->GetValue()); EndModal(wxID_OK); } else if (event.GetEventObject() == m_cancel) { EndModal(wxID_CANCEL); } }
void DeviceFrame::DoOpenEffect(audiere::SoundEffectType type, wxString typestring) { wxString filename(GetSoundFile()); if (filename.empty()) { return; } audiere::SoundEffectPtr effect = audiere::OpenSoundEffect(m_device, wxString2CStr(filename), type); if (effect) { wxString basename = wxFileNameFromPath(filename); wxString title; title.sprintf(wxT("Sound Effect (%s): %s"), typestring.c_str(), basename.c_str()); new SoundEffectFrame(this, title, effect); } else { wxMessageBox( wxT("Could not open sound effect: ") + filename, wxT("Open Sound Effect"), wxOK | wxCENTRE, this); } }