Removed some redundant code in FrameBufferGL.

Made sure emulation screen height can always accommodate the menus
placed in it.

Added check when switching to PAL mode, so that the emulation height
will be a default for PAL (250), not for NTSC (210).

Added ability to switch between stereo and mono sound dynamically
from the AudioDialog ('Stereo Mode') and the commandline ('-channels').
This setting is not saved to stellarc, so if you want it to be
permanent for some game, save it to the properties file.

Added 'Cartridge.Sound' property to the game properties, and have it
default to 'Mono'.  Setting it to 'Stereo' will give stereo sound
(2 sound channels used).  Related to this, update stella.pro
'Skeleton+' entry to use stereo sound.

Correctly update the sound framerate when switching between NTSC/PAL,
since the new sound core knows what to do in such a case.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@768 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-09-06 19:42:35 +00:00
parent b648fb4f50
commit 4dfb229566
16 changed files with 141 additions and 75 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferGL.cxx,v 1.40 2005-08-11 19:12:37 stephena Exp $ // $Id: FrameBufferGL.cxx,v 1.41 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
@ -275,13 +275,6 @@ void FrameBufferGL::postFrameUpdate()
// Now show all changes made to the textures // Now show all changes made to the textures
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
glBegin(GL_QUADS);
glTexCoord2f(myTexCoord[0], myTexCoord[1]); glVertex2i(0, 0);
glTexCoord2f(myTexCoord[2], myTexCoord[1]); glVertex2i(w, 0);
glTexCoord2f(myTexCoord[2], myTexCoord[3]); glVertex2i(w, h);
glTexCoord2f(myTexCoord[0], myTexCoord[3]); glVertex2i(0, h);
glEnd();
myDirtyFlag = false; myDirtyFlag = false;
} }
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SoundNull.hxx,v 1.2 2005-06-16 00:55:56 stephena Exp $ // $Id: SoundNull.hxx,v 1.3 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#ifndef SOUND_NULL_HXX #ifndef SOUND_NULL_HXX
@ -31,7 +31,7 @@ class Deserializer;
is completely disabled. is completely disabled.
@author Stephen Anthony @author Stephen Anthony
@version $Id: SoundNull.hxx,v 1.2 2005-06-16 00:55:56 stephena Exp $ @version $Id: SoundNull.hxx,v 1.3 2005-09-06 19:42:35 stephena Exp $
*/ */
class SoundNull : public Sound class SoundNull : public Sound
{ {
@ -64,6 +64,13 @@ class SoundNull : public Sound
*/ */
void adjustCycleCounter(Int32 amount) { } void adjustCycleCounter(Int32 amount) { }
/**
Sets the number of channels (mono or stereo sound).
@param channels The number of channels
*/
void setChannels(uInt32 channels) { }
/** /**
Sets the display framerate. Sound generation for NTSC and PAL games Sets the display framerate. Sound generation for NTSC and PAL games
depends on the framerate, so we need to set it here. depends on the framerate, so we need to set it here.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SoundSDL.cxx,v 1.23 2005-09-05 01:12:56 stephena Exp $ // $Id: SoundSDL.cxx,v 1.24 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
@ -41,11 +41,11 @@ SoundSDL::SoundSDL(OSystem* osystem)
myIsInitializedFlag(false), myIsInitializedFlag(false),
myLastRegisterSetCycle(0), myLastRegisterSetCycle(0),
myDisplayFrameRate(60), myDisplayFrameRate(60),
myNumChannels(1),
myFragmentSizeLogBase2(0), myFragmentSizeLogBase2(0),
myIsMuted(false), myIsMuted(false),
myVolume(100) myVolume(100)
{ {
initialize(true);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -106,7 +106,7 @@ void SoundSDL::initialize(bool forcerestart)
desired.freq = 44100; desired.freq = 44100;
desired.format = AUDIO_U16; desired.format = AUDIO_U16;
#endif #endif
desired.channels = 1; // Set to 2 for stereo TIA sound support desired.channels = myNumChannels;
desired.samples = fragsize; desired.samples = fragsize;
desired.callback = callback; desired.callback = callback;
desired.userdata = (void*)this; desired.userdata = (void*)this;
@ -155,7 +155,8 @@ void SoundSDL::initialize(bool forcerestart)
if(myOSystem->settings().getBool("showinfo")) if(myOSystem->settings().getBool("showinfo"))
cout << "Sound enabled:" << endl cout << "Sound enabled:" << endl
<< " Volume : " << myVolume << endl << " Volume : " << myVolume << endl
<< " Frag size: " << fragsize << endl << endl; << " Frag size: " << fragsize << endl
<< " Channels : " << myNumChannels << endl << endl;
} }
} }
@ -251,6 +252,16 @@ void SoundSDL::adjustCycleCounter(Int32 amount)
myLastRegisterSetCycle += amount; myLastRegisterSetCycle += amount;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL::setChannels(uInt32 channels)
{
if(channels == 1 || channels == 2)
{
myNumChannels = channels;
myOSystem->settings().setInt("channels", myNumChannels, false);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL::setFrameRate(uInt32 framerate) void SoundSDL::setFrameRate(uInt32 framerate)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SoundSDL.hxx,v 1.14 2005-09-04 23:59:30 bwmott Exp $ // $Id: SoundSDL.hxx,v 1.15 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#ifndef SOUND_SDL_HXX #ifndef SOUND_SDL_HXX
@ -34,7 +34,7 @@ class OSystem;
This class implements the sound API for SDL. This class implements the sound API for SDL.
@author Stephen Anthony and Bradford W. Mott @author Stephen Anthony and Bradford W. Mott
@version $Id: SoundSDL.hxx,v 1.14 2005-09-04 23:59:30 bwmott Exp $ @version $Id: SoundSDL.hxx,v 1.15 2005-09-06 19:42:35 stephena Exp $
*/ */
class SoundSDL : public Sound class SoundSDL : public Sound
{ {
@ -66,6 +66,13 @@ class SoundSDL : public Sound
*/ */
void adjustCycleCounter(Int32 amount); void adjustCycleCounter(Int32 amount);
/**
Sets the number of channels (mono or stereo sound).
@param channels The number of channels
*/
void setChannels(uInt32 channels);
/** /**
Sets the display framerate. Sound generation for NTSC and PAL games Sets the display framerate. Sound generation for NTSC and PAL games
depends on the framerate, so we need to set it here. depends on the framerate, so we need to set it here.
@ -244,6 +251,9 @@ class SoundSDL : public Sound
// Indicates the base framerate depending on if the ROM is NTSC or PAL // Indicates the base framerate depending on if the ROM is NTSC or PAL
uInt32 myDisplayFrameRate; uInt32 myDisplayFrameRate;
// Indicates the number of channels (mono or stereo)
uInt32 myNumChannels;
// Log base 2 of the selected fragment size // Log base 2 of the selected fragment size
double myFragmentSizeLogBase2; double myFragmentSizeLogBase2;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Console.cxx,v 1.68 2005-08-30 17:51:26 stephena Exp $ // $Id: Console.cxx,v 1.69 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -83,6 +83,11 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
// A developer can override properties from the commandline // A developer can override properties from the commandline
setDeveloperProperties(); setDeveloperProperties();
// Make sure height is set properly for PAL ROM
if(myProperties.get("Display.Format") == "PAL")
if(myProperties.get("Display.Height") == "210")
myProperties.set("Display.Height", "250");
// Setup the controllers based on properties // Setup the controllers based on properties
string left = myProperties.get("Controller.Left"); string left = myProperties.get("Controller.Left");
string right = myProperties.get("Controller.Right"); string right = myProperties.get("Controller.Right");
@ -182,6 +187,19 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
initializeVideo(); initializeVideo();
// Initialize the sound interface. // Initialize the sound interface.
// The # of channels can be overridden in the AudioDialog box or on
// the commandline, but it can't be saved.
uInt32 channels = myOSystem->settings().getInt("channels");
if(channels == 0)
{
if(myProperties.get("Cartridge.Sound") == "Stereo")
channels = 2;
else if(myProperties.get("Cartridge.Sound") == "Mono")
channels = 1;
else
channels = 1;
}
myOSystem->sound().setChannels(channels);
myOSystem->sound().setFrameRate(framerate); myOSystem->sound().setFrameRate(framerate);
myOSystem->sound().initialize(); myOSystem->sound().initialize();
@ -254,7 +272,7 @@ void Console::toggleFormat()
setPalette(); setPalette();
myOSystem->setFramerate(framerate); myOSystem->setFramerate(framerate);
//FIXME - should be change sound rate as well?? myOSystem->sound().setFrameRate(framerate);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OSystem.cxx,v 1.35 2005-08-30 01:10:54 stephena Exp $ // $Id: OSystem.cxx,v 1.36 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -171,21 +171,6 @@ void OSystem::setConfigFiles(const string& userconfig,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool OSystem::createFrameBuffer(bool showmessage) bool OSystem::createFrameBuffer(bool showmessage)
{ {
/* FIXME - this will probably be discontinued for 2.0
// Set the SDL_VIDEODRIVER environment variable, if possible
string videodriver = mySettings->getString("video_driver");
if(videodriver != "")
{
string buf = "SDL_VIDEODRIVER=" + videodriver;
putenv((char*) buf.c_str());
if(mySettings->getBool("showinfo"))
{
buf = "Video driver: " + videodriver;
cout << buf << endl << endl;
}
}
*/
// Delete the old framebuffer // Delete the old framebuffer
delete myFrameBuffer; myFrameBuffer = NULL; delete myFrameBuffer; myFrameBuffer = NULL;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: PropsSet.cxx,v 1.10 2005-06-16 01:11:28 stephena Exp $ // $Id: PropsSet.cxx,v 1.11 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -271,6 +271,7 @@ const Properties& PropertiesSet::defaultProperties()
ourDefaultProperties.set("Cartridge.Name", "Untitled"); ourDefaultProperties.set("Cartridge.Name", "Untitled");
ourDefaultProperties.set("Cartridge.Note", ""); ourDefaultProperties.set("Cartridge.Note", "");
ourDefaultProperties.set("Cartridge.Rarity", ""); ourDefaultProperties.set("Cartridge.Rarity", "");
ourDefaultProperties.set("Cartridge.Sound", "Mono");
ourDefaultProperties.set("Cartridge.Type", "Auto-detect"); ourDefaultProperties.set("Cartridge.Type", "Auto-detect");
ourDefaultProperties.set("Console.LeftDifficulty", "B"); ourDefaultProperties.set("Console.LeftDifficulty", "B");

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Settings.cxx,v 1.57 2005-08-30 17:51:26 stephena Exp $ // $Id: Settings.cxx,v 1.58 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -279,6 +279,7 @@ void Settings::usage()
<< " -holdbutton0 Start the emulator with the left joystick button held down\n" << " -holdbutton0 Start the emulator with the left joystick button held down\n"
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
<< " -sound <1|0> Enable sound generation\n" << " -sound <1|0> Enable sound generation\n"
<< " -channels <1|2> Enable mono or stereo sound\n"
<< " -fragsize <number> The size of sound fragments (must be a power of two)\n" << " -fragsize <number> The size of sound fragments (must be a power of two)\n"
<< " -volume <number> Set the volume (0 - 100)\n" << " -volume <number> Set the volume (0 - 100)\n"
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Sound.hxx,v 1.19 2005-06-16 00:55:58 stephena Exp $ // $Id: Sound.hxx,v 1.20 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#ifndef SOUND_HXX #ifndef SOUND_HXX
@ -30,7 +30,7 @@ class Deserializer;
It has no functionality whatsoever. It has no functionality whatsoever.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Sound.hxx,v 1.19 2005-06-16 00:55:58 stephena Exp $ @version $Id: Sound.hxx,v 1.20 2005-09-06 19:42:35 stephena Exp $
*/ */
class Sound class Sound
{ {
@ -62,6 +62,13 @@ class Sound
*/ */
virtual void adjustCycleCounter(Int32 amount) = 0; virtual void adjustCycleCounter(Int32 amount) = 0;
/**
Sets the number of channels (mono or stereo sound).
@param channels The number of channels
*/
virtual void setChannels(uInt32 channels) = 0;
/** /**
Sets the display framerate. Sound generation for NTSC and PAL games Sets the display framerate. Sound generation for NTSC and PAL games
depends on the framerate, so we need to set it here. depends on the framerate, so we need to set it here.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: TIA.cxx,v 1.56 2005-07-21 04:10:15 urchlay Exp $ // $Id: TIA.cxx,v 1.57 2005-09-06 19:42:35 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -30,6 +30,7 @@
#include "Deserializer.hxx" #include "Deserializer.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "Sound.hxx" #include "Sound.hxx"
#include "GuiUtils.hxx"
#define HBLANK 68 #define HBLANK 68
@ -223,6 +224,10 @@ void TIA::reset()
myFrameYStart = atoi(myConsole.properties().get("Display.YStart").c_str()); myFrameYStart = atoi(myConsole.properties().get("Display.YStart").c_str());
myFrameHeight = atoi(myConsole.properties().get("Display.Height").c_str()); myFrameHeight = atoi(myConsole.properties().get("Display.Height").c_str());
// Make sure frameHeight is no less than 190 pixels
// This is a hack for the onscreen menus
myFrameHeight = MAX((int)myFrameHeight, 190);
// Make sure the starting x and width values are reasonable // Make sure the starting x and width values are reasonable
if((myFrameXStart + myFrameWidth) > 160) if((myFrameXStart + myFrameWidth) > 160)
{ {

View File

@ -2967,6 +2967,7 @@
"Cartridge.MD5" "22b22c4ce240303012e8a9596ae8d189" "Cartridge.MD5" "22b22c4ce240303012e8a9596ae8d189"
"Cartridge.Name" "Skeleton+ (03-05-2003) (Eric Ball) (PAL)" "Cartridge.Name" "Skeleton+ (03-05-2003) (Eric Ball) (PAL)"
"Cartridge.Sound" "Stereo"
"Display.Format" "PAL" "Display.Format" "PAL"
"Display.Height" "256" "Display.Height" "256"
"" ""
@ -5706,10 +5707,25 @@
"Cartridge.Name" "Star Fire (17-02-2003) (MP)" "Cartridge.Name" "Star Fire (17-02-2003) (MP)"
"" ""
"Cartridge.MD5" "43f8459d39fb4eddf9186d62722ff795" "Cartridge.MD5" "eafe8b40313a65792e88ff9f2fe2655c"
"Cartridge.Name" "Skeleton+ (17-04-2003) (Eric Ball) (PAL)" "Cartridge.Name" "Skeleton+ (NTSC)"
"Cartridge.Manufacturer" "Eric Ball"
"Cartridge.ModelNo" "ELB004"
"Cartridge.Note" "Stereo sound"
"Cartridge.Rarity" "Homebrew"
"Cartridge.Type" "4K"
"Cartridge.Sound" "Stereo"
""
"Cartridge.MD5" "63c7395d412a3cd095ccdd9b5711f387"
"Cartridge.Name" "Skeleton+ (PAL)"
"Cartridge.Manufacturer" "Eric Ball"
"Cartridge.ModelNo" "ELB005"
"Cartridge.Note" "Stereo sound"
"Cartridge.Rarity" "Homebrew"
"Cartridge.Type" "4K"
"Cartridge.Sound" "Stereo"
"Display.Format" "PAL" "Display.Format" "PAL"
"Display.Height" "256"
"" ""
"Cartridge.MD5" "458883f1d952cd772cf0057abca57497" "Cartridge.MD5" "458883f1d952cd772cf0057abca57497"
@ -8089,12 +8105,6 @@
"Display.YStart" "27" "Display.YStart" "27"
"" ""
"Cartridge.MD5" "63c7395d412a3cd095ccdd9b5711f387"
"Cartridge.Name" "Skeleton+ (14-05-2003) (Eric Ball) (PAL)"
"Display.Format" "PAL"
"Display.Height" "256"
""
"Cartridge.MD5" "640a08e9ca019172d612df22a9190afb" "Cartridge.MD5" "640a08e9ca019172d612df22a9190afb"
"Cartridge.Name" "Joust (1982) (Atari) (PAL) [!]" "Cartridge.Name" "Joust (1982) (Atari) (PAL) [!]"
"Cartridge.Manufacturer" "Atari" "Cartridge.Manufacturer" "Atari"
@ -9641,6 +9651,7 @@
"Cartridge.MD5" "75b22fdf632d76e246433db1ebccd3c4" "Cartridge.MD5" "75b22fdf632d76e246433db1ebccd3c4"
"Cartridge.Name" "Skeleton+ (05-05-2003) (Eric Ball) (PAL)" "Cartridge.Name" "Skeleton+ (05-05-2003) (Eric Ball) (PAL)"
"Cartridge.Sound" "Stereo"
"Display.Format" "PAL" "Display.Format" "PAL"
"Display.Height" "256" "Display.Height" "256"
"" ""
@ -16612,6 +16623,7 @@
"Cartridge.MD5" "cfef1a2d1f6a5ee7a5e1f43f3056f112" "Cartridge.MD5" "cfef1a2d1f6a5ee7a5e1f43f3056f112"
"Cartridge.Name" "Skeleton+ (05-05-2003) (Eric Ball) (NTSC)" "Cartridge.Name" "Skeleton+ (05-05-2003) (Eric Ball) (NTSC)"
"Cartridge.Sound" "Stereo"
"" ""
"Cartridge.MD5" "cfee10bd7119f10b136921ced2ee8972" "Cartridge.MD5" "cfee10bd7119f10b136921ced2ee8972"
@ -18791,10 +18803,6 @@
"Controller.Right" "Paddles" "Controller.Right" "Paddles"
"" ""
"Cartridge.MD5" "eafe8b40313a65792e88ff9f2fe2655c"
"Cartridge.Name" "Skeleton+ (14-05-2003) (Eric Ball) (NTSC)"
""
"Cartridge.MD5" "eaf744185d5e8def899950ba7c6e7bb5" "Cartridge.MD5" "eaf744185d5e8def899950ba7c6e7bb5"
"Cartridge.Name" "Xenophobe (1990) (Atari) (PAL) [a1]" "Cartridge.Name" "Xenophobe (1990) (Atari) (PAL) [a1]"
"Cartridge.Manufacturer" "Atari" "Cartridge.Manufacturer" "Atari"
@ -19470,6 +19478,7 @@
"Cartridge.MD5" "f20bd756f3990e06c492f53cd0168e68" "Cartridge.MD5" "f20bd756f3990e06c492f53cd0168e68"
"Cartridge.Name" "Skeleton+ (03-05-2003) (Eric Ball) (NTSC)" "Cartridge.Name" "Skeleton+ (03-05-2003) (Eric Ball) (NTSC)"
"Cartridge.Sound" "Stereo"
"" ""
"Cartridge.MD5" "f1eeeccc4bba6999345a2575ae96508e" "Cartridge.MD5" "f1eeeccc4bba6999345a2575ae96508e"
@ -20124,6 +20133,7 @@
"Cartridge.MD5" "f98d869f287d2ce4f8fb36e0686929d9" "Cartridge.MD5" "f98d869f287d2ce4f8fb36e0686929d9"
"Cartridge.Name" "Skeleton+ (17-04-2003) (Eric Ball) (NTSC)" "Cartridge.Name" "Skeleton+ (17-04-2003) (Eric Ball) (NTSC)"
"Cartridge.Sound" "Stereo"
"" ""
"Cartridge.MD5" "f992a39b46aa48188fab12ad3809ae4a" "Cartridge.MD5" "f992a39b46aa48188fab12ad3809ae4a"

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: AudioDialog.cxx,v 1.13 2005-08-16 18:34:12 stephena Exp $ // $Id: AudioDialog.cxx,v 1.14 2005-09-06 19:42:35 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -70,19 +70,16 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
myFragsizePopup->appendEntry("4096", 5); myFragsizePopup->appendEntry("4096", 5);
yoff += kAudioRowHeight + 4; yoff += kAudioRowHeight + 4;
// Stereo sound
mySoundTypeCheckbox = new CheckboxWidget(this, font, xoff+28, yoff,
"Stereo mode", 0);
yoff += kAudioRowHeight + 4;
// Enable sound // Enable sound
new StaticTextWidget(this, xoff+8, yoff+3, 20, kLineHeight, "", kTextAlignLeft);
mySoundEnableCheckbox = new CheckboxWidget(this, font, xoff+28, yoff, mySoundEnableCheckbox = new CheckboxWidget(this, font, xoff+28, yoff,
"Enable sound", kSoundEnableChanged); "Enable sound", kSoundEnableChanged);
yoff += kAudioRowHeight + 12; yoff += kAudioRowHeight + 12;
// Add a short message about options that need a restart
// new StaticTextWidget(this, xoff+30, yoff, 170, kLineHeight,
// "* Note that these options take effect", kTextAlignLeft);
// yoff += kAudioRowHeight;
// new StaticTextWidget(this, xoff+30, yoff, 170, kLineHeight,
// "the next time you restart Stella.", kTextAlignLeft);
// Add Defaults, OK and Cancel buttons // Add Defaults, OK and Cancel buttons
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0); addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0);
#ifndef MAC_OSX #ifndef MAC_OSX
@ -118,6 +115,10 @@ void AudioDialog::loadConfig()
else if(i == 4096) i = 5; else if(i == 4096) i = 5;
myFragsizePopup->setSelectedTag(i); myFragsizePopup->setSelectedTag(i);
// Stereo mode
i = instance()->settings().getInt("channels");
mySoundTypeCheckbox->setState(i == 2);
// Enable sound // Enable sound
b = instance()->settings().getBool("sound"); b = instance()->settings().getBool("sound");
mySoundEnableCheckbox->setState(b); mySoundEnableCheckbox->setState(b);
@ -146,6 +147,14 @@ void AudioDialog::saveConfig()
restart = true; restart = true;
} }
// Enable/disable stereo sound (requires a restart to take effect)
b = mySoundTypeCheckbox->getState();
if((instance()->settings().getInt("channels") == 2) != b)
{
instance()->sound().setChannels(b ? 2 : 1);
restart = true;
}
// Enable/disable sound (requires a restart to take effect) // Enable/disable sound (requires a restart to take effect)
b = mySoundEnableCheckbox->getState(); b = mySoundEnableCheckbox->getState();
if(instance()->settings().getBool("sound") != b) if(instance()->settings().getBool("sound") != b)
@ -175,6 +184,7 @@ void AudioDialog::setDefaults()
myFragsizePopup->setSelectedTag(2); myFragsizePopup->setSelectedTag(2);
#endif #endif
mySoundTypeCheckbox->setState(false);
mySoundEnableCheckbox->setState(true); mySoundEnableCheckbox->setState(true);
// Make sure that mutually-exclusive items are not enabled at the same time // Make sure that mutually-exclusive items are not enabled at the same time
@ -189,6 +199,7 @@ void AudioDialog::handleSoundEnableChange(bool active)
myVolumeSlider->setEnabled(active); myVolumeSlider->setEnabled(active);
myVolumeLabel->setEnabled(active); myVolumeLabel->setEnabled(active);
myFragsizePopup->setEnabled(active); myFragsizePopup->setEnabled(active);
mySoundTypeCheckbox->setEnabled(active);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: AudioDialog.hxx,v 1.5 2005-07-05 15:25:44 stephena Exp $ // $Id: AudioDialog.hxx,v 1.6 2005-09-06 19:42:35 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -33,6 +33,11 @@ class CheckboxWidget;
#include "OSystem.hxx" #include "OSystem.hxx"
#include "bspf.hxx" #include "bspf.hxx"
enum {
kVolumeChanged = 'ADvc',
kSoundEnableChanged = 'ADse'
};
class AudioDialog : public Dialog class AudioDialog : public Dialog
{ {
public: public:
@ -44,6 +49,7 @@ class AudioDialog : public Dialog
SliderWidget* myVolumeSlider; SliderWidget* myVolumeSlider;
StaticTextWidget* myVolumeLabel; StaticTextWidget* myVolumeLabel;
PopUpWidget* myFragsizePopup; PopUpWidget* myFragsizePopup;
CheckboxWidget* mySoundTypeCheckbox;
CheckboxWidget* mySoundEnableCheckbox; CheckboxWidget* mySoundEnableCheckbox;
private: private:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GuiUtils.hxx,v 1.18 2005-08-11 19:12:39 stephena Exp $ // $Id: GuiUtils.hxx,v 1.19 2005-09-06 19:42:35 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,7 @@
Probably not very neat, but at least it works ... Probably not very neat, but at least it works ...
@author Stephen Anthony @author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.18 2005-08-11 19:12:39 stephena Exp $ @version $Id: GuiUtils.hxx,v 1.19 2005-09-06 19:42:35 stephena Exp $
*/ */
#define kFontHeight 10 #define kFontHeight 10
@ -59,13 +59,7 @@ enum {
kSetPositionCmd = 'SETP', kSetPositionCmd = 'SETP',
kTabChangedCmd = 'TBCH', kTabChangedCmd = 'TBCH',
kCheckActionCmd = 'CBAC', kCheckActionCmd = 'CBAC',
kRefreshAllCmd = 'REFA', kRefreshAllCmd = 'REFA'
kRendererChanged,
kAspectRatioChanged,
kFrameRateChanged,
kZoomChanged,
kVolumeChanged,
kSoundEnableChanged
}; };
// Indicates a three-way possibility when changing the size of some quantity // Indicates a three-way possibility when changing the size of some quantity

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OptionsDialog.cxx,v 1.24 2005-08-11 19:12:39 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.25 2005-09-06 19:42:35 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -96,7 +96,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myVideoDialog = new VideoDialog(myOSystem, parent, x, y, w, h); myVideoDialog = new VideoDialog(myOSystem, parent, x, y, w, h);
w = 200; h = 100; w = 200; h = 110;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myAudioDialog = new AudioDialog(myOSystem, parent, x, y, w, h); myAudioDialog = new AudioDialog(myOSystem, parent, x, y, w, h);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: VideoDialog.hxx,v 1.8 2005-07-05 15:25:44 stephena Exp $ // $Id: VideoDialog.hxx,v 1.9 2005-09-06 19:42:35 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -33,6 +33,13 @@ class CheckboxWidget;
#include "Dialog.hxx" #include "Dialog.hxx"
#include "bspf.hxx" #include "bspf.hxx"
enum {
kRendererChanged = 'VDrd',
kAspectRatioChanged = 'VDar',
kFrameRateChanged = 'VDfr',
kZoomChanged = 'VDzm'
};
class VideoDialog : public Dialog class VideoDialog : public Dialog
{ {
public: public: