mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-11-18 07:00:03 -05:00
Added hdspconf utility by Thomas Charbonnel (requiring FLTK)
This commit is contained in:
parent
1febedba63
commit
dceea38da2
38 changed files with 7092 additions and 0 deletions
46
hdspconf/src/HC_AboutText.cxx
Normal file
46
hdspconf/src/HC_AboutText.cxx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_AboutText.h"
|
||||
|
||||
HC_AboutText::HC_AboutText(int x, int y, int w, int h):Fl_Widget(x, y, w, h, "About Text")
|
||||
{
|
||||
text = "HDSPConf (C) 2003 Thomas Charbonnel <thomas@@undata.org>\n\n"
|
||||
"This Program is free software; you can redistribute it and/or modify\n"
|
||||
"it under the terms of the GNU General Public License as published by\n"
|
||||
"the Free Software Foundation; either version 2 of the License, or\n"
|
||||
"(at your option) any later version.\n\n"
|
||||
"This program is distributed in the hope that it will be useful,\n"
|
||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
|
||||
"See the GNU General Public License for more details.\n\n"
|
||||
"You should have received a copy of the GNU General Public License\n"
|
||||
"along with this program; if not, write to the Free Software\n"
|
||||
"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n";
|
||||
}
|
||||
|
||||
void HC_AboutText::draw()
|
||||
{
|
||||
fl_color(FL_BLACK);
|
||||
fl_font(FL_HELVETICA, 10);
|
||||
fl_draw(text, x(), y(), w(), h(), FL_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
39
hdspconf/src/HC_AboutText.h
Normal file
39
hdspconf/src/HC_AboutText.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_ABOUTTEXT_H
|
||||
#define HC_ABOUTTEXT_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
|
||||
class HC_AboutText:public Fl_Widget
|
||||
{
|
||||
public:
|
||||
HC_AboutText(int x, int y, int w, int h);
|
||||
void draw();
|
||||
private:
|
||||
char *text;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
88
hdspconf/src/HC_AutoSyncRef.cxx
Normal file
88
hdspconf/src/HC_AutoSyncRef.cxx
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_AutoSyncRef.h"
|
||||
|
||||
extern char *freqs[7];
|
||||
extern char *ref[6];
|
||||
|
||||
HC_AutoSyncRef::HC_AutoSyncRef(int x, int y, int w, int h):Fl_Widget(x, y, w, h, "AutoSync Ref.")
|
||||
{
|
||||
external_freq = 2;
|
||||
external_ref = 3;
|
||||
draw_box = Fl::get_boxtype(FL_ENGRAVED_FRAME);
|
||||
label("AutoSync Ref.");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
void HC_AutoSyncRef::draw()
|
||||
{
|
||||
fl_color(FL_BACKGROUND_COLOR);
|
||||
fl_rectf(x(), y(), w(), h());
|
||||
draw_box(x(), y(), w(), h(), FL_WHITE);
|
||||
fl_color(FL_BLACK);
|
||||
fl_font(FL_HELVETICA, 10);
|
||||
fl_draw("Input", x()+4, y(), w()/2, h()/2, FL_ALIGN_LEFT);
|
||||
fl_draw(ref[external_ref], x()+w()/2-4, y(), w()/2, h()/2, FL_ALIGN_CENTER);
|
||||
fl_draw("Freq.", x()+4, y()+h()/2, w()/2, h()/2, FL_ALIGN_LEFT);
|
||||
fl_draw(freqs[external_freq], x()+w()/2-4, y()+h()/2, w()/2, h()/2, FL_ALIGN_CENTER);
|
||||
}
|
||||
|
||||
void HC_AutoSyncRef::setFreq(int f)
|
||||
{
|
||||
int freq;
|
||||
switch (f) {
|
||||
case 32000:
|
||||
freq = 0;
|
||||
break;
|
||||
case 44100:
|
||||
freq = 1;
|
||||
break;
|
||||
case 48000:
|
||||
freq = 2;
|
||||
break;
|
||||
case 64000:
|
||||
freq = 3;
|
||||
break;
|
||||
case 88200:
|
||||
freq = 4;
|
||||
break;
|
||||
case 96000:
|
||||
freq = 5;
|
||||
break;
|
||||
default:
|
||||
freq = 6;
|
||||
}
|
||||
if (freq != external_freq) {
|
||||
external_freq = freq;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void HC_AutoSyncRef::setRef(unsigned char r)
|
||||
{
|
||||
if (r == external_ref) return;
|
||||
if (r > 6) external_ref = 6;
|
||||
else external_ref = r;
|
||||
redraw();
|
||||
}
|
||||
|
||||
45
hdspconf/src/HC_AutoSyncRef.h
Normal file
45
hdspconf/src/HC_AutoSyncRef.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_AUTOSYNCREF_H
|
||||
#define HC_AUTOSYNCREF_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_AutoSyncRef:public Fl_Widget
|
||||
{
|
||||
public:
|
||||
HC_AutoSyncRef(int x, int y, int w, int h);
|
||||
void draw();
|
||||
int external_freq, external_ref;
|
||||
void setFreq(int f);
|
||||
void setRef(unsigned char r);
|
||||
private:
|
||||
Fl_Box_Draw_F *draw_box;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
46
hdspconf/src/HC_CardPane.cxx
Normal file
46
hdspconf/src/HC_CardPane.cxx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
HC_CardPane::HC_CardPane(int alsa_idx, int idx, int t):Fl_Group(PANE_X, PANE_Y, PANE_W, PANE_H)
|
||||
{
|
||||
alsa_index = alsa_idx;
|
||||
index = idx;
|
||||
type = t;
|
||||
snprintf(name, 7, "Card %d", index+1);
|
||||
label(name);
|
||||
labelsize(10);
|
||||
|
||||
sync_ref = new HC_PrefSyncRef(x()+6, y()+20, 112, 120);
|
||||
sync_check = new HC_SyncCheck(x()+6, y()+156, 112, 100);
|
||||
|
||||
spdif_in = new HC_SpdifIn(x()+124, y()+20, 112, 60);
|
||||
spdif_out = new HC_SpdifOut(x()+124, y()+96, 112, 80);
|
||||
spdif_freq = new HC_SpdifFreq(x()+124, y()+192, 112, 20);
|
||||
|
||||
clock_source = new HC_ClockSource(x()+242, y()+20, 112, 140);
|
||||
autosync_ref = new HC_AutoSyncRef(x()+242, y()+176, 112, 40);
|
||||
system_clock = new HC_SystemClock(x()+242, y()+232, 112, 40);
|
||||
|
||||
end();
|
||||
}
|
||||
|
||||
66
hdspconf/src/HC_CardPane.h
Normal file
66
hdspconf/src/HC_CardPane.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_CardPane_H
|
||||
#define HC_CardPane_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include "HC_SyncCheck.h"
|
||||
#include "HC_SpdifFreq.h"
|
||||
#include "HC_AutoSyncRef.h"
|
||||
#include "HC_SystemClock.h"
|
||||
#include "HC_ClockSource.h"
|
||||
#include "HC_SpdifIn.h"
|
||||
#include "HC_SpdifOut.h"
|
||||
#include "HC_PrefSyncRef.h"
|
||||
#include "defines.h"
|
||||
|
||||
class HC_SyncCheck;
|
||||
class HC_SpdifFreq;
|
||||
class HC_AutoSyncRef;
|
||||
class HC_SystemClock;
|
||||
class HC_ClockSource;
|
||||
class HC_SpdifIn;
|
||||
class HC_SpdifOut;
|
||||
class HC_PrefSyncRef;
|
||||
|
||||
class HC_CardPane:public Fl_Group
|
||||
{
|
||||
public:
|
||||
HC_CardPane(int alsa_idx, int idx, int t);
|
||||
HC_SyncCheck *sync_check;
|
||||
HC_SpdifFreq *spdif_freq;
|
||||
HC_AutoSyncRef *autosync_ref;
|
||||
HC_SystemClock *system_clock;
|
||||
HC_ClockSource *clock_source;
|
||||
HC_SpdifIn *spdif_in;
|
||||
HC_SpdifOut *spdif_out;
|
||||
HC_PrefSyncRef *sync_ref;
|
||||
int index;
|
||||
int alsa_index;
|
||||
int type;
|
||||
private:
|
||||
char name[7];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
119
hdspconf/src/HC_ClockSource.cxx
Normal file
119
hdspconf/src/HC_ClockSource.cxx
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_ClockSource.h"
|
||||
|
||||
extern char *freqs[7];
|
||||
|
||||
void clock_source_cb(Fl_Widget *w, void *arg)
|
||||
{
|
||||
int src, err;
|
||||
char card_name[6];
|
||||
snd_ctl_elem_value_t *ctl;
|
||||
snd_ctl_elem_id_t *id;
|
||||
snd_ctl_t *handle;
|
||||
HC_ClockSource *cs = (HC_ClockSource *)arg;
|
||||
HC_CardPane *pane = (HC_CardPane *)(cs->parent());
|
||||
Fl_Round_Button *source = (Fl_Round_Button *)w;
|
||||
if (source == cs->autosync) {
|
||||
src = 0;
|
||||
} else if (source == cs->khz32) {
|
||||
src = 1;
|
||||
} else if (source == cs->khz44_1) {
|
||||
src = 2;
|
||||
} else if (source == cs->khz48) {
|
||||
src = 3;
|
||||
} else if (source == cs->khz64) {
|
||||
src = 4;
|
||||
} else if (source == cs->khz88_2) {
|
||||
src = 5;
|
||||
} else if (source == cs->khz96) {
|
||||
src = 6;
|
||||
}
|
||||
snprintf(card_name, 6, "hw:%i", pane->alsa_index);
|
||||
snd_ctl_elem_value_alloca(&ctl);
|
||||
snd_ctl_elem_id_alloca(&id);
|
||||
snd_ctl_elem_id_set_name(id, "Sample Clock Source");
|
||||
snd_ctl_elem_id_set_numid(id, 0);
|
||||
snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_PCM);
|
||||
snd_ctl_elem_id_set_device(id, 0);
|
||||
snd_ctl_elem_id_set_subdevice(id, 0);
|
||||
snd_ctl_elem_id_set_index(id, 0);
|
||||
snd_ctl_elem_value_set_id(ctl, id);
|
||||
snd_ctl_elem_value_set_enumerated(ctl, 0, src);
|
||||
if ((err = snd_ctl_open(&handle, card_name, SND_CTL_NONBLOCK)) < 0) {
|
||||
fprintf(stderr, "Error opening ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
if ((err = snd_ctl_elem_write(handle, ctl)) < 0) {
|
||||
fprintf(stderr, "Error accessing ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
snd_ctl_close(handle);
|
||||
}
|
||||
|
||||
HC_ClockSource::HC_ClockSource(int x, int y, int w, int h):Fl_Group(x, y, w, h, "Sample Clock Source")
|
||||
{
|
||||
int i = 0;
|
||||
int v_step = (int)(h/7.0f);
|
||||
box(FL_ENGRAVED_FRAME);
|
||||
label("Sample Clock Source");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
autosync = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "AutoSync");
|
||||
autosync->callback(clock_source_cb, (void *)this);
|
||||
khz32 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, freqs[0]);
|
||||
khz32->callback(clock_source_cb, (void *)this);
|
||||
khz44_1 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, freqs[1]);
|
||||
khz44_1->callback(clock_source_cb, (void *)this);
|
||||
khz48 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, freqs[2]);
|
||||
khz48->callback(clock_source_cb, (void *)this);
|
||||
khz64 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, freqs[3]);
|
||||
khz64->callback(clock_source_cb, (void *)this);
|
||||
khz88_2 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, freqs[4]);
|
||||
khz88_2->callback(clock_source_cb, (void *)this);
|
||||
khz96 = new Fl_Round_Button(x+15, y+v_step*i, w-30, v_step, freqs[5]);
|
||||
khz96->callback(clock_source_cb, (void *)this);
|
||||
autosync->labelsize(10);
|
||||
autosync->type(FL_RADIO_BUTTON);
|
||||
khz32->labelsize(10);
|
||||
khz32->type(FL_RADIO_BUTTON);
|
||||
khz44_1->labelsize(10);
|
||||
khz44_1->type(FL_RADIO_BUTTON);
|
||||
khz48->labelsize(10);
|
||||
khz48->type(FL_RADIO_BUTTON);
|
||||
khz64->labelsize(10);
|
||||
khz64->type(FL_RADIO_BUTTON);
|
||||
khz88_2->labelsize(10);
|
||||
khz88_2->type(FL_RADIO_BUTTON);
|
||||
khz96->labelsize(10);
|
||||
khz96->type(FL_RADIO_BUTTON);
|
||||
end();
|
||||
}
|
||||
|
||||
void HC_ClockSource::setSource(unsigned char s)
|
||||
{
|
||||
if (s < children()) {
|
||||
if (((Fl_Round_Button *)child(s))->value() != 1)
|
||||
((Fl_Round_Button *)child(s))->setonly();
|
||||
}
|
||||
}
|
||||
|
||||
48
hdspconf/src/HC_ClockSource.h
Normal file
48
hdspconf/src/HC_ClockSource.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_CLOCKSOURCE_H
|
||||
#define HC_CLOCKSOURCE_H
|
||||
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Round_Button.H>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_ClockSource:public Fl_Group
|
||||
{
|
||||
public:
|
||||
HC_ClockSource(int x, int y, int w, int h);
|
||||
int source;
|
||||
Fl_Round_Button *autosync;
|
||||
Fl_Round_Button *khz32;
|
||||
Fl_Round_Button *khz44_1;
|
||||
Fl_Round_Button *khz48;
|
||||
Fl_Round_Button *khz64;
|
||||
Fl_Round_Button *khz88_2;
|
||||
Fl_Round_Button *khz96;
|
||||
void setSource(unsigned char s);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
120
hdspconf/src/HC_PrefSyncRef.cxx
Normal file
120
hdspconf/src/HC_PrefSyncRef.cxx
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_PrefSyncRef.h"
|
||||
|
||||
void pref_sync_ref_cb(Fl_Widget *w, void *arg)
|
||||
{
|
||||
int ref, err;
|
||||
char card_name[6];
|
||||
snd_ctl_elem_value_t *ctl;
|
||||
snd_ctl_elem_id_t *id;
|
||||
snd_ctl_t *handle;
|
||||
HC_PrefSyncRef *psr = (HC_PrefSyncRef *)arg;
|
||||
HC_CardPane *pane = (HC_CardPane *)(psr->parent());
|
||||
Fl_Round_Button *source = (Fl_Round_Button *)w;
|
||||
if (source == psr->word_clock) {
|
||||
ref = 0;
|
||||
} else if (source == psr->adat_sync) {
|
||||
ref = 1;
|
||||
} else if (source == psr->spdif) {
|
||||
ref = 2;
|
||||
} else if (source == psr->adat1) {
|
||||
ref = 3;
|
||||
} else if (source == psr->adat2) {
|
||||
ref = 4;
|
||||
} else if (source == psr->adat3) {
|
||||
ref = 5;
|
||||
}
|
||||
snprintf(card_name, 6, "hw:%i", pane->alsa_index);
|
||||
snd_ctl_elem_value_alloca(&ctl);
|
||||
snd_ctl_elem_id_alloca(&id);
|
||||
snd_ctl_elem_id_set_name(id, "Preferred Sync Reference");
|
||||
snd_ctl_elem_id_set_numid(id, 0);
|
||||
snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_HWDEP);
|
||||
snd_ctl_elem_id_set_device(id, 0);
|
||||
snd_ctl_elem_id_set_subdevice(id, 0);
|
||||
snd_ctl_elem_id_set_index(id, 0);
|
||||
snd_ctl_elem_value_set_id(ctl, id);
|
||||
snd_ctl_elem_value_set_enumerated(ctl, 0, ref);
|
||||
if ((err = snd_ctl_open(&handle, card_name, SND_CTL_NONBLOCK)) < 0) {
|
||||
fprintf(stderr, "Error opening ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
if ((err = snd_ctl_elem_write(handle, ctl)) < 0) {
|
||||
fprintf(stderr, "Error accessing ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
snd_ctl_close(handle);
|
||||
}
|
||||
|
||||
|
||||
HC_PrefSyncRef::HC_PrefSyncRef(int x, int y, int w, int h):Fl_Group(x, y, w, h, "Pref. Sync Ref")
|
||||
{
|
||||
int i = 0;
|
||||
int v_step;
|
||||
if (((HC_CardPane *)parent())->type == MULTIFACE) {
|
||||
v_step = (int)(h/4.0f);
|
||||
} else {
|
||||
v_step = (int)(h/6.0f);
|
||||
}
|
||||
source = 0;
|
||||
box(FL_ENGRAVED_FRAME);;
|
||||
label("Pref. Sync Ref");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
word_clock = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "Word Clock");
|
||||
word_clock->callback(pref_sync_ref_cb, (void *)this);
|
||||
adat_sync = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "ADAT Sync");
|
||||
adat_sync->callback(pref_sync_ref_cb, (void *)this);
|
||||
spdif = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "SPDIF In");
|
||||
spdif->callback(pref_sync_ref_cb, (void *)this);
|
||||
adat1 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "ADAT1 In");
|
||||
adat1->callback(pref_sync_ref_cb, (void *)this);
|
||||
if (((HC_CardPane *)parent())->type != MULTIFACE) {
|
||||
adat2 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "ADAT2 In");
|
||||
adat2->labelsize(10);
|
||||
adat2->type(FL_RADIO_BUTTON);
|
||||
adat2->callback(pref_sync_ref_cb, (void *)this);
|
||||
adat3 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "ADAT3 In");
|
||||
adat3->labelsize(10);
|
||||
adat3->type(FL_RADIO_BUTTON);
|
||||
adat3->callback(pref_sync_ref_cb, (void *)this);
|
||||
}
|
||||
adat1->labelsize(10);
|
||||
adat1->type(FL_RADIO_BUTTON);
|
||||
spdif->labelsize(10);
|
||||
spdif->type(FL_RADIO_BUTTON);
|
||||
word_clock->labelsize(10);
|
||||
word_clock->type(FL_RADIO_BUTTON);
|
||||
adat_sync->labelsize(10);
|
||||
adat_sync->type(FL_RADIO_BUTTON);
|
||||
end();
|
||||
}
|
||||
|
||||
void HC_PrefSyncRef::setRef(int r)
|
||||
{
|
||||
if (r >= 0 && r < children()) {
|
||||
if (((Fl_Round_Button *)child(r))->value() != 1)
|
||||
((Fl_Round_Button *)child(r))->setonly();
|
||||
}
|
||||
}
|
||||
|
||||
47
hdspconf/src/HC_PrefSyncRef.h
Normal file
47
hdspconf/src/HC_PrefSyncRef.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_PREFSYNCREF_H
|
||||
#define HC_PREFSYNCREF_H
|
||||
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Round_Button.H>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_PrefSyncRef:public Fl_Group
|
||||
{
|
||||
public:
|
||||
HC_PrefSyncRef(int x, int y, int w, int h);
|
||||
int source;
|
||||
Fl_Round_Button *adat1;
|
||||
Fl_Round_Button *adat2;
|
||||
Fl_Round_Button *adat3;
|
||||
Fl_Round_Button *spdif;
|
||||
Fl_Round_Button *word_clock;
|
||||
Fl_Round_Button *adat_sync;
|
||||
void setRef(int r);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
74
hdspconf/src/HC_SpdifFreq.cxx
Normal file
74
hdspconf/src/HC_SpdifFreq.cxx
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_SpdifFreq.h"
|
||||
|
||||
extern char *freqs[7];
|
||||
|
||||
HC_SpdifFreq::HC_SpdifFreq(int x, int y, int w, int h):Fl_Widget(x, y, w, h, "SPDIF Freq.")
|
||||
{
|
||||
spdif_freq = 0;
|
||||
draw_box = Fl::get_boxtype(FL_ENGRAVED_FRAME);
|
||||
label("SPDIF Freq.");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
void HC_SpdifFreq::draw()
|
||||
{
|
||||
fl_color(FL_BACKGROUND_COLOR);
|
||||
fl_rectf(x(), y(), w(), h());
|
||||
draw_box(x(), y(), w(), h(), FL_WHITE);
|
||||
fl_color(FL_BLACK);
|
||||
fl_font(FL_HELVETICA, 10);
|
||||
fl_draw(freqs[spdif_freq], x(), y(), w(), h(), FL_ALIGN_CENTER);
|
||||
}
|
||||
|
||||
void HC_SpdifFreq::setFreq(int f)
|
||||
{
|
||||
int freq;
|
||||
switch (f) {
|
||||
case 32000:
|
||||
freq = 0;
|
||||
break;
|
||||
case 44100:
|
||||
freq = 1;
|
||||
break;
|
||||
case 48000:
|
||||
freq = 2;
|
||||
break;
|
||||
case 64000:
|
||||
freq = 3;
|
||||
break;
|
||||
case 88200:
|
||||
freq = 4;
|
||||
break;
|
||||
case 96000:
|
||||
freq = 5;
|
||||
break;
|
||||
default:
|
||||
freq = 6;
|
||||
}
|
||||
if (freq != spdif_freq) {
|
||||
spdif_freq = freq;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
44
hdspconf/src/HC_SpdifFreq.h
Normal file
44
hdspconf/src/HC_SpdifFreq.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_SPDIFFREQ_H
|
||||
#define HC_SPDIFFREQ_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_SpdifFreq:public Fl_Widget
|
||||
{
|
||||
public:
|
||||
HC_SpdifFreq(int x, int y, int w, int h);
|
||||
void draw();
|
||||
int spdif_freq;
|
||||
void setFreq(int f);
|
||||
private:
|
||||
Fl_Box_Draw_F *draw_box;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
94
hdspconf/src/HC_SpdifIn.cxx
Normal file
94
hdspconf/src/HC_SpdifIn.cxx
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_SpdifIn.h"
|
||||
|
||||
void spdif_in_cb(Fl_Widget *w, void *arg)
|
||||
{
|
||||
int in, err;
|
||||
char card_name[6];
|
||||
snd_ctl_elem_value_t *ctl;
|
||||
snd_ctl_elem_id_t *id;
|
||||
snd_ctl_t *handle;
|
||||
Fl_Round_Button *source = (Fl_Round_Button *)w;
|
||||
HC_SpdifIn *si = (HC_SpdifIn *)arg;
|
||||
HC_CardPane *pane = (HC_CardPane *)si->parent();
|
||||
if (source == si->adat1) {
|
||||
in = 0;
|
||||
} else if (source == si->coaxial) {
|
||||
in = 1;
|
||||
} else if (source == si->internal) {
|
||||
in = 2;
|
||||
}
|
||||
snprintf(card_name, 6, "hw:%i", pane->alsa_index);
|
||||
snd_ctl_elem_value_alloca(&ctl);
|
||||
snd_ctl_elem_id_alloca(&id);
|
||||
snd_ctl_elem_id_set_name(id, "IEC958 Input Connector");
|
||||
snd_ctl_elem_id_set_numid(id, 0);
|
||||
snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_PCM);
|
||||
snd_ctl_elem_id_set_device(id, 0);
|
||||
snd_ctl_elem_id_set_subdevice(id, 0);
|
||||
snd_ctl_elem_id_set_index(id, 0);
|
||||
snd_ctl_elem_value_set_id(ctl, id);
|
||||
snd_ctl_elem_value_set_enumerated(ctl, 0, in);
|
||||
if ((err = snd_ctl_open(&handle, card_name, SND_CTL_NONBLOCK)) < 0) {
|
||||
fprintf(stderr, "Error opening ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
if ((err = snd_ctl_elem_write(handle, ctl)) < 0) {
|
||||
fprintf(stderr, "Error accessing ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
snd_ctl_close(handle);
|
||||
}
|
||||
|
||||
HC_SpdifIn::HC_SpdifIn(int x, int y, int w, int h):Fl_Group(x, y, w, h, "SPDIF In")
|
||||
{
|
||||
int i = 0;
|
||||
int v_step = (int)(h/3.0f);
|
||||
source = 0;
|
||||
box(FL_ENGRAVED_FRAME);;
|
||||
label("SPDIF In");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
adat1 = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "ADAT1");
|
||||
coaxial = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "Coaxial");
|
||||
internal = new Fl_Round_Button(x+15, y+v_step*i++, w-30, v_step, "Internal");
|
||||
adat1->labelsize(10);
|
||||
adat1->type(FL_RADIO_BUTTON);
|
||||
adat1->callback(spdif_in_cb, (void *)this);
|
||||
coaxial->labelsize(10);
|
||||
coaxial->type(FL_RADIO_BUTTON);
|
||||
coaxial->callback(spdif_in_cb, (void *)this);
|
||||
internal->labelsize(10);
|
||||
internal->type(FL_RADIO_BUTTON);
|
||||
internal->callback(spdif_in_cb, (void *)this);
|
||||
end();
|
||||
}
|
||||
|
||||
void HC_SpdifIn::setInput(unsigned char i)
|
||||
{
|
||||
if (i < children()) {
|
||||
if (((Fl_Round_Button *)child(i))->value() != 1)
|
||||
((Fl_Round_Button *)child(i))->setonly();
|
||||
}
|
||||
}
|
||||
|
||||
44
hdspconf/src/HC_SpdifIn.h
Normal file
44
hdspconf/src/HC_SpdifIn.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_SPDIFIN_H
|
||||
#define HC_SPDIFIN_H
|
||||
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Round_Button.H>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_SpdifIn:public Fl_Group
|
||||
{
|
||||
public:
|
||||
HC_SpdifIn(int x, int y, int w, int h);
|
||||
int source;
|
||||
Fl_Round_Button *adat1;
|
||||
Fl_Round_Button *coaxial;
|
||||
Fl_Round_Button *internal;
|
||||
void setInput(unsigned char i);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
140
hdspconf/src/HC_SpdifOut.cxx
Normal file
140
hdspconf/src/HC_SpdifOut.cxx
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_SpdifOut.h"
|
||||
|
||||
static void setSpdifBit(char *ctl_name, int val, int card_index)
|
||||
{
|
||||
int err;
|
||||
char card_name[6];
|
||||
snd_ctl_elem_value_t *ctl;
|
||||
snd_ctl_elem_id_t *id;
|
||||
snd_ctl_t *handle;
|
||||
snprintf(card_name, 6, "hw:%i", card_index);
|
||||
snd_ctl_elem_value_alloca(&ctl);
|
||||
snd_ctl_elem_id_alloca(&id);
|
||||
snd_ctl_elem_id_set_name(id, ctl_name);
|
||||
snd_ctl_elem_id_set_numid(id, 0);
|
||||
snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_HWDEP);
|
||||
snd_ctl_elem_id_set_device(id, 0);
|
||||
snd_ctl_elem_id_set_subdevice(id, 0);
|
||||
snd_ctl_elem_id_set_index(id, 0);
|
||||
snd_ctl_elem_value_set_id(ctl, id);
|
||||
snd_ctl_elem_value_set_integer(ctl, 0, val);
|
||||
if ((err = snd_ctl_open(&handle, card_name, SND_CTL_NONBLOCK)) < 0) {
|
||||
fprintf(stderr, "Error opening ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
if ((err = snd_ctl_elem_write(handle, ctl)) < 0) {
|
||||
fprintf(stderr, "Error accessing ctl interface on card %s\n", card_name);
|
||||
return;
|
||||
}
|
||||
snd_ctl_close(handle);
|
||||
}
|
||||
|
||||
void spdif_on_adat_cb(Fl_Widget *w, void *arg)
|
||||
{
|
||||
setSpdifBit("IEC958 Output also on ADAT1", ((Fl_Check_Button *)w)->value(), ((HC_CardPane *)arg)->alsa_index);
|
||||
}
|
||||
|
||||
void spdif_professional_cb(Fl_Widget *w, void *arg)
|
||||
{
|
||||
setSpdifBit("IEC958 Professional Bit", ((Fl_Check_Button *)w)->value(), ((HC_CardPane *)arg)->alsa_index);
|
||||
}
|
||||
|
||||
void spdif_emphasis_cb(Fl_Widget *w, void *arg)
|
||||
{
|
||||
setSpdifBit("IEC958 Emphasis Bit", ((Fl_Check_Button *)w)->value(), ((HC_CardPane *)arg)->alsa_index);
|
||||
}
|
||||
|
||||
void spdif_nonaudio_cb(Fl_Widget *w, void *arg)
|
||||
{
|
||||
setSpdifBit("IEC958 Non-audio Bit", ((Fl_Check_Button *)w)->value(), ((HC_CardPane *)arg)->alsa_index);
|
||||
}
|
||||
|
||||
HC_SpdifOut::HC_SpdifOut(int x, int y, int w, int h):Fl_Group(x, y, w, h, "SPDIF Out")
|
||||
{
|
||||
int i = 0;
|
||||
lock = 0;
|
||||
int v_step = (int)(h/4.0f);
|
||||
box(FL_ENGRAVED_FRAME);
|
||||
label("SPDIF Out");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
adat1 = new Fl_Check_Button(x+15, y+v_step*i++, w-30, v_step, "ADAT1");
|
||||
professional = new Fl_Check_Button(x+15, y+v_step*i++, w-30, v_step, "Professional");
|
||||
emphasis = new Fl_Check_Button(x+15, y+v_step*i++, w-30, v_step, "Emphasis");
|
||||
non_audio = new Fl_Check_Button(x+15, y+v_step*i++, w-30, v_step, "Non-Audio");
|
||||
adat1->labelsize(10);
|
||||
adat1->callback(spdif_on_adat_cb, (void *)parent());
|
||||
professional->labelsize(10);
|
||||
professional->callback(spdif_professional_cb, (void *)parent());
|
||||
emphasis->labelsize(10);
|
||||
emphasis->callback(spdif_emphasis_cb, (void *)parent());
|
||||
non_audio->labelsize(10);
|
||||
non_audio->callback(spdif_nonaudio_cb, (void *)parent());
|
||||
end();
|
||||
}
|
||||
|
||||
void HC_SpdifOut::setOut(unsigned char val)
|
||||
{
|
||||
if (val != adat1->value()) {
|
||||
adat1->value(val);
|
||||
}
|
||||
}
|
||||
|
||||
void HC_SpdifOut::setProfessional(unsigned char val)
|
||||
{
|
||||
|
||||
if (val != professional->value()) {
|
||||
professional->value(val);
|
||||
}
|
||||
}
|
||||
|
||||
void HC_SpdifOut::setEmphasis(unsigned char val)
|
||||
{
|
||||
if (val != emphasis->value()) {
|
||||
emphasis->value(val);
|
||||
}
|
||||
}
|
||||
|
||||
void HC_SpdifOut::setNonaudio(unsigned char val)
|
||||
{
|
||||
if (val != non_audio->value()) {
|
||||
non_audio->value(val);
|
||||
}
|
||||
}
|
||||
|
||||
int HC_SpdifOut::handle(int e)
|
||||
{
|
||||
switch (e) {
|
||||
case FL_PUSH:
|
||||
lock = 1;
|
||||
break;
|
||||
case FL_RELEASE:
|
||||
lock = 0;
|
||||
break;
|
||||
default:
|
||||
return Fl_Group::handle(e);
|
||||
}
|
||||
return Fl_Group::handle(e);
|
||||
}
|
||||
|
||||
50
hdspconf/src/HC_SpdifOut.h
Normal file
50
hdspconf/src/HC_SpdifOut.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_SPDIFOUT_H
|
||||
#define HC_SPDIFOUT_H
|
||||
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_SpdifOut:public Fl_Group
|
||||
{
|
||||
public:
|
||||
HC_SpdifOut(int x, int y, int w, int h);
|
||||
int source;
|
||||
Fl_Check_Button *adat1;
|
||||
Fl_Check_Button *professional;
|
||||
Fl_Check_Button *emphasis;
|
||||
Fl_Check_Button *non_audio;
|
||||
void setOut(unsigned char val);
|
||||
void setProfessional(unsigned char val);
|
||||
void setEmphasis(unsigned char val);
|
||||
void setNonaudio(unsigned char val);
|
||||
int handle(int e);
|
||||
int lock;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
125
hdspconf/src/HC_SyncCheck.cxx
Normal file
125
hdspconf/src/HC_SyncCheck.cxx
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_SyncCheck.h"
|
||||
|
||||
extern char *lock_status[3];
|
||||
|
||||
HC_SyncCheck::HC_SyncCheck(int x, int y, int w, int h):Fl_Widget(x, y, w, h, "SyncCheck")
|
||||
{
|
||||
adat1_lock_status = -1;
|
||||
adat2_lock_status = -1;
|
||||
adat3_lock_status = -1;
|
||||
wordclock_lock_status = -1;
|
||||
adatsync_lock_status = -1;
|
||||
spdif_lock_status = -1;
|
||||
if (((HC_CardPane *)parent())->type == MULTIFACE) {
|
||||
v_step = (int)(h/4.0f);
|
||||
} else {
|
||||
v_step = (int)(h/6.0f);
|
||||
}
|
||||
h_step = (int)(w/2.0f);
|
||||
draw_box = Fl::get_boxtype(FL_ENGRAVED_FRAME);
|
||||
label("SyncCheck");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
void HC_SyncCheck::draw()
|
||||
{
|
||||
int v_pos = v_step;
|
||||
int h_pos = 4;
|
||||
int i = 0;
|
||||
fl_color(FL_BACKGROUND_COLOR);
|
||||
fl_rectf(x(), y(), w(), h());
|
||||
draw_box(x(), y(), w(), h(), FL_WHITE);
|
||||
fl_color(FL_BLACK);
|
||||
fl_font(FL_HELVETICA, 10);
|
||||
fl_draw("ADAT1 In", x()+h_pos, y()+v_pos*i, h_step, v_step, FL_ALIGN_LEFT);
|
||||
fl_draw(lock_status[adat1_lock_status], x()+h_pos+h_step, y()+v_pos*i++, h_step-h_pos, v_step, FL_ALIGN_CENTER);
|
||||
if (((HC_CardPane *)parent())->type != MULTIFACE) {
|
||||
fl_draw("ADAT2 In", x()+h_pos, y()+v_pos*i, h_step, v_step, FL_ALIGN_LEFT);
|
||||
fl_draw(lock_status[adat2_lock_status], x()+h_pos+h_step, y()+v_pos*i++, h_step-h_pos, v_step, FL_ALIGN_CENTER);
|
||||
fl_draw("ADAT3 In", x()+h_pos, y()+v_pos*i, h_step, v_step, FL_ALIGN_LEFT);
|
||||
fl_draw(lock_status[adat3_lock_status], x()+h_pos+h_step, y()+v_pos*i++, h_step-h_pos, v_step, FL_ALIGN_CENTER);
|
||||
}
|
||||
fl_draw("SPDIF In", x()+h_pos, y()+v_pos*i, h_step, v_step, FL_ALIGN_LEFT);
|
||||
fl_draw(lock_status[spdif_lock_status], x()+h_pos+h_step, y()+v_pos*i++, h_step-h_pos, v_step, FL_ALIGN_CENTER);
|
||||
fl_draw("WordClock", x()+h_pos, y()+v_pos*i, h_step, v_step, FL_ALIGN_LEFT);
|
||||
fl_draw(lock_status[wordclock_lock_status], x()+h_pos+h_step, y()+v_pos*i++, h_step-h_pos, v_step, FL_ALIGN_CENTER);
|
||||
fl_draw("ADAT Sync", x()+h_pos, y()+v_pos*i, h_step, v_step, FL_ALIGN_LEFT);
|
||||
fl_draw(lock_status[adatsync_lock_status], x()+h_pos+h_step, y()+v_pos*i, h_step-h_pos, v_step, FL_ALIGN_CENTER);
|
||||
}
|
||||
|
||||
void HC_SyncCheck::setSpdifStatus(unsigned char s)
|
||||
{
|
||||
if (s == spdif_lock_status) return;
|
||||
if (s > 2) spdif_lock_status = 2;
|
||||
else spdif_lock_status = s;
|
||||
redraw();
|
||||
return;
|
||||
}
|
||||
|
||||
void HC_SyncCheck::setWCStatus(unsigned char s)
|
||||
{
|
||||
if (s == wordclock_lock_status) return;
|
||||
if (s > 2) wordclock_lock_status = 2;
|
||||
else wordclock_lock_status = s;
|
||||
redraw();
|
||||
return;
|
||||
}
|
||||
|
||||
void HC_SyncCheck::setAdat1Status(unsigned char s)
|
||||
{
|
||||
if (s == adat1_lock_status) return;
|
||||
if (s > 2) adat1_lock_status = 2;
|
||||
else adat1_lock_status = s;
|
||||
redraw();
|
||||
return;
|
||||
}
|
||||
|
||||
void HC_SyncCheck::setAdat2Status(unsigned char s)
|
||||
{
|
||||
if (s == adat2_lock_status) return;
|
||||
if (s > 2) adat2_lock_status = 2;
|
||||
else adat2_lock_status = s;
|
||||
redraw();
|
||||
return;
|
||||
}
|
||||
|
||||
void HC_SyncCheck::setAdat3Status(unsigned char s)
|
||||
{
|
||||
if (s == adat3_lock_status) return;
|
||||
if (s > 2) adat3_lock_status = 2;
|
||||
else adat3_lock_status = s;
|
||||
redraw();
|
||||
return;
|
||||
}
|
||||
|
||||
void HC_SyncCheck::setAdatSyncStatus(unsigned char s)
|
||||
{
|
||||
if (s == adatsync_lock_status) return;
|
||||
if (s > 2) adatsync_lock_status = 2;
|
||||
else adatsync_lock_status = s;
|
||||
redraw();
|
||||
return;
|
||||
}
|
||||
|
||||
59
hdspconf/src/HC_SyncCheck.h
Normal file
59
hdspconf/src/HC_SyncCheck.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_SYNCCHECK_H
|
||||
#define HC_SYNCCHECK_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
#define NO_LOCK 0
|
||||
#define LOCK 1
|
||||
#define SYNC 2
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_SyncCheck:public Fl_Widget
|
||||
{
|
||||
public:
|
||||
HC_SyncCheck(int x, int y, int w, int h);
|
||||
void draw();
|
||||
int adat1_lock_status;
|
||||
int adat2_lock_status;
|
||||
int adat3_lock_status;
|
||||
int wordclock_lock_status;
|
||||
int adatsync_lock_status;
|
||||
int spdif_lock_status;
|
||||
void setSpdifStatus(unsigned char s);
|
||||
void setAdat1Status(unsigned char s);
|
||||
void setAdat2Status(unsigned char s);
|
||||
void setAdat3Status(unsigned char s);
|
||||
void setAdatSyncStatus(unsigned char s);
|
||||
void setWCStatus(unsigned char s);
|
||||
private:
|
||||
int v_step, h_step;
|
||||
Fl_Box_Draw_F *draw_box;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
87
hdspconf/src/HC_SystemClock.cxx
Normal file
87
hdspconf/src/HC_SystemClock.cxx
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_SystemClock.h"
|
||||
|
||||
extern char *freqs[7];
|
||||
|
||||
HC_SystemClock::HC_SystemClock(int x, int y, int w, int h):Fl_Widget(x, y, w, h, "System Clock")
|
||||
{
|
||||
system_freq = 6;
|
||||
system_mode = 0;
|
||||
draw_box = Fl::get_boxtype(FL_ENGRAVED_FRAME);
|
||||
label("System Clock");
|
||||
labelsize(10);
|
||||
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
void HC_SystemClock::draw()
|
||||
{
|
||||
fl_color(FL_BACKGROUND_COLOR);
|
||||
fl_rectf(x(), y(), w(), h());
|
||||
draw_box(x(), y(), w(), h(), FL_WHITE);
|
||||
fl_color(FL_BLACK);
|
||||
fl_font(FL_HELVETICA, 10);
|
||||
fl_draw("Mode", x()+4, y(), w()/2, h()/2, FL_ALIGN_LEFT);
|
||||
fl_draw(system_mode ? "Slave" : "Master", x()+w()/2-4, y(), w()/2, h()/2, FL_ALIGN_CENTER);
|
||||
fl_draw("Freq.", x()+4, y()+h()/2, w()/2, h()/2, FL_ALIGN_LEFT);
|
||||
fl_draw(freqs[system_freq], x()+w()/2-4, y()+h()/2, w()/2, h()/2, FL_ALIGN_CENTER);
|
||||
}
|
||||
|
||||
void HC_SystemClock::setMode(unsigned char m)
|
||||
{
|
||||
if (m != system_mode) {
|
||||
if (m) system_mode = 1;
|
||||
else system_mode = 0;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void HC_SystemClock::setFreq(int f)
|
||||
{
|
||||
int freq;
|
||||
switch(f) {
|
||||
case 32000:
|
||||
freq = 0;
|
||||
break;
|
||||
case 44100:
|
||||
freq = 1;
|
||||
break;
|
||||
case 48000:
|
||||
freq = 2;
|
||||
break;
|
||||
case 64000:
|
||||
freq = 3;
|
||||
break;
|
||||
case 88200:
|
||||
freq = 4;
|
||||
break;
|
||||
case 96000:
|
||||
freq = 5;
|
||||
break;
|
||||
default:
|
||||
freq = 6;
|
||||
}
|
||||
if (freq != system_freq) {
|
||||
system_freq = freq;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
46
hdspconf/src/HC_SystemClock.h
Normal file
46
hdspconf/src/HC_SystemClock.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_SYSTEMCLOCK_H
|
||||
#define HC_SYSTEMCLOCK_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include "HC_CardPane.h"
|
||||
|
||||
class HC_CardPane;
|
||||
|
||||
class HC_SystemClock:public Fl_Widget
|
||||
{
|
||||
public:
|
||||
HC_SystemClock(int x, int y, int w, int h);
|
||||
void draw();
|
||||
int system_freq;
|
||||
int system_mode;
|
||||
void setMode(unsigned char m);
|
||||
void setFreq(int f);
|
||||
private:
|
||||
Fl_Box_Draw_F *draw_box;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
33
hdspconf/src/HC_XpmRenderer.cxx
Normal file
33
hdspconf/src/HC_XpmRenderer.cxx
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma implementation
|
||||
#include "HC_XpmRenderer.h"
|
||||
|
||||
HC_XpmRenderer::HC_XpmRenderer(int x, int y, int w, int h, char * const *xpm):Fl_Widget(x, y, w, h)
|
||||
{
|
||||
pixmap = xpm;
|
||||
}
|
||||
|
||||
void HC_XpmRenderer::draw()
|
||||
{
|
||||
fl_draw_pixmap(pixmap, x(), y());
|
||||
}
|
||||
|
||||
39
hdspconf/src/HC_XpmRenderer.h
Normal file
39
hdspconf/src/HC_XpmRenderer.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma interface
|
||||
#ifndef HC_XPMRENDERER_H
|
||||
#define HC_XPMRENDERER_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
|
||||
class HC_XpmRenderer:public Fl_Widget
|
||||
{
|
||||
public:
|
||||
HC_XpmRenderer(int x, int y, int w, int h, char * const *xpm);
|
||||
void draw();
|
||||
private:
|
||||
char * const *pixmap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
26
hdspconf/src/Makefile.am
Normal file
26
hdspconf/src/Makefile.am
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
bin_PROGRAMS = hdspconf
|
||||
hdspconf_SOURCES = \
|
||||
hdspconf.cxx \
|
||||
defines.h \
|
||||
HC_CardPane.cxx \
|
||||
HC_CardPane.h \
|
||||
HC_SyncCheck.cxx \
|
||||
HC_SyncCheck.h \
|
||||
HC_SpdifFreq.cxx \
|
||||
HC_SpdifFreq.h \
|
||||
HC_AutoSyncRef.cxx \
|
||||
HC_AutoSyncRef.h \
|
||||
HC_SystemClock.cxx \
|
||||
HC_SystemClock.h \
|
||||
HC_ClockSource.cxx \
|
||||
HC_ClockSource.h \
|
||||
HC_SpdifIn.cxx \
|
||||
HC_SpdifIn.h \
|
||||
HC_SpdifOut.cxx \
|
||||
HC_SpdifOut.h \
|
||||
HC_PrefSyncRef.cxx \
|
||||
HC_PrefSyncRef.h \
|
||||
HC_XpmRenderer.cxx \
|
||||
HC_XpmRenderer.h \
|
||||
HC_AboutText.cxx \
|
||||
HC_AboutText.h
|
||||
42
hdspconf/src/defines.h
Normal file
42
hdspconf/src/defines.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef DEFINES_H
|
||||
#define DEFINES_H
|
||||
|
||||
#define MULTIFACE 0
|
||||
#define DIGIFACE 1
|
||||
#define HDSP9652 2
|
||||
|
||||
#define WINDOW_WIDTH 380
|
||||
#define WINDOW_HEIGHT 330
|
||||
|
||||
#define TABS_X 10
|
||||
#define TABS_Y 10
|
||||
#define TABS_W 360
|
||||
#define TABS_H 310
|
||||
|
||||
#define PANE_X 10
|
||||
#define PANE_Y 30
|
||||
#define PANE_H 290
|
||||
#define PANE_W 360
|
||||
|
||||
#endif
|
||||
|
||||
200
hdspconf/src/hdspconf.cxx
Normal file
200
hdspconf/src/hdspconf.cxx
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
* HDSPConf
|
||||
*
|
||||
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <sound/hdsp.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Tabs.H>
|
||||
#include "HC_CardPane.h"
|
||||
#include "HC_XpmRenderer.h"
|
||||
#include "HC_AboutText.h"
|
||||
#include "defines.h"
|
||||
|
||||
#include "../pixmaps/rme.xpm"
|
||||
#include "../pixmaps/alsalogo.xpm"
|
||||
#include "../pixmaps/lad_banner.xpm"
|
||||
|
||||
class HC_CardPane;
|
||||
class HC_XpmRenderer;
|
||||
class HC_AboutText;
|
||||
|
||||
char *freqs[7] = {
|
||||
"32.0 kHz",
|
||||
"44.1 kHz",
|
||||
"48.0 kHz",
|
||||
"64.0 kHz",
|
||||
"88.2 kHz",
|
||||
"96.0 kHz",
|
||||
"-----"
|
||||
};
|
||||
|
||||
char *ref[7] = {
|
||||
"Word Clock",
|
||||
"ADAT Sync",
|
||||
"SPDIF",
|
||||
"-----",
|
||||
"ADAT1",
|
||||
"ADAT2",
|
||||
"ADAT3"
|
||||
};
|
||||
|
||||
char *lock_status[3] = {
|
||||
"No Lock",
|
||||
"Lock",
|
||||
"Sync"
|
||||
};
|
||||
|
||||
static void refresh_cb(void *arg)
|
||||
{
|
||||
Fl_Tabs *tabs = (Fl_Tabs *)arg;
|
||||
int err;
|
||||
snd_hwdep_t *hw;
|
||||
char card_name[6];
|
||||
hdsp_config_info_t config_info;
|
||||
|
||||
for (int i = 0; i < tabs->children()-1 ; ++i) {
|
||||
HC_CardPane *pane = (HC_CardPane *)tabs->child(i);
|
||||
if (!pane->visible()) {
|
||||
break;
|
||||
}
|
||||
snprintf(card_name, 6, "hw:%i", pane->alsa_index);
|
||||
|
||||
if ((err = snd_hwdep_open(&hw, card_name, SND_HWDEP_OPEN_READ)) != 0) {
|
||||
fprintf(stderr, "Error opening hwdep device on card %s.\n", card_name);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((err = snd_hwdep_ioctl(hw, SNDRV_HDSP_IOCTL_GET_CONFIG_INFO, (void *)&config_info)) < 0) {
|
||||
fprintf(stderr, "Hwdep ioctl error on card %s.\n", card_name);
|
||||
snd_hwdep_close(hw);
|
||||
break;
|
||||
}
|
||||
|
||||
snd_hwdep_close(hw);
|
||||
|
||||
pane->sync_ref->setRef(config_info.pref_sync_ref);
|
||||
pane->spdif_freq->setFreq(config_info.spdif_sample_rate);
|
||||
pane->sync_check->setAdat1Status(config_info.adat_sync_check[0]);
|
||||
pane->sync_check->setSpdifStatus(config_info.spdif_sync_check);
|
||||
pane->sync_check->setWCStatus(config_info.wordclock_sync_check);
|
||||
pane->sync_check->setAdatSyncStatus(config_info.adatsync_sync_check);
|
||||
if (pane->type != MULTIFACE) {
|
||||
pane->sync_check->setAdat2Status(config_info.adat_sync_check[1]);
|
||||
pane->sync_check->setAdat3Status(config_info.adat_sync_check[2]);
|
||||
}
|
||||
pane->spdif_in->setInput(config_info.spdif_in);
|
||||
if (pane->spdif_out->lock == 0) {
|
||||
pane->spdif_out->setOut(config_info.spdif_out);
|
||||
pane->spdif_out->setProfessional(config_info.spdif_professional);
|
||||
pane->spdif_out->setEmphasis(config_info.spdif_emphasis);
|
||||
pane->spdif_out->setNonaudio(config_info.spdif_nonaudio);
|
||||
}
|
||||
pane->clock_source->setSource(config_info.clock_source);
|
||||
pane->autosync_ref->setRef(config_info.autosync_ref);
|
||||
pane->autosync_ref->setFreq(config_info.autosync_sample_rate);
|
||||
pane->system_clock->setMode(config_info.system_clock_mode);
|
||||
pane->system_clock->setFreq(config_info.system_sample_rate);
|
||||
}
|
||||
|
||||
Fl::add_timeout(0.3, refresh_cb, arg);
|
||||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Fl_Window *window;
|
||||
Fl_Tabs *tabs;
|
||||
HC_CardPane *card_panes[4];
|
||||
HC_XpmRenderer *lad_banner;
|
||||
HC_XpmRenderer *alsa_logo;
|
||||
HC_XpmRenderer *rme_logo;
|
||||
HC_AboutText *about_text;
|
||||
Fl_Group *about_pane;
|
||||
char **name;
|
||||
int card;
|
||||
int hdsp_cards[4];
|
||||
int alsa_index[4];
|
||||
snd_ctl_t *handle;
|
||||
snd_ctl_card_info_t *info;
|
||||
snd_pcm_info_t *pcminfo;
|
||||
int cards = 0;
|
||||
|
||||
snd_ctl_card_info_alloca(&info);
|
||||
snd_pcm_info_alloca(&pcminfo);
|
||||
card = -1;
|
||||
printf("HDSPConf %s\n", VERSION);
|
||||
printf("Looking for HDSP cards :\n");
|
||||
while (snd_card_next(&card) >= 0 && cards < 4) {
|
||||
if (card < 0) {
|
||||
break;
|
||||
} else {
|
||||
snd_card_get_longname(card, name);
|
||||
printf("Card %d : %s\n", card, *name);
|
||||
if (!strncmp(*name, "RME Hammerfall DSP + Multiface", 30)) {
|
||||
printf("Multiface found !\n");
|
||||
hdsp_cards[cards] = MULTIFACE;
|
||||
alsa_index[cards] = card;
|
||||
cards++;
|
||||
} else if (!strncmp(*name, "RME Hammerfall DSP + Digiface", 29)) {
|
||||
printf("Digiface found !\n");
|
||||
hdsp_cards[cards] = DIGIFACE;
|
||||
alsa_index[cards] = card;
|
||||
cards++;
|
||||
} else if (!strncmp(*name, "RME HDSP 9652", 13)) {
|
||||
printf("HDSP 9652 found !\n");
|
||||
hdsp_cards[cards] = HDSP9652;
|
||||
alsa_index[cards] = card;
|
||||
cards++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cards) {
|
||||
printf("No Hammerfall DSP card found.\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("%d Hammerfall DSP %s found.\n", cards, (cards > 1) ? "cards" : "card");
|
||||
|
||||
window = new Fl_Window(WINDOW_WIDTH, WINDOW_HEIGHT, "Hammerfall DSP Alsa Settings");
|
||||
tabs = new Fl_Tabs(TABS_X, TABS_Y, TABS_W, TABS_H);
|
||||
window->end();
|
||||
for (int i = 0; i < cards; ++i) {
|
||||
card_panes[i] = new HC_CardPane(alsa_index[i], i, hdsp_cards[i]);
|
||||
tabs->add((Fl_Group *)card_panes[i]);
|
||||
}
|
||||
about_pane = new Fl_Group(10, 30, 360, 360, "About");
|
||||
about_pane->labelsize(10);
|
||||
about_text = new HC_AboutText(20, 40, 340, 210);
|
||||
rme_logo = new HC_XpmRenderer(20, 263, 113, 35, rme_xpm);
|
||||
alsa_logo = new HC_XpmRenderer(170, 255, 50, 50, alsalogo_xpm);
|
||||
lad_banner = new HC_XpmRenderer(245, 260, 113, 39, lad_banner_xpm);
|
||||
about_pane->end();
|
||||
tabs->add(about_pane);
|
||||
refresh_cb((void *)tabs);
|
||||
window->show(argc, argv);
|
||||
return Fl::run();
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue