Browse Source

fix synth_shed

master
heck 4 years ago
parent
commit
50f901de7d
  1. 11
      examples/lib/lib_synth_shed/synth_shed.c
  2. 2
      examples/lib/lib_synth_shed/synth_shed.h

11
examples/lib/lib_synth_shed/synth_shed.c

@ -46,13 +46,12 @@ SYNTH_STATUS synth_create(synth_t **new_synth, const char *brand, const char *mo
SYNTH_STATUS synth_set_osc_count(synth_t *synth, int osc_count) { SYNTH_STATUS synth_set_osc_count(synth_t *synth, int osc_count) {
assert(synth); assert(synth);
SYNTH_STATUS status = 0;
if (osc_count < 0) { if (osc_count < 0) {
status = 1; return SYNTH_STATUS_ARG_ERR;
} else { } else {
synth->osc_count = osc_count; synth->osc_count = osc_count;
} }
return status; return SYNTH_STATUS_OK;
} }
@ -87,9 +86,9 @@ const char *tech_to_string(const enum _tech *tech) {
} }
SYNTH_STATUS filtertype_to_string(const filtertype_t *const filt, char **ftstr) { SYNTH_STATUS filtertype_to_string(const filtertype_t *const filt,const char **ftstr) {
assert(filt); assert(filt);
char *_ftstr = "unknown filtertype"; const char *_ftstr = "unknown filtertype";
if (filt == NULL) { if (filt == NULL) {
return SYNTH_STATUS_ARG_ERR; return SYNTH_STATUS_ARG_ERR;
} }
@ -126,7 +125,7 @@ const char *play_synth(synth_t *synth) {
const char *filtertype_str[3] = {"", "", ""}; const char *filtertype_str[3] = {"", "", ""};
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
filt_tech[i] = tech_to_string(&synth->filter[i].technology); (filt_tech[i]) = tech_to_string(&synth->filter[i].technology);
SYNTH_STATUS status = filtertype_to_string(&synth->filter[i].type, &filtertype_str[i]); SYNTH_STATUS status = filtertype_to_string(&synth->filter[i].type, &filtertype_str[i]);
if (status != SYNTH_STATUS_OK) { if (status != SYNTH_STATUS_OK) {

2
examples/lib/lib_synth_shed/synth_shed.h

@ -58,7 +58,7 @@ const char* status_to_string(SYNTH_STATUS status);
const char* tech_to_string(const enum _tech* tech); const char* tech_to_string(const enum _tech* tech);
SYNTH_STATUS filtertype_to_string(const filtertype_t* const filt, char** ftstr); SYNTH_STATUS filtertype_to_string(const filtertype_t* const filt,const char** ftstr);
const char* play_synth(synth_t* synth); const char* play_synth(synth_t* synth);

Loading…
Cancel
Save