diff --git a/Changes.txt b/Changes.txt index bb0909587..de050f686 100644 --- a/Changes.txt +++ b/Changes.txt @@ -12,16 +12,17 @@ Release History =========================================================================== -3.7.5 to 3.8: (January xx, 2013) +3.7.5 to 3.8: (February xx, 2013) * Huge changes to the sound system: - - The sound code now uses signed 16-bit samples instead of unsigned - 8-bit samples, making it more compatible with a wider variety of + - The sound code now uses 16-bit signed samples instead of 8-bit + unsigned samples, making it more compatible with a wider variety of systems. - Improved sound output for several ROMs, including "Space Rocks" (the 'heartbeat' sound can now be clearly heard). - The 'volume clipping' option has been removed, since in 16-bit mode it's no longer needed. + - The 'Tia freq' option has been removed. * Improved bankswitch autodetection for X07 ROMs (although there's only two known ROMs in existence, so the detection probably isn't robust). @@ -69,7 +70,7 @@ reading from TIMINT. Also, D6 of the Interrupt Flag register is now properly set on active transition of the PA7 pin. - * Fixed bug in DPC+ bankswitch scheme; the music in "Stay Frosty 2" + * Fixed bug in DPC+ bankswitch scheme; the music several DPC+ ROMS wasn't playing correctly. * The ROM properties database now uses 'Auto' instead of 'Auto-select' diff --git a/docs/graphics/options_audio.png b/docs/graphics/options_audio.png index 1bf47fa3e..d89bca326 100644 Binary files a/docs/graphics/options_audio.png and b/docs/graphics/options_audio.png differ diff --git a/docs/index.html b/docs/index.html index 0fba9d048..dc16b117a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -10,7 +10,7 @@

A multi-platform Atari 2600 VCS emulator

-

Release 3.7.5

+

Release 3.8



User's Guide

@@ -54,7 +54,7 @@


