added hdspmixer by Thomas Charbonnel

This commit is contained in:
Takashi Iwai 2003-07-28 11:32:32 +00:00
parent a459b42371
commit 0fb00d0bdc
102 changed files with 14102 additions and 1 deletions

View file

@ -0,0 +1,32 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerAbout.h"
HDSPMixerAbout::HDSPMixerAbout(int w, int h, char *label, HDSPMixerWindow *win):Fl_Double_Window(w, h, label)
{
basew = win;
text = new HDSPMixerAboutText(0,0,w,h);
end();
set_modal();
}

View file

@ -0,0 +1,43 @@
/*
* HDSPMixer
*
* 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 HDSPMixerAbout_H
#define HDSPMixerAbout_H
#include <string.h>
#include <FL/Fl_Double_Window.H>
#include "HDSPMixerWindow.h"
#include "HDSPMixerAboutText.h"
class HDSPMixerWindow;
class HDSPMixerAboutText;
class HDSPMixerAbout:public Fl_Double_Window
{
private:
HDSPMixerAboutText *text;
HDSPMixerWindow *basew;
public:
HDSPMixerAbout(int w, int h, char *label, HDSPMixerWindow *w);
};
#endif

View file

@ -0,0 +1,48 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerAboutText.h"
HDSPMixerAboutText::HDSPMixerAboutText(int x, int y, int w, int h):Fl_Widget(x, y, w, h, "About Text")
{
text = "HDSPMixer (C) 2003 Thomas Charbonnel <thomas@@undata.org>\n\n"
"Bitmaps by Ralf Brunner\n"
"Many thanks to Martin Björnsen, Matthias Carstens and Paul Davis\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 HDSPMixerAboutText::draw()
{
fl_color(FL_BLACK);
fl_font(FL_HELVETICA, 10);
fl_draw(text, x(), y(), w(), h(), FL_ALIGN_LEFT);
}

View file

@ -0,0 +1,39 @@
/*
* HDSPMixer
*
* 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 HDSPMixerAboutText_H
#define HDSPMixerAboutText_H
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include <FL/Fl.H>
class HDSPMixerAboutText:public Fl_Widget
{
public:
HDSPMixerAboutText(int x, int y, int w, int h);
void draw();
private:
char *text;
};
#endif

View file

@ -0,0 +1,73 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerButtons.h"
HDSPMixerButtons::HDSPMixerButtons(int x, int y, int w, int h):Fl_Group(x, y, w, h)
{
cardselector = new HDSPMixerCardSelector(x+6, y+227, 61, 13, 1);
master = new HDSPMixerMaster(x+6 , y+18 , 62, 12);
view = new HDSPMixerView(x+6, y+53, 13, 76);
presets = new HDSPMixerPresets(x+6, y+153, 61, 52);
end();
preset = 0;
input = 0;
playback = 0;
output = 0;
submix = 0;
save = 0;
}
void HDSPMixerButtons::draw_background()
{
draw_background(x(), y(), w(), h());
}
void HDSPMixerButtons::draw_background(int xpos, int ypos, int w, int h)
{
fl_push_clip(xpos, ypos, w, h);
fl_draw_pixmap(buttons_xpm, x(), y());
fl_pop_clip();
}
void HDSPMixerButtons::draw()
{
Fl_Widget *const* a = array();
if (damage() & ~FL_DAMAGE_CHILD) {
draw_background();
for (int i=children(); i--;) {
Fl_Widget& o = **a++;
draw_child(o);
}
} else {
for (int i=children(); i--;) update_child(**a++);
}
}
void HDSPMixerButtons::update_child(Fl_Widget& widget)
{
if (widget.damage() && widget.visible() && widget.type() < FL_WINDOW && fl_not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
draw_background(widget.x(), widget.y(), widget.w(), widget.h());
widget.draw();
widget.clear_damage();
}
}

View file

@ -0,0 +1,57 @@
/*
* HDSPMixer
*
* 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 HDSPMixerButtons_H
#define HDSPMixerButtons_H
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/fl_draw.H>
#include "HDSPMixerCardSelector.h"
#include "HDSPMixerMaster.h"
#include "HDSPMixerView.h"
#include "HDSPMixerPresets.h"
#include "pixmaps.h"
class HDSPMixerCardSelector;
class HDSPMixerMaster;
class HDSPMixerView;
class HDSPMixerPresets;
class HDSPMixerButtons:public Fl_Group
{
private:
void update_child(Fl_Widget& widget);
void draw_background();
void draw_background(int x, int y, int w, int h);
public:
HDSPMixerPresets *presets;
HDSPMixerCardSelector *cardselector;
HDSPMixerMaster *master;
HDSPMixerView *view;
int input, output, playback, submix, preset, save;
HDSPMixerButtons(int x, int y, int w, int h);
void draw();
};
#endif

View file

@ -0,0 +1,288 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerCard.h"
static void alsactl_cb(snd_async_handler_t *handler)
{
int err, clock_value;
snd_ctl_t *ctl;
snd_ctl_event_t *event;
snd_ctl_elem_value_t *elemval;
snd_ctl_elem_id_t *elemid;
HDSPMixerCard *card;
card = (HDSPMixerCard *)snd_async_handler_get_callback_private(handler);
snd_ctl_elem_value_alloca(&elemval);
snd_ctl_elem_id_alloca(&elemid);
ctl = snd_async_handler_get_ctl(handler);
if ((err = snd_ctl_nonblock(ctl, 1))) {
printf("Error setting non blocking mode for card %s\n", card->name);
return;
}
snd_ctl_event_malloc(&event);
while ((err = snd_ctl_read(ctl, event)) > 0) {
if (snd_ctl_event_elem_get_numid(event) == 11 && (card == card->basew->cards[card->basew->current_card])) {
/* We have a clock change and are the focused card */
snd_ctl_event_elem_get_id(event, elemid);
snd_ctl_elem_value_set_id(elemval, elemid);
if ((err = snd_ctl_elem_read(ctl, elemval)) < 0) {
fprintf(stderr, "Error reading snd_ctl_elem_t\n");
snd_ctl_event_free(event);
return;
}
clock_value = snd_ctl_elem_value_get_enumerated(elemval, 0);
if (clock_value == 0) {
int new_speed = card->getAutosyncSpeed();
if (new_speed >= 0 && new_speed != card->double_speed) card->setMode(new_speed);
}
if (clock_value > 3 && !card->double_speed) {
card->setMode(1);
} else if (clock_value < 4 && card->double_speed) {
card->setMode(0);
}
}
snd_ctl_event_clear(event);
}
snd_ctl_event_free(event);
}
int HDSPMixerCard::getAutosyncSpeed()
{
/* FIXME : this is over simplistic, there are lots of crooked cases
It should always be possible to do what one wants executing the
proper sequence of actions, though.
*/
int err, external_rate;
snd_ctl_elem_value_t *elemval;
snd_ctl_elem_id_t * elemid;
snd_ctl_t *handle;
snd_ctl_elem_value_alloca(&elemval);
snd_ctl_elem_id_alloca(&elemid);
if ((err = snd_ctl_open(&handle, name, SND_CTL_NONBLOCK)) < 0) {
fprintf(stderr, "Error accessing ctl interface on card %s\n.", name);
return -1;
}
snd_ctl_elem_id_set_name(elemid, "External Rate");
snd_ctl_elem_id_set_numid(elemid, 17);
snd_ctl_elem_id_set_interface(elemid, SND_CTL_ELEM_IFACE_PCM);
snd_ctl_elem_id_set_device(elemid, 0);
snd_ctl_elem_id_set_subdevice(elemid, 0);
snd_ctl_elem_id_set_index(elemid, 0);
snd_ctl_elem_value_set_id(elemval, elemid);
snd_ctl_elem_read(handle, elemval);
external_rate = snd_ctl_elem_value_get_enumerated(elemval, 0);
snd_ctl_close(handle);
if (external_rate > 2 && external_rate < 6) {
return 1;
} else if (external_rate < 2) {
return 0;
}
}
int HDSPMixerCard::getSpeed()
{
int err, val;
snd_ctl_elem_value_t *elemval;
snd_ctl_elem_id_t * elemid;
snd_ctl_t *handle;
snd_ctl_elem_value_alloca(&elemval);
snd_ctl_elem_id_alloca(&elemid);
if ((err = snd_ctl_open(&handle, name, SND_CTL_NONBLOCK)) < 0) {
fprintf(stderr, "Error accessing ctl interface on card %s\n.", name);
return -1;
}
snd_ctl_elem_id_set_name(elemid, "Sample Clock Source");
snd_ctl_elem_id_set_numid(elemid, 11);
snd_ctl_elem_id_set_interface(elemid, SND_CTL_ELEM_IFACE_PCM);
snd_ctl_elem_id_set_device(elemid, 0);
snd_ctl_elem_id_set_subdevice(elemid, 0);
snd_ctl_elem_id_set_index(elemid, 0);
snd_ctl_elem_value_set_id(elemval, elemid);
snd_ctl_elem_read(handle, elemval);
val = snd_ctl_elem_value_get_enumerated(elemval, 0);
snd_ctl_close(handle);
switch (val) {
case 0:
/* Autosync mode : We need to determine sample rate */
return getAutosyncSpeed();
break;
case 1:
case 2:
case 3:
/* SR <= 48000 - normal speed */
return 0;
case 4:
case 5:
case 6:
/* SR > 48000 kHz - double speed */
return 1;
break;
default:
/* Should never happen */
return 0;
}
return 0;
}
HDSPMixerCard::HDSPMixerCard(HDSP_IO_Type cardtype, int id)
{
type = cardtype;
card_id = id;
snprintf(name, 6, "hw:%i", card_id);
double_speed = getSpeed();
if (double_speed < 0) {
fprintf(stderr, "Error trying to determine speed mode for card %s, exiting.\n", name);
exit(EXIT_FAILURE);
}
/* Set channels and mappings */
adjustSettings();
basew = NULL;
}
void HDSPMixerCard::adjustSettings() {
if (type == Multiface && !double_speed) {
channels = 18;
channel_map = channel_map_mf_ss;
dest_map = dest_map_mf_ss;
meter_map = channel_map_mf_ss;
lineouts = 2;
} else if (type == Multiface && double_speed) {
channels = 14;
/* FIXME : this is a workaround because the driver is wrong */
channel_map = meter_map_ds;
dest_map = dest_map_ds;
meter_map = meter_map_ds;
lineouts = 2;
} else if (type == Digiface && !double_speed) {
channels = 26;
channel_map = channel_map_df_ss;
dest_map = dest_map_df_ss;
meter_map = channel_map_df_ss;
lineouts = 2;
} else if (type == Digiface && double_speed) {
channels = 14;
channel_map = channel_map_ds;
dest_map = dest_map_ds;
meter_map = meter_map_ds;
lineouts = 2;
} else if (type == H9652 && !double_speed) {
channels = 26;
channel_map = channel_map_df_ss;
dest_map = dest_map_h9652_ss;
meter_map = channel_map_df_ss;
lineouts = 0;
} else if (type == H9652 && double_speed) {
channels = 14;
channel_map = channel_map_ds;
dest_map = dest_map_h9652_ds;
meter_map = meter_map_ds;
lineouts = 0;
}
window_width = (channels+2)*STRIP_WIDTH;
window_height = FULLSTRIP_HEIGHT*2+SMALLSTRIP_HEIGHT+MENU_HEIGHT;
}
void HDSPMixerCard::setMode(int mode)
{
double_speed = mode;
adjustSettings();
actualizeStrips();
for (int i = 0; i < channels; ++i) {
basew->inputs->strips[i]->targets->setLabels();
basew->playbacks->strips[i]->targets->setLabels();
basew->outputs->strips[i]->setLabels();
}
for (int i = channels; i < channels+lineouts; ++i) {
basew->outputs->strips[i]->setLabels();
}
basew->inputs->buttons->position(STRIP_WIDTH*channels, basew->inputs->buttons->y());
basew->inputs->init_sizes();
basew->playbacks->empty->position(STRIP_WIDTH*channels, basew->playbacks->empty->y());
basew->playbacks->init_sizes();
basew->outputs->empty->position(STRIP_WIDTH*(channels+lineouts), basew->outputs->empty->y());
basew->outputs->init_sizes();
basew->inputs->size(window_width, basew->inputs->h());
basew->playbacks->size(window_width, basew->playbacks->h());
basew->outputs->size(window_width, basew->outputs->h());
basew->scroll->init_sizes();
((Fl_Widget *)(basew->menubar))->size(window_width, basew->menubar->h());
basew->size_range(MIN_WIDTH, MIN_HEIGHT, window_width, window_height);
basew->resize(basew->x(), basew->y(), window_width, basew->h());
basew->reorder();
basew->resetMixer();
basew->inputs->buttons->presets->preset_change(1);
}
void HDSPMixerCard::actualizeStrips()
{
for (int i = 0; i < HDSP_MAX_CHANNELS; ++i) {
if (i < channels) {
basew->inputs->strips[i]->show();
basew->playbacks->strips[i]->show();
basew->outputs->strips[i]->show();
} else {
basew->inputs->strips[i]->hide();
basew->playbacks->strips[i]->hide();
basew->outputs->strips[i]->hide();
}
}
for (int i = channels; i < channels+lineouts; ++i) {
basew->outputs->strips[i]->show();
}
if (type != H9652) basew->outputs->empty->hide();
}
int HDSPMixerCard::initializeCard(HDSPMixerWindow *w)
{
int err;
if ((err = snd_ctl_open(&cb_handle, name, SND_CTL_NONBLOCK)) < 0) {
fprintf(stderr, "Error opening ctl interface for card %s - exiting\n", name);
exit(EXIT_FAILURE);
}
if ((err = snd_async_add_ctl_handler(&cb_handler, cb_handle, alsactl_cb, this)) < 0) {
fprintf(stderr, "Error registering async ctl callback for card %s - exiting\n", name);
exit(EXIT_FAILURE);
}
if ((err = snd_ctl_subscribe_events(cb_handle, 1)) < 0) {
fprintf(stderr, "Error subscribing to ctl events for card %s - exiting\n", name);
exit(EXIT_FAILURE);
}
basew = w;
actualizeStrips();
return 0;
}

View file

