예제 #1
0
int music_init(void)
{
	u32 seed;

	cache_init();

	seed = sctrlKernelRand();

	if (seed == 0x8002013A) {
		pspTime tm;

		sceRtcGetCurrentClockLocalTime(&tm);
		seed = tm.microseconds;
	}

	srand(seed);
	xr_lock_init(&music_l);

#ifdef ENABLE_MPC
	mpc_init();
#endif

#ifdef ENABLE_WAV
	wav_init();
#endif

#ifdef ENABLE_TTA
	tta_init();
#endif

#ifdef ENABLE_APE
	ape_init();
#endif

#ifdef ENABLE_MP3
	mp3_init();
#endif

#ifdef ENABLE_FLAC
	flac_init();
#endif

#ifdef ENABLE_OGG
	ogg_init();
#endif

#ifdef ENABLE_WMA
	wmadrv_init();
#endif

#ifdef ENABLE_WAVPACK
	wv_init();
#endif

#ifdef ENABLE_AT3
	at3_init();
#endif

#ifdef ENABLE_M4A
	m4a_init();
#endif

#ifdef ENABLE_AAC
	aac_init();
#endif

#ifdef ENABLE_AA3
	aa3_init();
#endif

	musiclist_init(&g_music_list);
	memset(&g_list, 0, sizeof(g_list));
	g_list.first_time = true;
	stack_init(&g_played);
	g_music_thread = sceKernelCreateThread("Music Thread", music_thread, 0x12, 0x10000, 0, NULL);

	if (g_music_thread < 0) {
		return -EBUSY;
	}

	sceKernelStartThread(g_music_thread, 0, 0);

	return 0;
}
예제 #2
0
파일: musicmgr.c 프로젝트: azuwis/xreader
int music_init(void)
{
	pspTime tm;

	cache_init();

	xrRtcGetCurrentClockLocalTime(&tm);
	srand(tm.microseconds);
	xr_lock_init(&music_l);

#ifdef ENABLE_MPC
	mpc_init();
#endif

#ifdef ENABLE_WAV
	wav_init();
#endif

#ifdef ENABLE_TTA
	tta_init();
#endif

#ifdef ENABLE_APE
	ape_init();
#endif

#ifdef ENABLE_MP3
	mp3_init();
#endif

#ifdef ENABLE_FLAC
	flac_init();
#endif

#ifdef ENABLE_OGG
	ogg_init();
#endif

#ifdef ENABLE_WMA
	wmadrv_init();
#endif

#ifdef ENABLE_WAVPACK
	wv_init();
#endif

#ifdef ENABLE_AT3
	at3_init();
#endif

#ifdef ENABLE_M4A
	m4a_init();
#endif

#ifdef ENABLE_AAC
	aac_init();
#endif

#ifdef ENABLE_AA3
	aa3_init();
#endif

	memset(&g_list, 0, sizeof(g_list));
	g_list.first_time = true;
	g_shuffle.first_time = true;
	stack_init(&played);
	g_music_thread = xrKernelCreateThread("Music Thread",
										  music_thread, 0x12, 0x10000, 0, NULL);

	if (g_music_thread < 0) {
		return -EBUSY;
	}

	xrKernelStartThread(g_music_thread, 0, 0);

	return 0;
}
예제 #3
0
static libaudio_prop_t *
loader_flc_open_prop(const char *filename, libaudio_prop_t *prop)
{
  flc_data_t *data;
  FLAC__FileDecoder *decoder;

  data = (flc_data_t *)malloc(sizeof(flc_data_t));
  if (data == NULL)
    return NULL;

  decoder = FLAC__file_decoder_new();
  if (decoder == NULL)
    return NULL;

  if (!flac_init(decoder, data, filename))
    {
      FLAC__file_decoder_delete(decoder);
      free(data);
      return NULL;
    }

  if (FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK)
    {
      FLAC__file_decoder_delete(decoder);
      free(data);
      return NULL;
    }

  /*
   *  The metadata callback should fill the sample_rate, channels
   *  and bits_per_sample values in our data structure.
   */
  data->sample_rate = 0;
  if (!FLAC__file_decoder_process_metadata(decoder))
    {
      FLAC__file_decoder_delete(decoder);
      free(data);
      return NULL;
    }

  if (data->sample_rate == 0)
    {
      /*
       *  We got no stream info while processing the metadata, odd.
       */
      FLAC__file_decoder_delete(decoder);
      free(data);
      return NULL;
    }

  data->eof = 0;
  data->idx = 0;
  data->size = 0;
  data->decoder = decoder;

  prop->type = LIBAUDIO_TYPE_FLC;
  prop->loader = self;
  prop->loader_data = data;

  prop->sample_freq = data->sample_rate;
  prop->sample_size = data->bits_per_sample;
  prop->channels = data->channels;

  return prop;
}