(a) If the action is pending in a local criminal court as a result of an accusatory instrument filed therewith, the application must be made to and determined by such local criminal court;
(b) If the defendant has been held by a local criminal court for the action of a grand jury on the basis of a felony complaint, or if an indictment has been filed against him, the application must be made to and determined by the superior court by which the grand jury was or is to be impaneled or in which the indictment is pending. If the superior court by which the grand jury is to be impaneled is the supreme court, the motion may, in the alternative, be made in the county court of the county in which the action is pending.