@ -0,0 +1,59 @@
/*
* HDSPMixer
*
* 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 HDSPMixerCard_H
#define HDSPMixerCard_H
#include <stdlib.h>
#include <stdio.h>
#include <alsa/asoundlib.h>
#include <sound/hdsp.h>
#include "mappings.h"
#include "defines.h"
#include "HDSPMixerWindow.h"
class HDSPMixerWindow;
class HDSPMixerCard
{
private:
snd_ctl_t *cb_handle;
snd_async_handler_t *cb_handler;
public:
HDSPMixerWindow *basew;
char name[6];
HDSPMixerCard(HDSP_IO_Type cardtype, int id);
int channels, lineouts, window_width, window_height, card_id;
HDSP_IO_Type type;
char *channel_map;
char *dest_map;
char *meter_map;
int double_speed;
void setMode(int mode);
int initializeCard(HDSPMixerWindow *w);
int getSpeed();
int getAutosyncSpeed();
void actualizeStrips();
void adjustSettings();
};
#endif

View file

@ -0,0 +1,73 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerCardSelector.h"
HDSPMixerCardSelector::HDSPMixerCardSelector(int x, int y, int w, int h, int cardnum):Fl_Widget(x, y, 61, 13)
{
basew = (HDSPMixerWindow *)window();
card = cardnum;
}
void HDSPMixerCardSelector::draw()
{
switch (card) {
case 1:
fl_draw_pixmap(b_card1_xpm, x(), y());
return;
case 2:
fl_draw_pixmap(b_card2_xpm, x()+24, y());
return;
case 3:
fl_draw_pixmap(b_card3_xpm, x()+48, y());
return;
default:
return;
}
}
int HDSPMixerCardSelector::handle(int e)
{
int xpos = Fl::event_x()-x();
switch (e) {
case FL_PUSH:
if (xpos < 13 && card != 1) {
card = 1;
basew->current_card = 0;
basew->cards[0]->setMode(basew->cards[0]->getSpeed());
redraw();
} else if (xpos >= 24 && xpos < 37 && card != 2 && basew->cards[1] != NULL) {
card = 2;
basew->current_card = 1;
basew->cards[1]->setMode(basew->cards[1]->getSpeed());
redraw();
} else if (xpos >= 48 && card != 3 && basew->cards[2] != NULL) {
card = 3;
basew->current_card = 2;
basew->cards[2]->setMode(basew->cards[2]->getSpeed());
redraw();
}
return 1;
default:
return Fl_Widget::handle(e);
}
}

View file

@ -0,0 +1,45 @@
/*
* HDSPMixer
*
* 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 HDSPMixerCardSelector_H
#define HDSPMixerCardSelector_H
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include <FL/fl_ask.H>
#include "HDSPMixerWindow.h"
#include "pixmaps.h"
class HDSPMixerWindow;
class HDSPMixerCardSelector:public Fl_Widget
{
public:
int card;
HDSPMixerWindow *basew;
HDSPMixerCardSelector(int x, int y, int w, int h, int card);
void draw();
int handle(int e);
};
#endif

View file

@ -0,0 +1,39 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerEmpty.h"
HDSPMixerEmpty::HDSPMixerEmpty(int x, int y, int w, int h, int type):Fl_Widget(x, y, w, h)
{
linux_advertising = type;
}
void HDSPMixerEmpty::draw()
{
if (fl_not_clipped(x(), y(), w(), h()) != 0) {
if (linux_advertising) {
fl_draw_pixmap(empty_linux_xpm, x(), y());
} else {
fl_draw_pixmap(empty_xpm, x(), y());
}
}
}

View file

@ -0,0 +1,39 @@
/*
* HDSPMixer
*
* 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 HDSPMixerEmpty_H
#define HDSPMixerEmpty_H
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "pixmaps.h"
class HDSPMixerEmpty:public Fl_Widget
{
private:
int linux_advertising;
public:
HDSPMixerEmpty(int x, int y, int w, int h, int type);
void draw();
};
#endif

View file

@ -0,0 +1,181 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerFader.h"
HDSPMixerFader::HDSPMixerFader(int x, int y, double r, int id, int src):Fl_Widget(x, y, 13, 153)
{
index = id;
source = src;
ndb = (int)(CF*(double)(log(0.5*(exp(3.0)-1)+1)*(double)(FADER_HEIGHT)/3.0));
non_submix_dest = 0;
dest = 0;
ref = r;
basew = (HDSPMixerWindow *)window();
anchor = lastpos = lasty = drag = shift_orig = y_orig = 0;
for (int i = 0; i < 14; i++) {
pos[i] = 0;
}
}
void HDSPMixerFader::draw()
{
fl_draw_pixmap(Slider1_xpm, x(), y()+139-(int)(pos[dest]/CF));
}
int HDSPMixerFader::handle(int e)
{
int button3 = Fl::event_button3();
int shift = Fl::event_shift();
int ctrl = Fl::event_ctrl();
int xpos = Fl::event_x()-x();
int ypos = Fl::event_y()-y();
switch (e) {
case FL_PUSH:
if (onSlider(ypos)) {
anchor = 144-ypos-(int)(pos[dest]/CF);
if (button3) relative->set(pos[dest]);
return 1;
}
anchor = 0;
if (ctrl) {
pos[dest] = ndb;
} else if (ypos < 7) {
pos[dest] = 137*CF;
} else if (ypos > 6 && ypos < 146) {
pos[dest] = (144-ypos)*CF;
} else if (ypos > 145) {
pos[dest] = 0;
}
if (lastpos != pos[dest]) {
basew->setMixer(index, source, dest);
sendGain();
lastpos = pos[dest];
}
if (lasty != (int)(pos[dest]/CF)) {
redraw();
lasty = (int)(pos[dest]/CF);
}
if (button3) relative->set(pos[dest]);
shift_orig = pos[dest];
y_orig = ypos;
basew->checkState();
return 1;
case FL_DRAG:
ypos += anchor;
if (ctrl) {
pos[dest] = ndb;
shift_orig = pos[dest];
y_orig = ypos;
} else if ((ypos > 6 && ypos < 146) || drag) {
drag = 1;
if (shift) {
pos[dest] = (y_orig-ypos)+shift_orig;
if (pos[dest] < 0) pos[dest] = 0;
if (pos[dest] > 137*CF) pos[dest] = 137*CF;
} else {
if (ypos < 7) {
pos[dest] = 137*CF;
} else if (ypos > 144) {
pos[dest] = 0;
} else {
pos[dest] = (144-ypos)*CF;
}
shift_orig = pos[dest];
y_orig = ypos;
}
}
if (lastpos != pos[dest]) {
basew->setMixer(index, source, dest);
sendGain();
lastpos = pos[dest];
}
if (lasty != (int)(pos[dest]/CF)) {
redraw();
lasty = (int)(pos[dest]/CF);
}
if (button3) relative->set(pos[dest]);
basew->checkState();
return 1;
case FL_RELEASE:
drag = 0;
anchor = 0;
return 1;
default :
return Fl_Widget::handle(e);
}
}
int HDSPMixerFader::onSlider(int ypos)
{
if (ypos > (139-(int)(pos[dest]/CF)) && ypos < (151-(int)(pos[dest]/CF))) {
return 1;
}
return 0;
}
void HDSPMixerFader::set(int p)
{
if (p != pos[dest]) {
pos[dest] = lastpos = p;
basew->setMixer(index, source, dest);
sendGain();
}
if (lasty != (int)(pos[dest]/CF)) {
lasty = (int)(pos[dest]/CF);
redraw();
}
}
int HDSPMixerFader::posToInt(int p) {
double x, y;
if (p == ndb) return 32768;
if (p == 137*CF) return 65535;
if (p == 0) return 0;
x = ((double)(p)) / (double)(137*CF);
y = 65535.0 * (exp(3.0 * x) - 1.0) / (exp(3.0) - 1.0);
if (y > 65535.0) y = 65535.0;
if (y < 0.0) y = 0.0;
return (int)y;
}
void HDSPMixerFader::posToLog(char *s)
{
double db, fpos;
if (posToInt(pos[dest]) == 0) {
snprintf(s, 10, "-oo");
return;
}
fpos = (double)posToInt(pos[dest]) / ref;
db = 20.0 * log10(fpos);
snprintf(s, 10, "%.1f", db);
}
void HDSPMixerFader::sendGain()
{
char buf[10];
posToLog(buf);
gain->setText(buf);
}

View file

@ -0,0 +1,64 @@
/*
* HDSPMixer
*
* 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 HDSPMixerFader_H
#define HDSPMixerFader_H
#include <math.h>
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "HDSPMixerWindow.h"
#include "HDSPMixerIOMixer.h"
#include "HDSPMixerOutput.h"
#include "pixmaps.h"
#include "defines.h"
class HDSPMixerIOMixer;
class HDSPMixerOutput;
class HDSPMixerGain;
class HDSPMixerWindow;
class HDSPMixerFader:public Fl_Widget
{
private:
double ref;
int lastpos, lasty, drag, shift_orig, y_orig, anchor, source, index;
int onSlider(int ypos);
void posToLog(char *s);
public:
int ndb;
int posToInt(int p);
int non_submix_dest;
int dest;
int pos[14];
HDSPMixerWindow *basew;
HDSPMixerFader *relative;
HDSPMixerGain *gain;
void set(int pos);
HDSPMixerFader(int x, int y, double r, int id, int src);
int handle(int e);
void draw();
void sendGain();
};
#endif

View file

@ -0,0 +1,40 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerGain.h"
HDSPMixerGain::HDSPMixerGain(int x, int y, int parenttype):Fl_Widget(x, y, 30, 13)
{
setText("-oo");
}
void HDSPMixerGain::draw()
{
fl_color(FL_GREEN);
fl_font(FL_HELVETICA, 8);
fl_draw(text, x(), y(), w(), h(), FL_ALIGN_CENTER);
}
void HDSPMixerGain::setText(char *txt)
{
strncpy(text, txt, 10);
redraw();
}

View file

@ -0,0 +1,46 @@
/*
* HDSPMixer
*
* 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 HDSPMixerGain_H
#define HDSPMixerGain_H
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "HDSPMixerIOMixer.h"
#include "HDSPMixerOutput.h"
class HDSPMixerIOMixer;
class HDSPMixerOutput;
class HDSPMixerGain:public Fl_Widget
{
private:
int parent_iomixer;
public:
HDSPMixerGain *relative;
char text[10];
HDSPMixerGain(int x, int y, int parenttype);
void draw();
void setText(char *txt);
};
#endif

View file

@ -0,0 +1,95 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerIOMixer.h"
HDSPMixerIOMixer::HDSPMixerIOMixer(int x, int y, int w, int h, int ch, int type):Fl_Group(x, y, w, h)
{
mixer_type = type;
if (type) {
sprintf(channel_name, "Out %d", ch);
} else {
sprintf(channel_name, "In %d", ch);
}
channel_num = ch;
if (channel_num%2) {
relative_num = channel_num+1;
} else {
relative_num = channel_num-1;
}
for (int j = 0; j < 3; ++j) {
for (int i = 0; i < 8; ++i) {
data[j][0][i] = new HDSPMixerStripData();
data[j][1][i] = new HDSPMixerStripData();
}
}
mutesolo = new HDSPMixerMuteSolo(x+3, y+3, 0, 0, channel_num, type);
gain = new HDSPMixerGain(x+3, y+207, 1);
peak = new HDSPMixerPeak(x+3, y+36, 1);
fader = new HDSPMixerFader(x+4, y+51, 32768.0, channel_num, type);
pan = new HDSPMixerPan(x+3, y+19, channel_num, type) ;
targets = new HDSPMixerSelector(x+3, y+240, 29, 10);
meter = new HDSPMixerMeter(x+20, y+59, true, peak);
end();
}
void HDSPMixerIOMixer::draw_background()
{
draw_background(x(), y(), w(), h());
}
void HDSPMixerIOMixer::draw_background(int xpos, int ypos, int w, int h)
{
fl_push_clip(xpos, ypos, w, h);
fl_draw_pixmap(iomixer_xpm, x(), y());
fl_pop_clip();
}
void HDSPMixerIOMixer::draw()
{
Fl_Widget *const* a = array();
if (damage() & ~FL_DAMAGE_CHILD) {
draw_background();
fl_color(FL_BLACK);
fl_font(FL_HELVETICA, 8);
fl_draw(channel_name, x()+4, y()+225, 27, 9, FL_ALIGN_CENTER);
for (int i=children(); i--;) {
Fl_Widget& o = **a++;
draw_child(o);
}
} else {
for (int i=children(); i--;) update_child(**a++);
}
}
void HDSPMixerIOMixer::update_child(Fl_Widget& widget)
{
if (widget.damage() && widget.visible() && widget.type() < FL_WINDOW && fl_not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
if ((HDSPMixerMeter*)&widget == meter) {
((HDSPMixerMeter *)&widget)->fine_draw = 1;
} else {
draw_background(widget.x(), widget.y(), widget.w(), widget.h());
}
widget.draw();
widget.clear_damage();
}
}

View file

@ -0,0 +1,73 @@
/*
* HDSPMixer
*
* 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 HDSPMixerIOMixer_H
#define HDSPMixerIOMixer_H
#include <FL/Fl.H>
#include <FL/Fl_Group.H>
#include <FL/fl_draw.H>
#include <stdio.h>
#include "HDSPMixerWindow.h"
#include "HDSPMixerSelector.h"
#include "HDSPMixerPan.h"
#include "HDSPMixerFader.h"
#include "HDSPMixerGain.h"
#include "HDSPMixerPeak.h"
#include "HDSPMixerMuteSolo.h"
#include "HDSPMixerStripData.h"
#include "HDSPMixerMeter.h"
#include "pixmaps.h"
class HDSPMixerWindow;
class HDSPMixerSelector;
class HDSPMixerPan;
class HDSPMixerFader;
class HDSPMixerGain;
class HDSPMixerPeak;
class HDSPMixerMuteSolo;
class HDSPMixerStripData;
class HDSPMixerMeter;
class HDSPMixerIOMixer:public Fl_Group
{
private:
int channel_num, relative_num, mixer_type;
char channel_name[6];
void update_child(Fl_Widget &widget);
public:
HDSPMixerStripData *data[3][2][8]; /* data[card][mode(ds/ss)][preset number] */
HDSPMixerPan *pan;
HDSPMixerFader *fader;
HDSPMixerPeak *peak;
HDSPMixerGain *gain;
HDSPMixerMuteSolo *mutesolo;
HDSPMixerSelector *targets;
HDSPMixerMeter *meter;
HDSPMixerIOMixer(int x, int y, int w, int h, int channelnum, int type);
void draw();
void draw_background();
void draw_background(int x, int y, int w, int h);
void register_relatives();
};
#endif

View file

@ -0,0 +1,46 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerInputs.h"
HDSPMixerInputs::HDSPMixerInputs(int x, int y, int w, int h, int nchans):Fl_Group(x, y, w, h)
{
int i;
for (i = 0; i < HDSP_MAX_CHANNELS; i += 2) {
strips[i] = new HDSPMixerIOMixer((i*STRIP_WIDTH), y, STRIP_WIDTH, FULLSTRIP_HEIGHT, i+1, 0);
strips[i+1] = new HDSPMixerIOMixer(((i+1)*STRIP_WIDTH), y, STRIP_WIDTH, FULLSTRIP_HEIGHT, i+2, 0);
/* Setup stereo channel links */
strips[i]->pan->relative = strips[i+1]->pan;
strips[i+1]->pan->relative = strips[i]->pan;
strips[i]->mutesolo->relative = strips[i+1]->mutesolo;
strips[i+1]->mutesolo->relative = strips[i]->mutesolo;
strips[i]->fader->relative = strips[i+1]->fader;
strips[i+1]->fader->relative = strips[i]->fader;
strips[i]->fader->gain = strips[i]->gain;
strips[i+1]->fader->gain = strips[i+1]->gain;
strips[i]->gain->relative = strips[i+1]->gain;
strips[i+1]->gain->relative = strips[i]->gain;
}
buttons = new HDSPMixerButtons(nchans*STRIP_WIDTH, y, 2*STRIP_WIDTH, FULLSTRIP_HEIGHT);
end();
resizable(NULL);
}

View file