-
February 1999 - December 2012
+
February 1999 - February 2013
The Stella Team
Stella Homepage
@@ -1995,14 +1995,7 @@
-freq <number>
- Set sound sample output frequency (0 - 48000). - Default is 31400. Do not change unless you experience sound - issues. - - - -
-tiafreq <number>
- Set sound sample generation frequency (0 - 48000). + Set sound sample output frequency (11025,22050,31400,44100,48000) Default is 31400. Do not change unless you experience sound issues. @@ -2494,9 +2487,7 @@ ItemBrief descriptionFor more information,
see CommandLine Volumeself-explanatory-volume Sample size (*)set size of audio buffers-fragsize - Output freq (*)change sound output frequency (advanced)-freq - TIA freqchange TIA output frequency (advanced)-tiafreq - Clip volumeEliminate popping in sound generation (advanced)-clipvol + Frequency (*)change sound output frequency-freq Enable soundself-explanatory-sound diff --git a/src/common/SoundNull.cxx b/src/common/SoundNull.cxx deleted file mode 100644 index 4f4784a0e..000000000 --- a/src/common/SoundNull.cxx +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll -// SS SS tt ll ll -// SS tttttt eeee ll ll aaaa -// SSSS tt ee ee ll ll aa -// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" -// SS SS tt ee ll ll aa aa -// SSSS ttt eeeee llll llll aaaaa -// -// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony -// and the Stella Team -// -// See the file "License.txt" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -// -// $Id$ -//============================================================================ - -#include "bspf.hxx" - -#include "OSystem.hxx" -#include "Settings.hxx" -#include "SoundNull.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SoundNull::SoundNull(OSystem* osystem) - : Sound(osystem) -{ - myOSystem->logMessage("Sound disabled.\n", 1); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SoundNull::~SoundNull() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SoundNull::load(Serializer& in) -{ - if(in.getString() != "TIASound") - return false; - - // Read sound registers and discard - in.getByte(); - in.getByte(); - in.getByte(); - in.getByte(); - in.getByte(); - in.getByte(); - - // myLastRegisterSetCycle - in.getInt(); - - return true; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SoundNull::save(Serializer& out) const -{ - out.putString("TIASound"); - - out.putByte(0); - out.putByte(0); - out.putByte(0); - out.putByte(0); - out.putByte(0); - out.putByte(0); - - // myLastRegisterSetCycle - out.putInt(0); - - return true; -} diff --git a/src/common/SoundNull.hxx b/src/common/SoundNull.hxx index 874ae3301..1f5180bd7 100644 --- a/src/common/SoundNull.hxx +++ b/src/common/SoundNull.hxx @@ -24,6 +24,7 @@ class OSystem; #include "bspf.hxx" #include "Sound.hxx" +#include "OSystem.hxx" /** This class implements a Null sound object, where-by sound generation @@ -39,7 +40,10 @@ class SoundNull : public Sound Create a new sound object. The init method must be invoked before using the object. */ - SoundNull(OSystem* osystem); + SoundNull(OSystem* osystem) : Sound(osystem) + { + myOSystem->logMessage("Sound disabled.\n", 1); + } /** Destructor @@ -128,14 +132,25 @@ class SoundNull : public Sound */ void adjustVolume(Int8 direction) { } -public: + public: /** Saves the current state of this device to the given Serializer. @param out The serializer device to save to. @return The result of the save. True on success, false on failure. */ - bool save(Serializer& out) const; + bool save(Serializer& out) const + { + out.putString("TIASound"); + + for(int = 0; i < 6; ++i) + out.putByte(0); + + // myLastRegisterSetCycle + out.putInt(0); + + return true; + } /** Loads the current state of this device from the given Serializer. @@ -143,7 +158,20 @@ public: @param in The Serializer device to load from. @return The result of the load. True on success, false on failure. */ - bool load(Serializer& in); + bool load(Serializer& in) + { + if(in.getString() != "TIASound") + return false; + + // Read sound registers and discard + for(int = 0; i < 6; ++i) + in.getByte(); + + // myLastRegisterSetCycle + in.getInt(); + + return true; + } /** Get a descriptor for this console class (used in error checking). diff --git a/src/common/SoundSDL.cxx b/src/common/SoundSDL.cxx index d34f29d9c..9b779f48a 100644 --- a/src/common/SoundSDL.cxx +++ b/src/common/SoundSDL.cxx @@ -125,9 +125,7 @@ void SoundSDL::open() } // Now initialize the TIASound object which will actually generate sound - int tiafreq = myOSystem->settings().getInt("tiafreq"); myTIASound.outputFrequency(myHardwareSpec.freq); - myTIASound.tiaFrequency(tiafreq); const string& chanResult = myTIASound.channels(myHardwareSpec.channels, myNumChannels == 2); diff --git a/src/common/module.mk b/src/common/module.mk index 7f50934b3..9e91715f3 100644 --- a/src/common/module.mk +++ b/src/common/module.mk @@ -2,7 +2,6 @@ MODULE := src/common MODULE_OBJS := \ src/common/mainSDL.o \ - src/common/SoundNull.o \ src/common/SoundSDL.o \ src/common/FrameBufferSoft.o \ src/common/FrameBufferGL.o \ diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 9f50f7b08..7035c7034 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -79,7 +79,6 @@ Settings::Settings(OSystem* osystem) setInternal("sound", "true"); setInternal("fragsize", "512"); setInternal("freq", "31400"); - setInternal("tiafreq", "31400"); setInternal("volume", "100"); // Input event options @@ -285,9 +284,8 @@ void Settings::validate() i = getInt("volume"); if(i < 0 || i > 100) setInternal("volume", "100"); i = getInt("freq"); - if(i < 0 || i > 48000) setInternal("freq", "31400"); - i = getInt("tiafreq"); - if(i < 0 || i > 48000) setInternal("tiafreq", "31400"); + if(!(i == 11025 || i == 22050 || i == 31400 || i == 44100 || i == 48000)) + setInternal("freq", "31400"); #endif i = getInt("joydeadzone"); @@ -382,8 +380,7 @@ void Settings::usage() #ifdef SOUND_SUPPORT << " -sound <1|0> Enable sound generation\n" << " -fragsize The size of sound fragments (must be a power of two)\n" - << " -freq Set sound sample output frequency (0 - 48000)\n" - << " -tiafreq Set sound sample generation frequency (0 - 48000)\n" + << " -freq Set sound sample output frequency (11025|22050|31400|44100|48000)\n" << " -volume Set the volume (0 - 100)\n" << " -clipvol <1|0> Enable volume clipping (eliminates popping)\n" << endl diff --git a/src/emucore/TIASnd.cxx b/src/emucore/TIASnd.cxx index 2c0001fb9..bed979521 100644 --- a/src/emucore/TIASnd.cxx +++ b/src/emucore/TIASnd.cxx @@ -21,10 +21,9 @@ #include "TIASnd.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TIASound::TIASound(Int32 outputFrequency, Int32 tiaFrequency) +TIASound::TIASound(Int32 outputFrequency) : myChannelMode(Hardware2Stereo), myOutputFrequency(outputFrequency), - myTIAFrequency(tiaFrequency), myOutputCounter(0), myVolumePercentage(100) { @@ -68,12 +67,6 @@ void TIASound::outputFrequency(Int32 freq) myOutputFrequency = freq; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIASound::tiaFrequency(Int32 freq) -{ - myTIAFrequency = freq; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string TIASound::channels(uInt32 hardware, bool stereo) { @@ -352,31 +345,31 @@ void TIASound::process(Int16* buffer, uInt32 samples) switch(myChannelMode) { case Hardware2Mono: // mono sampling with 2 hardware channels - while((samples > 0) && (myOutputCounter >= myTIAFrequency)) + while((samples > 0) && (myOutputCounter >= 31400)) { Int16 byte = v0 + v1; *(buffer++) = byte; *(buffer++) = byte; - myOutputCounter -= myTIAFrequency; + myOutputCounter -= 31400; samples--; } break; case Hardware2Stereo: // stereo sampling with 2 hardware channels - while((samples > 0) && (myOutputCounter >= myTIAFrequency)) + while((samples > 0) && (myOutputCounter >= 31400)) { *(buffer++) = v0; *(buffer++) = v1; - myOutputCounter -= myTIAFrequency; + myOutputCounter -= 31400; samples--; } break; case Hardware1: // mono/stereo sampling with only 1 hardware channel - while((samples > 0) && (myOutputCounter >= myTIAFrequency)) + while((samples > 0) && (myOutputCounter >= 31400)) { *(buffer++) = v0 + v1; - myOutputCounter -= myTIAFrequency; + myOutputCounter -= 31400; samples--; } break; diff --git a/src/emucore/TIASnd.hxx b/src/emucore/TIASnd.hxx index 57ce93f17..41a38b7b2 100644 --- a/src/emucore/TIASnd.hxx +++ b/src/emucore/TIASnd.hxx @@ -26,6 +26,9 @@ This class implements a fairly accurate emulation of the TIA sound hardware. This class uses code/ideas from z26 and MESS. + Currently, the sound generation routines work at 31400Hz only. + Resampling can be done by passing in a different output frequency. + @author Bradford W. Mott, Stephen Anthony, z26 and MESS teams @version $Id$ */ @@ -35,7 +38,7 @@ class TIASound /** Create a new TIA Sound object using the specified output frequency */ - TIASound(Int32 outputFrequency = 31400, Int32 tiaFrequency = 31400); + TIASound(Int32 outputFrequency = 31400); /** Destructor @@ -53,11 +56,6 @@ class TIASound */ void outputFrequency(Int32 freq); - /** - Set the frequency the of the TIA device - */ - void tiaFrequency(Int32 freq); - /** Selects the number of audio channels per sample. There are two factors to consider: hardware capability and desired mixing. @@ -159,7 +157,6 @@ class TIASound ChannelMode myChannelMode; Int32 myOutputFrequency; - Int32 myTIAFrequency; Int32 myOutputCounter; uInt32 myVolumePercentage; diff --git a/src/gui/AudioDialog.cxx b/src/gui/AudioDialog.cxx index 455256a79..0be5dc601 100644 --- a/src/gui/AudioDialog.cxx +++ b/src/gui/AudioDialog.cxx @@ -55,7 +55,7 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent, // Set real dimensions _w = 35 * fontWidth + 10; - _h = 8 * (lineHeight + 4) + 10; + _h = 7 * (lineHeight + 4) + 10; // Volume xpos = 3 * fontWidth; ypos = 10; @@ -95,20 +95,13 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent, items.push_back("48000 Hz", "48000"); myFreqPopup = new PopUpWidget(this, font, xpos, ypos, pwidth + myVolumeLabel->getWidth() - 4, lineHeight, - items, "Output freq (*): ", lwidth); + items, "Frequency (*): ", lwidth); wid.push_back(myFreqPopup); ypos += lineHeight + 4; - // TIA frequency - // ... use same items as above - myTiaFreqPopup = new PopUpWidget(this, font, xpos, ypos, - pwidth + myVolumeLabel->getWidth() - 4, lineHeight, - items, "TIA freq: ", lwidth); - wid.push_back(myTiaFreqPopup); - ypos += lineHeight + 4; - // Enable sound xpos = (_w - (font.getStringWidth("Enable sound") + 10)) / 2; + ypos += 4; mySoundEnableCheckbox = new CheckboxWidget(this, font, xpos, ypos, "Enable sound", kSoundEnableChanged); wid.push_back(mySoundEnableCheckbox); @@ -148,9 +141,6 @@ void AudioDialog::loadConfig() // Output frequency myFreqPopup->setSelected(instance().settings().getString("freq"), "31400"); - // TIA frequency - myTiaFreqPopup->setSelected(instance().settings().getString("tiafreq"), "31400"); - // Enable sound bool b = instance().settings().getBool("sound"); mySoundEnableCheckbox->setState(b); @@ -174,9 +164,6 @@ void AudioDialog::saveConfig() // Output frequency settings.setString("freq", myFreqPopup->getSelectedTag()); - // TIA frequency - settings.setString("tiafreq", myTiaFreqPopup->getSelectedTag()); - // Enable/disable sound (requires a restart to take effect) instance().sound().setEnabled(mySoundEnableCheckbox->getState()); @@ -194,7 +181,6 @@ void AudioDialog::setDefaults() myFragsizePopup->setSelected("512", ""); myFreqPopup->setSelected("31400", ""); - myTiaFreqPopup->setSelected("31400", ""); mySoundEnableCheckbox->setState(true); @@ -211,7 +197,6 @@ void AudioDialog::handleSoundEnableChange(bool active) myVolumeLabel->setEnabled(active); myFragsizePopup->setEnabled(active); myFreqPopup->setEnabled(active); - myTiaFreqPopup->setEnabled(active); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/AudioDialog.hxx b/src/gui/AudioDialog.hxx index c35cd82f5..a79cee551 100644 --- a/src/gui/AudioDialog.hxx +++ b/src/gui/AudioDialog.hxx @@ -45,7 +45,6 @@ class AudioDialog : public Dialog StaticTextWidget* myVolumeLabel; PopUpWidget* myFragsizePopup; PopUpWidget* myFreqPopup; - PopUpWidget* myTiaFreqPopup; CheckboxWidget* mySoundEnableCheckbox; private: