/*
 * Class:     org_tritonus_midi_device_fluidsynth_FluidSynthesizer
 * Method:    setTrace
 * Signature: (Z)V
 */
JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_setTrace
(JNIEnv *env, jclass cls, jboolean bTrace)
{
	debug_flag = bTrace;
	debug_file = stderr;
	/* Don't try to turn of log levels in Win32 since fluid_log_config() is not an exported function
	 * in the fluidsynth DLL and so causes a link error
	 */
#if !defined(WIN32) && !defined(__CYGWIN__)
	if (!bTrace)
	{
		/* fluid_log_config() is not part of the public API of fluidsynth.
		 * However, this call is necessary because of a bug in fluidsynth:
		 * fluid_set_log_function() does not initialize the data structures.
		 * This is only done with the first call to fluid_log() and then, log
		 * functions that are NULL are initialized to the default, so that
		 * setting them to NULL with fluid_set_log_function() previously has no
		 * effect.
		 */
		fluid_log_config();
		fluid_set_log_function(FLUID_WARN, NULL, NULL);
		fluid_set_log_function(FLUID_INFO, NULL, NULL);
	}
#endif
}
Esempio n. 2
0
/**
 * Default log function which prints to the stderr.
 * @param level Log level
 * @param message Log message
 * @param data User supplied data (not used)
 */
void
fluid_default_log_function(int level, char* message, void* data)
{
  FILE* out;

#if defined(WIN32)
  out = stdout;
#else
  out = stderr;
#endif

  if (fluid_log_initialized == 0) {
    fluid_log_config();
  }

  switch (level) {
  case FLUID_PANIC:
    FLUID_FPRINTF(out, "%s: panic: %s\n", fluid_libname, message);
    break;
  case FLUID_ERR:
    FLUID_FPRINTF(out, "%s: error: %s\n", fluid_libname, message);
    break;
  case FLUID_WARN:
    FLUID_FPRINTF(out, "%s: warning: %s\n", fluid_libname, message);
    break;
  case FLUID_INFO:
    FLUID_FPRINTF(out, "%s: %s\n", fluid_libname, message);
    break;
  case FLUID_DBG:
#if DEBUG
    FLUID_FPRINTF(out, "%s: debug: %s\n", fluid_libname, message);
#endif
    break;
  default:
    FLUID_FPRINTF(out, "%s: %s\n", fluid_libname, message);
    break;
  }
  fflush(out);
}
Esempio n. 3
0
void fluid_sys_config()
{
  fluid_log_config();
}