mirror of https://github.com/stella-emu/stella.git
Finally got rid of the annoying popping in starting/quiting Stella, and when
entering/exiting menu or pause mode. This one has bugged me for quite some time, and was just made worse by my new laptop (where the sound would cause me to jump about 5 feet every time Stella started :) Rearranged the output a little wrt sound and video settings. This is only seen if 'showinfo' is enabled. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@348 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
d890dbf6cf
commit
e84e982439
|
@ -13,7 +13,7 @@
|
|||
## See the file "license" for information on usage and redistribution of
|
||||
## this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
##
|
||||
## $Id: makefile,v 1.56 2004-07-14 16:49:45 stephena Exp $
|
||||
## $Id: makefile,v 1.57 2005-01-03 19:16:09 stephena Exp $
|
||||
##============================================================================
|
||||
|
||||
##============================================================================
|
||||
|
@ -41,7 +41,7 @@ OPTIMIZATIONS =
|
|||
|
||||
### to build on SMP (or distcc-based) machines
|
||||
### change to number of CPU's you have
|
||||
NUMBER_CPU = 1
|
||||
NUMBER_CPU = 3
|
||||
|
||||
##============================================================================
|
||||
## All done, type make to get a list of frontends
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferGL.cxx,v 1.6 2004-06-27 22:43:49 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.7 2005-01-03 19:16:09 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -32,7 +32,8 @@ FrameBufferGL::FrameBufferGL()
|
|||
: myTexture(0),
|
||||
myScreenmode(0),
|
||||
myScreenmodeCount(0),
|
||||
myFilterParam(GL_NEAREST)
|
||||
myFilterParam(GL_NEAREST),
|
||||
myFilterParamName("GL_NEAREST")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -210,20 +211,6 @@ bool FrameBufferGL::init()
|
|||
// and the textures
|
||||
setupPalette();
|
||||
|
||||
// Show some OpenGL info
|
||||
if(myConsole->settings().getBool("showinfo"))
|
||||
{
|
||||
ostringstream colormode;
|
||||
colormode << "Color : " << myDepth << " bit, " << myRGB[0] << "-"
|
||||
<< myRGB[1] << "-" << myRGB[2] << "-" << myRGB[3];
|
||||
|
||||
cout << endl
|
||||
<< "Vendor : " << glGetString(GL_VENDOR) << endl
|
||||
<< "Renderer: " << glGetString(GL_RENDERER) << endl
|
||||
<< "Version : " << glGetString(GL_VERSION) << endl
|
||||
<< colormode.str() << endl << endl;
|
||||
}
|
||||
|
||||
// Make sure that theUseFullScreenFlag sets up fullscreen mode correctly
|
||||
if(myConsole->settings().getBool("fullscreen"))
|
||||
{
|
||||
|
@ -239,6 +226,23 @@ bool FrameBufferGL::init()
|
|||
showCursor(!myConsole->settings().getBool("hidecursor"));
|
||||
}
|
||||
|
||||
// Show some OpenGL info
|
||||
if(myConsole->settings().getBool("showinfo"))
|
||||
{
|
||||
cout << "Video rendering: OpenGL mode" << endl;
|
||||
|
||||
ostringstream colormode;
|
||||
colormode << " Color : " << myDepth << " bit, " << myRGB[0] << "-"
|
||||
<< myRGB[1] << "-" << myRGB[2] << "-" << myRGB[3];
|
||||
|
||||
cout << " Vendor : " << glGetString(GL_VENDOR) << endl
|
||||
<< " Renderer: " << glGetString(GL_RENDERER) << endl
|
||||
<< " Version : " << glGetString(GL_VERSION) << endl
|
||||
<< colormode.str() << endl
|
||||
<< " Filter : " << myFilterParamName << endl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -382,19 +386,16 @@ bool FrameBufferGL::createTextures()
|
|||
return false;
|
||||
|
||||
// Create an OpenGL texture from the SDL texture
|
||||
bool showinfo = myConsole->settings().getBool("showinfo");
|
||||
string filter = myConsole->settings().getString("gl_filter");
|
||||
if(filter == "linear")
|
||||
{
|
||||
myFilterParam = GL_LINEAR;
|
||||
if(showinfo)
|
||||
cout << "Using GL_LINEAR filtering.\n";
|
||||
myFilterParam = GL_LINEAR;
|
||||
myFilterParamName = "GL_LINEAR";
|
||||
}
|
||||
else if(filter == "nearest")
|
||||
{
|
||||
myFilterParam = GL_NEAREST;
|
||||
if(showinfo)
|
||||
cout << "Using GL_NEAREST filtering.\n";
|
||||
myFilterParam = GL_NEAREST;
|
||||
myFilterParamName = "GL_NEAREST";
|
||||
}
|
||||
|
||||
glGenTextures(1, &myTextureID);
|
||||
|
@ -473,13 +474,13 @@ void FrameBufferGL::toggleFilter()
|
|||
{
|
||||
myFilterParam = GL_LINEAR;
|
||||
myConsole->settings().setString("gl_filter", "linear");
|
||||
showMessage("GL_LINEAR filtering");
|
||||
showMessage("Filtering: GL_LINEAR");
|
||||
}
|
||||
else
|
||||
{
|
||||
myFilterParam = GL_NEAREST;
|
||||
myConsole->settings().setString("gl_filter", "nearest");
|
||||
showMessage("GL_NEAREST filtering");
|
||||
showMessage("Filtering: GL_NEAREST");
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, myTextureID);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferGL.hxx,v 1.4 2004-06-27 22:44:04 stephena Exp $
|
||||
// $Id: FrameBufferGL.hxx,v 1.5 2005-01-03 19:16:09 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_GL_HXX
|
||||
|
@ -34,7 +34,7 @@ class MediaSource;
|
|||
This class implements an SDL OpenGL framebuffer.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferGL.hxx,v 1.4 2004-06-27 22:44:04 stephena Exp $
|
||||
@version $Id: FrameBufferGL.hxx,v 1.5 2005-01-03 19:16:09 stephena Exp $
|
||||
*/
|
||||
class FrameBufferGL : public FrameBufferSDL
|
||||
{
|
||||
|
@ -179,6 +179,9 @@ class FrameBufferGL : public FrameBufferSDL
|
|||
|
||||
// The texture filtering to use
|
||||
GLint myFilterParam;
|
||||
|
||||
// The name of the texture filtering to use
|
||||
string myFilterParamName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: FrameBufferSoft.cxx,v 1.3 2004-06-23 03:43:47 stephena Exp $
|
||||
// $Id: FrameBufferSoft.cxx,v 1.4 2005-01-03 19:16:09 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -121,6 +121,10 @@ bool FrameBufferSoft::init()
|
|||
showCursor(!myConsole->settings().getBool("hidecursor"));
|
||||
}
|
||||
|
||||
// Show some info
|
||||
if(myConsole->settings().getBool("showinfo"))
|
||||
cout << "Video rendering: Software mode" << endl << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: mainSDL.cxx,v 1.17 2004-09-14 16:10:27 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.18 2005-01-03 19:16:09 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -730,12 +730,12 @@ void SetupProperties(PropertiesSet& set)
|
|||
stringstream buf;
|
||||
if(theAltPropertiesFile != "")
|
||||
{
|
||||
buf << "Reading game properties from \'" << theAltPropertiesFile << "\'\n";
|
||||
buf << "Game properties: \'" << theAltPropertiesFile << "\'\n";
|
||||
set.load(theAltPropertiesFile, useMemList);
|
||||
}
|
||||
else if(thePropertiesFile != "")
|
||||
{
|
||||
buf << "Reading game properties from \'" << thePropertiesFile << "\'\n";
|
||||
buf << "Game properties: \'" << thePropertiesFile << "\'\n";
|
||||
set.load(thePropertiesFile, useMemList);
|
||||
}
|
||||
else
|
||||
|
@ -832,7 +832,7 @@ int main(int argc, char* argv[])
|
|||
putenv((char*) buf.str().c_str());
|
||||
|
||||
buf.str("");
|
||||
buf << "Using SDL video driver = " << theSettings->getString("video_driver") << ".";
|
||||
buf << "Video driver: " << theSettings->getString("video_driver");
|
||||
ShowInfo(buf.str());
|
||||
}
|
||||
|
||||
|
@ -858,20 +858,17 @@ int main(int argc, char* argv[])
|
|||
if(videodriver == "soft")
|
||||
{
|
||||
theDisplay = new FrameBufferSoft();
|
||||
ShowInfo("Using software mode for video rendering.");
|
||||
}
|
||||
#ifdef DISPLAY_OPENGL
|
||||
else if(videodriver == "gl")
|
||||
{
|
||||
theDisplay = new FrameBufferGL();
|
||||
theUseOpenGLFlag = true;
|
||||
ShowInfo("Using OpenGL mode for video rendering.");
|
||||
}
|
||||
#endif
|
||||
else // a driver that doesn't exist was requested, so use software mode
|
||||
{
|
||||
theDisplay = new FrameBufferSoft();
|
||||
ShowInfo("Using software mode for video rendering.");
|
||||
}
|
||||
|
||||
if(!theDisplay)
|
||||
|
@ -886,18 +883,21 @@ int main(int argc, char* argv[])
|
|||
if(theSettings->getBool("sound"))
|
||||
{
|
||||
uInt32 fragsize = theSettings->getInt("fragsize");
|
||||
Int32 volume = theSettings->getInt("volume");
|
||||
theSound = new SoundSDL(fragsize);
|
||||
theSound->setVolume(volume);
|
||||
|
||||
ostringstream message;
|
||||
message << "Sound enabled, using fragment size = " << fragsize << ".";
|
||||
message << "Sound enabled:" << endl
|
||||
<< " Volume : " << volume << endl
|
||||
<< " Frag size: " << fragsize << endl;
|
||||
ShowInfo(message.str());
|
||||
}
|
||||
else // even if sound has been disabled, we still need a sound object
|
||||
{
|
||||
theSound = new Sound();
|
||||
ShowInfo("Sound disabled.");
|
||||
ShowInfo("Sound disabled");
|
||||
}
|
||||
theSound->setVolume(theSettings->getInt("volume"));
|
||||
|
||||
// Get just the filename of the file containing the ROM image
|
||||
const char* filename = (!strrchr(file, '/')) ? file : strrchr(file, '/') + 1;
|
||||
|
@ -911,7 +911,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
// Print message about the framerate
|
||||
ostringstream message;
|
||||
message << "Using framerate = " << theSettings->getInt("framerate") << ".";
|
||||
message << "Framerate: " << theSettings->getInt("framerate");
|
||||
ShowInfo(message.str());
|
||||
|
||||
// Setup the SDL joysticks
|
||||
|
|
|
@ -302,127 +302,6 @@ void Update_tia_sound (uint16 addr, uint8 val)
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Module: Tia_process_2() */
|
||||
/* Purpose: To fill the output buffer with the sound output based on the */
|
||||
/* tia chip parameters. This routine has not been optimized. */
|
||||
/* Though it is not used by the program, I've left it for reference.*/
|
||||
/* */
|
||||
/* Author: Ron Fries */
|
||||
/* Date: September 10, 1996 */
|
||||
/* */
|
||||
/* Inputs: *buffer - pointer to the buffer where the audio output will */
|
||||
/* be placed */
|
||||
/* n - size of the playback buffer */
|
||||
/* */
|
||||
/* Outputs: the buffer will be filled with n bytes of audio - no return val */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
void Tia_process_2 (register unsigned char *buffer, register uint16 n)
|
||||
{
|
||||
register uint8 chan;
|
||||
|
||||
/* loop until the buffer is filled */
|
||||
while (n)
|
||||
{
|
||||
/* loop through the channels */
|
||||
for (chan = CHAN1; chan <= CHAN2; chan++)
|
||||
{
|
||||
/* NOTE: this routine intentionally does not count down to zero */
|
||||
/* since 0 is used as a special case - no clock */
|
||||
|
||||
/* if the divide by N counter can count down */
|
||||
if (Div_n_cnt[chan] > 1)
|
||||
{
|
||||
/* decrement and loop */
|
||||
Div_n_cnt[chan]--;
|
||||
}
|
||||
/* otherwise if we've reached the bottom */
|
||||
else if (Div_n_cnt[chan] == 1)
|
||||
{
|
||||
/* reset the counter */
|
||||
Div_n_cnt[chan] = Div_n_max[chan];
|
||||
|
||||
/* the P5 counter has multiple uses, so we inc it here */
|
||||
P5[chan]++;
|
||||
if (P5[chan] == POLY5_SIZE)
|
||||
P5[chan] = 0;
|
||||
|
||||
/* check clock modifier for clock tick */
|
||||
|
||||
/* if we're using pure tones OR
|
||||
we're using DIV31 and the DIV31 bit is set OR
|
||||
we're using POLY5 and the POLY5 bit is set */
|
||||
if (((AUDC[chan] & 0x02) == 0) ||
|
||||
(((AUDC[chan] & 0x01) == 0) && Div31[P5[chan]]) ||
|
||||
(((AUDC[chan] & 0x01) == 1) && Bit5[P5[chan]]))
|
||||
{
|
||||
if (AUDC[chan] & 0x04) /* pure modified clock selected */
|
||||
{
|
||||
if (Outvol[chan]) /* if the output was set */
|
||||
Outvol[chan] = 0; /* turn it off */
|
||||
else
|
||||
Outvol[chan] = AUDV[chan]; /* else turn it on */
|
||||
}
|
||||
else if (AUDC[chan] & 0x08) /* check for p5/p9 */
|
||||
{
|
||||
if (AUDC[chan] == POLY9) /* check for poly9 */
|
||||
{
|
||||
/* inc the poly9 counter */
|
||||
P9[chan]++;
|
||||
if (P9[chan] == POLY9_SIZE)
|
||||
P9[chan] = 0;
|
||||
|
||||
if (Bit9[P9[chan]]) /* if poly9 bit is set */
|
||||
Outvol[chan] = AUDV[chan];
|
||||
else
|
||||
Outvol[chan] = 0;
|
||||
}
|
||||
else /* must be poly5 */
|
||||
{
|
||||
if (Bit5[P5[chan]])
|
||||
Outvol[chan] = AUDV[chan];
|
||||
else
|
||||
Outvol[chan] = 0;
|
||||
}
|
||||
}
|
||||
else /* poly4 is the only remaining option */
|
||||
{
|
||||
/* inc the poly4 counter */
|
||||
P4[chan]++;
|
||||
if (P4[chan] == POLY4_SIZE)
|
||||
P4[chan] = 0;
|
||||
|
||||
if (Bit4[P4[chan]])
|
||||
Outvol[chan] = AUDV[chan];
|
||||
else
|
||||
Outvol[chan] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* decrement the sample counter - value is 256 since the lower
|
||||
byte contains the fractional part */
|
||||
Samp_n_cnt -= 256;
|
||||
|
||||
/* if the count down has reached zero */
|
||||
if (Samp_n_cnt < 256)
|
||||
{
|
||||
/* adjust the sample counter */
|
||||
Samp_n_cnt += Samp_n_max;
|
||||
|
||||
/* calculate the latest output value and place in buffer */
|
||||
*(buffer++) = Outvol[0] + Outvol[1];
|
||||
|
||||
/* and indicate one less byte to process */
|
||||
n--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Module: Tia_process() */
|
||||
/* Purpose: To fill the output buffer with the sound output based on the */
|
||||
|
@ -598,12 +477,12 @@ void Tia_process (register unsigned char *buffer, register uint16 n)
|
|||
/* adjust the sample counter */
|
||||
Samp_n_cnt += Samp_n_max;
|
||||
|
||||
/* calculate the latest output value and place in buffer */
|
||||
#ifdef MAC_OSX
|
||||
/* calculate the latest output value and place in buffer
|
||||
scale the volume by 128, since this is the default silence value
|
||||
when using unsigned 8-bit samples in SDL */
|
||||
*(buffer++) = ((uint8) ((((uint32)outvol_0 + (uint32)outvol_1) * volume) / 100))/2 + 128;
|
||||
#else
|
||||
*(buffer++) = ((((uint32)outvol_0 + (uint32)outvol_1) * volume) / 100);
|
||||
#endif
|
||||
/* *(buffer++) = ((((uint32)outvol_0 + (uint32)outvol_1) * volume) / 100); */
|
||||
|
||||
/* and indicate one less byte to process */
|
||||
n--;
|
||||
}
|
||||
|
@ -687,3 +566,125 @@ void Tia_volume (unsigned int percent)
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*****************************************************************************/
|
||||
/* Module: Tia_process_2() */
|
||||
/* Purpose: To fill the output buffer with the sound output based on the */
|
||||
/* tia chip parameters. This routine has not been optimized. */
|
||||
/* Though it is not used by the program, I've left it for reference.*/
|
||||
/* */
|
||||
/* Author: Ron Fries */
|
||||
/* Date: September 10, 1996 */
|
||||
/* */
|
||||
/* Inputs: *buffer - pointer to the buffer where the audio output will */
|
||||
/* be placed */
|
||||
/* n - size of the playback buffer */
|
||||
/* */
|
||||
/* Outputs: the buffer will be filled with n bytes of audio - no return val */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
void Tia_process_2 (register unsigned char *buffer, register uint16 n)
|
||||
{
|
||||
register uint8 chan;
|
||||
|
||||
/* loop until the buffer is filled */
|
||||
while (n)
|
||||
{
|
||||
/* loop through the channels */
|
||||
for (chan = CHAN1; chan <= CHAN2; chan++)
|
||||
{
|
||||
/* NOTE: this routine intentionally does not count down to zero */
|
||||
/* since 0 is used as a special case - no clock */
|
||||
|
||||
/* if the divide by N counter can count down */
|
||||
if (Div_n_cnt[chan] > 1)
|
||||
{
|
||||
/* decrement and loop */
|
||||
Div_n_cnt[chan]--;
|
||||
}
|
||||
/* otherwise if we've reached the bottom */
|
||||
else if (Div_n_cnt[chan] == 1)
|
||||
{
|
||||
/* reset the counter */
|
||||
Div_n_cnt[chan] = Div_n_max[chan];
|
||||
|
||||
/* the P5 counter has multiple uses, so we inc it here */
|
||||
P5[chan]++;
|
||||
if (P5[chan] == POLY5_SIZE)
|
||||
P5[chan] = 0;
|
||||
|
||||
/* check clock modifier for clock tick */
|
||||
|
||||
/* if we're using pure tones OR
|
||||
we're using DIV31 and the DIV31 bit is set OR
|
||||
we're using POLY5 and the POLY5 bit is set */
|
||||
if (((AUDC[chan] & 0x02) == 0) ||
|
||||
(((AUDC[chan] & 0x01) == 0) && Div31[P5[chan]]) ||
|
||||
(((AUDC[chan] & 0x01) == 1) && Bit5[P5[chan]]))
|
||||
{
|
||||
if (AUDC[chan] & 0x04) /* pure modified clock selected */
|
||||
{
|
||||
if (Outvol[chan]) /* if the output was set */
|
||||
Outvol[chan] = 0; /* turn it off */
|
||||
else
|
||||
Outvol[chan] = AUDV[chan]; /* else turn it on */
|
||||
}
|
||||
else if (AUDC[chan] & 0x08) /* check for p5/p9 */
|
||||
{
|
||||
if (AUDC[chan] == POLY9) /* check for poly9 */
|
||||
{
|
||||
/* inc the poly9 counter */
|
||||
P9[chan]++;
|
||||
if (P9[chan] == POLY9_SIZE)
|
||||
P9[chan] = 0;
|
||||
|
||||
if (Bit9[P9[chan]]) /* if poly9 bit is set */
|
||||
Outvol[chan] = AUDV[chan];
|
||||
else
|
||||
Outvol[chan] = 0;
|
||||
}
|
||||
else /* must be poly5 */
|
||||
{
|
||||
if (Bit5[P5[chan]])
|
||||
Outvol[chan] = AUDV[chan];
|
||||
else
|
||||
Outvol[chan] = 0;
|
||||
}
|
||||
}
|
||||
else /* poly4 is the only remaining option */
|
||||
{
|
||||
/* inc the poly4 counter */
|
||||
P4[chan]++;
|
||||
if (P4[chan] == POLY4_SIZE)
|
||||
P4[chan] = 0;
|
||||
|
||||
if (Bit4[P4[chan]])
|
||||
Outvol[chan] = AUDV[chan];
|
||||
else
|
||||
Outvol[chan] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* decrement the sample counter - value is 256 since the lower
|
||||
byte contains the fractional part */
|
||||
Samp_n_cnt -= 256;
|
||||
|
||||
/* if the count down has reached zero */
|
||||
if (Samp_n_cnt < 256)
|
||||
{
|
||||
/* adjust the sample counter */
|
||||
Samp_n_cnt += Samp_n_max;
|
||||
|
||||
/* calculate the latest output value and place in buffer */
|
||||
*(buffer++) = Outvol[0] + Outvol[1];
|
||||
|
||||
/* and indicate one less byte to process */
|
||||
n--;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue