gehe zur Dokumentation dieser Datei00001
00075 #include "InputMidiDeviceShape.h"
00076 #include "DevMidi.h"
00077 #include <limits>
00078
00079
00080 void MutInputMidiDeviceShape::InitializeDialog(InputDevDlg * in) const
00081 {
00082 wxASSERT(device);
00083 wxASSERT(device->GetType() == DTMidiPort);
00084 wxASSERT(in);
00085 InMidiPort * dev = dynamic_cast<InMidiPort *> (device);
00086 wxASSERT (dev);
00087 in -> SetType(DTMidiPort);
00088 in -> SetMidiDevice(dev->GetDevId());
00089 }
00090
00091 bool MutInputMidiDeviceShape::readDialog (InputDevDlg * in)
00092 {
00093 wxASSERT(device);
00094 wxASSERT(device->GetType() == DTMidiPort);
00095 wxASSERT(in);
00096 wxASSERT (in -> GetType() == DTMidiPort);
00097 InMidiPort * dev = dynamic_cast<InMidiPort *> (device);
00098 if (!dev) return false;
00099 wxASSERT (dev);
00100 dev->SetDevId (in -> GetMidiDevice());
00101 SetLabel (dev->GetName());
00102 return true;
00103 }
00104
00105 wxPanel * MutInputMidiDeviceShape::GetInputFilterPanel(wxWindow * parent,
00106 Route * route) const
00107 {
00108 const int maxint = std::numeric_limits<int>().max();
00109 MidiInputFilterPanel * panel = new MidiInputFilterPanel(parent);
00110 if (!panel) return NULL;
00111 InMidiPort * dev = dynamic_cast<InMidiPort *> (device);
00112 const int maxchannel = dev?dev->GetMaxChannel():MIDI_MAX_CHANNEL;
00113 const int minchannel = dev?dev->GetMinChannel():MIDI_MIN_CHANNEL;
00114 const int maxkey = dev?dev->GetMaxKey():MIDI_MAX_KEY;
00115 const int minkey = dev?dev->GetMinKey():MIDI_MIN_KEY;
00116 if (!route) {
00117 panel->SetFromChannel(minchannel, minchannel, maxchannel);
00118 panel->SetToChannel(maxchannel, minchannel, maxchannel);
00119 panel->SetFromKey(minkey, minkey, maxkey);
00120 panel->SetToKey(maxkey, minkey, maxkey);
00121 panel->SetRouteType(RTall);
00122 return panel;
00123 }
00124 panel->SetFromChannel(route->IFrom, minchannel, maxchannel);
00125 panel->SetToChannel(route->ITo, minchannel, maxchannel);
00126 panel->SetFromKey(route->IFrom, minkey, maxkey);
00127 panel->SetToKey(route->ITo, minkey, maxkey);
00128 panel->SetRouteType(route->GetType());
00129 return panel;
00130 }
00131
00132 void MutInputMidiDeviceShape::ReadInputFilterPanel(wxWindow * panel, Route * route)
00133 {
00134 MidiInputFilterPanel * pan = dynamic_cast<MidiInputFilterPanel *> (panel);
00135 if (!pan) {
00136 UNREACHABLEC;
00137 return;
00138 }
00139 route->SetType(pan->GetRouteType());
00140 switch (route->GetType()) {
00141 case RTall:
00142 case RTelse:
00143
00144 break;
00145 case RTchannel:
00146 route->SetInputFrom(pan->GetFromChannel());
00147 route->SetInputTo(pan->GetToChannel());
00148 break;
00149 case RTstaff:
00150 route->SetInputFrom(pan->GetFromKey());
00151 route->SetInputTo(pan->GetToKey());
00152 break;
00153 default:
00154 UNREACHABLEC;
00155 break;
00156 }
00157 return;
00158 }
00159
00160
00161
00162 IMPLEMENT_DYNAMIC_CLASS(MutInputMidiDeviceShape, MutInputDeviceShape)
00163
00164
00165
00166