mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-31 22:25:34 -04:00
us428control support for mixxx
This patch allow to change the mapping of the us428, the new mapping is used with mixxx. To use the new mapping: ./us428control -m mixxx Signed-off-by: Cedric GESTES <goctaf@gmail.com>
This commit is contained in:
parent
b956edf51f
commit
b715a9637d
8 changed files with 395 additions and 153 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003 by Karsten Wiese <annabellesgarden@yahoo.de>
|
* Copyright (c) 2003 by Karsten Wiese <annabellesgarden@yahoo.de>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003 by Karsten Wiese <annabellesgarden@yahoo.de>
|
* Copyright (c) 2003 by Karsten Wiese <annabellesgarden@yahoo.de>
|
||||||
|
|
@ -87,14 +88,23 @@ class Cus428Midi {
|
||||||
return Err;
|
return Err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SendMidiControl(char Param, char Val){
|
int SendMidiControl(char Channel, char Param, char Val){
|
||||||
snd_seq_ev_set_controller(&Ev, 15, Param, Val & 0x7F);
|
snd_seq_ev_set_controller(&Ev, Channel, Param, Val & 0x7F);
|
||||||
SubMitEvent();
|
SubMitEvent();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SendMidiControl(Cus428State::eKnobs K, bool Down){
|
int SendMidiNote(char Channel, char Note, char Val){
|
||||||
return SendMidiControl(KnobParam[K - Cus428State::eK_RECORD], Down ? 0x7F : 0);
|
if (!Val)
|
||||||
|
snd_seq_ev_set_noteoff(&Ev, Channel, Note, Val & 0x7F);
|
||||||
|
else
|
||||||
|
snd_seq_ev_set_noteon(&Ev, Channel, Note, Val & 0x7F);
|
||||||
|
SubMitEvent();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SendMidiControl(char Channel, Cus428State::eKnobs K, bool Down){
|
||||||
|
return SendMidiControl(Channel, KnobParam[K - Cus428State::eK_RECORD], Down ? 0x7F : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// To parse and dispatch input MIDI events.
|
// To parse and dispatch input MIDI events.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
* Controller for Tascam US-X2Y
|
* Controller for Tascam US-X2Y
|
||||||
*
|
*
|
||||||
|
|
@ -46,7 +47,6 @@ void Cus428State::InitDevice(void)
|
||||||
SliderChangedTo(eFaderM, ((unsigned char*)(us428ctls_sharedmem->CtlSnapShot + us428ctls_sharedmem->CtlSnapShotLast))[eFaderM]);
|
SliderChangedTo(eFaderM, ((unsigned char*)(us428ctls_sharedmem->CtlSnapShot + us428ctls_sharedmem->CtlSnapShotLast))[eFaderM]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Cus428State::LightSend()
|
int Cus428State::LightSend()
|
||||||
{
|
{
|
||||||
int Next = us428ctls_sharedmem->p4outLast + 1;
|
int Next = us428ctls_sharedmem->p4outLast + 1;
|
||||||
|
|
@ -57,6 +57,11 @@ int Cus428State::LightSend()
|
||||||
return us428ctls_sharedmem->p4outLast = Next;
|
return us428ctls_sharedmem->p4outLast = Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cus428State::SliderSend(int S)
|
||||||
|
{
|
||||||
|
Midi.SendMidiControl(15, 0x40 + S, ((unsigned char*)us428_ctls)[S] / 2);
|
||||||
|
}
|
||||||
|
|
||||||
void Cus428State::SendVolume(usX2Y_volume &V)
|
void Cus428State::SendVolume(usX2Y_volume &V)
|
||||||
{
|
{
|
||||||
int Next = us428ctls_sharedmem->p4outLast + 1;
|
int Next = us428ctls_sharedmem->p4outLast + 1;
|
||||||
|
|
@ -67,54 +72,31 @@ void Cus428State::SendVolume(usX2Y_volume &V)
|
||||||
us428ctls_sharedmem->p4outLast = Next;
|
us428ctls_sharedmem->p4outLast = Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cus428State::UserSliderChangedTo(int S, unsigned char New)
|
||||||
|
{
|
||||||
|
SliderSend(S);
|
||||||
|
}
|
||||||
|
|
||||||
void Cus428State::SliderChangedTo(int S, unsigned char New)
|
void Cus428State::SliderChangedTo(int S, unsigned char New)
|
||||||
{
|
{
|
||||||
if (StateInputMonitor() && S <= eFader3
|
if (StateInputMonitor() && S <= eFader3 || S == eFaderM) {
|
||||||
|| S == eFaderM) {
|
|
||||||
usX2Y_volume &V = Volume[S >= eFader4 ? eFader4 : S];
|
usX2Y_volume &V = Volume[S >= eFader4 ? eFader4 : S];
|
||||||
V.SetTo(S, New);
|
V.SetTo(S, New);
|
||||||
if (S == eFaderM || !LightIs(eL_Mute0 + S))
|
if (S == eFaderM || !LightIs(eL_Mute0 + S))
|
||||||
SendVolume(V);
|
SendVolume(V);
|
||||||
}
|
}
|
||||||
else SliderSend(S);
|
else
|
||||||
|
UserSliderChangedTo(S, New);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cus428State::SliderSend(int S)
|
void Cus428State::UserKnobChangedTo(eKnobs K, bool V)
|
||||||
{
|
{
|
||||||
Midi.SendMidiControl(0x40 + S, ((unsigned char*)us428_ctls)[S] / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
|
||||||
{
|
|
||||||
switch (K & ~(StateInputMonitor() ? 3 : -1)) {
|
|
||||||
case eK_Select0:
|
|
||||||
if (V) {
|
|
||||||
int S = eL_Select0 + (K & 7);
|
|
||||||
Light[eL_Select0 / 8].Value = 0;
|
|
||||||
LightSet(S, !LightIs(S));
|
|
||||||
LightSend();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case eK_Mute0:
|
|
||||||
if (V) {
|
|
||||||
int M = eL_Mute0 + (K & 7);
|
|
||||||
LightSet(M, !LightIs(M));
|
|
||||||
LightSend();
|
|
||||||
if (StateInputMonitor()) {
|
|
||||||
usX2Y_volume V = Volume[M - eL_Mute0];
|
|
||||||
if (LightIs(M))
|
|
||||||
V.LH = V.LL = V.RL = V.RH = 0;
|
|
||||||
SendVolume(V);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
switch (K) {
|
switch (K) {
|
||||||
case eK_STOP:
|
case eK_STOP:
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf("Knob STOP now %i\n", V);
|
printf("Knob STOP now %i\n", V);
|
||||||
if (V) TransportToggle(T_STOP);
|
if (V) TransportToggle(T_STOP);
|
||||||
Midi.SendMidiControl(K, V);
|
Midi.SendMidiControl(15, K, V);
|
||||||
break;
|
break;
|
||||||
case eK_PLAY:
|
case eK_PLAY:
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
|
|
@ -122,7 +104,7 @@ void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
||||||
if (V) TransportToggle(T_PLAY);
|
if (V) TransportToggle(T_PLAY);
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf(" Light is %i\n", LightIs(eL_Play));
|
printf(" Light is %i\n", LightIs(eL_Play));
|
||||||
Midi.SendMidiControl(K, V);
|
Midi.SendMidiControl(15, K, V);
|
||||||
break;
|
break;
|
||||||
case eK_REW:
|
case eK_REW:
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
|
|
@ -130,7 +112,7 @@ void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
||||||
if (V) TransportToggle(T_REW);
|
if (V) TransportToggle(T_REW);
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf(" Light is %i\n", LightIs(eL_Rew));
|
printf(" Light is %i\n", LightIs(eL_Rew));
|
||||||
Midi.SendMidiControl(K, V);
|
Midi.SendMidiControl(15, K, V);
|
||||||
break;
|
break;
|
||||||
case eK_FFWD:
|
case eK_FFWD:
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
|
|
@ -138,7 +120,7 @@ void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
||||||
if (V) TransportToggle(T_F_FWD);
|
if (V) TransportToggle(T_F_FWD);
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf(" Light is %i\n", LightIs(eL_FFwd));
|
printf(" Light is %i\n", LightIs(eL_FFwd));
|
||||||
Midi.SendMidiControl(K, V);
|
Midi.SendMidiControl(15, K, V);
|
||||||
break;
|
break;
|
||||||
case eK_RECORD:
|
case eK_RECORD:
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
|
|
@ -146,7 +128,7 @@ void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
||||||
if (V) TransportToggle(T_RECORD);
|
if (V) TransportToggle(T_RECORD);
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf(" Light is %i\n", LightIs(eL_Record));
|
printf(" Light is %i\n", LightIs(eL_Record));
|
||||||
Midi.SendMidiControl(K, V);
|
Midi.SendMidiControl(15, K, V);
|
||||||
break;
|
break;
|
||||||
case eK_SET:
|
case eK_SET:
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
|
|
@ -177,7 +159,40 @@ void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eK_InputMonitor:
|
default:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob %i now %i\n", K, V);
|
||||||
|
Midi.SendMidiControl(15, K, V);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
||||||
|
{
|
||||||
|
switch (K & ~(StateInputMonitor() ? 3 : -1)) {
|
||||||
|
case eK_Select0:
|
||||||
|
if (V) {
|
||||||
|
int S = eL_Select0 + (K & 7);
|
||||||
|
Light[eL_Select0 / 8].Value = 0;
|
||||||
|
LightSet(S, !LightIs(S));
|
||||||
|
LightSend();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case eK_Mute0:
|
||||||
|
if (V) {
|
||||||
|
int M = eL_Mute0 + (K & 7);
|
||||||
|
LightSet(M, !LightIs(M));
|
||||||
|
LightSend();
|
||||||
|
if (StateInputMonitor()) {
|
||||||
|
usX2Y_volume V = Volume[M - eL_Mute0];
|
||||||
|
if (LightIs(M))
|
||||||
|
V.LH = V.LL = V.RL = V.RH = 0;
|
||||||
|
SendVolume(V);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (K == eK_InputMonitor) {
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf("Knob InputMonitor now %i", V);
|
printf("Knob InputMonitor now %i", V);
|
||||||
if (V) {
|
if (V) {
|
||||||
|
|
@ -195,35 +210,16 @@ void Cus428State::KnobChangedTo(eKnobs K, bool V)
|
||||||
}
|
}
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
printf(" Light is %i\n", LightIs(eL_InputMonitor));
|
printf(" Light is %i\n", LightIs(eL_InputMonitor));
|
||||||
break;
|
} else
|
||||||
default:
|
UserKnobChangedTo(K, V);
|
||||||
if (verbose > 1)
|
|
||||||
printf("Knob %i now %i\n", K, V);
|
|
||||||
Midi.SendMidiControl(K, V);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cus428State::UserWheelChangedTo(E_In84 W, char Diff)
|
||||||
void Cus428State::WheelChangedTo(E_In84 W, char Diff)
|
|
||||||
{
|
{
|
||||||
char Param;
|
char Param;
|
||||||
switch (W) {
|
switch (W) {
|
||||||
case eWheelPan:
|
case eWheelPan:
|
||||||
if (StateInputMonitor() && Light[0].Value) {
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
while( index < 4 && (1 << index) != Light[0].Value)
|
|
||||||
index++;
|
|
||||||
|
|
||||||
if (index >= 4)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Volume[index].PanTo(Diff, us428_ctls->Knob(eK_SET));
|
|
||||||
if (!LightIs(eL_Mute0 + index))
|
|
||||||
SendVolume(Volume[index]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Param = 0x4D;
|
Param = 0x4D;
|
||||||
break;
|
break;
|
||||||
case eWheelGain:
|
case eWheelGain:
|
||||||
|
|
@ -241,7 +237,27 @@ void Cus428State::WheelChangedTo(E_In84 W, char Diff)
|
||||||
WheelDelta((int) ((unsigned char *) us428_ctls)[W]);
|
WheelDelta((int) ((unsigned char *) us428_ctls)[W]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Midi.SendMidiControl(Param, ((unsigned char *) us428_ctls)[W]);
|
Midi.SendMidiControl(15, Param, ((unsigned char *) us428_ctls)[W]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cus428State::WheelChangedTo(E_In84 W, char Diff)
|
||||||
|
{
|
||||||
|
if (W == eWheelPan && StateInputMonitor() && Light[0].Value)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
while( index < 4 && (1 << index) != Light[0].Value)
|
||||||
|
index++;
|
||||||
|
|
||||||
|
if (index >= 4)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Volume[index].PanTo(Diff, us428_ctls->Knob(eK_SET));
|
||||||
|
if (!LightIs(eL_Mute0 + index))
|
||||||
|
SendVolume(Volume[index]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UserWheelChangedTo(W, Diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -444,3 +460,181 @@ void Cus428State::MmcReset()
|
||||||
LocateSend();
|
LocateSend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cus428StateMixxx::Cus428StateMixxx(struct us428ctls_sharedmem* Pus428ctls_sharedmem):Cus428State(Pus428ctls_sharedmem)
|
||||||
|
{
|
||||||
|
focus = 0;
|
||||||
|
eq = 0;
|
||||||
|
LightSet(eL_Low, 1);
|
||||||
|
LightSet(eL_LowMid, 0);
|
||||||
|
LightSet(eL_HiMid, 0);
|
||||||
|
LightSet(eL_High, 0);
|
||||||
|
LightSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cus428StateMixxx::UserKnobChangedTo(eKnobs K, bool V)
|
||||||
|
{
|
||||||
|
switch (K) {
|
||||||
|
case eK_BANK_L:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob BANK_L now %i", V);
|
||||||
|
if (V) LightSet(eL_BankL, !LightIs(eL_BankL));
|
||||||
|
LightSend();
|
||||||
|
Midi.SendMidiNote(0, 51, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_BANK_R:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob BANK_R now %i", V);
|
||||||
|
if (V) LightSet(eL_BankR, !LightIs(eL_BankR));
|
||||||
|
LightSend();
|
||||||
|
Midi.SendMidiNote(1, 51, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_REW:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob REW now %i", V);
|
||||||
|
Midi.SendMidiNote(focus, 60, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_FFWD:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob FFWD now %i", V);
|
||||||
|
Midi.SendMidiNote(focus, 61, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_STOP:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob STOP now %i\n", V);
|
||||||
|
Midi.SendMidiNote(focus, 62, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_PLAY:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob PLAY now %i", V);
|
||||||
|
Midi.SendMidiNote(focus, 63, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_RECORD:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob RECORD now %i", V);
|
||||||
|
Midi.SendMidiNote(focus, 64, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_LOW:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob LOW now %i", V);
|
||||||
|
if (V)
|
||||||
|
{
|
||||||
|
eq = 0;
|
||||||
|
LightSet(eL_Low, 1);
|
||||||
|
LightSet(eL_LowMid, 0);
|
||||||
|
LightSet(eL_HiMid, 0);
|
||||||
|
LightSet(eL_High, 0);
|
||||||
|
LightSend();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case eK_LOWMID:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob LOWMID now %i", V);
|
||||||
|
if (V)
|
||||||
|
{
|
||||||
|
eq = 1;
|
||||||
|
LightSet(eL_Low, 0);
|
||||||
|
LightSet(eL_LowMid, 1);
|
||||||
|
LightSet(eL_HiMid, 0);
|
||||||
|
LightSet(eL_High, 0);
|
||||||
|
LightSend();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case eK_HIMID:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob HIMID now %i", V);
|
||||||
|
if (V)
|
||||||
|
{
|
||||||
|
eq = 2;
|
||||||
|
LightSet(eL_Low, 0);
|
||||||
|
LightSet(eL_LowMid, 0);
|
||||||
|
LightSet(eL_HiMid, 1);
|
||||||
|
LightSet(eL_High, 0);
|
||||||
|
LightSend();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case eK_HIGH:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob HIGH now %i", V);
|
||||||
|
if (V)
|
||||||
|
{
|
||||||
|
eq = 3;
|
||||||
|
LightSet(eL_Low, 0);
|
||||||
|
LightSet(eL_LowMid, 0);
|
||||||
|
LightSet(eL_HiMid, 0);
|
||||||
|
LightSet(eL_High, 1);
|
||||||
|
LightSend();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case eK_SET:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob SET now %i", V);
|
||||||
|
Midi.SendMidiNote(focus, 65, V ? 127 : 0);
|
||||||
|
break;
|
||||||
|
case eK_LOCATE_L:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob LOCATE_L now %i", V);
|
||||||
|
if (V) {
|
||||||
|
focus = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case eK_LOCATE_R:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob LOCATE_R now %i", V);
|
||||||
|
if (V) {
|
||||||
|
focus = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (verbose > 1)
|
||||||
|
printf("Knob %i now %i\n", K, V);
|
||||||
|
if (K >= eK_Select0 && K <= eK_Select0 + 7) {
|
||||||
|
if (V) LightSet(eL_Select0 + (K - eK_Select0), !LightIs(eL_Select0 + (K - eK_Select0)));
|
||||||
|
LightSend();
|
||||||
|
} else if (K >= eK_Mute0 && K <= eK_Mute0 + 7) {
|
||||||
|
if (V) LightSet(eL_Mute0 + (K - eK_Mute0), !LightIs(eL_Mute0 + (K - eK_Mute0)));
|
||||||
|
LightSend();
|
||||||
|
}
|
||||||
|
Midi.SendMidiNote(0, K, V);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cus428StateMixxx::UserSliderChangedTo(int S, unsigned char New)
|
||||||
|
{
|
||||||
|
// if (verbose > 1)
|
||||||
|
// printf("Slider : %d - %d - %d\n", S, New, ((unsigned char*)us428_ctls)[S]);
|
||||||
|
Midi.SendMidiControl(0, 0x40 + S, ((unsigned char*)us428_ctls)[S] / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cus428StateMixxx::UserWheelChangedTo(E_In84 W, char Diff)
|
||||||
|
{
|
||||||
|
char Param;
|
||||||
|
char Value;
|
||||||
|
char Channel;
|
||||||
|
//if (verbose > 1)
|
||||||
|
// printf("Slider : %d - %d - %d\n", W, Diff, ((unsigned char *) us428_ctls)[W]);
|
||||||
|
|
||||||
|
Channel = 0;
|
||||||
|
switch (W) {
|
||||||
|
case eWheelGain:
|
||||||
|
Param = 0x48 + eq * 4;
|
||||||
|
break;
|
||||||
|
case eWheelFreq:
|
||||||
|
Param = 0x49 + eq * 4;
|
||||||
|
break;
|
||||||
|
case eWheelQ:
|
||||||
|
Param = 0x4A + eq * 4;
|
||||||
|
break;
|
||||||
|
case eWheelPan:
|
||||||
|
Param = 0x4B + eq * 4;
|
||||||
|
break;
|
||||||
|
case eWheel:
|
||||||
|
Param = 0x60;
|
||||||
|
Channel = focus;
|
||||||
|
// Update the absolute wheel position.
|
||||||
|
//WheelDelta((int) ((unsigned char *) us428_ctls)[W]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Value = 64 + Diff;
|
||||||
|
Midi.SendMidiControl(Channel, Param, Value);
|
||||||
|
//Midi.SendMidiControl(0, Param, ((unsigned char *) us428_ctls)[W]);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
* Controller for Tascam US-X2Y
|
* Controller for Tascam US-X2Y
|
||||||
*
|
*
|
||||||
|
|
@ -84,10 +85,15 @@ class Cus428State: public us428_lights{
|
||||||
eK_F3,
|
eK_F3,
|
||||||
};
|
};
|
||||||
void InitDevice(void);
|
void InitDevice(void);
|
||||||
|
|
||||||
void KnobChangedTo(eKnobs K, bool V);
|
void KnobChangedTo(eKnobs K, bool V);
|
||||||
void SliderChangedTo(int S, unsigned char New);
|
void SliderChangedTo(int S, unsigned char New);
|
||||||
void SliderSend(int S);
|
|
||||||
void WheelChangedTo(E_In84 W, char Diff);
|
void WheelChangedTo(E_In84 W, char Diff);
|
||||||
|
virtual void UserSliderChangedTo(int S, unsigned char New);
|
||||||
|
virtual void UserWheelChangedTo(E_In84 W, char Diff);
|
||||||
|
virtual void UserKnobChangedTo(eKnobs K, bool V);
|
||||||
|
|
||||||
|
void SliderSend(int S);
|
||||||
Cus428_ctls *Set_us428_ctls(Cus428_ctls *New) {
|
Cus428_ctls *Set_us428_ctls(Cus428_ctls *New) {
|
||||||
Cus428_ctls *Old = us428_ctls;
|
Cus428_ctls *Old = us428_ctls;
|
||||||
us428_ctls = New;
|
us428_ctls = New;
|
||||||
|
|
@ -104,7 +110,7 @@ class Cus428State: public us428_lights{
|
||||||
void TransportSend();
|
void TransportSend();
|
||||||
// Reset internal MMC state.
|
// Reset internal MMC state.
|
||||||
void MmcReset();
|
void MmcReset();
|
||||||
private:
|
protected:
|
||||||
void SendVolume(usX2Y_volume &V);
|
void SendVolume(usX2Y_volume &V);
|
||||||
struct us428ctls_sharedmem* us428ctls_sharedmem;
|
struct us428ctls_sharedmem* us428ctls_sharedmem;
|
||||||
bool StateInputMonitor() {
|
bool StateInputMonitor() {
|
||||||
|
|
@ -140,6 +146,18 @@ class Cus428State: public us428_lights{
|
||||||
int aWheelSpeed;
|
int aWheelSpeed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Cus428StateMixxx: public Cus428State{
|
||||||
|
public:
|
||||||
|
Cus428StateMixxx(struct us428ctls_sharedmem* Pus428ctls_sharedmem);
|
||||||
|
void UserKnobChangedTo(eKnobs K, bool V);
|
||||||
|
void UserSliderChangedTo(int S, unsigned char New);
|
||||||
|
void UserWheelChangedTo(E_In84 W, char Diff);
|
||||||
|
protected:
|
||||||
|
int focus;
|
||||||
|
int eq;
|
||||||
|
};
|
||||||
|
|
||||||
extern Cus428State* OneState;
|
extern Cus428State* OneState;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
* Controller for Tascam US-X2Y
|
* Controller for Tascam US-X2Y
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
* Controller for Tascam US-X2Y
|
* Controller for Tascam US-X2Y
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
* Controller for Tascam US-X2Y
|
* Controller for Tascam US-X2Y
|
||||||
*
|
*
|
||||||
|
|
@ -61,7 +62,8 @@ static void usage(void)
|
||||||
{
|
{
|
||||||
printf("Tascam US-428 Control\n");
|
printf("Tascam US-428 Control\n");
|
||||||
printf("version %s\n", VERSION);
|
printf("version %s\n", VERSION);
|
||||||
printf("usage: "PROGNAME" [-v verbosity_level 0..2] [-c card] [-D device] [-u usb-device]\n");
|
printf("usage: "PROGNAME" [-v verbosity_level 0..2] [-c card] [-D device] [-u usb-device] [-m mode]\n");
|
||||||
|
printf("mode is one of (native, mixxx)\n");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* check the name id of the given hwdep handle
|
* check the name id of the given hwdep handle
|
||||||
|
|
@ -83,7 +85,7 @@ static int check_hwinfo(snd_hwdep_t *hw, const char *id, const char* usb_dev_nam
|
||||||
return 0; /* ok */
|
return 0; /* ok */
|
||||||
}
|
}
|
||||||
|
|
||||||
int US428Control(const char* DevName)
|
int US428Control(const char* DevName, int mode)
|
||||||
{
|
{
|
||||||
snd_hwdep_t *hw;
|
snd_hwdep_t *hw;
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -117,7 +119,11 @@ int US428Control(const char* DevName)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
us428ctls_sharedmem->CtlSnapShotRed = us428ctls_sharedmem->CtlSnapShotLast;
|
us428ctls_sharedmem->CtlSnapShotRed = us428ctls_sharedmem->CtlSnapShotLast;
|
||||||
|
if (mode == 1)
|
||||||
|
OneState = new Cus428StateMixxx(us428ctls_sharedmem);
|
||||||
|
else
|
||||||
OneState = new Cus428State(us428ctls_sharedmem);
|
OneState = new Cus428State(us428ctls_sharedmem);
|
||||||
|
|
||||||
OneState->InitDevice();
|
OneState->InitDevice();
|
||||||
|
|
||||||
while ((pollrc = poll(pfds, npfd, 60000)) >= 0) {
|
while ((pollrc = poll(pfds, npfd, 60000)) >= 0) {
|
||||||
|
|
@ -152,12 +158,13 @@ int US428Control(const char* DevName)
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
int mode = 0;
|
||||||
int card = -1;
|
int card = -1;
|
||||||
char *device_name = NULL,
|
char *device_name = NULL,
|
||||||
*usb_device_name = getenv("DEVICE");
|
*usb_device_name = getenv("DEVICE");
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "c:D:u:v:")) != -1) {
|
while ((c = getopt(argc, argv, "c:D:u:v:m:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'c':
|
case 'c':
|
||||||
card = atoi(optarg);
|
card = atoi(optarg);
|
||||||
|
|
@ -171,6 +178,10 @@ int main (int argc, char *argv[])
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = atoi(optarg);
|
verbose = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
if (!strcmp(optarg, "mixxx"))
|
||||||
|
mode = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -190,18 +201,18 @@ int main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (device_name) {
|
if (device_name) {
|
||||||
return US428Control(device_name) != 0;
|
return US428Control(device_name, mode) != 0;
|
||||||
}
|
}
|
||||||
if (card >= 0) {
|
if (card >= 0) {
|
||||||
sprintf(name, "hw:%d", card);
|
sprintf(name, "hw:%d", card);
|
||||||
return US428Control(name) != 0;
|
return US428Control(name, mode) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* probe the all cards */
|
/* probe the all cards */
|
||||||
for (c = 0; c < SND_CARDS; c++) {
|
for (c = 0; c < SND_CARDS; c++) {
|
||||||
// verbose--;
|
// verbose--;
|
||||||
sprintf(name, "hw:%d", c);
|
sprintf(name, "hw:%d", c);
|
||||||
if (! US428Control(name))
|
if (!US428Control(name, mode))
|
||||||
card = c;
|
card = c;
|
||||||
}
|
}
|
||||||
if (card < 0) {
|
if (card < 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- mode:C++; indent-tabs-mode:t; tab-width:8; c-basic-offset: 8 -*- */
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003 by Karsten Wiese <annabellesgarden@yahoo.de>
|
* Copyright (c) 2003 by Karsten Wiese <annabellesgarden@yahoo.de>
|
||||||
|
|
@ -158,7 +159,12 @@ struct us428_lights{
|
||||||
eL_FFwd = 29,
|
eL_FFwd = 29,
|
||||||
eL_Play = 30,
|
eL_Play = 30,
|
||||||
eL_Record = 31,
|
eL_Record = 31,
|
||||||
eL_Null
|
eL_AnalogDigital = 32,
|
||||||
|
eL_Null = 34,
|
||||||
|
eL_Low = 36,
|
||||||
|
eL_LowMid = 37,
|
||||||
|
eL_HiMid = 38,
|
||||||
|
eL_High = 39
|
||||||
};
|
};
|
||||||
bool LightIs(int L){
|
bool LightIs(int L){
|
||||||
return Light[L / 8].Value & (1 << (L % 8));
|
return Light[L / 8].Value & (1 << (L % 8));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue