gehe zur Dokumentation dieser Datei00001
00072 #include "OutputMidiDeviceShape.h"
00073 #include "DevMidi.h"
00074 #include <limits>
00075
00076 class MidiOutputFilterPanel : public MidiOutputFilterPanelBase {
00077 public:
00078 MidiOutputFilterPanel(wxWindow * parent):MidiOutputFilterPanelBase(parent) {}
00082 void SetFromChannel(int current, int min, int max) {
00083 from_channel->SetRange(min,max);
00084 from_channel->SetValue(current);
00085 }
00086 int GetFromChannel() const
00087 {
00088 return from_channel->GetValue();
00089 }
00090
00091 void SetToChannel(int current, int min, int max) {
00092 to_channel->SetRange(min,max);
00093 to_channel->SetValue(current);
00094 }
00095 int GetToChannel() const
00096 {
00097 return to_channel->GetValue();
00098 }
00099
00100 void SetAvoidDrumChannel(bool avoid) {
00101 avoid_drum_channel->SetValue(avoid);
00102 }
00103 bool GetAvoidDrumChannel() const
00104 {
00105 return avoid_drum_channel->GetValue();
00106 }
00107 };
00108
00109
00110 void MutOutputMidiDeviceShape::InitializeDialog(OutputDevDlg * out) const
00111 {
00112 DEBUGLOG (other, _T("Type: %d"),DTMidiPort);
00113 wxASSERT(device);
00114 wxASSERT(device->GetType() == DTMidiPort);
00115 wxASSERT(out);
00116 OutMidiPort * dev = dynamic_cast<OutMidiPort *> (device);
00117 wxASSERT (dev);
00118 out -> SetType(DTMidiPort);
00119 out -> SetMidiDevice(dev->GetDevId());
00120 out -> SetMidiBendingRange (dev-> GetBendingRange());
00121 }
00122
00123 bool MutOutputMidiDeviceShape::readDialog (OutputDevDlg * out)
00124 {
00125 wxASSERT(device);
00126 wxASSERT(device->GetType() == DTMidiPort);
00127 wxASSERT(out);
00128 wxASSERT (out -> GetType() == DTMidiPort);
00129 OutMidiPort * dev = dynamic_cast<OutMidiPort *> (device);
00130 if (!dev) return false;
00131 wxASSERT (dev);
00132 DEBUGLOG(routing,_T("New midi device: %d"),out -> GetMidiDevice());
00133 dev->SetDevId (out -> GetMidiDevice());
00134 dev->SetBendingRange (out->GetMidiBendingRange());
00135 SetLabel (dev->GetName());
00136 return true;
00137 }
00138
00139 wxPanel * MutOutputMidiDeviceShape::GetOutputFilterPanel(wxWindow * parent,
00140 Route * route) const
00141 {
00142 const int maxint = std::numeric_limits<int>().max();
00143 MidiOutputFilterPanel * panel = new MidiOutputFilterPanel(parent);
00144 if (!panel) return NULL;
00145 OutMidiPort * dev = dynamic_cast<OutMidiPort *> (device);
00146 const int maxchannel = dev?dev->GetMaxChannel():maxint;
00147 const int minchannel = dev?dev->GetMinChannel():0;
00148 if (!route) {
00149 panel->SetFromChannel(minchannel, minchannel, maxchannel);
00150 panel->SetToChannel(maxchannel, minchannel, maxchannel);
00151 panel->SetAvoidDrumChannel(true);
00152 return panel;
00153 }
00154 panel->SetFromChannel(route->OFrom, minchannel, maxchannel);
00155 panel->SetToChannel(route->OTo, minchannel, maxchannel);
00156 panel->SetAvoidDrumChannel(route->ONoDrum);
00157 return panel;
00158 }
00159
00160 void MutOutputMidiDeviceShape::ReadOutputFilterPanel(wxWindow * panel, Route * route)
00161 {
00162 wxASSERT(route);
00163 MidiOutputFilterPanel * pan = dynamic_cast<MidiOutputFilterPanel *> (panel);
00164 if (!pan) {
00165 UNREACHABLEC;
00166 return;
00167 }
00168
00169 route->SetOutputFrom(pan->GetFromChannel());
00170 route->SetOutputTo(pan->GetToChannel());
00171 route->OutputAvoidDrumChannel(pan->GetAvoidDrumChannel());
00172 }
00173
00174
00175 IMPLEMENT_DYNAMIC_CLASS(MutOutputMidiDeviceShape, MutOutputDeviceShape)
00176
00177
00178
00179