@ -0,0 +1,41 @@
/*
* HDSPMixer
*
* 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 HDSPMixerInputs_H
#define HDSPMixerInputs_H
#include <FL/Fl_Group.H>
#include "HDSPMixerIOMixer.h"
#include "HDSPMixerButtons.h"
class HDSPMixerButtons;
class HDSPMixerIOMixer;
class HDSPMixerInputs:public Fl_Group
{
public:
HDSPMixerButtons *buttons;
HDSPMixerIOMixer *strips[26];
HDSPMixerInputs(int x, int y, int w, int h, int nchannels);
};
#endif

View file

@ -0,0 +1,93 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerMaster.h"
HDSPMixerMaster::HDSPMixerMaster(int x, int y, int w, int h):Fl_Widget(x, y, 62, 12)
{
basew = (HDSPMixerWindow *)window();
solo = mute = solo_active = mute_active = 0;
}
void HDSPMixerMaster::draw()
{
if (mute && mute_active) {
fl_push_clip(x(), y(), 29, 10);
fl_draw_pixmap(b_mute_xpm, x(), y());
fl_pop_clip();
} else if (mute) {
fl_push_clip(x(), y(), 29, 10);
fl_draw_pixmap(b_mute_xpm, x(), y()-10);
fl_pop_clip();
}
if (solo && solo_active) {
fl_push_clip(x()+32, y(), 29, 10);
fl_draw_pixmap(b_solo_xpm, x()+32, y());
fl_pop_clip();
} else if (solo) {
fl_push_clip(x()+32, y(), 29, 10);
fl_draw_pixmap(b_solo_xpm, x()+32, y()-10);
fl_pop_clip();
}
}
int HDSPMixerMaster::handle(int e)
{
int xpos = Fl::event_x()-x();
int ypos = Fl::event_y()-y();
switch (e) {
case FL_PUSH:
if (xpos >= 0 && xpos <= 29) {
if (mute) {
mute = 0;
} else {
mute = 1;
}
for (int i = 0; i < basew->cards[basew->current_card]->channels; i++) {
basew->inputs->strips[i]->mutesolo->redraw();
basew->playbacks->strips[i]->mutesolo->redraw();
}
basew->refreshMixer();
redraw();
basew->checkState();
return 1;
}
if (xpos >= 32) {
if (solo) {
solo = 0;
} else {
solo = 1;
}
for (int i = 0; i < basew->cards[basew->current_card]->channels; i++) {
basew->inputs->strips[i]->mutesolo->redraw();
basew->playbacks->strips[i]->mutesolo->redraw();
}
basew->refreshMixer();
redraw();
basew->checkState();
return 1;
}
default:
return Fl_Widget::handle(e);
}
}

View file

@ -0,0 +1,45 @@
/*
* HDSPMixer
*
* 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 HDSPMixerMaster_H
#define HDSPMixerMaster_H
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "HDSPMixerWindow.h"
#include "pixmaps.h"
class HDSPMixerWindow;
class HDSPMixerMaster:public Fl_Widget
{
private:
HDSPMixerWindow *basew;
public:
int solo, mute, solo_active, mute_active;
HDSPMixerMaster(int x, int y, int w, int h);
void draw();
int handle(int e);
};
#endif

View file

@ -0,0 +1,193 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerMeter.h"
HDSPMixerMeter::HDSPMixerMeter(int x, int y, bool not_output, HDSPMixerPeak *p):Fl_Widget(x, y, 8, METER_HEIGHT)
{
basew = (HDSPMixerWindow *)window();
count = 0;
fine_draw = 0;
peaktext = p;
new_peak_height = peak_height = 0;
new_rms_height = rms_height = 0;
fast_peak_level = 1000.0;
slow_peak_level = 1000.0;
max_level = 1000.0;
peak_rms = not_output;
}
void HDSPMixerMeter::draw()
{
if (!fine_draw) {
fl_push_clip(x(), y()+(METER_HEIGHT-new_rms_height), w(), new_rms_height);
fl_draw_pixmap(level_xpm, x(), y());
fl_pop_clip();
} else {
if (new_rms_height > rms_height) {
fl_push_clip(x(), y()+(METER_HEIGHT-new_rms_height), w(), new_rms_height-rms_height);
fl_draw_pixmap(level_xpm, x(), y());
fl_pop_clip();
} else if (new_rms_height < rms_height) {
fl_push_clip(x(), y()+(METER_HEIGHT-rms_height), w(), rms_height-new_rms_height);
if (peak_rms) {
fl_draw_pixmap(iomixer_xpm, x()-20, y()-59);
} else {
fl_draw_pixmap(output_xpm, x()-20, y()-27);
}
fl_pop_clip();
}
}
rms_height = new_rms_height;
if ((new_peak_height != peak_height || !fine_draw) && peak_rms) {
if ((rms_height <= (peak_height - PEAK_HEIGHT)) || rms_height == 0) {
fl_push_clip(x(), y()+(METER_HEIGHT - peak_height), w(), PEAK_HEIGHT+1);
if (peak_rms) {
fl_draw_pixmap(iomixer_xpm, x()-20, y()-59);
} else {
fl_draw_pixmap(output_xpm, x()-20, y()-27);
}
fl_pop_clip();
} else if (rms_height >= peak_height) {
fl_push_clip(x(), y()+(METER_HEIGHT - peak_height), w(), PEAK_HEIGHT+1);
fl_draw_pixmap(level_xpm, x(), y());
fl_pop_clip();
} else {
fl_push_clip(x(), y()+(METER_HEIGHT - peak_height), w(), peak_height - rms_height);
if (peak_rms) {
fl_draw_pixmap(iomixer_xpm, x()-20, y()-59);
} else {
fl_draw_pixmap(output_xpm, x()-20, y()-27);
}
fl_pop_clip();
fl_push_clip(x(), y()+(METER_HEIGHT - peak_height)+(peak_height - rms_height), w(), PEAK_HEIGHT - (peak_height - rms_height));
fl_draw_pixmap(level_xpm, x(), y());
fl_pop_clip();
}
if (new_peak_height > 0) {
fl_push_clip(x(), y()+(METER_HEIGHT-new_peak_height), w(), ((new_peak_height > METER_HEIGHT) ? METER_HEIGHT : new_peak_height));
fl_draw_pixmap(peak_xpm, x(), y()+(METER_HEIGHT-new_peak_height));
fl_pop_clip();
}
peak_height = new_peak_height;
}
fine_draw = 0;
}
int HDSPMixerMeter::logToHeight(double db)
{
double x;
int h;
double max_db;
max_db = basew->setup->level_val ? 60.0 : 40.0;
if (db < max_db) {
x = (db /max_db) * double(METER_HEIGHT);
h = METER_HEIGHT - (int)x;
} else {
h = 0;
}
if (h < 0) h = 0;
return h;
}
void HDSPMixerMeter::update(int peak, int overs, int64 rms)
{
int p;
double fp, fr, db;
int over = 0;
if (!visible()) return;
count++;
if (overs >= basew->setup->over_val) {
over = 1;
}
peak >>= 8;
peak &= 0x7FFFFF;
if (peak != 0) {
fp = (double)peak / (double)(0x7FFFFF);
db = -20 * log10(fp);
} else {
db = 1000.0;
}
switch (basew->setup->rate_val) {
case 0:
fast_peak_level += 0.030 * 8.3;
break;
case 1:
fast_peak_level += 0.030 * 15;
break;
case 2:
fast_peak_level += 0.030 * 23.7;
break;
}
if (fast_peak_level > 138.47) fast_peak_level = 1000.0;
if (db > fast_peak_level)
db = fast_peak_level;
else
fast_peak_level = db;
new_peak_height = logToHeight(db);
fr = (double)rms;
fr /= ((double)(1125899638407184.0)*(double)(8191.0));
fr = sqrt(fr);
if (!peak_rms) {
new_rms_height = new_peak_height;
} else {
fr = -20 * log10(fr);
if (basew->setup->rmsplus3_val) {
fr -= 3.010299957;
if (fr < 0.0) fr = 0.0;
}
if (basew->setup->numbers_val == 0) db = fr;
new_rms_height = logToHeight(fr);
}
if (new_rms_height != rms_height || (new_peak_height != peak_height && peak_rms)) {
/* FIXME: may not be SMP safe */
redraw();
}
if (db < max_level) max_level = db;
if (count > 15 || over) {
count = 0;
if (max_level != slow_peak_level) {
peaktext->update(max_level, over);
slow_peak_level = max_level;
}
max_level = 1000.0;
}
}

View file

@ -0,0 +1,52 @@
/*
* HDSPMixer
*
* 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 HDSPMixerMeter_H
#define HDSPMixerMeter_H
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.h>
#include "HDSPMixerWindow.h"
#include "HDSPMixerPeak.h"
#include "pixmaps.h"
#include "defines.h"
class HDSPMixerWindow;
class HDSPMixerPeak;
class HDSPMixerMeter:public Fl_Widget
{
private:
HDSPMixerWindow *basew;
HDSPMixerPeak *peaktext;
int logToHeight(double db);
double fast_peak_level, max_level, slow_peak_level;
bool peak_rms;
int peak_height, rms_height, count, new_peak_height, new_rms_height;
public:
int fine_draw;
void draw();
void update(int peak, int overs, int64 rms);
HDSPMixerMeter(int x, int y, bool not_output, HDSPMixerPeak *p);
};
#endif

View file

@ -0,0 +1,137 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerMuteSolo.h"
HDSPMixerMuteSolo::HDSPMixerMuteSolo(int x, int y, int muteinit, int soloinit, int idx, int src):Fl_Widget(x, y, 30, 13)
{
basew = (HDSPMixerWindow *)window();
source = src;
index = idx;
mute = muteinit;
solo = soloinit;
}
void HDSPMixerMuteSolo::draw()
{
int gmute = basew->inputs->buttons->master->mute;
int gsolo = basew->inputs->buttons->master->solo;
int gsolo_active = basew->inputs->buttons->master->solo_active;
if (solo && gsolo) {
fl_push_clip(x()+17, y(), 13, 13);
fl_draw_pixmap(solo_xpm, x()+17, y());
fl_pop_clip();
} else if (solo) {
fl_push_clip(x()+17, y(), 13, 13);
fl_draw_pixmap(solo_xpm, x()+17, y()-13);
fl_pop_clip();
}
if (((mute && gmute) || (gsolo && gsolo_active)) && !(solo && gsolo)) {
fl_push_clip(x(), y(), 13, 13);
fl_draw_pixmap(mute_xpm, x(), y());
fl_pop_clip();
} else if (mute) {
fl_push_clip(x(), y(), 13, 13);
fl_draw_pixmap(mute_xpm, x(), y()-13);
fl_pop_clip();
}
}
void HDSPMixerMuteSolo::setMute(int m)
{
if (m != mute) {
mute = m;
if (mute) {
basew->inputs->buttons->master->mute_active++;
} else {
basew->inputs->buttons->master->mute_active--;
}
basew->refreshMixerStrip(index, source);
redraw();
}
}
void HDSPMixerMuteSolo::setSolo(int s)
{
if (s != solo) {
solo = s;
if (solo) {
basew->inputs->buttons->master->solo_active++;
} else {
basew->inputs->buttons->master->solo_active--;
}
basew->refreshMixer();
redraw_all();
}
}
int HDSPMixerMuteSolo::handle(int e)
{
int button3 = Fl::event_button3();
int xpos = Fl::event_x()-x();
switch (e) {
case FL_PUSH:
if (xpos < 13) {
if (mute) {
mute = 0;
basew->inputs->buttons->master->mute_active--;
} else {
mute = 1;
basew->inputs->buttons->master->mute_active++;
}
basew->inputs->buttons->master->redraw();
basew->refreshMixerStrip(index, source);
redraw();
if (button3)
relative->setMute(mute);
} else if (xpos > 16) {
if (solo) {
solo = 0;
basew->inputs->buttons->master->solo_active--;
} else {
solo = 1;
basew->inputs->buttons->master->solo_active++;
}
basew->inputs->buttons->master->redraw();
redraw();
basew->refreshMixerStrip(index, source);
if (button3) {
relative->setSolo(solo);
} else {
basew->refreshMixer();
redraw_all();
}
}
basew->checkState();
return 1;
default:
return Fl_Widget::handle(e);
}
}
void HDSPMixerMuteSolo::redraw_all()
{
for (int i = 0; i < (basew->cards[basew->current_card]->channels); ++i) {
basew->inputs->strips[i]->mutesolo->redraw();
basew->playbacks->strips[i]->mutesolo->redraw();
}
}

View file

@ -0,0 +1,48 @@
/*
* HDSPMixer
*
* 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 HDSPMixerMuteSolo_H
#define HDSPMixerMuteSolo_H
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include "HDSPMixerWindow.h"
#include "pixmaps.h"
class HDSPMixerWindow;
class HDSPMixerMuteSolo:public Fl_Widget
{
private:
HDSPMixerWindow *basew;
public:
HDSPMixerMuteSolo *relative;
int solo, mute, index, source;
HDSPMixerMuteSolo(int x, int y, int m, int s, int idx, int src);
void draw();
int handle(int e);
void setSolo(int s);
void setMute(int m);
void redraw_all();
};
#endif

View file

@ -0,0 +1,98 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerOutput.h"
HDSPMixerOutput::HDSPMixerOutput(int x, int y, int w, int h, int num):Fl_Group(x, y, w, h)
{
for (int j = 0; j < 3; ++j) {
for (int i = 0; i < 8; ++i) {
data[j][0][i] = new HDSPMixerOutputData();
data[j][1][i] = new HDSPMixerOutputData();
}
}
basew = (HDSPMixerWindow *)window();
setLabels();
out_num = num;
fader = new HDSPMixerFader(x+4, y+19, 65535.0, out_num+1, 2);
peak = new HDSPMixerPeak(x+3, y+4, 0);
gain = new HDSPMixerGain(x+3, y+175, 0);
meter = new HDSPMixerMeter(x+20, y+27, false, peak);
end();
}
void HDSPMixerOutput::setLabels()
{
HDSP_IO_Type type = basew->cards[basew->current_card]->type;
int ds = basew->cards[basew->current_card]->double_speed;
if (type == Multiface && !ds) {
labels = labels_mf_ss;
} else if (type == Multiface && ds) {
labels = labels_mf_ds;
} else if (!ds) {
labels = labels_df_ss;
} else if (ds) {
labels = labels_df_ds;
}
}
void HDSPMixerOutput::draw_background()
{
draw_background(x(), y(), w(), h());
}
void HDSPMixerOutput::draw_background(int xpos, int ypos, int w, int h)
{
fl_push_clip(xpos, ypos, w, h);
fl_draw_pixmap(output_xpm, x(), y());
fl_pop_clip();
}
void HDSPMixerOutput::draw()
{
Fl_Widget*const* a = array();
if (damage() & ~FL_DAMAGE_CHILD) {
draw_background();
fl_color(FL_BLACK);
fl_font(FL_HELVETICA, 8);
fl_draw(labels[out_num], x()+4, y()+193, 27, 9, FL_ALIGN_CENTER);
for (int i=children(); i--;) {
Fl_Widget& o = **a++;
draw_child(o);
}
} else {
for (int i=children(); i--;) update_child(**a++);
}
}
void HDSPMixerOutput::update_child(Fl_Widget& widget) {
if (widget.damage() && widget.visible() && widget.type() < FL_WINDOW && fl_not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
if ((HDSPMixerMeter *)&widget == meter) {
((HDSPMixerMeter *)&widget)->fine_draw = 1;
} else {
draw_background(widget.x(), widget.y(), widget.w(), widget.h());
}
widget.draw();
widget.clear_damage();
}
}

View file

@ -0,0 +1,91 @@
/*
* HDSPMixer
*
* 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 HDSPMixerOutput_H
#define HDSPMixerOutput_H
#include <FL/Fl.H>
#include <FL/Fl_Group.H>
#include <FL/fl_draw.H>
#include <sound/hdsp.h>
#include "HDSPMixerFader.h"
#include "HDSPMixerPeak.h"
#include "HDSPMixerGain.h"
#include "HDSPMixerMeter.h"
#include "HDSPMixerOutputData.h"
#include "HDSPMixerWindow.h"
#include "pixmaps.h"
class HDSPMixerFader;
class HDSPMixerGain;
class HDSPMixerPeak;
class HDSPMixerMeter;
class HDSPMixerOutputData;
class HDSPMixerWindow;
static char *labels_mf_ss[20] = {
"AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6", "AN 7", "AN 8",
"A 1", "A 2", "A 3", "A 4", "A 5", "A 6", "A 7", "A 8",
"SP.L", "SP.R", "AN.L", "AN.R"
};
static char *labels_mf_ds[16] = {
"AN 1", "AN 2", "AN 3", "AN 4", "AN 5", "AN 6", "AN 7", "AN 8",
"A 1", "A 2", "A 3", "A 4",
"SP.L", "SP.R", "AN.L", "AN.R"
};
static char *labels_df_ss[28] = {
"A1 1", "A1 2", "A1 3", "A1 4", "A1 5", "A1 6", "A1 7", "A1 8",
"A2 1", "A2 2", "A2 3", "A2 4", "A2 5", "A2 6", "A2 7", "A2 8",
"A3 1", "A3 2", "A3 3", "A3 4", "A3 5", "A3 6", "A3 7", "A3 8",
"SP.L", "SP.R", "AN.L", "AN.R"
};
static char *labels_df_ds[16] = {
"A1 1", "A1 2", "A1 3", "A1 4",
"A2 1", "A2 2", "A2 3", "A2 4",
"A3 1", "A3 2", "A3 3", "A3 4",
"SP.L", "SP.R", "AN.L", "AN.R"
};
class HDSPMixerOutput:public Fl_Group
{
private:
int out_num;
char **labels;
HDSPMixerPeak *peak;
HDSPMixerWindow *basew;
void update_child(Fl_Widget& widget);
public:
HDSPMixerOutputData *data[3][2][8]; /* data[card][mode(ds/ss)][preset number] */
HDSPMixerFader *fader;
HDSPMixerGain *gain;
HDSPMixerMeter *meter;
HDSPMixerOutput(int x, int y, int w, int h, int out);
void draw();
void draw_background();
void draw_background(int x, int y, int w, int h);
void setLabels();
};
#endif

View file

@ -0,0 +1,28 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerOutputData.h"
HDSPMixerOutputData::HDSPMixerOutputData()
{
fader_pos = 0;
}

View file

@ -0,0 +1,33 @@
/*
* HDSPMixer
*
* 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 HDSPMixerOutputData_H
#define HDSPMixerOutputData_H
class HDSPMixerOutputData
{
public:
int fader_pos;
HDSPMixerOutputData();
};
#endif

View file

@ -0,0 +1,40 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerOutputs.h"
HDSPMixerOutputs::HDSPMixerOutputs(int x, int y, int w, int h, int nchans):Fl_Group(x, y, w, h)
{
int i;
for (i = 0; i < HDSP_MAX_CHANNELS+2; i += 2) {
strips[i] = new HDSPMixerOutput((i*STRIP_WIDTH), y, STRIP_WIDTH, SMALLSTRIP_HEIGHT, i);
strips[i+1] = new HDSPMixerOutput(((i+1)*STRIP_WIDTH), y, STRIP_WIDTH, SMALLSTRIP_HEIGHT, i+1);
/* Setup linked stereo channels */
strips[i]->fader->relative = strips[i+1]->fader;
strips[i+1]->fader->relative = strips[i]->fader;
strips[i]->fader->gain = strips[i]->gain;
strips[i+1]->fader->gain = strips[i+1]->gain;
}
empty = new HDSPMixerEmpty(nchans*STRIP_WIDTH, y, 2*STRIP_WIDTH, SMALLSTRIP_HEIGHT, 0);
end();
resizable(NULL);
}

View file

@ -0,0 +1,42 @@
/*
* HDSPMixer
*
* 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 HDSPMixerOutputs_H
#define HDSPMixerOutputs_H
#include <FL/Fl_Group.H>
#include "HDSPMixerOutput.h"
#include "HDSPMixerEmpty.h"
#include "defines.h"
class HDSPMixerOutput;
class HDSPMixerEmpty;
class HDSPMixerOutputs:public Fl_Group
{
public:
HDSPMixerEmpty *empty;
HDSPMixerOutput *strips[28];
HDSPMixerOutputs(int x, int y, int w, int h, int nchannels);
};
#endif

View file

@ -0,0 +1,146 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerPan.h"
HDSPMixerPan::HDSPMixerPan(int x, int y, int id, int src):Fl_Widget(x, y, 30, 13)
{
source = src;
index = id;
basew = (HDSPMixerWindow *)window();
dest = x_orig = shift_orig = lastpos = lastx = drag = 0;
for (int i = 0; i < 14; i++) {
pos[i] = 0;
}
}
void HDSPMixerPan::draw()
{
fl_draw_pixmap(Slider2_xpm, x()+(int)(pos[dest]/CF), y());
}
int HDSPMixerPan::handle(int e)
{
int button3 = Fl::event_button3();
int shift = Fl::event_shift();
int ctrl = Fl::event_ctrl();
int xpos = Fl::event_x()-x();
int ypos = Fl::event_y()-y();
switch (e) {
case FL_PUSH:
if (xpos > 0 && xpos < 30) {
if (ctrl) {
pos[dest] = 14*CF;
} else {
pos[dest] = (xpos-1)*CF;
}
if (lastx != (int)(pos[dest]/CF)) {
redraw();
lastx = (int)(pos[dest]/CF);
}
if (lastpos != pos[dest]) {
basew->setMixer(index, source, dest);
sendText();
lastpos = pos[dest];
}
if (button3) relative->set(28*CF-pos[dest]);
shift_orig = pos[dest];
x_orig = xpos;
basew->checkState();
}
return 1;
case FL_DRAG:
if (ctrl) {
pos[dest] = 14*CF;
shift_orig = pos[dest];
x_orig = xpos;
} else if ((xpos > 0 && xpos < 30) || drag) {
drag = 1;
if (shift) {
pos[dest] = ((xpos-1)-x_orig)+shift_orig;
if (pos[dest] < 0) pos[dest] = 0;
if (pos[dest] > 28*CF) pos[dest] = 28*CF;
} else {
if (xpos < 1) {
pos[dest] = 0;
} else if (xpos > 29) {
pos[dest] = 28*CF;
} else {
pos[dest] = (xpos-1)*CF;
}
shift_orig = pos[dest];
x_orig = xpos;
}
}
if (lastpos != pos[dest]) {
basew->setMixer(index, source, dest);
sendText();
lastpos = pos[dest];
}
if (lastx != (int)(pos[dest]/CF)) {
redraw();
lastx = (int)(pos[dest]/CF);
}
if (button3) relative->set(28*CF-pos[dest]);
basew->checkState();
return 1;
case FL_RELEASE:
drag = 0;
return 1;
default :
return Fl_Widget::handle(e);
}
}
void HDSPMixerPan::panToText(char *s)
{
double x;
x = (double)pos[dest] / (double)(28*CF);
if (pos[dest] < 28*CF/2) {
x = 1.0 - x;
snprintf(s, 10, "L %.2f", x);
} else if (pos[dest] > 28*CF/2) {
snprintf(s, 10, "R %.2f", x);
} else {
snprintf(s, 10, "<C>");
}
}
void HDSPMixerPan::sendText() {
char buf[10];
panToText(buf);
((HDSPMixerIOMixer *)parent())->gain->setText(buf);
}
void HDSPMixerPan::set(int p)
{
if (pos[dest] != p) {
pos[dest] = lastpos = p;
basew->setMixer(index, source, dest);
sendText();
}
if (lastx != (int)(pos[dest]/CF)) {
lastx = (int)(pos[dest]/CF);
redraw();
}
}

View file

@ -0,0 +1,55 @@
/*
* HDSPMixer
*
* 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 HDSPMixerPan_H
#define HDSPMixerPan_H
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "HDSPMixerIOMixer.h"
#include "HDSPMixerWindow.h"
#include "pixmaps.h"
class HDSPMixerIOMixer;
class HDSPMixerWindow;
class HDSPMixerPan:public Fl_Widget
{
private:
int drag, shift_orig, x_orig, lastpos, lastx;
void sendText();
void panToText(char *s);
public:
int pos[14];
int dest;
int index;
int source;
HDSPMixerWindow *basew;
HDSPMixerPan *relative;
HDSPMixerPan(int x, int y, int id, int src);
int handle(int e);
void draw();
void set(int pos);
};
#endif

View file

@ -0,0 +1,59 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerPeak.h"
HDSPMixerPeak::HDSPMixerPeak(int x, int y, int parenttype):Fl_Widget(x, y, 30, 13)
{
parent_iomixer = parenttype;
over = 0;
snprintf(text, 10, "-oo");
}
void HDSPMixerPeak::draw()
{
if (over) {
fl_draw_pixmap(over_xpm, x(), y());
}
fl_color(FL_GREEN);
fl_font(FL_HELVETICA, 8);
fl_draw(text, x(), y(), w(), h(), FL_ALIGN_CENTER);
}
void HDSPMixerPeak::update(double maxlevel, int ovr) {
if (ovr) {
snprintf(text, 10, "Ovr");
over = 1;
} else {
over = 0;
if (maxlevel <= 0.001) {
snprintf(text, 10, "0.00");
} else if (maxlevel == 1000.0) {
snprintf(text, 10, "-oo");
} else if (maxlevel >= 100.0) {
snprintf(text, 10, "-%.1f", maxlevel);
} else {
snprintf(text, 10, "-%.2f", maxlevel);
}
}
redraw();
}

View file

@ -0,0 +1,45 @@
/*
* HDSPMixer
*
* 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 HDSPMixerPeak_H
#define HDSPMixerPeak_H
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "HDSPMixerIOMixer.h"
#include "HDSPMixerOutput.h"
class HDSPMixerIOMixer;
class HDSPMixerOutput;
class HDSPMixerPeak:public Fl_Widget
{
private:
int parent_iomixer, over;
char text[10];
public:
HDSPMixerPeak(int x, int y, int parenttype);
void draw();
void update(double maxlevel, int over);
};
#endif

View file

@ -0,0 +1,46 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerPlaybacks.h"
HDSPMixerPlaybacks::HDSPMixerPlaybacks(int x, int y, int w, int h, int nchans):Fl_Group(x, y, w, h)
{
int i;
for (i = 0; i < HDSP_MAX_CHANNELS; i += 2) {
strips[i] = new HDSPMixerIOMixer((i*STRIP_WIDTH), y, STRIP_WIDTH, FULLSTRIP_HEIGHT, i+1, 1);
strips[i+1] = new HDSPMixerIOMixer(((i+1)*STRIP_WIDTH), y, STRIP_WIDTH, FULLSTRIP_HEIGHT, i+2, 1);
/* Setup linked stereo channels */
strips[i]->pan->relative = strips[i+1]->pan;
strips[i+1]->pan->relative = strips[i]->pan;
strips[i]->mutesolo->relative = strips[i+1]->mutesolo;
strips[i+1]->mutesolo->relative = strips[i]->mutesolo;
strips[i]->fader->relative = strips[i+1]->fader;
strips[i+1]->fader->relative = strips[i]->fader;
strips[i]->fader->gain = strips[i]->gain;
strips[i+1]->fader->gain = strips[i+1]->gain;
strips[i]->gain->relative = strips[i+1]->gain;
strips[i+1]->gain->relative = strips[i]->gain;
}
empty = new HDSPMixerEmpty(nchans*STRIP_WIDTH, y, 2*STRIP_WIDTH, FULLSTRIP_HEIGHT, 1);
end();
resizable(NULL);
}

View file

@ -0,0 +1,41 @@
/*
* HDSPMixer
*
* 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 HDSPMixerPlaybacks_H
#define HDSPMixerPlaybacks_H
#include <FL/Fl_Group.H>
#include "HDSPMixerIOMixer.h"
#include "HDSPMixerEmpty.h"
class HDSPMixerEmpty;
class HDSPMixerIOMixer;
class HDSPMixerPlaybacks:public Fl_Group
{
public:
HDSPMixerEmpty *empty;
HDSPMixerIOMixer *strips[26];
HDSPMixerPlaybacks(int x, int y, int w, int h, int nchannels);
};
#endif

View file

@ -0,0 +1,40 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerPresetData.h"
HDSPMixerPresetData::HDSPMixerPresetData()
{
input = 1;
playback = 1;
output = 1;
submix = 1;
submix_value = 0;
mute = 0;
solo = 0;
last_destination = 0;
rmsplus3 = 0;
numbers = 0;
over = 3;
level = 0;
rate = 1;
}

View file

@ -0,0 +1,45 @@
/*
* HDSPMixer
*
* 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 HDSPMixerPresetData_H
#define HDSPMixerPresetData_H
class HDSPMixerPresetData
{
public:
int mute;
int solo;
int input;
int playback;
int output;
int submix;
int submix_value;
int last_destination;
int level;
int numbers;
int over;
int rate;
int rmsplus3;
HDSPMixerPresetData();
};
#endif

View file

@ -0,0 +1,259 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerPresets.h"
static void saving_cb(void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (w->inputs->buttons->presets->presetmask == 0 && w->dirty) {
w->inputs->buttons->presets->presetmask = (int)pow(2, w->inputs->buttons->presets->preset-1);
}
if (w->inputs->buttons->presets->saving) {
w->inputs->buttons->presets->presetmask = ~(w->inputs->buttons->presets->presetmask);
if (w->inputs->buttons->presets->save) {
w->inputs->buttons->presets->save = 0;
} else {
w->inputs->buttons->presets->save = 1;
}
Fl::add_timeout(0.3, saving_cb, arg);
} else {
w->inputs->buttons->presets->save = 0;
w->inputs->buttons->presets->presetmask = (int)pow(2, w->inputs->buttons->presets->preset-1);
}
w->inputs->buttons->presets->redraw();
}
HDSPMixerPresets::HDSPMixerPresets(int x, int y, int w, int h):Fl_Widget(x, y, 61, 52)
{
basew = (HDSPMixerWindow *)window();
preset = 1;
presetmask = PRE1;
save = 0;
saving = 0;
}
void HDSPMixerPresets::draw()
{
if (presetmask & PRE1) {
fl_draw_pixmap(b_pre1_xpm, x(), y());
}
if (presetmask & PRE2) {
fl_draw_pixmap(b_pre2_xpm, x()+16, y());
}
if (presetmask & PRE3) {
fl_draw_pixmap(b_pre3_xpm, x()+32, y());
}
if (presetmask & PRE4) {
fl_draw_pixmap(b_pre4_xpm, x()+48, y());
}
if (presetmask & PRE5) {
fl_draw_pixmap(b_pre5_xpm, x(), y()+20);
}
if (presetmask & PRE6) {
fl_draw_pixmap(b_pre6_xpm, x()+16, y()+20);
}
if (presetmask & PRE7) {
fl_draw_pixmap(b_pre7_xpm, x()+32, y()+20);
}
if (presetmask & PRE8) {
fl_draw_pixmap(b_pre8_xpm, x()+48, y()+20);
}
if (save) {
fl_draw_pixmap(b_save_xpm, x(), y()+39);
}
}
int HDSPMixerPresets::handle(int e)
{
int xpos = Fl::event_x()-x();
int ypos = Fl::event_y()-y();
switch (e) {
case FL_PUSH:
if (ypos < 13 && xpos < 13) {
preset_change(1);
} else if (xpos > 15 && xpos < 29 && ypos < 13) {
preset_change(2);
} else if (xpos > 31 && xpos < 45 && ypos < 13) {
preset_change(3);
} else if (xpos > 47 && ypos < 13) {
preset_change(4);
} else if (ypos > 19 && ypos < 33 && xpos < 13) {
preset_change(5);
} else if (ypos > 19 && ypos < 33 && xpos > 15 && xpos < 29) {
preset_change(6);
} else if (ypos > 19 && ypos < 33 && xpos > 31 && xpos < 45) {
preset_change(7);
} else if (ypos > 19 && ypos < 33 && xpos > 47) {
preset_change(8);
} else if (xpos < 12 && ypos > 38) {
if (saving) {
saving = 0;
save = 0;
} else {
saving = 1;
save = 1;
Fl::add_timeout(0.3, saving_cb, (void *)basew);
}
redraw();
}
return 1;
default:
return Fl_Widget::handle(e);
}
}
void HDSPMixerPresets::save_preset(int prst) {
int speed = basew->cards[basew->current_card]->double_speed;
int card = basew->current_card;
int p = prst-1;
basew->dirty = 0;
for (int i = 0; i < HDSP_MAX_CHANNELS; i++) {
for (int z = 0; z < HDSP_MAX_DEST; z++) {
basew->inputs->strips[i]->data[card][speed][p]->pan_pos[z] = basew->inputs->strips[i]->pan->pos[z];
basew->inputs->strips[i]->data[card][speed][p]->fader_pos[z] = basew->inputs->strips[i]->fader->pos[z];
basew->playbacks->strips[i]->data[card][speed][p]->pan_pos[z] = basew->playbacks->strips[i]->pan->pos[z];
basew->playbacks->strips[i]->data[card][speed][p]->fader_pos[z] = basew->playbacks->strips[i]->fader->pos[z];
}
basew->inputs->strips[i]->data[card][speed][p]->mute = basew->inputs->strips[i]->mutesolo->mute;
basew->inputs->strips[i]->data[card][speed][p]->solo = basew->inputs->strips[i]->mutesolo->solo;
basew->inputs->strips[i]->data[card][speed][p]->dest = basew->inputs->strips[i]->targets->selected;
basew->playbacks->strips[i]->data[card][speed][p]->mute = basew->playbacks->strips[i]->mutesolo->mute;
basew->playbacks->strips[i]->data[card][speed][p]->solo = basew->playbacks->strips[i]->mutesolo->solo;
basew->playbacks->strips[i]->data[card][speed][p]->dest = basew->playbacks->strips[i]->targets->selected;
basew->outputs->strips[i]->data[card][speed][p]->fader_pos = basew->outputs->strips[i]->fader->pos[0];
}
/* Line outs */
basew->outputs->strips[HDSP_MAX_CHANNELS]->data[card][speed][p]->fader_pos = basew->outputs->strips[HDSP_MAX_CHANNELS]->fader->pos[0];
basew->outputs->strips[HDSP_MAX_CHANNELS+1]->data[card][speed][p]->fader_pos = basew->outputs->strips[HDSP_MAX_CHANNELS+1]->fader->pos[0];
/* Global settings */
basew->data[card][speed][p]->input = basew->inputs->buttons->view->input;
basew->data[card][speed][p]->output = basew->inputs->buttons->view->output;
basew->data[card][speed][p]->playback = basew->inputs->buttons->view->playback;
basew->data[card][speed][p]->submix = basew->inputs->buttons->view->submix;
basew->data[card][speed][p]->submix_value = basew->inputs->buttons->view->submix_value;
basew->data[card][speed][p]->solo = basew->inputs->buttons->master->solo;
basew->data[card][speed][p]->mute = basew->inputs->buttons->master->mute;
basew->data[card][speed][p]->over = basew->setup->over_val;
basew->data[card][speed][p]->rate = basew->setup->rate_val;
basew->data[card][speed][p]->level = basew->setup->level_val;
basew->data[card][speed][p]->numbers = basew->setup->numbers_val;
basew->data[card][speed][p]->rmsplus3 = basew->setup->rmsplus3_val;
}
void HDSPMixerPresets::restore_preset(int prst) {
int speed = basew->cards[basew->current_card]->double_speed;
int card = basew->current_card;
int p = prst-1;
basew->dirty = 0;
basew->inputs->buttons->master->solo_active = 0;
basew->inputs->buttons->master->mute_active = 0;
for (int i = 0; i < HDSP_MAX_CHANNELS; i++) {
for (int z = 0; z < HDSP_MAX_DEST; z++) {
basew->inputs->strips[i]->pan->pos[z] = basew->inputs->strips[i]->data[card][speed][p]->pan_pos[z];
basew->inputs->strips[i]->fader->pos[z] = basew->inputs->strips[i]->data[card][speed][p]->fader_pos[z];
basew->playbacks->strips[i]->pan->pos[z] = basew->playbacks->strips[i]->data[card][speed][p]->pan_pos[z];
basew->playbacks->strips[i]->fader->pos[z] = basew->playbacks->strips[i]->data[card][speed][p]->fader_pos[z];
}
basew->inputs->buttons->master->mute_active += (basew->inputs->strips[i]->mutesolo->mute = basew->inputs->strips[i]->data[card][speed][p]->mute);
basew->inputs->buttons->master->solo_active += (basew->inputs->strips[i]->mutesolo->solo = basew->inputs->strips[i]->data[card][speed][p]->solo);
basew->inputs->strips[i]->targets->selected = basew->inputs->strips[i]->data[card][speed][p]->dest;
basew->inputs->buttons->master->mute_active += (basew->playbacks->strips[i]->mutesolo->mute = basew->playbacks->strips[i]->data[card][speed][p]->mute);
basew->inputs->buttons->master->solo_active += (basew->playbacks->strips[i]->mutesolo->solo = basew->playbacks->strips[i]->data[card][speed][p]->solo);
basew->playbacks->strips[i]->targets->selected = basew->playbacks->strips[i]->data[card][speed][p]->dest;
basew->outputs->strips[i]->fader->pos[0] = basew->outputs->strips[i]->data[card][speed][p]->fader_pos;
}
/* Line outs */
basew->outputs->strips[HDSP_MAX_CHANNELS]->fader->pos[0] = basew->outputs->strips[HDSP_MAX_CHANNELS+1]->data[card][speed][p]->fader_pos;
basew->outputs->strips[HDSP_MAX_CHANNELS+1]->fader->pos[0] = basew->outputs->strips[HDSP_MAX_CHANNELS+1]->data[card][speed][p]->fader_pos;
for (int i = 0; i < basew->cards[card]->channels; ++i) {
basew->inputs->strips[i]->fader->sendGain();
basew->inputs->strips[i]->redraw();
basew->playbacks->strips[i]->fader->sendGain();
basew->playbacks->strips[i]->redraw();
basew->outputs->strips[i]->fader->sendGain();
basew->outputs->strips[i]->redraw();
}
basew->outputs->strips[basew->cards[card]->channels]->fader->sendGain();
basew->outputs->strips[basew->cards[card]->channels]->redraw();
basew->outputs->strips[basew->cards[card]->channels+1]->fader->sendGain();
basew->outputs->strips[basew->cards[card]->channels+1]->redraw();
/* Global settings */
basew->inputs->buttons->view->input = basew->data[card][speed][p]->input;
basew->inputs->buttons->view->output = basew->data[card][speed][p]->output;
basew->inputs->buttons->view->playback = basew->data[card][speed][p]->playback;
basew->inputs->buttons->view->submix = basew->data[card][speed][p]->submix;
basew->inputs->buttons->view->submix_value = basew->data[card][speed][p]->submix_value;
if (basew->inputs->buttons->view->submix) {
basew->setSubmix(basew->inputs->buttons->view->submix_value);
basew->menubar->mode(12, FL_MENU_TOGGLE|FL_MENU_VALUE);
} else {
basew->menubar->mode(12, FL_MENU_TOGGLE);
}
basew->inputs->buttons->master->solo = basew->data[card][speed][p]->solo;
basew->inputs->buttons->master->mute = basew->data[card][speed][p]->mute;
basew->inputs->buttons->redraw();
basew->reorder();
basew->setup->over_val = basew->data[card][speed][p]->over;
basew->setup->rate_val = basew->data[card][speed][p]->rate;
basew->setup->numbers_val = basew->data[card][speed][p]->numbers;
basew->setup->rmsplus3_val = basew->data[card][speed][p]->rmsplus3;
basew->setup->level_val = basew->data[card][speed][p]->level;
basew->setup->updateValues();
if (basew->inputs->buttons->view->submix) {
basew->setSubmix(basew->inputs->buttons->view->submix_value);
} else {
basew->unsetSubmix();
}
basew->refreshMixer();
#ifdef NON_MODAL_SETUP
if (basew->setup->shown()) {
basew->setup->redraw();
}
#endif
}
void HDSPMixerPresets::preset_change(int p) {
preset = p;
basew->current_preset = preset-1;
presetmask = (int)pow(2, preset-1);
if (saving) {
saving = 0;
save_preset(p);
} else {
restore_preset(p);
}
redraw();
}

