|
Packit Service |
b98cfc |
/*
|
|
Packit Service |
b98cfc |
* HDSPConf
|
|
Packit Service |
b98cfc |
*
|
|
Packit Service |
b98cfc |
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
|
|
Packit Service |
b98cfc |
*
|
|
Packit Service |
b98cfc |
* This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
b98cfc |
* it under the terms of the GNU General Public License as published by
|
|
Packit Service |
b98cfc |
* the Free Software Foundation; either version 2 of the License, or
|
|
Packit Service |
b98cfc |
* (at your option) any later version.
|
|
Packit Service |
b98cfc |
*
|
|
Packit Service |
b98cfc |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
b98cfc |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
b98cfc |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
b98cfc |
* GNU General Public License for more details.
|
|
Packit Service |
b98cfc |
*
|
|
Packit Service |
b98cfc |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
b98cfc |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
b98cfc |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Packit Service |
b98cfc |
*/
|
|
Packit Service |
b98cfc |
|
|
Packit Service |
b98cfc |
#pragma implementation
|
|
Packit Service |
b98cfc |
#include "HC_SystemClock.h"
|
|
Packit Service |
b98cfc |
|
|
Packit Service |
b98cfc |
extern const char *freqs[10];
|
|
Packit Service |
b98cfc |
|
|
Packit Service |
b98cfc |
HC_SystemClock::HC_SystemClock(int x, int y, int w, int h):Fl_Widget(x, y, w, h, "System Clock")
|
|
Packit Service |
b98cfc |
{
|
|
Packit Service |
b98cfc |
system_freq = 6;
|
|
Packit Service |
b98cfc |
system_mode = 0;
|
|
Packit Service |
b98cfc |
draw_box = Fl::get_boxtype(FL_ENGRAVED_FRAME);
|
|
Packit Service |
b98cfc |
label("System Clock");
|
|
Packit Service |
b98cfc |
labelsize(10);
|
|
Packit Service |
b98cfc |
align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
|
|
Packit Service |
b98cfc |
}
|
|
Packit Service |
b98cfc |
|
|
Packit Service |
b98cfc |
void HC_SystemClock::draw()
|
|
Packit Service |
b98cfc |
{
|
|
Packit Service |
b98cfc |
fl_color(FL_BACKGROUND_COLOR);
|
|
Packit Service |
b98cfc |
fl_rectf(x(), y(), w(), h());
|
|
Packit Service |
b98cfc |
draw_box(x(), y(), w(), h(), FL_WHITE);
|
|
Packit Service |
b98cfc |
fl_color(FL_FOREGROUND_COLOR);
|
|
Packit Service |
b98cfc |
fl_font(FL_HELVETICA, 10);
|
|
Packit Service |
b98cfc |
fl_draw("Mode", x()+4, y(), w()/2, h()/2, FL_ALIGN_LEFT);
|
|
Packit Service |
b98cfc |
fl_draw(system_mode ? "Slave" : "Master", x()+w()/2-4, y(), w()/2, h()/2, FL_ALIGN_CENTER);
|
|
Packit Service |
b98cfc |
fl_draw("Freq.", x()+4, y()+h()/2, w()/2, h()/2, FL_ALIGN_LEFT);
|
|
Packit Service |
b98cfc |
fl_draw(freqs[system_freq], x()+w()/2-4, y()+h()/2, w()/2, h()/2, FL_ALIGN_CENTER);
|
|
Packit Service |
b98cfc |
}
|
|
Packit Service |
b98cfc |
|
|
Packit Service |
b98cfc |
void HC_SystemClock::setMode(unsigned char m)
|
|
Packit Service |
b98cfc |
{
|
|
Packit Service |
b98cfc |
if (m != system_mode) {
|
|
Packit Service |
b98cfc |
if (m) system_mode = 1;
|
|
Packit Service |
b98cfc |
else system_mode = 0;
|
|
Packit Service |
b98cfc |
redraw();
|
|
Packit Service |
b98cfc |
}
|
|
Packit Service |
b98cfc |
}
|
|
Packit Service |
b98cfc |
|
|
Packit Service |
b98cfc |
void HC_SystemClock::setFreq(int f)
|
|
Packit Service |
b98cfc |
{
|
|
Packit Service |
b98cfc |
int freq;
|
|
Packit Service |
b98cfc |
switch(f) {
|
|
Packit Service |
b98cfc |
case 32000:
|
|
Packit Service |
b98cfc |
freq = 0;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 44100:
|
|
Packit Service |
b98cfc |
freq = 1;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 48000:
|
|
Packit Service |
b98cfc |
freq = 2;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 64000:
|
|
Packit Service |
b98cfc |
freq = 3;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 88200:
|
|
Packit Service |
b98cfc |
freq = 4;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 96000:
|
|
Packit Service |
b98cfc |
freq = 5;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 128000:
|
|
Packit Service |
b98cfc |
freq = 7;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 176400:
|
|
Packit Service |
b98cfc |
freq = 8;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
case 192000:
|
|
Packit Service |
b98cfc |
freq = 9;
|
|
Packit Service |
b98cfc |
break;
|
|
Packit Service |
b98cfc |
default:
|
|
Packit Service |
b98cfc |
freq = 6;
|
|
Packit Service |
b98cfc |
}
|
|
Packit Service |
b98cfc |
if (freq != system_freq) {
|
|
Packit Service |
b98cfc |
system_freq = freq;
|
|
Packit Service |
b98cfc |
redraw();
|
|
Packit Service |
b98cfc |
}
|
|
Packit Service |
b98cfc |
}
|