Skip to content

Commit

Permalink
Fix issue 1196 and add GetErrorCnt to API
Browse files Browse the repository at this point in the history
  • Loading branch information
jpffitch committed Nov 27, 2019
1 parent 5cdd1a2 commit 3ade264
Show file tree
Hide file tree
Showing 16 changed files with 3,580 additions and 3,409 deletions.
8 changes: 5 additions & 3 deletions Frontends/csound/csound_main.c
Expand Up @@ -259,7 +259,8 @@ int main(int argc, char **argv)
{
CSOUND *csound;
char *fname = NULL;
int i, result, nomessages=0;
int i, result, errs, nomessages=0;
extern int csoundErrCnt(CSOUND*);
#ifdef GNU_GETTEXT
const char* lang;
#endif
Expand Down Expand Up @@ -325,6 +326,7 @@ int main(int argc, char **argv)

if (!result) result = csoundPerform(csound);
//printf("**** result = %d\n", result);
errs = csoundErrCnt(csound);
/* delete Csound instance */
csoundDestroy(csound);
_csound = NULL;
Expand All @@ -338,6 +340,6 @@ int main(int argc, char **argv)
/* remove global configuration variables, if there are any */
csoundDeleteAllGlobalConfigurationVariables();
#endif
//printf("**** return %d\n", (result >= 0 ? 0 : -result));
return (result >= 0 ? 0 : -result);
//printf("**** return %d\n", (result >= 0 ? errs : -result));
return (result >= 0 ? errs : -result);
}
2 changes: 1 addition & 1 deletion OOps/ugens5.c
Expand Up @@ -1137,7 +1137,7 @@ int32_t lpfrsnset(CSOUND *csound, LPFRESON *p)

p->lpread = ((LPREAD**) csound->lprdaddr)[csound->currentLPCSlot];
if(p->lpread->npoles < 2) {
return csound->InitError(csound, Str("Two few poles (> 2)"));
return csound->InitError(csound, Str("Too few poles (> 2)"));
}

p->prvratio = FL(1.0);
Expand Down
2 changes: 1 addition & 1 deletion Opcodes/gammatone.c
Expand Up @@ -61,7 +61,7 @@ static int32_t gammatone_init(CSOUND *csound, GAMMA *p)
p->xxi = & p->xxr[CS_KSMPS];
return OK;
}

static int32_t gammatone_perf(CSOUND *csound, GAMMA *p)
{
MYFLT freq = p->oldf;
Expand Down
10 changes: 5 additions & 5 deletions Opcodes/lowpassr.c
Expand Up @@ -30,7 +30,7 @@
static int32_t lowpr_set(CSOUND *csound, LOWPR *p)
{

IGN(csound);
IGN(csound);
if (*p->istor==FL(0.0))
p->ynm1 = p->ynm2 = 0.0;
p->okf = 0.0;
Expand Down Expand Up @@ -375,10 +375,10 @@ static int32_t lowpr_w_sep(CSOUND *csound, LOWPR_SEP *p)

static OENTRY localops[] =
{
{ "lowres.kk", S(LOWPR), 0, 3, "a", "akko", (SUBR)lowpr_set, (SUBR)lowpr },
{ "lowres.aa", S(LOWPR), 0, 3, "a", "aaao", (SUBR)lowpr_set, (SUBR)lowpraa },
{ "lowres.ak", S(LOWPR), 0, 3, "a", "aako", (SUBR)lowpr_set, (SUBR)lowprak },
{ "lowres.ka", S(LOWPR), 0, 3, "a", "akao", (SUBR)lowpr_set, (SUBR)lowprka },
{ "lowres.kk", S(LOWPR), 0, 3, "a", "akko", (SUBR)lowpr_set, (SUBR)lowpr },
{ "lowres.aa", S(LOWPR), 0, 3, "a", "aaao", (SUBR)lowpr_set, (SUBR)lowpraa },
{ "lowres.ak", S(LOWPR), 0, 3, "a", "aako", (SUBR)lowpr_set, (SUBR)lowprak },
{ "lowres.ka", S(LOWPR), 0, 3, "a", "akao", (SUBR)lowpr_set, (SUBR)lowprka },

{ "lowresx.kk", S(LOWPRX),0, 3, "a", "akkoo", (SUBR)lowpr_setx, (SUBR)lowprx },
{ "lowresx.ak", S(LOWPRX),0, 3, "a", "aakoo", (SUBR)lowpr_setx, (SUBR)lowprx },
Expand Down
7 changes: 5 additions & 2 deletions Top/csound.c
Expand Up @@ -98,7 +98,7 @@ extern void close_all_files(CSOUND *);
extern void csoundInputMessageInternal(CSOUND *csound, const char *message);
extern int isstrcod(MYFLT );
extern int fterror(const FGDATA *ff, const char *s, ...);

extern int csoundErrCnt(CSOUND *);
void (*msgcallback_)(CSOUND *, int, const char *, va_list) = NULL;

void csoundDebuggerBreakpointReached(CSOUND *csound);
Expand Down Expand Up @@ -504,11 +504,12 @@ static const CSOUND cenviron_ = {
find_opcode_exact,
csoundGetChannelPtr,
csoundListChannels,
csoundErrCnt,
{
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL
NULL
},
/* ------- private data (not to be used by hosts or externals) ------- */
/* callback function pointers */
Expand Down Expand Up @@ -4436,6 +4437,8 @@ static void set_util_nchnls(CSOUND *csound, int nchnls){ csound->nchnls = nchnls

MYFLT csoundGetA4(CSOUND *csound) { return (MYFLT) csound->A4; }

int PUBLIC csoundErrCnt(CSOUND *csound) { return csound->perferrcnt; }

#if 0
PUBLIC int csoundPerformKsmpsAbsolute(CSOUND *csound)
{
Expand Down
1 change: 1 addition & 0 deletions all_string_files
Expand Up @@ -285,6 +285,7 @@
./Opcodes/gab/tabmorph.c
./Opcodes/gab/vectorial.c
./Opcodes/gab/vectorial.h
./Opcodes/gammatone.c
./Opcodes/gendy.c
./Opcodes/getftargs.c
./Opcodes/grain.c
Expand Down
4 changes: 2 additions & 2 deletions include/csoundCore.h
Expand Up @@ -1382,12 +1382,12 @@ typedef struct _message_queue_t_ {
char* , char*);
int (*GetChannelPtr)(CSOUND *,MYFLT **, const char *, int);
int (*ListChannels)(CSOUND *, controlChannelInfo_t **);

int (*GetErrorCnt)(CSOUND *);
/**@}*/
/** @name Placeholders
To allow the API to grow while maintining backward binary compatibility. */
/**@{ */
SUBR dummyfn_2[32];
SUBR dummyfn_2[31];
/**@}*/
#ifdef __BUILDING_LIBCSOUND
/* ------- private data (not to be used by hosts or externals) ------- */
Expand Down

0 comments on commit 3ade264

Please sign in to comment.