mirror of
https://github.com/dborth/fceugx.git
synced 2024-12-04 22:34:14 +01:00
change audio sample rate depending on video mode.
This commit is contained in:
parent
197ba79dd6
commit
82cf404231
@ -31,8 +31,6 @@
|
||||
|
||||
bool romLoaded = false;
|
||||
|
||||
#define SAMPLERATE 48000
|
||||
|
||||
int GCMemROM(int size)
|
||||
{
|
||||
bool biosError = false;
|
||||
@ -47,8 +45,6 @@ int GCMemROM(int size)
|
||||
GameInfo->archiveCount = 0;
|
||||
|
||||
/*** Set some default values ***/
|
||||
GameInfo->soundchan = 1;
|
||||
GameInfo->soundrate = SAMPLERATE;
|
||||
GameInfo->name=0;
|
||||
GameInfo->type=GIT_CART;
|
||||
GameInfo->vidsys=(EGIV)GCSettings.timing;
|
||||
@ -57,7 +53,7 @@ int GCMemROM(int size)
|
||||
GameInfo->cspecial=SIS_NONE;
|
||||
|
||||
/*** Set internal sound information ***/
|
||||
FCEUI_Sound(SAMPLERATE);
|
||||
SetSampleRate();
|
||||
FCEUI_SetSoundVolume(100); // 0-100
|
||||
FCEUI_SetLowPass(0);
|
||||
|
||||
|
@ -13,8 +13,7 @@
|
||||
#include <gccore.h>
|
||||
#include <string.h>
|
||||
#include <asndlib.h>
|
||||
|
||||
#define SAMPLERATE 48000
|
||||
#include "fceusupport.h"
|
||||
|
||||
static u8 ConfigRequested = 0;
|
||||
static u8 soundbuffer[2][3840] ATTRIBUTE_ALIGN(32);
|
||||
@ -23,6 +22,7 @@ static int mixhead = 0;
|
||||
static int mixtail = 0;
|
||||
static int whichab = 0;
|
||||
static int IsPlaying = 0;
|
||||
static int samplerate;
|
||||
|
||||
/****************************************************************************
|
||||
* MixerCollect
|
||||
@ -176,3 +176,13 @@ void PlaySound( int *Buffer, int count )
|
||||
AudioSwitchBuffers ();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSampleRate(int rate)
|
||||
{
|
||||
samplerate = rate;
|
||||
}
|
||||
|
||||
void SetSampleRate()
|
||||
{
|
||||
FCEUI_Sound(samplerate);
|
||||
}
|
||||
|
@ -15,3 +15,5 @@ void ResetAudio();
|
||||
void PlaySound( int *Buffer, int samples );
|
||||
void SwitchAudioMode(int mode);
|
||||
void ShutdownAudio();
|
||||
void UpdateSampleRate(int rate);
|
||||
void SetSampleRate();
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "fceugx.h"
|
||||
#include "fceusupport.h"
|
||||
#include "gcvideo.h"
|
||||
#include "gcaudio.h"
|
||||
#include "menu.h"
|
||||
#include "pad.h"
|
||||
#include "gui/gui.h"
|
||||
@ -613,11 +614,20 @@ ResetVideo_Emu ()
|
||||
GXRModeObj *rmode;
|
||||
Mtx44 p;
|
||||
|
||||
// change current VI mode if using original render mode
|
||||
// set VI mode and audio sample rate depending on if original mode is used
|
||||
|
||||
if (GCSettings.render == 0)
|
||||
{
|
||||
rmode = tvmodes[FCEUI_GetCurrentVidSystem(NULL, NULL)];
|
||||
UpdateSampleRate(48220);
|
||||
SetSampleRate();
|
||||
}
|
||||
else
|
||||
{
|
||||
rmode = FindVideoMode();
|
||||
UpdateSampleRate(48000);
|
||||
SetSampleRate();
|
||||
}
|
||||
|
||||
SetupVideoMode(rmode); // reconfigure VI
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user