iOS/libraries/allegro/allegro/src/psp/psound.c
/* digi_psp_init:
 *  Initializes the PSP digital sound driver.
 */
Initializes the PSP digital sound driver.
Initializes the PSP digital sound driver .
static int digi_psp_init(int input, int voices)
{
   char digi_psp_desc[512] = EMPTY_STRING;
   char tmp1[256];
   if (input) {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
         get_config_text("Input is not supported"));
      return -1;
   }
   hw_channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, SAMPLES_PER_BUFFER,
      PSP_AUDIO_FORMAT_STEREO);
   if (hw_channel < 0) {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
         get_config_text("Failed reserving hardware sound channel"));
      return -1;
   }
   psp_audio_on = TRUE;
   audio_thread_UID = sceKernelCreateThread("psp_audio_thread",
      (void *)&psp_audio_channel_thread, 0x19, 0x10000, 0, NULL);
   if (audio_thread_UID < 0) {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
         get_config_text("Cannot create audio thread"));
      digi_psp_exit(FALSE);
      return -1;
   }
   if (sceKernelStartThread(audio_thread_UID, 0, NULL) != 0) {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
         get_config_text("Cannot start audio thread"));
      digi_psp_exit(FALSE);
      return -1;
   }
   _sound_bits = 16;
   _sound_stereo = TRUE;
   _sound_freq = 44100;
   digi_psp.voices = voices;
   if (_mixer_init(SAMPLES_PER_BUFFER * 2, _sound_freq, _sound_stereo,
         (_sound_bits == 16), &digi_psp.voices))
   {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
         get_config_text("Error initializing mixer"));
      digi_psp_exit(FALSE);
      return -1;
   }
   uszprintf(digi_psp_desc, sizeof(digi_psp_desc),
      get_config_text("%d bits, %d bps, %s"), _sound_bits,
      _sound_freq, uconvert_ascii(_sound_stereo ? "stereo" : "mono", tmp1));
   digi_psp.desc = digi_psp_desc;
   return 0;
}
static int digi_psp_init ( int input , int voices ) { char digi_psp_desc [ 512 ] = EMPTY_STRING ; char tmp1 [ 256 ] ; if ( input ) { ustrzcpy ( allegro_error , ALLEGRO_ERROR_SIZE , get_config_text ( " " ) ) ; return -1 ; } hw_channel = sceAudioChReserve ( PSP_AUDIO_NEXT_CHANNEL , SAMPLES_PER_BUFFER , PSP_AUDIO_FORMAT_STEREO ) ; if ( hw_channel < 0 ) { ustrzcpy ( allegro_error , ALLEGRO_ERROR_SIZE , get_config_text ( " " ) ) ; return -1 ; } psp_audio_on = TRUE ; audio_thread_UID = sceKernelCreateThread ( " " , ( void * ) & psp_audio_channel_thread , 0x19 , 0x10000 , 0 , NULL ) ; if ( audio_thread_UID < 0 ) { ustrzcpy ( allegro_error , ALLEGRO_ERROR_SIZE , get_config_text ( " " ) ) ; digi_psp_exit ( FALSE ) ; return -1 ; } if ( sceKernelStartThread ( audio_thread_UID , 0 , NULL ) != 0 ) { ustrzcpy ( allegro_error , ALLEGRO_ERROR_SIZE , get_config_text ( " " ) ) ; digi_psp_exit ( FALSE ) ; return -1 ; } _sound_bits = 16 ; _sound_stereo = TRUE ; _sound_freq = 44100 ; digi_psp . voices = voices ; if ( _mixer_init ( SAMPLES_PER_BUFFER * 2 , _sound_freq , _sound_stereo , ( _sound_bits == 16 ) , & digi_psp . voices ) ) { ustrzcpy ( allegro_error , ALLEGRO_ERROR_SIZE , get_config_text ( " " ) ) ; digi_psp_exit ( FALSE ) ; return -1 ; } uszprintf ( digi_psp_desc , sizeof ( digi_psp_desc ) , get_config_text ( " " ) , _sound_bits , _sound_freq , uconvert_ascii ( _sound_stereo ? " " : " " , tmp1 ) ) ; digi_psp . desc = digi_psp_desc ; return 0 ; }
digi_psp_init:
  Initializes the PSP digital sound driver.
digi_psp_init : Initializes the PSP digital sound driver .
/* Allegro sound state variables */