--- /dev/null
+/* -*-c-*-
+ *
+ * $Id: auerr.c,v 1.1 2002/02/02 19:16:28 mdw Exp $
+ *
+ * Audio error reporting
+ *
+ * (c) 2002 Mark Wooding
+ */
+
+/*----- Licensing notice --------------------------------------------------*
+ *
+ * This file is part of Jog: Programming for a jogging machine.
+ *
+ * Jog is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Jog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jog; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*----- Revision history --------------------------------------------------*
+ *
+ * $Log: auerr.c,v $
+ * Revision 1.1 2002/02/02 19:16:28 mdw
+ * New audio subsystem.
+ *
+ */
+
+/*----- Header files ------------------------------------------------------*/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <mLib/dstr.h>
+
+#include "au.h"
+#include "aunum.h"
+#include "err.h"
+
+/*----- Main code ---------------------------------------------------------*/
+
+/* --- @auerr@ --- *
+ *
+ * Arguments: @int ctx@ = context code
+ * @int reason@ = reason code
+ * @unsigned long err@ = error code
+ *
+ * Returns: ---
+ *
+ * Use: Reports an error to the audio output.
+ */
+
+void auerr(int ctx, int reason, unsigned long err)
+{
+ dstr d = DSTR_INIT;
+
+ dstr_putf(&d, "%d", ctx);
+ if (reason)
+ dstr_putf(&d, "-%d", reason);
+ if (err)
+ dstr_putf(&d, "-%lu", err);
+ if (!au_tryplay(d.buf))
+ goto done;
+
+ au_play("e-error");
+ au_play("e-ctx"); aunum_ulong(ctx);
+ if (reason) { au_play("e-reason"); aunum_ulong(reason); }
+ if (err) { au_play("e-code"); aunum_ulong(err); }
+
+done:
+ dstr_destroy(&d);
+}
+
+/* --- @auerr_abort@ --- *
+ *
+ * Arguments: @int reason@ = abort reason code
+ * @unsigned long err@ = error code
+ *
+ * Returns: ---
+ *
+ * Use: Reports an abort message to te audio output.
+ */
+
+void auerr_abort(int reason, unsigned long err)
+{
+ au_play("e-abort");
+ au_play("e-reason"); aunum_ulong(reason);
+ au_play("e-code"); aunum_ulong(err);
+}
+
+/*----- That's all, folks -------------------------------------------------*/