Skip to content

Commit

Permalink
pdinfo: Cosmetic fixes (audio/midiapi et al).
Browse files Browse the repository at this point in the history
  • Loading branch information
agraef committed Sep 14, 2024
1 parent fac5a18 commit f1f4580
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions pd/src/x_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ void canvasinfo_setup(void)
/* -------------------------- pdinfo ------------------------------ */
static t_class *pdinfo_class;

t_symbol *getapiname(int id)
static t_symbol *getapiname(int id)
{
t_symbol *s = 0;
switch (id)
Expand All @@ -733,6 +733,14 @@ t_symbol *getapiname(int id)
return s;
}

static t_symbol *getmidiapiname(int id)
{
if (id == API_PORTAUDIO)
return gensym("PortMidi");
else
return getapiname(id);
}

void pdinfo_dir(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[1];
Expand Down Expand Up @@ -814,11 +822,6 @@ void pdinfo_classlist(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
}
}

void pdinfo_audioin(t_pdinfo *x, t_symbol *s, int argc, t_atom *arg)
{
// char i
}

void pdinfo_audio_api_list_all(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[7];
Expand All @@ -832,15 +835,15 @@ void pdinfo_audio_apilist(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[8];
int n = 0;
#ifdef USEAPI_ALSA
SETSYMBOL(at+n, getapiname(API_ALSA)); n++;
#endif
#ifdef USEAPI_OSS
SETSYMBOL(at+n, getapiname(API_OSS)); n++;
#endif
#ifdef USEAPI_MMIO
SETSYMBOL(at+n, getapiname(API_MMIO)); n++;
#endif
#ifdef USEAPI_ALSA
SETSYMBOL(at+n, getapiname(API_ALSA)); n++;
#endif
#ifdef USEAPI_PORTAUDIO
#ifdef MSW
SETSYMBOL(at+n, getapiname(API_PORTAUDIO));
Expand Down Expand Up @@ -925,26 +928,26 @@ void pdinfo_audio_dev(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
void pdinfo_midi_api(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[1];
t_symbol *api, *def = gensym("DEFAULT");
#ifdef USEAPI_OSS
def = gensym("OSS");
#endif
api = sys_midiapi ? gensym("ALSA") : def;
t_symbol *api = getmidiapiname(sys_midiapi);
SETSYMBOL(at, api);
info_out((t_text *)x, s, 1, at);
}

void pdinfo_midi_apilist(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[8];
t_atom at[4];
int n = 0;
SETSYMBOL(at+n, gensym("DEFAULT"));
#ifdef USEAPI_ALSA
SETSYMBOL(at+n, getmidiapiname(API_ALSA)); n++;
#endif
#ifdef USEAPI_OSS
SETSYMBOL(at+n, gensym("OSS"));
SETSYMBOL(at+n, getmidiapiname(API_OSS)); n++;
#endif
n++;
#ifdef USEAPI_ALSA
SETSYMBOL(at+n, getapiname(API_ALSA)); n++;
#ifdef USEAPI_MMIO
SETSYMBOL(at+n, getmidiapiname(API_MMIO)); n++;
#endif
#ifdef USEAPI_PORTAUDIO
SETSYMBOL(at+n, getmidiapiname(API_PORTAUDIO)); n++;
#endif
info_out((t_text *)x, s, n, at);
}
Expand Down

0 comments on commit f1f4580

Please sign in to comment.