2
Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net>
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#include "callbacks.h"
25
Audiowin::Audiowin (X_window *parent, X_callback *callb, int xp, int yp, X_resman *xresm) :
26
X_window (parent, xp, yp, 200, 100, Colors.main_bg),
32
_atom = XInternAtom (dpy (), "WM_DELETE_WINDOW", True);
33
XSetWMProtocols (dpy (), win (), &_atom, 1);
34
_atom = XInternAtom (dpy (), "WM_PROTOCOLS", True);
38
Audiowin::~Audiowin (void)
43
void Audiowin::handle_event (XEvent *E)
48
handle_xmesg ((XClientMessageEvent *) E);
54
void Audiowin::handle_xmesg (XClientMessageEvent *E)
56
if (E->message_type == _atom) x_unmap ();
60
void Audiowin::handle_callb (int k, X_window *W, XEvent *E)
66
case SLIDER | X_slider::MOVE:
67
case SLIDER | X_slider::STOP:
69
X_slider *X = (X_slider *) W;
71
_asect = (c >> ASECT_BIT0) - 1;
72
_parid = c & ASECT_MASK;
73
_value = X->get_val ();
74
_final = k == (X_callback::SLIDER | X_slider::STOP);
75
_callb->handle_callb (CB_AUDIO_ACT, this, E);
82
void Audiowin::setup (M_ifc_init *M)
92
for (i = 0; i < _nasect; i++)
95
x = XOFFS + XSTEP * i;
96
k = ASECT_STEP * (i + 1);
98
(S->_slid [0] = new X_hslider (this, this, &sli1, &sca_azim, x, 40, 20, k + 0))->x_map ();
99
(S->_slid [1] = new X_hslider (this, this, &sli1, &sca_difg, x, 75, 20, k + 1))->x_map ();
100
(S->_slid [2] = new X_hslider (this, this, &sli1, &sca_dBsh, x, 110, 20, k + 2))->x_map ();
101
(S->_slid [3] = new X_hslider (this, this, &sli1, &sca_dBsh, x, 145, 20, k + 3))->x_map ();
102
(S->_slid [4] = new X_hslider (this, this, &sli1, &sca_dBsh, x, 180, 20, k + 4))->x_map ();
103
(new X_hscale (this, &sca_azim, x, 30, 10))->x_map ();
104
(new X_hscale (this, &sca_difg, x, 65, 10))->x_map ();
105
(new X_hscale (this, &sca_dBsh, x, 133, 10))->x_map ();
106
(new X_hscale (this, &sca_dBsh, x, 168, 10))->x_map ();
108
for (j = 0; j < M->_ndivis; j++)
110
if (M->_divisd [j]._asect == i)
112
if (S->_label [0]) strcat (S->_label, " + ");
113
strcat (S->_label, M->_divisd [j]._label);
114
add_text (x, 5, 200, 20, S->_label, &text0);
118
add_text ( 10, 40, 60, 20, "Azimuth", &text0);
119
add_text ( 10, 75, 60, 20, "Width", &text0);
120
add_text ( 10, 110, 60, 20, "Direct ", &text0);
121
add_text ( 10, 145, 60, 20, "Reflect", &text0);
122
add_text ( 10, 180, 60, 20, "Reverb", &text0);
124
(_slid [0] = new X_hslider (this, this, &sli1, &sca_dBsh, 520, 275, 20, 0))->x_map ();
125
(_slid [1] = new X_hslider (this, this, &sli1, &sca_size, 70, 240, 20, 1))->x_map ();
126
(_slid [2] = new X_hslider (this, this, &sli1, &sca_trev, 70, 275, 20, 2))->x_map ();
127
(_slid [3] = new X_hslider (this, this, &sli1, &sca_spos, 305, 275, 20, 3))->x_map ();
128
(new X_hscale (this, &sca_size, 70, 230, 10))->x_map ();
129
(new X_hscale (this, &sca_trev, 70, 265, 10))->x_map ();
130
(new X_hscale (this, &sca_spos, 305, 265, 10))->x_map ();
131
(new X_hscale (this, &sca_dBsh, 520, 265, 10))->x_map ();
132
add_text ( 10, 240, 50, 20, "Delay", &text0);
133
add_text ( 10, 275, 50, 20, "Time", &text0);
134
add_text (135, 305, 60, 20, "Reverb", &text0);
135
add_text (355, 305, 80, 20, "Position", &text0);
136
add_text (570, 305, 60, 20, "Volume", &text0);
138
sprintf (s, "%s Aeolus-%s Audio settings", M->_appid, VERSION);
141
H.position (_xp, _yp);
142
H.minsize (200, 100);
143
H.maxsize (XOFFS + _nasect * XSTEP, YSIZE);
144
H.rname (_xresm->rname ());
145
H.rclas (_xresm->rclas ());
147
x_resize (XOFFS + _nasect * XSTEP, YSIZE);
151
void Audiowin::set_aupar (M_ifc_aupar *M)
155
if ((M->_parid >= 0) && (M->_parid < 4))
157
_slid [M->_parid]->set_val (M->_value);
160
else if (M->_asect < _nasect)
162
if ((M->_parid >= 0) && (M->_parid < 5))
164
_asectd [M->_asect]._slid [M->_parid]->set_val (M->_value);
170
void Audiowin::add_text (int xp, int yp, int xs, int ys, const char *text, X_textln_style *style)
172
(new X_textln (this, style, xp, yp, xs, ys, text, -1))->x_map ();