View file

@ -0,0 +1,62 @@
/*
* HDSPMixer
*
* 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 HDSPMixerPresets_H
#define HDSPMixerPresets_H
#include <math.h>
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "HDSPMixerWindow.h"
#include "pixmaps.h"
class HDSPMixerWindow;
enum presets {
NONE = 0,
PRE1 = 1,
PRE2 = 2,
PRE3 = 4,
PRE4 = 8,
PRE5 = 16,
PRE6 = 32,
PRE7 = 64,
PRE8 = 128,
};
class HDSPMixerPresets:public Fl_Widget
{
private:
HDSPMixerWindow *basew;
public:
int preset, presetmask, save, saving;
HDSPMixerPresets(int x, int y, int w, int h);
void draw();
int handle(int e);
void restore_preset(int preset);
void save_preset(int preset);
void preset_change(int preset);
};
#endif

View file

@ -0,0 +1,122 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerSelector.h"
HDSPMixerSelector::HDSPMixerSelector(int x, int y, int w, int h):Fl_Menu_(x, y, w, h)
{
max_dest = 0;
selected = 0;
basew = (HDSPMixerWindow *)window();
setLabels();
textfont(FL_HELVETICA);
textsize(8);
textcolor(FL_BLACK);
}
void HDSPMixerSelector::draw() {
fl_color(FL_WHITE);
fl_font(FL_HELVETICA, 8);
fl_draw((char *)mvalue()->label(), x(), y(), w(), h(), FL_ALIGN_CENTER);
}
int HDSPMixerSelector::handle(int e) {
const Fl_Menu_Item *item;
int xpos = Fl::event_x()-x();
int ypos = Fl::event_y()-y();
switch(e) {
case FL_PUSH:
for (int i = 0; i < max_dest; i++) {
if (((HDSPMixerIOMixer *)parent())->fader->pos[i] != 0) {
mode(i, FL_MENU_TOGGLE|FL_MENU_VALUE);
} else {
mode(i, FL_MENU_TOGGLE);
}
}
if ((item = (menu()->popup(x(), y()+h(), 0, 0, this))) != NULL) {
value(item);
selected = value();
if (basew->inputs->buttons->view->submix) {
basew->inputs->buttons->view->submix_value = value();
for (int i = 0; i < HDSP_MAX_CHANNELS; i++) {
basew->inputs->strips[i]->targets->value(value());
basew->inputs->strips[i]->targets->redraw();
basew->playbacks->strips[i]->targets->value(value());
basew->playbacks->strips[i]->targets->redraw();
basew->inputs->strips[i]->fader->dest = value();
basew->inputs->strips[i]->fader->redraw();
basew->inputs->strips[i]->fader->sendGain();
basew->playbacks->strips[i]->fader->dest = value();
basew->playbacks->strips[i]->fader->redraw();
basew->playbacks->strips[i]->fader->sendGain();
basew->inputs->strips[i]->pan->dest = value();
basew->inputs->strips[i]->pan->redraw();
basew->playbacks->strips[i]->pan->dest = value();
basew->playbacks->strips[i]->pan->redraw();
}
} else {
((HDSPMixerIOMixer *)parent())->fader->dest = value();
((HDSPMixerIOMixer *)parent())->fader->redraw();
((HDSPMixerIOMixer *)parent())->pan->dest = value();
((HDSPMixerIOMixer *)parent())->pan->redraw();
((HDSPMixerIOMixer *)parent())->fader->sendGain();
}
redraw();
}
basew->checkState();
return 1;
default:
return Fl_Menu_::handle(e);
}
}
void HDSPMixerSelector::setLabels()
{
HDSP_IO_Type type;
int ds;
clear();
type = basew->cards[basew->current_card]->type;
ds = basew->cards[basew->current_card]->double_speed;
if (type == Multiface && !ds) {
max_dest = 10;
destinations = destinations_mf_ss;
} else if (type == Multiface && ds) {
max_dest = 8;
destinations = destinations_mf_ds;
} else if (type == Digiface && !ds) {
max_dest = 14;
destinations = destinations_df_ss;
} else if (type == Digiface && ds) {
max_dest = 8;
destinations = destinations_df_ds;
} else if (type == H9652 && !ds) {
max_dest = 13;
destinations = destinations_h9652_ss;
} else if (type == H9652 && ds) {
max_dest = 7;
destinations = destinations_h9652_ds;
}
for (int i = 0; i < max_dest; ++i) {
add(destinations[i], 0, 0, 0, FL_MENU_TOGGLE);
}
value(0);
}

View file

@ -0,0 +1,94 @@
/*
* HDSPMixer
*
* 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 HDSPMixerSelector_H
#define HDSPMixerSelector_H
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Menu_.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/fl_draw.H>
#include <sound/hdsp.h>
#include "HDSPMixerWindow.h"
#include "HDSPMixerIOMixer.h"
#include "defines.h"
class HDSPMixerWindow;
class HDSPMixerIOMixer;
static char *destinations_mf_ss[10] = {
"AN 1+2", "AN 3+4", "AN 5+6", "AN 7+8",
"A 1+2", "A 3+4", "A 5+6", "A 7+8",
"SPDIF", "Analog"
};
static char *destinations_mf_ds[8] = {
"AN 1+2", "AN 3+4", "AN 5+6", "AN 7+8",
"A 1+2", "A 3+4",
"SPDIF", "Analog"
};
static char *destinations_df_ss[14] = {
"A1 1+2", "A1 3+4", "A1 5+6", "A1 7+8",
"A2 1+2", "A2 3+4", "A2 5+6", "A2 7+8",
"A3 1+2", "A3 3+4", "A3 5+6", "A3 7+8",
"SPDIF", "Analog"
};
static char *destinations_df_ds[8] = {
"A1 1+2", "A1 3+4",
"A2 1+2", "A2 3+4",
"A3 1+2", "A3 3+4",
"SPDIF", "Analog"
};
static char *destinations_h9652_ss[13] = {
"A1 1+2", "A1 3+4", "A1 5+6", "A1 7+8",
"A2 1+2", "A2 3+4", "A2 5+6", "A2 7+8",
"A3 1+2", "A3 3+4", "A3 5+6", "A3 7+8",
"SPDIF"
};
static char *destinations_h9652_ds[7] = {
"A1 1+2", "A1 3+4",
"A2 1+2", "A2 3+4",
"A3 1+2", "A3 3+4",
"SPDIF"
};
class HDSPMixerSelector:public Fl_Menu_
{
private:
char **destinations;
HDSPMixerWindow *basew;
public:
int max_dest;
int selected;
HDSPMixerSelector(int x, int y, int w, int h);
void draw();
int handle(int e);
void select(int element);
void setLabels();
};
#endif

View file

@ -0,0 +1,195 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerSetup.h"
static void rate_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
const Fl_Menu_Item *i = ((Fl_Menu_ *)widget)->mvalue();
if (!strncmp("s", i->label(), 1)) {
w->setup->rate_val = 0;
} else if (!strncmp("m", i->label(), 1)) {
w->setup->rate_val = 1;
} else {
w->setup->rate_val = 2;
}
w->checkState();
}
static void ok_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerSetup *s = (HDSPMixerSetup *)arg;
s->hide();
}
static void peak_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
w->setup->numbers_val = 1;
w->checkState();
}
static void rms_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
w->setup->numbers_val = 0;
w->checkState();
}
static void fourty_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
w->setup->level_val = 0;
w->checkState();
}
static void sixty_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
w->setup->level_val = 1;
w->checkState();
}
static void over_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
w->setup->over_val = (int)w->setup->over->value();
w->checkState();
}
static void rmsplus3_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (w->setup->rmsplus3->value()) {
w->setup->rmsplus3_val = 1;
} else {
w->setup->rmsplus3_val = 0;
}
w->checkState();
}
HDSPMixerSetup::HDSPMixerSetup(int w, int h, char *label, HDSPMixerWindow *win):Fl_Double_Window(w, h, label)
{
basew = win;
plm = new Fl_Group(10, 25, 380, 60, "Peak Level Meters");
plm->labelfont(FL_HELVETICA);
plm->labelsize(12);
plm->align(FL_ALIGN_TOP_LEFT);
plm->box(FL_ENGRAVED_FRAME);
over = new Fl_Counter(30, 50, 50, 20, "FS samples for OVR ");
over->callback((Fl_Callback *)over_cb, (void *)basew);
over->type(FL_SIMPLE_COUNTER);
over->bounds(1, 15);
over->step(1);
over->value(3);
over_val = 3;
over->labelfont(FL_HELVETICA);
over->labelsize(12);
over->align(FL_ALIGN_TOP_LEFT);
rate = new Fl_Choice(230, 50, 80, 20, "Release Rate ");
rate->align(FL_ALIGN_TOP_LEFT);
rate->labelfont(FL_HELVETICA);
rate->labelsize(12);
rate->add("slow", 0, (Fl_Callback *)rate_cb, (void *)basew);
rate->add("medium", 0, (Fl_Callback *)rate_cb, (void *)basew);
rate->add("high", 0, (Fl_Callback *)rate_cb, (void *)basew);
rate->value(1);
rate_val = 1;
plm->end();
numbers = new Fl_Group(10, 110, 180, 60, "Numbers");
numbers->box(FL_ENGRAVED_FRAME);
numbers->labelfont(FL_HELVETICA);
numbers->labelsize(12);
numbers->align(FL_ALIGN_TOP_LEFT);
rms = new Fl_Round_Button(30, 120, 60, 20, "RMS");
rms->labelfont(FL_HELVETICA);
rms->labelsize(12);
rms->callback((Fl_Callback *)rms_cb, (void *)basew);
rms->set();
numbers_val = 0;
rms->type(FL_RADIO_BUTTON);
peak = new Fl_Round_Button(30, 140, 60, 20, "Peak");
peak->labelfont(FL_HELVETICA);
peak->labelsize(12);
peak->type(FL_RADIO_BUTTON);
peak->callback((Fl_Callback *)peak_cb, (void *)basew);
numbers->end();
level = new Fl_Group(210, 110, 180, 60, "Minimum Level");
level->box(FL_ENGRAVED_FRAME);
level->labelfont(FL_HELVETICA);
level->labelsize(12);
level->align(FL_ALIGN_TOP_LEFT);
fourty = new Fl_Round_Button(230, 120, 60, 20, "-40 dB");
fourty->labelfont(FL_HELVETICA);
fourty->labelsize(12);
fourty->type(FL_RADIO_BUTTON);
fourty->set();
level_val = 0;
fourty->callback((Fl_Callback *)fourty_cb, (void *)basew);
sixty = new Fl_Round_Button(230, 140, 60, 20, "-60 dB");
sixty->labelfont(FL_HELVETICA);
sixty->labelsize(12);
sixty->type(FL_RADIO_BUTTON);
sixty->callback((Fl_Callback *)sixty_cb, (void *)basew);
level->end();
rmsplus3grp = new Fl_Group(10, 190, 180, 60);
rmsplus3grp->box(FL_ENGRAVED_FRAME);
rmsplus3 = new Fl_Check_Button(30, 210, 100, 20, "RMS +3dB");
rmsplus3->labelfont(FL_HELVETICA);
rmsplus3->labelsize(12);
rmsplus3->callback((Fl_Callback *)rmsplus3_cb, (void *)basew);
rmsplus3_val = 0;
rmsplus3grp->end();
ok = new Fl_Return_Button(270, 210, 60, 20, "OK");
ok->callback((Fl_Callback *)ok_cb, (void *)this);
end();
#ifndef NON_MODAL_SETUP
set_modal();
#endif
}
void HDSPMixerSetup::updateValues()
{
rmsplus3->value(rmsplus3_val);
if (level_val) {
sixty->setonly();
} else {
fourty->setonly();
}
if (numbers_val) {
peak->setonly();
} else {
rms->setonly();
}
over->value(over_val);
rate->value(rate_val);
#ifdef NON_MODAL_SETUP
if (shown()) {
redraw();
}
#endif
}

View file

@ -0,0 +1,63 @@
/*
* HDSPMixer
*
* 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 HDSPMixerSetup_H
#define HDSPMixerSetup_H
#include <string.h>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Counter.H>
#include <FL/Fl_Choice.H>
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Return_Button.H>
#include "HDSPMixerWindow.h"
class HDSPMixerWindow;
class HDSPMixerSetup:public Fl_Double_Window
{
public:
Fl_Group *plm;
Fl_Group *numbers;
Fl_Group *level;
Fl_Group *rmsplus3grp;
Fl_Counter *over;
Fl_Choice *rate;
Fl_Round_Button *rms;
Fl_Round_Button *peak;
Fl_Round_Button *fourty;
Fl_Round_Button *sixty;
Fl_Check_Button *rmsplus3;
Fl_Return_Button *ok;
int rate_val;
int over_val;
int level_val;
int numbers_val;
int rmsplus3_val;
HDSPMixerSetup(int w, int h, char *label, HDSPMixerWindow *w);
HDSPMixerWindow *basew;
void updateValues();
};
#endif

View file

@ -0,0 +1,30 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerStripData.h"
HDSPMixerStripData::HDSPMixerStripData() {
dest = mute = solo = 0;
for (int i = 0; i < 14; i++) {
fader_pos[i] = pan_pos[i] = 0;
}
}

View file

@ -0,0 +1,38 @@
/*
* HDSPMixer
*
* 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 HDSPMixerStripData_H
#define HDSPMixerStripData_H
class HDSPMixerStripData
{
public:
int mute;
int solo;
int pan_pos[14];
int fader_pos[14];
int dest;
HDSPMixerStripData();
};
#endif

View file

@ -0,0 +1,103 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerView.h"
HDSPMixerView::HDSPMixerView(int x, int y, int w, int h):Fl_Widget(x, y, 13, 76)
{
basew = (HDSPMixerWindow *)window();
submix = input = playback = output = 1;
submix_value = 0;
}
void HDSPMixerView::draw()
{
if (input) {
fl_draw_pixmap(b_blank_xpm, x(), y());
}
if (playback) {
fl_draw_pixmap(b_blank_xpm, x(), y()+20);
}
if (output) {
fl_draw_pixmap(b_blank_xpm, x(), y()+40);
}
if (submix) {
fl_draw_pixmap(b_blank_xpm, x(), y()+63);
}
}
int HDSPMixerView::handle(int e)
{
int xpos = Fl::event_x()-x();
int ypos = Fl::event_y()-y();
switch (e) {
case FL_PUSH:
if (ypos < 13) {
if (input) {
input = 0;
basew->menubar->mode(9, FL_MENU_TOGGLE);
} else {
basew->menubar->mode(9, FL_MENU_TOGGLE|FL_MENU_VALUE);
input = 1;
}
redraw();
basew->reorder();
} else if (ypos >= 20 && ypos < 33) {
if (playback) {
basew->menubar->mode(10, FL_MENU_TOGGLE);
playback = 0;
} else {
basew->menubar->mode(10, FL_MENU_TOGGLE|FL_MENU_VALUE);
playback = 1;
}
redraw();
basew->reorder();
} else if (ypos >= 40 && ypos < 53) {
if (output) {
basew->menubar->mode(11, FL_MENU_TOGGLE|FL_MENU_DIVIDER);
output = 0;
} else {
basew->menubar->mode(11, FL_MENU_TOGGLE|FL_MENU_VALUE|FL_MENU_DIVIDER);
output = 1;
}
redraw();
basew->reorder();
} else if (ypos >= 63) {
if (submix) {
basew->menubar->mode(12, FL_MENU_TOGGLE);
submix = 0;
basew->unsetSubmix();
} else {
basew->menubar->mode(12, FL_MENU_TOGGLE|FL_MENU_VALUE);
basew->setSubmix(submix_value);
submix = 1;
}
redraw();
basew->reorder();
}
basew->checkState();
return 1;
default:
return Fl_Widget::handle(e);
}
}

View file

@ -0,0 +1,45 @@
/*
* HDSPMixer
*
* 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 HDSPMixerView_H
#define HDSPMixerView_H
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include "HDSPMixerWindow.h"
#include "pixmaps.h"
class HDSPMixerWindow;
class HDSPMixerView:public Fl_Widget
{
private:
HDSPMixerWindow *basew;
public:
int input, playback, output, submix, submix_value;
HDSPMixerView(int x, int y, int w, int h);
void draw();
int handle(int e);
};
#endif

View file

@ -0,0 +1,972 @@
/*
* HDSPMixer
*
* 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 "HDSPMixerWindow.h"
inline int64 swap_rms(int64 *rms)
{
unsigned int *base = (unsigned int *)rms;
int64 ret = *base;
ret = (ret<<32) | *(base+1);
return ret;
}
static void readregisters_cb(void *arg)
{
int err;
snd_hwdep_t *hw;
hdsp_peak_rms_t peak_rms;
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (!w->visible()) {
Fl::add_timeout(0.03, readregisters_cb, w);
return;
}
if ((err = snd_hwdep_open(&hw, w->cards[w->current_card]->name, SND_HWDEP_OPEN_READ)) < 0) {
fprintf(stderr, "Couldn't open hwdep device. Metering stopped\n");
return;
}
if ((err = snd_hwdep_ioctl(hw, SNDRV_HDSP_IOCTL_GET_PEAK_RMS, (void *)&peak_rms)) < 0) {
fprintf(stderr, "HwDep ioctl failed. Metering stopped\n");
snd_hwdep_close(hw);
return;
}
snd_hwdep_close(hw);
if (w->inputs->buttons->input) {
for (int i = 0; i < w->cards[w->current_card]->channels; ++i) {
w->inputs->strips[i]->meter->update(peak_rms.input_peaks[(w->cards[w->current_card]->meter_map[i])] & 0xffffff00,
peak_rms.input_peaks[(w->cards[w->current_card]->meter_map[i])] & 0xf,
swap_rms(&peak_rms.input_rms[(w->cards[w->current_card]->meter_map[i])]) );
}
}
if (w->inputs->buttons->playback) {
for (int i = 0; i < w->cards[w->current_card]->channels; ++i) {
w->playbacks->strips[i]->meter->update(peak_rms.playback_peaks[(w->cards[w->current_card]->meter_map[i])] & 0xffffff00,
peak_rms.playback_peaks[(w->cards[w->current_card]->meter_map[i])] & 0xf,
swap_rms(&peak_rms.playback_rms[(w->cards[w->current_card]->meter_map[i])]) );
}
}
if (w->inputs->buttons->output) {
for (int i = 0; i < w->cards[w->current_card]->channels; ++i) {
w->outputs->strips[i]->meter->update(peak_rms.output_peaks[(w->cards[w->current_card]->meter_map[i])] & 0xffffff00,
peak_rms.output_peaks[(w->cards[w->current_card]->meter_map[i])] & 0xf,
0 );
}
for (int i = 0; i < w->cards[w->current_card]->lineouts; ++i) {
w->outputs->strips[w->cards[w->current_card]->channels+i]->meter->update(peak_rms.output_peaks[26+i] & 0xffffff00,
peak_rms.output_peaks[26+i] & 0xf,
0 );
}
}
Fl::add_timeout(0.03, readregisters_cb, w);
}
static void exit_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (w->dirty) {
if (!fl_ask("There are unsaved changes, quit anyway ?")) return;
}
exit(EXIT_SUCCESS);
}
static void view_cb(Fl_Widget *widget, void *arg)
{
const Fl_Menu_Item *item = ((Fl_Menu_ *)widget)->mvalue();
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (!strncmp(item->label(), "Input", 5)) {
if (w->inputs->buttons->view->input) {
w->inputs->buttons->view->input = 0;
} else {
w->inputs->buttons->view->input = 1;
}
}
if (!strncmp(item->label(), "Playback", 8)) {
if (w->inputs->buttons->view->playback) {
w->inputs->buttons->view->playback = 0;
} else {
w->inputs->buttons->view->playback = 1;
}
}
if (!strncmp(item->label(), "Output", 6)) {
if (w->inputs->buttons->view->output) {
w->inputs->buttons->view->output = 0;
} else {
w->inputs->buttons->view->output = 1;
}
}
w->checkState();
w->reorder();
}
static void submix_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (w->inputs->buttons->view->submix) {
w->inputs->buttons->view->submix = 0;
w->unsetSubmix();
} else {
w->inputs->buttons->view->submix = 1;
w->setSubmix(w->inputs->buttons->view->submix_value);
}
w->checkState();
w->inputs->buttons->view->redraw();
}
static void dirty_cb(void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (!w->inputs->buttons->presets->saving) {
if (w->inputs->buttons->presets->presetmask == (int)pow(2, w->inputs->buttons->presets->preset-1)) {
w->inputs->buttons->presets->presetmask = 0;
} else {
w->inputs->buttons->presets->presetmask = (int)pow(2, w->inputs->buttons->presets->preset-1);
}
w->inputs->buttons->presets->redraw();
}
if (w->dirty) {
Fl::add_timeout(0.3, dirty_cb, arg);
} else {
w->inputs->buttons->presets->presetmask = (int)pow(2, w->inputs->buttons->presets->preset-1);
}
}
static void setup_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
w->setup->show();
}
static void about_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
w->about->show();
}
static void open_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (!(w->file_name = fl_file_chooser("Choose a file to load presets from :", "HDSPMixer preset file (*.mix)", NULL, 0))) return;
w->load();
}
static void save_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (w->file_name == NULL) {
if (!(w->file_name = fl_file_chooser("Choose a file to save presets to :", "HDSPMixer preset file (*.mix)", NULL, 0))) return;
}
w->save();
snprintf(w->window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(w->file_name));
w->label(w->window_title);
}
static void make_default_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (w->file_name) {
w->prefs->set("default_file", w->file_name);
w->prefs->flush();
} else {
fl_alert("Please save to a file before setting to default");
}
}
static void restore_defaults_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
int i = 0;
if (w->dirty) {
if (!fl_ask("There are unsaved changes, restore factory settings anyway ?")) return;
}
w->prefs->deleteEntry("default_file");
w->prefs->flush();
w->file_name = NULL;
snprintf(w->window_title, FL_PATH_MAX, "HDSPMixer");
w->label(w->window_title);
w->resetMixer();
while (w->cards[i] != NULL) {
w->restoreDefaults(i++);
}
w->inputs->buttons->presets->preset_change(1);
}
static void save_as_cb(Fl_Widget *widget, void *arg)
{
HDSPMixerWindow *w = (HDSPMixerWindow *)arg;
if (!(w->file_name = fl_file_chooser("Choose a file to save presets to :", "HDSPMixer preset file (*.mix)", NULL, 0))) return;
w->save();
}
static void atclose_cb(Fl_Window *w, void *arg)
{
if (strncmp("HDSPMixer", w->label(), 9) == 0) {
if (((HDSPMixerWindow *)w)->dirty) {
if (!fl_ask("There are unsaved changes, quit anyway ?")) return;
}
exit(EXIT_SUCCESS);
}
w->hide();
}
static int handler_cb(int event)
{
HDSPMixerWindow *w = NULL;
Fl_Window *fl_win = Fl::first_window();
while (1) {
if (fl_win->label()) {
if (strncmp("HDSPMixer", fl_win->label(), 9) == 0) {
w = (HDSPMixerWindow *)fl_win;
break;
}
}
if (fl_win = Fl::next_window(fl_win)) return 0;
}
if (!w) return 0;
int key = Fl::event_key();
switch (event) {
case FL_SHORTCUT:
if (key == FL_Escape) {
if (w->dirty) {
if (!fl_ask("There are unsaved changes, quit anyway ?")) return 1;
}
exit(EXIT_SUCCESS);
}
if (!w->setup->visible()) {
if (key == 'r' || key == 'R') {
/* numbers should show peak values */
w->setup->numbers_val = 0;
w->checkState();
return 1;
} else if (key == 'e' || key == 'E') {
/* numbers should show rms values */
w->setup->numbers_val = 1;
w->checkState();
return 1;
}
if (key == '0' || key == '0'+FL_KP) {
/* rms +0dB */
w->setup->rmsplus3_val = 0;
w->checkState();
return 1;
} else if (key == '3' || key == '3'+FL_KP) {
/* rms +3B */
w->setup->rmsplus3_val = 1;
w->checkState();
return 1;
}
if (key == '4' || key == '4'+FL_KP) {
/* meter range is 40 dB */
w->setup->level_val = 0;
w->checkState();
return 1;
} else if (key == '6' || key == '6'+FL_KP) {
/* meter range is 60 dB */
w->setup->level_val = 1;
w->checkState();
return 1;
}
}
break;
default:
return 0;
}
return 0;
}
void HDSPMixerWindow::save()
{
FILE *file;
if ((file = fopen(file_name, "w")) == NULL) {
fl_alert("Error opening file %s for saving", file_name);
}
if (dirty) {
inputs->buttons->presets->save_preset(current_preset+1);
}
for (int speed = 0; speed < 2; ++speed) {
for (int card = 0; card < 3; ++card) {
for (int preset = 0; preset < 8; ++preset) {
for (int channel = 0; channel < HDSP_MAX_CHANNELS; ++channel) {
/* inputs pans and volumes */
if (fwrite((void *)&(inputs->strips[channel]->data[card][speed][preset]->pan_pos[0]), sizeof(int), 14, file) != 14) {
goto save_error;
}
if (fwrite((void *)&(inputs->strips[channel]->data[card][speed][preset]->fader_pos[0]), sizeof(int), 14, file) != 14) {
goto save_error;
}
/* playbacks pans and volumes */
if (fwrite((void *)&(playbacks->strips[channel]->data[card][speed][preset]->pan_pos[0]), sizeof(int), 14, file) != 14) {
goto save_error;
}
if (fwrite((void *)&(playbacks->strips[channel]->data[card][speed][preset]->fader_pos[0]), sizeof(int), 14, file) != 14) {
goto save_error;
}
/* inputs mute/solo/dest */
if (fwrite((void *)&(inputs->strips[channel]->data[card][speed][preset]->mute), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(inputs->strips[channel]->data[card][speed][preset]->solo), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(inputs->strips[channel]->data[card][speed][preset]->dest), sizeof(int), 1, file) != 1) {
goto save_error;
}
/* playbacks mute/solo/dest */
if (fwrite((void *)&(playbacks->strips[channel]->data[card][speed][preset]->mute), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(playbacks->strips[channel]->data[card][speed][preset]->solo), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(playbacks->strips[channel]->data[card][speed][preset]->dest), sizeof(int), 1, file) != 1) {
goto save_error;
}
/* outputs volumes */
if (fwrite((void *)&(outputs->strips[channel]->data[card][speed][preset]->fader_pos), sizeof(int), 1, file) != 1) {
goto save_error;
}
}
/* Lineouts */
if (fwrite((void *)&(outputs->strips[HDSP_MAX_CHANNELS]->data[card][speed][preset]->fader_pos), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(outputs->strips[HDSP_MAX_CHANNELS+1]->data[card][speed][preset]->fader_pos), sizeof(int), 1, file) != 1) {
goto save_error;
}
/* Global settings */
if (fwrite((void *)&(data[card][speed][preset]->input), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(data[card][speed][preset]->output), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(data[card][speed][preset]->playback), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(data[card][speed][preset]->submix), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(data[card][speed][preset]->submix_value), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(data[card][speed][preset]->solo), sizeof(int), 1, file) != 1) {
goto save_error;
}
if (fwrite((void *)&(data[card][speed][preset]->mute), sizeof(int), 1, file) != 1) {
goto save_error;
}
}
}
}
fclose(file);
return;
save_error:
fclose(file);
fl_alert("Error saving presets to file %s", file_name);
return;
}
void HDSPMixerWindow::load()
{
FILE *file;
if ((file = fopen(file_name, "r")) == NULL) {
fl_alert("Error opening file %s for reading", file_name);
}
for (int speed = 0; speed < 2; ++speed) {
for (int card = 0; card < 3; ++card) {
for (int preset = 0; preset < 8; ++preset) {
for (int channel = 0; channel < HDSP_MAX_CHANNELS; ++channel) {
/* inputs pans and volumes */
if (fread((void *)&(inputs->strips[channel]->data[card][speed][preset]->pan_pos[0]), sizeof(int), 14, file) != 14) {
goto load_error;
}
if (fread((void *)&(inputs->strips[channel]->data[card][speed][preset]->fader_pos[0]), sizeof(int), 14, file) != 14) {
goto load_error;
}
/* playbacks pans and volumes */
if (fread((void *)&(playbacks->strips[channel]->data[card][speed][preset]->pan_pos[0]), sizeof(int), 14, file) != 14) {
goto load_error;
}
if (fread((void *)&(playbacks->strips[channel]->data[card][speed][preset]->fader_pos[0]), sizeof(int), 14, file) != 14) {
goto load_error;
}
/* inputs mute/solo/dest */
if (fread((void *)&(inputs->strips[channel]->data[card][speed][preset]->mute), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(inputs->strips[channel]->data[card][speed][preset]->solo), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(inputs->strips[channel]->data[card][speed][preset]->dest), sizeof(int), 1, file) != 1) {
goto load_error;
}
/* playbacks mute/solo/dest */
if (fread((void *)&(playbacks->strips[channel]->data[card][speed][preset]->mute), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(playbacks->strips[channel]->data[card][speed][preset]->solo), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(playbacks->strips[channel]->data[card][speed][preset]->dest), sizeof(int), 1, file) != 1) {
goto load_error;
}
/* outputs volumes */
if (fread((void *)&(outputs->strips[channel]->data[card][speed][preset]->fader_pos), sizeof(int), 1, file) != 1) {
goto load_error;
}
}
/* Lineouts */
if (fread((void *)&(outputs->strips[HDSP_MAX_CHANNELS]->data[card][speed][preset]->fader_pos), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(outputs->strips[HDSP_MAX_CHANNELS+1]->data[card][speed][preset]->fader_pos), sizeof(int), 1, file) != 1) {
goto load_error;
}
/* Global settings */
if (fread((void *)&(data[card][speed][preset]->input), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(data[card][speed][preset]->output), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(data[card][speed][preset]->playback), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(data[card][speed][preset]->submix), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(data[card][speed][preset]->submix_value), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(data[card][speed][preset]->solo), sizeof(int), 1, file) != 1) {
goto load_error;
}
if (fread((void *)&(data[card][speed][preset]->mute), sizeof(int), 1, file) != 1) {
goto load_error;
}
}
}
}
fclose(file);
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(file_name));
label(window_title);
resetMixer();
inputs->buttons->presets->preset_change(1);
return;
load_error:
fclose(file);
fl_alert("Error loading presets from file %s", file_name);
return;
}
void HDSPMixerWindow::restoreDefaults(int card)
{
int phones;
int chnls[2];
int maxdest[2];
int ndb = inputs->strips[0]->fader->ndb;
switch (cards[card]->type) {
case Multiface:
chnls[0] = 18;
chnls[1] = 14;
maxdest[0] = 10;
maxdest[1] = 8;
phones = 1;
break;
case Digiface:
chnls[0] = 26;
chnls[1] = 14;
maxdest[0] = 14;
maxdest[1] = 8;
phones = 1;
break;
case H9652:
chnls[0] = 26;
chnls[1] = 14;
maxdest[0] = 13;
maxdest[1] = 7;
phones = 0;
break;
}
for (int preset = 0; preset < 8; ++preset) {
for (int speed = 0; speed < 2; ++speed) {
for (int i = 0; i < chnls[speed]; i+=2) {
for (int z = 0; z < maxdest[speed]; ++z) {
inputs->strips[i]->data[card][speed][preset]->fader_pos[z] =
((preset == 6 && z == maxdest[speed]-phones-1) || (i == z*2 && (preset > 1 && preset < 4)) || (((preset > 0 && preset < 4) || preset == 7) && phones && (z == maxdest[speed]-1))) ? ndb : 0;
inputs->strips[i+1]->data[card][speed][preset]->fader_pos[z] =
((preset == 6 && z == maxdest[speed]-phones-1) || (i == z*2 && (preset > 1 && preset < 4)) || (((preset > 0 && preset < 4) || preset == 7) && phones && (z == maxdest[speed]-1))) ? ndb : 0;
inputs->strips[i]->data[card][speed][preset]->pan_pos[z] = 0;
inputs->strips[i+1]->data[card][speed][preset]->pan_pos[z] = 28*CF;
playbacks->strips[i]->data[card][speed][preset]->fader_pos[z] =
((preset > 4 && preset < 7 && z == maxdest[speed]-phones-1) || i == z*2 || (phones && (z == maxdest[speed]-1))) ? ndb : 0;
playbacks->strips[i+1]->data[card][speed][preset]->fader_pos[z] =
((preset > 4 && preset < 7 && z == maxdest[speed]-phones-1) || i == z*2 || (phones && (z == maxdest[speed]-1))) ? ndb : 0;
playbacks->strips[i]->data[card][speed][preset]->pan_pos[z] = 0;
playbacks->strips[i+1]->data[card][speed][preset]->pan_pos[z] = 28*CF;
}
inputs->strips[i]->data[card][speed][preset]->dest = (int)floor(i/2);
inputs->strips[i+1]->data[card][speed][preset]->dest = (int)floor(i/2);
playbacks->strips[i]->data[card][speed][preset]->dest = (int)floor(i/2);
playbacks->strips[i+1]->data[card][speed][preset]->dest = (int)floor(i/2);
outputs->strips[i]->data[card][speed][preset]->fader_pos = (preset != 4) ? 137*CF : 0;
outputs->strips[i+1]->data[card][speed][preset]->fader_pos = (preset != 4) ? 137*CF : 0;
if (preset > 4 && preset < 7) {
outputs->strips[chnls[speed]-2]->data[card][speed][preset]->fader_pos = ndb;
outputs->strips[chnls[speed]-1]->data[card][speed][preset]->fader_pos = ndb;
}
if (preset == 3 || preset == 7) {
inputs->strips[i]->data[card][speed][preset]->mute = 1;
inputs->strips[i+1]->data[card][speed][preset]->mute = 1;
if (preset == 7) {
playbacks->strips[i]->data[card][speed][preset]->mute = 1;
playbacks->strips[i+1]->data[card][speed][preset]->mute = 1;
}
}
}
if (phones) {
outputs->strips[chnls[speed]]->data[card][speed][preset]->fader_pos = (preset != 4) ? ndb : 0;
outputs->strips[chnls[speed]+1]->data[card][speed][preset]->fader_pos = (preset != 4) ? ndb : 0;
}
if (preset == 3 || preset == 7) {
data[card][speed][preset]->mute = 1;
}
if (preset > 4 && preset < 7) {
data[card][speed][preset]->submix_value = (maxdest[speed]-phones-1);
} else {
data[card][speed][preset]->submix = 0;
}
}
}
}
HDSPMixerWindow::HDSPMixerWindow(int x, int y, int w, int h, const char *label, HDSPMixerCard *hdsp_card1, HDSPMixerCard *hdsp_card2, HDSPMixerCard *hdsp_card3):Fl_Double_Window(x, y, w, h, label)
{
int def, i;
cards[0] = hdsp_card1;
cards[1] = hdsp_card2;
cards[2] = hdsp_card3;
current_card = current_preset = 0;
prefs = new Fl_Preferences(Fl_Preferences::USER, "thomasATundata.org", "HDSPMixer");
if (!prefs->get("default_file", file_name_buffer, NULL, FL_PATH_MAX-1)) file_name = NULL;
else file_name = file_name_buffer;
for (int j = 0; j < 3; ++j) {
for (int i = 0; i < 8; ++i) {
data[j][0][i] = new HDSPMixerPresetData();
data[j][1][i] = new HDSPMixerPresetData();
}
}
buttons_removed = 0;
dirty = 0;
scroll = new Fl_Scroll(0, 0, w, h);
menubar = new Fl_Menu_Bar(0, 0, w, MENU_HEIGHT);
menubar->textfont(FL_HELVETICA);
menubar->textsize(12);
menubar->box(FL_THIN_UP_BOX);
menubar->add("&File/Open preset file", FL_CTRL+'o', (Fl_Callback *)open_cb, (void *)this);
menubar->add("&File/Save preset file", FL_CTRL+'s', (Fl_Callback *)save_cb, (void *)this);
menubar->add("&File/Save preset file as ...", 0, (Fl_Callback *)save_as_cb, (void *)this, FL_MENU_DIVIDER);
menubar->add("&File/Make current file default", 'd', (Fl_Callback *)make_default_cb, (void *)this);
menubar->add("&File/Restore factory settings", 'f', (Fl_Callback *)restore_defaults_cb, (void *)this, FL_MENU_DIVIDER);
menubar->add("&File/E&xit", FL_CTRL+'q', (Fl_Callback *)exit_cb, (void *)this);
menubar->add("&View/Input", 'i', (Fl_Callback *)view_cb, (void *)this, FL_MENU_TOGGLE|FL_MENU_VALUE);
menubar->add("&View/Playback", 'p', (Fl_Callback *)view_cb, (void *)this, FL_MENU_TOGGLE|FL_MENU_VALUE);
menubar->add("&View/Output", 'o', (Fl_Callback *)view_cb, (void *)this, FL_MENU_DIVIDER|FL_MENU_TOGGLE|FL_MENU_VALUE);
menubar->add("&View/Submix", 's', (Fl_Callback *)submix_cb, (void *)this, FL_MENU_TOGGLE|FL_MENU_VALUE);
menubar->add("&Options/Level Meter Setup", 'm', (Fl_Callback *)setup_cb, (void *)this);
menubar->add("&?/About", 0, (Fl_Callback *)about_cb, (void *)this);
inputs = new HDSPMixerInputs(0, MENU_HEIGHT, w, FULLSTRIP_HEIGHT, cards[0]->channels);
inputs->buttons->input = 1;
inputs->buttons->output = 1;
inputs->buttons->submix = 1;
inputs->buttons->playback = 1;
playbacks = new HDSPMixerPlaybacks(0, MENU_HEIGHT+FULLSTRIP_HEIGHT, w, FULLSTRIP_HEIGHT, cards[0]->channels);
outputs = new HDSPMixerOutputs(0, MENU_HEIGHT+FULLSTRIP_HEIGHT*2, w, SMALLSTRIP_HEIGHT, cards[0]->channels);
scroll->end();
end();
setup = new HDSPMixerSetup(400, 260, "Level Meters Setup", this);
about = new HDSPMixerAbout(340, 230, "About HDSPMixer", this);
i = 0;
while (cards[i] != NULL) {
cards[i++]->initializeCard(this);
}
size_range(MIN_WIDTH, MIN_HEIGHT, cards[current_card]->window_width, cards[current_card]->window_height);
resetMixer();
if (file_name) {
printf("Restoring last presets used\n");
load();
} else {
printf("Initializing default presets\n");
i = 0;
while (cards[i] != NULL) {
restoreDefaults(i++);
}
inputs->buttons->presets->preset_change(1);
}
Fl::atclose = atclose_cb;
Fl::add_handler(handler_cb);
Fl::add_timeout(0.030, readregisters_cb, this);
}
int HDSPMixerWindow::handle(int e)
{
return Fl_Double_Window::handle(e);
}
void HDSPMixerWindow::resize(int x, int y, int w, int h)
{
Fl_Double_Window::resize(x, y, w, h);
scroll->resize (0, 0, w, h);
}
void HDSPMixerWindow::reorder()
{
int xpos = scroll->x();
int ypos = scroll->y();
int ytemp = ypos+MENU_HEIGHT;
if (inputs->buttons->view->input) {
scroll->add(inputs);
inputs->add(*(inputs->buttons));
buttons_removed = 0;
inputs->buttons->position(inputs->buttons->x(), MENU_HEIGHT);
inputs->position(xpos, ytemp);
ytemp += FULLSTRIP_HEIGHT;
} else {
if (!buttons_removed) {
buttons_removed = 1;
playbacks->add(*(inputs->buttons));
inputs->buttons->position(playbacks->empty->x(), playbacks->empty->y());
}
scroll->remove(*inputs);
}
if (inputs->buttons->view->playback) {
scroll->add(playbacks);
playbacks->position(xpos, ytemp);
ytemp += FULLSTRIP_HEIGHT;
} else {
scroll->remove(*playbacks);
}
if (inputs->buttons->view->output) {
scroll->add(outputs);
outputs->position(xpos, ytemp);
ytemp += SMALLSTRIP_HEIGHT;
} else {
scroll->remove(*outputs);
}
scroll->init_sizes();
resize(x(), y(), w(), ytemp);
size_range(MIN_WIDTH, MIN_HEIGHT, cards[current_card]->window_width, ytemp);
}
void HDSPMixerWindow::checkState()
{
int speed = cards[current_card]->double_speed;
int p = inputs->buttons->presets->preset-1;
int corrupt = 0;
/* Mixer strips */
for (int i = 0; i < HDSP_MAX_CHANNELS; ++i) {
for (int j = 0; j < HDSP_MAX_DEST; ++j) {
/* Inputs */
if (inputs->strips[i]->data[current_card][speed][p]->pan_pos[j] != inputs->strips[i]->pan->pos[j])
corrupt++;
if (inputs->strips[i]->data[current_card][speed][p]->fader_pos[j] != inputs->strips[i]->fader->pos[j])
corrupt++;
if (playbacks->strips[i]->data[current_card][speed][p]->pan_pos[j] != playbacks->strips[i]->pan->pos[j])
corrupt++;
if (playbacks->strips[i]->data[current_card][speed][p]->fader_pos[j] != playbacks->strips[i]->fader->pos[j])
corrupt++;
}
/* Inputs row */
if (inputs->strips[i]->data[current_card][speed][p]->mute != inputs->strips[i]->mutesolo->mute)
corrupt++;
if (inputs->strips[i]->data[current_card][speed][p]->solo != inputs->strips[i]->mutesolo->solo)
corrupt++;
if (inputs->strips[i]->data[current_card][speed][p]->dest != inputs->strips[i]->targets->selected)
corrupt++;
/* Playbacks row */
if (playbacks->strips[i]->data[current_card][speed][p]->mute != playbacks->strips[i]->mutesolo->mute)
corrupt++;
if (playbacks->strips[i]->data[current_card][speed][p]->solo != playbacks->strips[i]->mutesolo->solo)
corrupt++;
if (playbacks->strips[i]->data[current_card][speed][p]->dest != playbacks->strips[i]->targets->selected)
corrupt++;
/* Outputs row */
if (outputs->strips[i]->data[current_card][speed][p]->fader_pos != outputs->strips[i]->fader->pos[0])
corrupt++;
}
/* Line outs */
if (outputs->strips[HDSP_MAX_CHANNELS]->data[current_card][speed][p]->fader_pos != outputs->strips[HDSP_MAX_CHANNELS]->fader->pos[0])
corrupt++;
if (outputs->strips[HDSP_MAX_CHANNELS+1]->data[current_card][speed][p]->fader_pos != outputs->strips[HDSP_MAX_CHANNELS+1]->fader->pos[0])
corrupt++;
/* Global settings */
if (data[current_card][speed][p]->mute != inputs->buttons->master->mute)
corrupt++;
if (data[current_card][speed][p]->solo != inputs->buttons->master->solo)
corrupt++;
if (data[current_card][speed][p]->input != inputs->buttons->view->input)
corrupt++;
if (data[current_card][speed][p]->output != inputs->buttons->view->output)
corrupt++;
if (data[current_card][speed][p]->playback != inputs->buttons->view->playback)
corrupt++;
if (data[current_card][speed][p]->submix != inputs->buttons->view->submix)
corrupt++;
if (data[current_card][speed][p]->submix_value != inputs->buttons->view->submix_value)
corrupt++;
/* Setup options */
if (setup->over_val != data[current_card][speed][p]->over)
corrupt++;
if (setup->rate_val != data[current_card][speed][p]->rate)
corrupt++;
if (setup->level_val != data[current_card][speed][p]->level)
corrupt++;
if (setup->rmsplus3_val != data[current_card][speed][p]->rmsplus3)
corrupt++;
if (setup->numbers_val != data[current_card][speed][p]->numbers)
corrupt++;
if (corrupt) {
if (!dirty) {
dirty = 1;
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s *", fl_filename_name(file_name));
label(window_title);
Fl::add_timeout(0.3, dirty_cb, (void *)this);
}
} else {
snprintf(window_title, FL_PATH_MAX, "HDSPMixer - %s", fl_filename_name(file_name));
label(window_title);
dirty = 0;
}
}
void HDSPMixerWindow::setSubmix(int submix_value)
{
for (int i = 0; i < cards[current_card]->channels; i++) {
inputs->strips[i]->targets->value(submix_value);
inputs->strips[i]->targets->redraw();
inputs->strips[i]->fader->dest = submix_value;
inputs->strips[i]->fader->redraw();
inputs->strips[i]->pan->dest = submix_value;
inputs->strips[i]->pan->redraw();
inputs->strips[i]->fader->sendGain();
playbacks->strips[i]->targets->value(submix_value);
playbacks->strips[i]->targets->redraw();
playbacks->strips[i]->fader->dest = submix_value;
playbacks->strips[i]->fader->redraw();
playbacks->strips[i]->pan->dest = submix_value;
playbacks->strips[i]->pan->redraw();
playbacks->strips[i]->fader->sendGain();
}
}
void HDSPMixerWindow::unsetSubmix()
{
for (int i = 0; i < cards[current_card]->channels; i++) {
inputs->strips[i]->targets->value(inputs->strips[i]->targets->selected);
inputs->strips[i]->targets->redraw();
inputs->strips[i]->fader->dest = inputs->strips[i]->targets->selected;
inputs->strips[i]->fader->redraw();
inputs->strips[i]->pan->dest = inputs->strips[i]->targets->selected;
inputs->strips[i]->pan->redraw();
inputs->strips[i]->fader->sendGain();
playbacks->strips[i]->targets->value(playbacks->strips[i]->targets->selected);
playbacks->strips[i]->targets->redraw();
playbacks->strips[i]->fader->dest = playbacks->strips[i]->targets->selected;
playbacks->strips[i]->fader->redraw();
playbacks->strips[i]->pan->dest = playbacks->strips[i]->targets->selected;
playbacks->strips[i]->pan->redraw();
playbacks->strips[i]->fader->sendGain();
}
}
void HDSPMixerWindow::refreshMixer()
{
int i, j;
for (i = 1; i <= cards[current_card]->channels; ++i) {
for (j = 0; j < inputs->strips[0]->targets->max_dest; ++j) {
setMixer(i, 0, j);
setMixer(i, 1, j);
}
}
}
void HDSPMixerWindow::refreshMixerStrip(int idx, int src)
{
int i;
for (i = 0; i < inputs->strips[0]->targets->max_dest; ++i) {
setMixer(idx, src, i);
}
}
void HDSPMixerWindow::resetMixer()
{
int i, j;
for (i = 0; i < 52 ; ++i) {
for (j = 0; j < 28; ++j) {
setGain(i, j, 0);
}
}
}
void HDSPMixerWindow::setGain(int in, int out, int value)
{
/* just a wrapper around the 'Mixer' ctl */
int err;
snd_ctl_elem_id_t *id;
snd_ctl_elem_value_t *ctl;
snd_ctl_t *handle;
snd_ctl_elem_value_alloca(&ctl);
snd_ctl_elem_id_alloca(&id);
snd_ctl_elem_id_set_name(id, "Mixer");
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);
if ((err = snd_ctl_open(&handle, cards[current_card]->name, SND_CTL_NONBLOCK)) < 0) {
fprintf(stderr, "Alsa error: %s\n", snd_strerror(err));
return;
}
snd_ctl_elem_value_set_integer(ctl, 0, in);
snd_ctl_elem_value_set_integer(ctl, 1, out);
snd_ctl_elem_value_set_integer(ctl, 2, value);
if ((err = snd_ctl_elem_write(handle, ctl)) < 0) {
fprintf(stderr, "Alsa error: %s\n", snd_strerror(err));
return;
}
snd_ctl_close(handle);
}
void HDSPMixerWindow::setMixer(int idx, int src, int dst)
{
/* idx is the strip number (indexed fom 1)
src is the row (0 = inputs, 1 = playbacks, 2 = outputs)
dst is the destination stereo channel
*/
int err,gsolo_active,gmute_active, gmute, gsolo;
snd_ctl_elem_id_t *id;
snd_ctl_elem_value_t *ctl;
snd_ctl_t *handle;
gsolo_active = inputs->buttons->master->solo_active;
gmute_active = inputs->buttons->master->mute_active;
gsolo = inputs->buttons->master->solo;
gmute = inputs->buttons->master->mute;
if (src == 0 || src == 1) {
double vol, pan, attenuation_l, attenuation_r, left_val, right_val;
snd_ctl_elem_value_alloca(&ctl);
snd_ctl_elem_id_alloca(&id);
snd_ctl_elem_id_set_name(id, "Mixer");
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);
if ((err = snd_ctl_open(&handle, cards[current_card]->name, SND_CTL_NONBLOCK)) < 0) {
fprintf(stderr, "Alsa error: %s\n", snd_strerror(err));
return;
}
if (src) {
if ((gmute && playbacks->strips[idx-1]->mutesolo->mute && !(playbacks->strips[idx-1]->mutesolo->solo && gsolo)) || (gsolo && gsolo_active && !(playbacks->strips[idx-1]->mutesolo->solo)) ) {
left_val = right_val = 0;
goto muted;
}
} else {
if ((gmute && inputs->strips[idx-1]->mutesolo->mute && !(inputs->strips[idx-1]->mutesolo->solo && gsolo)) || (gsolo && gsolo_active && !(inputs->strips[idx-1]->mutesolo->solo)) ) {
left_val = right_val = 0;
goto muted;
}
}
if (src) {
vol = playbacks->strips[idx-1]->fader->posToInt(playbacks->strips[idx-1]->fader->pos[dst]);
pan = (double)(playbacks->strips[idx-1]->pan->pos[dst])/(double)(PAN_WIDTH*CF);
} else {
vol = inputs->strips[idx-1]->fader->posToInt(inputs->strips[idx-1]->fader->pos[dst]);
pan = (double)(inputs->strips[idx-1]->pan->pos[dst])/(double)(PAN_WIDTH*CF);
}
attenuation_l = (double)(outputs->strips[dst*2]->fader->posToInt(outputs->strips[dst*2]->fader->pos[0]))/65535.0;
attenuation_r = (double)(outputs->strips[dst*2+1]->fader->posToInt(outputs->strips[dst*2+1]->fader->pos[0]))/65535.0;
left_val = attenuation_l* vol * (1.0 - pan);
right_val = attenuation_r* vol * pan;
muted:
snd_ctl_elem_value_set_integer(ctl, 0, src*26+cards[current_card]->channel_map[idx-1]);
snd_ctl_elem_value_set_integer(ctl, 1, cards[current_card]->dest_map[dst]);
snd_ctl_elem_value_set_integer(ctl, 2, (int)left_val);
if ((err = snd_ctl_elem_write(handle, ctl)) < 0) {
fprintf(stderr, "Alsa error: %s\n", snd_strerror(err));
return;
}
snd_ctl_elem_value_set_integer(ctl, 0, src*26+cards[current_card]->channel_map[idx-1]);
snd_ctl_elem_value_set_integer(ctl, 1, cards[current_card]->dest_map[dst]+1);
snd_ctl_elem_value_set_integer(ctl, 2, (int)right_val);
if ((err = snd_ctl_elem_write(handle, ctl)) < 0) {
fprintf(stderr, "Alsa error: %s\n", snd_strerror(err));
return;
}
snd_ctl_close(handle);
} else if (src == 2) {
int i, vol, dest;
dest = (int)floor((idx-1)/2);
for (i = 0; i < cards[current_card]->channels; ++i) {
if ((vol = inputs->strips[i]->fader->posToInt(inputs->strips[i]->fader->pos[dest])) != 0) {
setMixer(i+1, 0, dest);
}
if ((vol = playbacks->strips[i]->fader->posToInt(playbacks->strips[i]->fader->pos[dest])) != 0) {
setMixer(i+1, 1, dest);
}
}
}
}

