DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

sdl_c.cpp (3476B)


      1 /* 
      2 
      3 TiMidity -- Experimental MIDI to WAVE converter
      4 Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
      5 
      6 This program is free software; you can redistribute it and/or modify
      7 it under the terms of the GNU General Public License as published by
      8 the Free Software Foundation; either version 2 of the License, or
      9 (at your option) any later version.
     10 
     11 This program is distributed in the hope that it will be useful,
     12 but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 GNU General Public License for more details.
     15 
     16 You should have received a copy of the GNU General Public License
     17 along with this program; if not, write to the Free Software
     18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19 
     20 sdl_c.c
     21 Minimal control mode -- no interaction, just stores messages.
     22 */
     23 
     24 #include "../../neo/idlib/precompiled.h"
     25 
     26 #include <stdio.h>
     27 #include <stdlib.h>
     28 #include <stdarg.h>
     29 #include <string.h>
     30 
     31 #include "config.h"
     32 #include "common.h"
     33 #include "output.h"
     34 #include "controls.h"
     35 #include "instrum.h"
     36 #include "playmidi.h"
     37 
     38 static void ctl_refresh(void);
     39 static void ctl_total_time(int tt);
     40 static void ctl_master_volume(int mv);
     41 static void ctl_file_name(char *name);
     42 static void ctl_current_time(int ct);
     43 static void ctl_note(int v);
     44 static void ctl_program(int ch, int val);
     45 static void ctl_volume(int channel, int val);
     46 static void ctl_expression(int channel, int val);
     47 static void ctl_panning(int channel, int val);
     48 static void ctl_sustain(int channel, int val);
     49 static void ctl_pitch_bend(int channel, int val);
     50 static void ctl_reset(void);
     51 static int ctl_open(int using_stdin, int using_stdout);
     52 static void ctl_close(void);
     53 static int ctl_read(int *valp);
     54 static int cmsg(int type, int verbosity_level, char *fmt, ...);
     55 
     56 #ifdef _DEBUG
     57 #define safeOutputDebug(x) printf( "%s", x )
     58 #else
     59 #define safeOutputDebug(x)
     60 #endif
     61 
     62 /**********************************/
     63 /* export the interface functions */
     64 
     65 #define ctl sdl_control_mode
     66 
     67 ControlMode ctl= 
     68 {
     69 	"SDL interface", 's',
     70 		1,0,0,
     71 		ctl_open,NULL, ctl_close, ctl_read, cmsg,
     72 		ctl_refresh, ctl_reset, ctl_file_name, ctl_total_time, ctl_current_time, 
     73 		ctl_note, 
     74 		ctl_master_volume, ctl_program, ctl_volume, 
     75 		ctl_expression, ctl_panning, ctl_sustain, ctl_pitch_bend
     76 };
     77 
     78 static int ctl_open(int using_stdin, int using_stdout)
     79 {
     80 	ctl.opened=1;
     81 	return 0;
     82 }
     83 
     84 static void ctl_close(void)
     85 { 
     86 	ctl.opened=0;
     87 }
     88 
     89 static int ctl_read(int *valp)
     90 {
     91 	return RC_NO_RETURN_VALUE;
     92 }
     93 extern void SendDebugMsg(const char*);
     94 extern bool debugOutput;
     95 static int cmsg(int type, int verbosity_level, char *fmt, ...)
     96 {
     97 #ifdef _DEBUG
     98 	va_list ap;
     99 
    100 	va_start(ap, fmt);
    101 	idStr::vsnPrintf(timidity_error, TIMIDITY_ERROR_MAX_CHARS - 1, fmt, ap);
    102 	va_end(ap);
    103 
    104 	strcat( timidity_error, "\n" );
    105 
    106 	if ( debugOutput && verbosity_level <= VERB_VERBOSE ) {
    107 		safeOutputDebug( timidity_error );
    108 	}
    109 #endif
    110 
    111 	return 0;
    112 }
    113 
    114 static void ctl_refresh(void) { }
    115 
    116 static void ctl_total_time(int tt) {}
    117 
    118 static void ctl_master_volume(int mv) {}
    119 
    120 static void ctl_file_name(char *name) {}
    121 
    122 static void ctl_current_time(int ct) {}
    123 
    124 static void ctl_note(int v) {}
    125 
    126 static void ctl_program(int ch, int val) {}
    127 
    128 static void ctl_volume(int channel, int val) {}
    129 
    130 static void ctl_expression(int channel, int val) {}
    131 
    132 static void ctl_panning(int channel, int val) {}
    133 
    134 static void ctl_sustain(int channel, int val) {}
    135 
    136 static void ctl_pitch_bend(int channel, int val) {}
    137 
    138 static void ctl_reset(void) {}