static void inline play_buffer(void) { int i; for (i = 0; i < buffer_size / 4; ++i) ((int*) buffer)[i] = bswap_32(((int*) buffer)[i]); xenon_sound_submit(buffer, buffer_size); }
void GuiSound::Play() { switch (type) { case SOUND_PCM: xenon_sound_submit((void*)sound,length); break; } #ifndef NO_SOUND int vol; switch (type) { case SOUND_PCM: vol = 255 * (volume / 100.0); voice = ASND_GetFirstUnusedVoice(); if (voice >= 0) ASND_SetVoice(voice, VOICE_STEREO_16BIT, 48000, 0, (u8 *) sound, length, vol, vol, NULL); break; case SOUND_OGG: voice = 0; if (loop) PlayOgg((char *) sound, length, 0, OGG_INFINITE_TIME); else PlayOgg((char *) sound, length, 0, OGG_ONE_TIME); SetVolumeOgg(255 * (volume / 100.0)); break; } #endif }
/* // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played */ static int play(void* data, int len, int flags) { if (!(flags & AOPLAY_FINAL_CHUNK)) len -= len % ao_data.outburst; xenon_sound_submit(data, len); return len; }
void update_sound(int32 * snd, int32 size){ //return; //size = size * 4; uint16_t sound_s16; uint32_t * dst = (uint32_t *) pAudioBuffer; sound_pos = 0; for(int i = 0; i < size; i++ ) { sound_s16 = snd[i] & 0xffff; //dst[sound_pos++] = sound_s16 | ( sound_s16 << 16); //dst[sound_pos++] = bswap_32(snd[i]); dst[sound_pos++] = bswap_32(sound_s16 | ( sound_s16 << 16)); if (sound_pos == 4000) sound_pos = 0; } while (xenon_sound_get_unplayed()>(size)) udelay(50); //udelay(16); xenon_sound_submit(pAudioBuffer, size*4); }