From 058bbe02866e513a9e95e1d1f346ac9efb87d043 Mon Sep 17 00:00:00 2001 From: Ivan Epifanov Date: Sat, 24 Apr 2021 10:17:03 +0300 Subject: [PATCH] Set volume on device open --- src/audio/vita/SDL_vitaaudio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/audio/vita/SDL_vitaaudio.c b/src/audio/vita/SDL_vitaaudio.c index de2611bb5..b69aed8d2 100644 --- a/src/audio/vita/SDL_vitaaudio.c +++ b/src/audio/vita/SDL_vitaaudio.c @@ -48,6 +48,7 @@ static int VITAAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { int format, mixlen, i, port = SCE_AUDIO_OUT_PORT_TYPE_MAIN; + int vols[2] = {SCE_AUDIO_MAX_VOLUME, SCE_AUDIO_MAX_VOLUME}; this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); @@ -97,6 +98,8 @@ VITAAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("Couldn't reserve hardware channel"); } + sceAudioOutSetVolume(this->hidden->channel, SCE_AUDIO_VOLUME_FLAG_L_CH|SCE_AUDIO_VOLUME_FLAG_R_CH, vols); + memset(this->hidden->rawbuf, 0, mixlen); for (i = 0; i < NUM_BUFFERS; i++) { this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size]; @@ -110,8 +113,6 @@ static void VITAAUD_PlayDevice(_THIS) { Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer]; - int vols[2] = {SCE_AUDIO_MAX_VOLUME, SCE_AUDIO_MAX_VOLUME}; - sceAudioOutSetVolume(this->hidden->channel, SCE_AUDIO_VOLUME_FLAG_L_CH|SCE_AUDIO_VOLUME_FLAG_R_CH, vols); sceAudioOutOutput(this->hidden->channel, mixbuf); this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS;