SHARE
TWEET

Untitled

a guest Nov 5th, 2016 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /* game provides us mono samples, we need stereo */
  3. static int16_t rb_soundbuf [MAX_SOUNDBUF_SIZE * 2];
  4. static int8_t temp_soundbuf[MAX_SOUNDBUF_SIZE];
  5. static void get_more(const void** start, size_t* size)
  6. {
  7.     if(audio_sys->settings.sound_enabled && audio_callback)
  8.     {
  9.         audio_callback(audio_param, temp_soundbuf, audio_sys->settings.sound_bufsize);
  10.         /* convert xworld format (signed 8-bit) to rockbox format (stereo signed 16-bit) */
  11.         for(int i = 0; i < audio_sys->settings.sound_bufsize; i += 2)
  12.         {
  13.             rb_soundbuf[i] = temp_soundbuf[i] * 0x100; /* mirror left/right channels */
  14.             rb_soundbuf[i+1] = rb_soundbuf[i];
  15.         }
  16.         *start = rb_soundbuf;
  17.         *size = audio_sys->settings.sound_bufsize * 2 * sizeof(int16_t);
  18.     }
  19.     else
  20.     {
  21.         rb->memset(rb_soundbuf, 0, audio_sys->settings.sound_bufsize * 2 * sizeof(int16_t));
  22.         *start = rb_soundbuf;
  23.         *size = audio_sys->settings.sound_bufsize * 2 * sizeof(int16_t);
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top