View file

@ -0,0 +1,96 @@
/*
* HDSPMixer
*
* 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 HDSPMixerWindow_H
#define HDSPMixerWindow_H
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Preferences.H>
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Menu.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/filename.H>
#include <FL/fl_ask.H>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <sys/ioctl.h>
#include <alsa/asoundlib.h>
#include <sound/hdsp.h>
#include "HDSPMixerCard.h"
#include "HDSPMixerInputs.h"
#include "HDSPMixerOutputs.h"
#include "HDSPMixerPresetData.h"
#include "HDSPMixerPlaybacks.h"
#include "HDSPMixerSetup.h"
#include "HDSPMixerAbout.h"
#include "defines.h"
class HDSPMixerInputs;
class HDSPMixerOutputs;
class HDSPMixerPlaybacks;
class HDSPMixerPresetData;
class HDSPMixerSetup;
class HDSPMixerAbout;
class HDSPMixerCard;
class HDSPMixerWindow:public Fl_Double_Window
{
private:
int buttons_removed;
public:
int current_card;
int current_preset;
int dirty;
char file_name_buffer[FL_PATH_MAX];
char window_title[FL_PATH_MAX];
char *file_name;
Fl_Preferences *prefs;
Fl_Menu_Bar *menubar;
Fl_Scroll *scroll;
HDSPMixerSetup *setup;
HDSPMixerAbout *about;
HDSPMixerPresetData *data[3][2][8]; /* data[card number][mode(ds/ss)][preset number] */
HDSPMixerCard *cards[3];
HDSPMixerInputs *inputs;
HDSPMixerPlaybacks *playbacks;
HDSPMixerOutputs *outputs;
HDSPMixerWindow(int x, int y, int w, int h, const char *label, class HDSPMixerCard *hdsp_card1, class HDSPMixerCard *hdsp_card2, class HDSPMixerCard *hdsp_card3);
void reorder();
int handle(int e);
void resize(int x, int y, int w, int h);
void checkState();
void setSubmix(int submix_value);
void unsetSubmix();
void setMixer(int idx, int src, int dest);
void refreshMixer();
void setGain(int in, int out, int value);
void resetMixer();
void restoreDefaults(int card);
void refreshMixerStrip(int idx, int src);
void save();
void load();
};
#endif

