sound options work better, and they save with the configuration now
This commit is contained in:
parent
ef228133f6
commit
412304e840
|
@ -1,3 +1,6 @@
|
||||||
|
//this code is sloppily ripped from an unfinished sound system written for internal use by m.gambrell
|
||||||
|
//it is released into the public domain and its stability is not warranted
|
||||||
|
|
||||||
#include "oakra.h"
|
#include "oakra.h"
|
||||||
|
|
||||||
#include "dsound.h"
|
#include "dsound.h"
|
||||||
|
@ -64,7 +67,6 @@ public:
|
||||||
cPlay = 0;
|
cPlay = 0;
|
||||||
|
|
||||||
hr = ds_buf->Play(0,0,DSBPLAY_LOOPING);
|
hr = ds_buf->Play(0,0,DSBPLAY_LOOPING);
|
||||||
int xxx=9;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//not supported
|
//not supported
|
||||||
|
|
|
@ -95,7 +95,12 @@ void ApplyDefaultCommandMapping(void);
|
||||||
uint8 *xbsave = NULL;
|
uint8 *xbsave = NULL;
|
||||||
int eoptions = EO_BGRUN | EO_FORCEISCALE;
|
int eoptions = EO_BGRUN | EO_FORCEISCALE;
|
||||||
|
|
||||||
|
//global variables
|
||||||
int soundoptions = SO_SECONDARY | SO_GFOCUS;
|
int soundoptions = SO_SECONDARY | SO_GFOCUS;
|
||||||
|
int soundrate = 44100;
|
||||||
|
int soundbuftime = 50;
|
||||||
|
int soundvolume = 100;
|
||||||
|
int soundquality = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the names of the overridden standard directories
|
* Contains the names of the overridden standard directories
|
||||||
|
|
|
@ -54,10 +54,12 @@ static double winsizemulx = 1, winsizemuly = 1;
|
||||||
static int winwidth, winheight;
|
static int winwidth, winheight;
|
||||||
static int ismaximized = 0;
|
static int ismaximized = 0;
|
||||||
|
|
||||||
static int soundrate = 44100;
|
extern int soundoptions;
|
||||||
static int soundbuftime = 50;
|
extern int soundrate;
|
||||||
static int soundvolume = 100;
|
extern int soundbuftime;
|
||||||
static int soundquality = 0;
|
extern int soundvolume;
|
||||||
|
extern int soundquality;
|
||||||
|
|
||||||
static uint8 cpalette[192];
|
static uint8 cpalette[192];
|
||||||
//mbg 5/7/08 - I changed the ntsc settings to match pal.
|
//mbg 5/7/08 - I changed the ntsc settings to match pal.
|
||||||
//this is more for precision emulation, instead of entertainment, which is what fceux is all about nowadays
|
//this is more for precision emulation, instead of entertainment, which is what fceux is all about nowadays
|
||||||
|
|
Binary file not shown.
|
@ -18,6 +18,10 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//todo - config synchronization guards
|
||||||
|
//todo - use correct framerate instead of 60
|
||||||
|
//todo - find out why fast forwarding at 96khz causes buffering to glitch?
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
@ -165,9 +169,9 @@ public:
|
||||||
int bufferSamples = buffers.length>>1;
|
int bufferSamples = buffers.length>>1;
|
||||||
|
|
||||||
//if we're we're too far behind, playback faster
|
//if we're we're too far behind, playback faster
|
||||||
if(bufferSamples > 44100*3/60) {
|
if(bufferSamples > soundrate*3/60) {
|
||||||
int behind = bufferSamples - 44100/60;
|
int behind = bufferSamples - soundrate/60;
|
||||||
incr = behind*256*60/44100/2;
|
incr = behind*256*60/soundrate/2;
|
||||||
//we multiply our playback rate by 1/2 the number of frames we're behind
|
//we multiply our playback rate by 1/2 the number of frames we're behind
|
||||||
}
|
}
|
||||||
if(incr<256) printf("OHNO -- %d -- shouldnt be less than 256!\n",incr); //sanity check: should never be less than 256
|
if(incr<256) printf("OHNO -- %d -- shouldnt be less than 256!\n",incr); //sanity check: should never be less than 256
|
||||||
|
@ -206,8 +210,8 @@ public:
|
||||||
dsout->lock();
|
dsout->lock();
|
||||||
int remain = buffers.length>>1;
|
int remain = buffers.length>>1;
|
||||||
dsout->unlock();
|
dsout->unlock();
|
||||||
if(remain<44100/60) break;
|
if(remain<soundrate/60) break;
|
||||||
//if(remain<44100*scale/256/60) break; ??
|
//if(remain<soundrate*scale/256/60) break; ??
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,10 +253,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//todo - a properly synchronized method ShouldntTouchSound() which is totally safe (use mutexes) and use that to guard all sound code
|
|
||||||
//also add an alternate timer-based throttler for when sound is disabled
|
|
||||||
|
|
||||||
|
|
||||||
static Player *player;
|
static Player *player;
|
||||||
static Player8 *player8;
|
static Player8 *player8;
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ void win_SoundInit(int bits) {
|
||||||
OAKRA_Format fmt;
|
OAKRA_Format fmt;
|
||||||
fmt.format = bits==8?OAKRA_U8:OAKRA_S16;
|
fmt.format = bits==8?OAKRA_U8:OAKRA_S16;
|
||||||
fmt.channels = 1;
|
fmt.channels = 1;
|
||||||
fmt.rate = 44100;
|
fmt.rate = soundrate;
|
||||||
fmt.size = OAKRA_Module::calcSize(fmt);
|
fmt.size = OAKRA_Module::calcSize(fmt);
|
||||||
OAKRA_Voice *voice = dsout->getVoice(fmt);
|
OAKRA_Voice *voice = dsout->getVoice(fmt);
|
||||||
|
|
||||||
|
@ -318,23 +318,25 @@ void win_SoundInit(int bits) {
|
||||||
|
|
||||||
|
|
||||||
int InitSound() {
|
int InitSound() {
|
||||||
if(soundoptions&SO_FORCE8BIT)
|
|
||||||
bits = 8;
|
bits = 8;
|
||||||
else {
|
|
||||||
|
if(!(soundoptions&SO_FORCE8BIT))
|
||||||
|
{
|
||||||
//no modern system should have this problem, and we dont use primary buffer
|
//no modern system should have this problem, and we dont use primary buffer
|
||||||
/*if( (!(dscaps.dwFlags&DSCAPS_PRIMARY16BIT) && !(soundoptions&SO_SECONDARY)) ||
|
/*if( (!(dscaps.dwFlags&DSCAPS_PRIMARY16BIT) && !(soundoptions&SO_SECONDARY)) ||
|
||||||
(!(dscaps.dwFlags&DSCAPS_SECONDARY16BIT) && (soundoptions&SO_SECONDARY)))
|
(!(dscaps.dwFlags&DSCAPS_SECONDARY16BIT) && (soundoptions&SO_SECONDARY)))
|
||||||
{
|
|
||||||
FCEUD_PrintError("DirectSound: 16-bit sound is not supported. Forcing 8-bit sound.");*/
|
FCEUD_PrintError("DirectSound: 16-bit sound is not supported. Forcing 8-bit sound.");*/
|
||||||
|
|
||||||
|
//if(dscaps.dwFlags&DSCAPS_SECONDARY16BIT)
|
||||||
bits = 16;
|
bits = 16;
|
||||||
|
//else
|
||||||
|
// FCEUD_PrintError("DirectSound: 16-bit sound is not supported. Forcing 8-bit sound.")
|
||||||
}
|
}
|
||||||
bits = 8;
|
|
||||||
|
|
||||||
win_SoundInit(bits);
|
win_SoundInit(bits);
|
||||||
|
|
||||||
FCEUI_Sound(soundrate);
|
FCEUI_Sound(soundrate);
|
||||||
return 1;
|
return 1;
|
||||||
// FCEUD_PrintError("DirectSound: Sound device is being emulated through waveform-audio functions. Sound quality will most likely be awful. Try to update your sound device's sound drivers.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -533,9 +535,7 @@ BOOL CALLBACK SoundConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// Shows the sounds configuration dialog.
|
||||||
* Shows the sounds configuration dialog.
|
|
||||||
**/
|
|
||||||
void ConfigSound()
|
void ConfigSound()
|
||||||
{
|
{
|
||||||
if(!uug)
|
if(!uug)
|
||||||
|
|
Loading…
Reference in New Issue