00001 00029 #include "Defs.h" 00030 #ifdef DEBUG 00031 #include "DebugRoute.h" 00032 #include "Device.h" 00033 #include "InputDeviceShape.h" 00034 #include "OutputDeviceShape.h" 00035 00036 static void CheckOutputDevice(OutDevice * Out, MutBoxChannelShape * channel) 00037 { 00038 DEBUGLOG2(routing,_T("Output device %p, Channel %p"),Out,channel); 00039 MutOutputDeviceShape * shape = (MutOutputDeviceShape *) (Out->getUserData()); 00040 wxASSERT ((channel && shape) || !(channel || shape)); 00041 if (shape) { 00042 bool found = false; 00043 const MutBoxChannelShapeList & list = shape->getRoutesList(); 00044 for (MutBoxChannelShapeList::const_iterator i = list.begin(); i != list.end(); i++) 00045 if ((*i) == channel) { 00046 found = true; 00047 break; 00048 } 00049 wxASSERT(found); 00050 DEBUGLOG2(routing,_T("Output device shape %p"),shape); 00051 wxASSERT(shape->GetDevice() == Out); 00052 wxASSERT(channel->GetOutput() == shape); 00053 } else { 00054 DEBUGLOG2(routing,_T("No output device shape")); 00055 } 00056 DEBUGLOG2(routing,_T("Output device %p '%s' Type %d:\n%s"),Out,Out->GetName().c_str(),Out->GetType(),Out->TowxString().c_str()); 00057 } 00058 00059 static void CheckRoute(Route * route, MutInputDeviceShape * In) 00060 { 00061 DEBUGLOG2(routing,_T("Route %p id %d, Type %d, Input range %d -- %d"),route,route->GetId(),route->GetType(), 00062 route->GetInputFrom(), route->GetInputTo()); 00063 DEBUGLOG2(routing,_T("Box %d, active %d, Output range %d -- %d (no Drum: %d)"),route->GetBox(), 00064 route->GetActive(),route->GetOutputFrom(), route->GetOutputTo(), route->OutputAvoidDrumChannel()); 00065 MutBoxChannelShape * shape = (MutBoxChannelShape *) (route->getUserData()); 00066 wxASSERT((In && shape ) || !(In || shape)); 00067 if (shape) { 00068 DEBUGLOG2(routing,_T("Box channel shape %p"), shape); 00069 MutBoxShape * box = dynamic_cast<MutBoxShape *> (shape->GetParent()); 00070 DEBUGLOG2(routing,_T("Box shape %p box %d"),box,box->GetBoxId()); 00071 wxASSERT(shape->GetRoute() == route); 00072 wxASSERT(shape->GetInput() == In); 00073 wxASSERT(box->GetBoxId() == route->GetBox()); 00074 } else { 00075 DEBUGLOG2(routing,_T("No Box Channel shape")); 00076 } 00077 OutDevice * Out = route->GetOutDevice(); 00078 if (Out) CheckOutputDevice(Out, shape); 00079 } 00080 00081 static void CheckInputDevice(InDevice *In) 00082 { 00083 DEBUGLOG2(routing,_T("Input device %p '%s' %d:\n%s"), In,In->GetName().c_str(),In->GetType(),In->TowxString().c_str()); 00084 MutInputDeviceShape * shape = (MutInputDeviceShape *) (In->getUserData()); 00085 if (shape) { 00086 DEBUGLOG2(routing,_T("Input device shape %p"),shape); 00087 wxASSERT (shape->GetDevice() == In); 00088 } else { 00089 DEBUGLOG2(routing,_T("No input device shape")); 00090 } 00091 for (Route * route = In->GetRoutes();route;route = route->GetNext()) 00092 CheckRoute(route, shape); 00093 } 00094 00095 void DebugCheckRoutes() { 00096 for (InDevice *In = InDevice::GetDeviceList(); In; In = In->GetNext()) 00097 CheckInputDevice(In); 00098 } 00099 #endif 00100