59
hdspmixer/src/Makefile.am Normal file
View file

@ -0,0 +1,59 @@
bin_PROGRAMS = hdspmixer
hdspmixer_SOURCES = \
hdspmixer.cxx \
HDSPMixerWindow.cxx \
HDSPMixerWindow.h \
HDSPMixerInputs.cxx \
HDSPMixerInputs.h \
HDSPMixerOutputs.cxx \
HDSPMixerOutputs.h \
HDSPMixerPlaybacks.cxx \
HDSPMixerPlaybacks.h \
HDSPMixerButtons.cxx \
HDSPMixerButtons.h \
HDSPMixerEmpty.cxx \
HDSPMixerEmpty.h \
HDSPMixerOutput.cxx \
HDSPMixerOutput.h \
HDSPMixerIOMixer.cxx \
HDSPMixerIOMixer.h \
HDSPMixerSelector.cxx \
HDSPMixerSelector.h \
HDSPMixerPan.cxx \
HDSPMixerPan.h \
HDSPMixerFader.cxx \
HDSPMixerFader.h \
HDSPMixerGain.cxx \
HDSPMixerGain.h \
HDSPMixerPeak.cxx \
HDSPMixerPeak.h \
HDSPMixerCard.cxx \
HDSPMixerCard.h \
HDSPMixerCardSelector.cxx \
HDSPMixerCardSelector.h \
HDSPMixerMaster.cxx \
HDSPMixerMaster.h \
HDSPMixerView.cxx \
HDSPMixerView.h \
HDSPMixerPresets.cxx \
HDSPMixerPresets.h \
HDSPMixerMuteSolo.cxx \
HDSPMixerMuteSolo.h \
HDSPMixerStripData.cxx \
HDSPMixerStripData.h \
HDSPMixerOutputData.cxx \
HDSPMixerOutputData.h \
HDSPMixerPresetData.cxx \
HDSPMixerPresetData.h \
HDSPMixerSetup.cxx \
HDSPMixerSetup.h \
HDSPMixerAbout.cxx \
HDSPMixerAbout.h \
HDSPMixerAboutText.cxx \
HDSPMixerAboutText.h \
HDSPMixerMeter.cxx \
HDSPMixerMeter.h \
pixmaps.cxx \
pixmaps.h \
mappings.h \
defines.h

48
hdspmixer/src/defines.h Normal file
View file

@ -0,0 +1,48 @@
/*
* HDSPMixer
*
* 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
/* Uncomment this to make the setup window non-modal */
//#define NON_MODAL_SETUP 1
#define HDSP_MAX_CHANNELS 26
#define HDSP_MAX_DEST 14
#define STRIP_WIDTH 36
#define FULLSTRIP_HEIGHT 253
#define SMALLSTRIP_HEIGHT 208
#define MENU_HEIGHT 20
#define MIN_WIDTH 2*STRIP_WIDTH
#define MIN_HEIGHT MENU_HEIGHT
#define CF 8
#define FADER_HEIGHT 137
#define METER_HEIGHT 139
#define PEAK_HEIGHT 4
#define PAN_WIDTH 28
typedef unsigned long long int int64;
#endif

View file

@ -0,0 +1,82 @@
/*
* HDSPMixer
*
* 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 <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <alsa/asoundlib.h>
#include <sound/hdsp.h>
#include <FL/Fl.H>
#include <FL/Fl_Preferences.H>
#include "pixmaps.h"
#include "HDSPMixerCard.h"
#include "HDSPMixerWindow.h"
#include "defines.h"
int main(int argc, char **argv)
{
HDSPMixerWindow *window;
HDSPMixerCard *hdsp_cards[3];
char *name;
int card;
int cards = 0;
card = -1;
printf("\nHDSPMixer %s - Copyright (C) 2003 Thomas Charbonnel <thomas@undata.org>\n", VERSION);
printf("This program comes with ABSOLUTELY NO WARRANTY\n");
printf("HDSPMixer is free software, see the file COPYING for details\n\n");
printf("Looking for HDSP cards :\n");
while (snd_card_next(&card) >= 0) {
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] = new HDSPMixerCard(Multiface, card);
cards++;
} else if (!strncmp(name, "RME Hammerfall DSP + Digiface", 29)) {
printf("Digiface found !\n");
hdsp_cards[cards] = new HDSPMixerCard(Digiface, card);
cards++;
} else if (!strncmp(name, "RME Hammerfall HDSP 9652", 24)) {
printf("HDSP 9652 found !\n");
hdsp_cards[cards] = new HDSPMixerCard(H9652, card);
cards++;
}
}
}
if (!cards) {
printf("No Hammerfall DSP card found.\n");
exit(EXIT_FAILURE);
}
for (int i = cards; i < 3; ++i) {
hdsp_cards[i] = NULL;
}
printf("%d Hammerfall DSP %s found.\n", cards, (cards > 1) ? "cards" : "card");
window = new HDSPMixerWindow(0, 0, hdsp_cards[0]->window_width, hdsp_cards[0]->window_height, "HDSPMixer", hdsp_cards[0], hdsp_cards[1], hdsp_cards[2]);
Fl::visual(FL_DOUBLE|FL_INDEX);
window->show(argc, argv);
return Fl::run();
}

69
hdspmixer/src/mappings.h Normal file
View file

@ -0,0 +1,69 @@
/*
* HDSPMixer
*
* 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 mappings_H
#define mappings_H
static char channel_map_df_ss[26] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25
};
static char channel_map_mf_ss[26] = {
0, 1, 2, 3, 4, 5, 6, 7,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25,
-1, -1, -1, -1, -1, -1, -1, -1
};
static char meter_map_ds[26] = {
0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19,
24, 25,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
static char channel_map_ds[26] = {
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
24, 25,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
static char dest_map_mf_ss[10] = {
0, 2, 4, 6, 16, 18, 20, 22, 24, 26
};
static char dest_map_ds[8] = {
0, 2, 8, 10, 16, 18, 24, 26
};
static char dest_map_df_ss[14] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26
};
static char dest_map_h9652_ss[13] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24
};
static char dest_map_h9652_ds[7] = {
0, 2, 8, 10, 16, 18, 24
};
#endif

51
hdspmixer/src/pixmaps.cxx Normal file
View file

@ -0,0 +1,51 @@
/*
* HDSPMixer
*
* 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 "pixmaps.h"
#include "../pixmaps/Slider2.xpm"
#include "../pixmaps/Slider1.xpm"
#include "../pixmaps/b_blank.xpm"
#include "../pixmaps/b_card1.xpm"
#include "../pixmaps/b_card2.xpm"
#include "../pixmaps/b_card3.xpm"
#include "../pixmaps/b_mute.xpm"
#include "../pixmaps/b_pre1.xpm"
#include "../pixmaps/b_pre2.xpm"
#include "../pixmaps/b_pre3.xpm"
#include "../pixmaps/b_pre4.xpm"
#include "../pixmaps/b_pre5.xpm"
#include "../pixmaps/b_pre6.xpm"
#include "../pixmaps/b_pre7.xpm"
#include "../pixmaps/b_pre8.xpm"
#include "../pixmaps/b_save.xpm"
#include "../pixmaps/b_solo.xpm"
#include "../pixmaps/buttons.xpm"
#include "../pixmaps/empty.xpm"
#include "../pixmaps/empty_linux.xpm"
#include "../pixmaps/iomixer.xpm"
#include "../pixmaps/level.xpm"
#include "../pixmaps/monitor.xpm"
#include "../pixmaps/mute.xpm"
#include "../pixmaps/output.xpm"
#include "../pixmaps/over.xpm"
#include "../pixmaps/peak.xpm"
#include "../pixmaps/solo.xpm"

54
hdspmixer/src/pixmaps.h Normal file
View file

@ -0,0 +1,54 @@
/*
* HDSPMixer
*
* 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 pixmaps_H
#define pixmaps_H
extern char * Slider1_xpm[];
extern char * Slider2_xpm[];
extern char * b_blank_xpm[];
extern char * b_card1_xpm[];
extern char * b_card2_xpm[];
extern char * b_card3_xpm[];
extern char * b_mute_xpm[];
extern char * b_pre1_xpm[];
extern char * b_pre2_xpm[];
extern char * b_pre3_xpm[];
extern char * b_pre4_xpm[];
extern char * b_pre5_xpm[];
extern char * b_pre6_xpm[];
extern char * b_pre7_xpm[];
extern char * b_pre8_xpm[];
extern char * b_save_xpm[];
extern char * b_solo_xpm[];
extern char * buttons_xpm[];
extern char * empty_xpm[];
extern char * empty_linux_xpm[];
extern char * iomixer_xpm[];
extern char * level_xpm[];
extern char * monitor_xpm[];
extern char * mute_xpm[];
extern char * output_xpm[];
extern char * over_xpm[];
extern char * peak_xpm[];
extern char * solo_xpm[];
#endif