예제 #1
0
const char *MusicDriver_LibTimidity::Start(const char * const *param)
{
    _midi.status = MIDI_STOPPED;
    _midi.song = NULL;

    if (mid_init(param == NULL ? NULL : const_cast<char *>(param[0])) < 0) {
        /* If init fails, it can be because no configuration was found.
         *  If it was not forced via param, try to load it without a
         *  configuration. Who knows that works. */
        if (param != NULL || mid_init_no_config() < 0) {
            return "error initializing timidity";
        }
    }
    DEBUG(driver, 1, "successfully initialised timidity");

    _midi.options.rate = 44100;
    _midi.options.format = MID_AUDIO_S16LSB;
    _midi.options.channels = 2;
#if defined(PSP)
    _midi.options.buffer_size = PSP_NUM_AUDIO_SAMPLES;
#else
    _midi.options.buffer_size = _midi.options.rate;
#endif

#if defined(PSP)
    pspAudioInit();
    pspAudioSetChannelCallback(_midi.options.channels, &AudioOutCallback, NULL);
    pspAudioSetVolume(_midi.options.channels, PSP_VOLUME_MAX, PSP_VOLUME_MAX);
#endif /* PSP */

    return NULL;
}
예제 #2
0
int mid_init(const char *config_file)
{
  int rc = mid_init_no_config();
  if (rc != 0)
      return rc;

  if (config_file == NULL || *config_file == '\0')
      return init_with_config(TIMIDITY_CFG);

  return init_with_config(config_file);
}