kopia lustrzana https://github.com/jamescoxon/dl-fldigi
PA debug
rodzic
838e11237e
commit
0caa5ea1e1
|
@ -48,7 +48,9 @@ void sound_close(void);
|
|||
void sound_update(unsigned idx);
|
||||
|
||||
#include <string>
|
||||
|
||||
class Fl_Choice;
|
||||
int pa_set_dev(Fl_Choice *choice, std::string dev_name, int dev_index);
|
||||
extern std::string str_pa_devices;
|
||||
|
||||
#endif // SOUNDCONF_H
|
||||
|
|
|
@ -351,6 +351,9 @@ void delayed_startup(void *)
|
|||
if (progdefaults.check_for_updates)
|
||||
cb_mnuCheckUpdate((Fl_Widget *)0, NULL);
|
||||
|
||||
#if USE_PORTAUDIO
|
||||
LOG_INFO("%s", str_pa_devices.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
|
|
|
@ -135,7 +135,7 @@ void debug::start(const char* filename)
|
|||
rotate_log(filename);
|
||||
inst = new debug(filename);
|
||||
|
||||
window = new Fl_Double_Window(600, 200, _("Event log"));
|
||||
window = new Fl_Double_Window(800, 400, _("Event log"));
|
||||
window->xclass(PACKAGE_TARNAME);
|
||||
|
||||
int pad = 2;
|
||||
|
@ -266,6 +266,7 @@ void debug::elog(const char* func, const char* srcf, int line, const char* text)
|
|||
|
||||
void debug::show(void)
|
||||
{
|
||||
btext->bottomline(btext->size());
|
||||
window->show();
|
||||
}
|
||||
|
||||
|
@ -290,8 +291,9 @@ void debug::sync_text(void* arg)
|
|||
linebuf += '\n';
|
||||
size_t p1 = 0, p2 = linebuf.find("\n");
|
||||
while( p2 != string::npos) {
|
||||
btext->insert(1, linebuf.substr(p1, p2 - p1).c_str());
|
||||
dbg_buffer.append(linebuf.substr(p1, p2 - p1)).append("\n");
|
||||
btext->add(linebuf.substr(p1, p2 - p1).c_str());
|
||||
btext->redraw();
|
||||
dbg_buffer.append(linebuf.substr(p1, p2 - p1 + 1));//.append("\n");
|
||||
p1 = p2 + 1;
|
||||
p2 = linebuf.find("\n", p1);
|
||||
}
|
||||
|
|
|
@ -118,15 +118,18 @@ ret_def:
|
|||
|
||||
#include <cerrno>
|
||||
|
||||
std::string str_pa_devices;
|
||||
|
||||
static void init_portaudio(void)
|
||||
{
|
||||
try {
|
||||
SoundPort::initialize();
|
||||
}
|
||||
catch (const SndException& e) {
|
||||
if (e.error() == ENODEV) // don't complain if there are no devices
|
||||
return;
|
||||
LOG_ERROR("%s", e.what());
|
||||
// if (e.error() == ENODEV) // don't complain if there are no devices
|
||||
// return;
|
||||
str_pa_devices.assign("\nPortaudio devices init failure:");
|
||||
str_pa_devices.assign(e.what());
|
||||
AudioPort->deactivate();
|
||||
btnAudioIO[SND_IDX_PORT]->deactivate();
|
||||
if (progdefaults.btnAudioIOis == SND_IDX_PORT)
|
||||
|
@ -150,12 +153,16 @@ static void init_portaudio(void)
|
|||
#endif
|
||||
|
||||
list<padev> devlist;
|
||||
int devnbr = 0;
|
||||
for (SoundPort::device_iterator idev = SoundPort::devices().begin();
|
||||
idev != SoundPort::devices().end(); ++idev)
|
||||
idev != SoundPort::devices().end(); ++idev) {
|
||||
devlist.push_back( padev(*idev, idev - SoundPort::devices().begin(),
|
||||
Pa_GetHostApiInfo((*idev)->hostApi)->type) );
|
||||
devnbr++;
|
||||
}
|
||||
devlist.sort();
|
||||
|
||||
str_pa_devices.assign("\nPortaudio devices:\n");
|
||||
PaHostApiTypeId first_api = devlist.begin()->api;
|
||||
for (list<padev>::const_iterator ilist = devlist.begin();
|
||||
ilist != devlist.end(); ilist++) {
|
||||
|
@ -166,22 +173,24 @@ static void init_portaudio(void)
|
|||
i = menu_item.length();
|
||||
}
|
||||
menu_item.append(ilist->dev->name);
|
||||
|
||||
str_pa_devices.append(menu_item).append("\n");
|
||||
|
||||
// backslash-escape any slashes in the device name
|
||||
while ((i = menu_item.find('/', i)) != string::npos) {
|
||||
menu_item.insert(i, 1, '\\');
|
||||
i += 2;
|
||||
}
|
||||
|
||||
// add to menu
|
||||
if (ilist->dev->maxInputChannels > 0) {
|
||||
if (ilist->dev->maxInputChannels > 0)
|
||||
menuPortInDev->add(menu_item.c_str(), 0, NULL,
|
||||
reinterpret_cast<void *>(ilist->idx), 0);
|
||||
}
|
||||
|
||||
if (ilist->dev->maxOutputChannels > 0) {
|
||||
if (ilist->dev->maxOutputChannels > 0)
|
||||
menuPortOutDev->add(menu_item.c_str(), 0, NULL,
|
||||
reinterpret_cast<void *>(ilist->idx), 0);
|
||||
LOG_INFO("%s", menu_item.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (progdefaults.PortInDevice.length() == 0) {
|
||||
|
|
Ładowanie…
Reference in New Issue