mirror of https://github.com/stella-emu/stella.git
Pass sound reference directly into the TIA class, eliminating the use
of pointers. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1657 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
771108ad3b
commit
dec6efccdd
|
@ -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.155 2009-01-24 18:11:47 stephena Exp $
|
// $Id: Console.cxx,v 1.156 2009-01-24 18:17:34 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -108,8 +108,7 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
||||||
|
|
||||||
myCart = cart;
|
myCart = cart;
|
||||||
myRiot = new M6532(*this);
|
myRiot = new M6532(*this);
|
||||||
myTIA = new TIA(*this, myOSystem->settings());
|
myTIA = new TIA(*this, myOSystem->sound(), myOSystem->settings());
|
||||||
myTIA->setSound(myOSystem->sound());
|
|
||||||
|
|
||||||
mySystem->attach(m6502);
|
mySystem->attach(m6502);
|
||||||
mySystem->attach(myRiot);
|
mySystem->attach(myRiot);
|
||||||
|
|
|
@ -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.102 2009-01-19 16:57:54 stephena Exp $
|
// $Id: TIA.cxx,v 1.103 2009-01-24 18:17:34 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
//#define DEBUG_HMOVE
|
//#define DEBUG_HMOVE
|
||||||
|
@ -40,10 +40,10 @@
|
||||||
#define HBLANK 68
|
#define HBLANK 68
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
TIA::TIA(Console& console, Settings& settings)
|
TIA::TIA(Console& console, Sound& sound, Settings& settings)
|
||||||
: myConsole(console),
|
: myConsole(console),
|
||||||
|
mySound(sound),
|
||||||
mySettings(settings),
|
mySettings(settings),
|
||||||
mySound(NULL),
|
|
||||||
myMaximumNumberOfScanlines(262),
|
myMaximumNumberOfScanlines(262),
|
||||||
myCOLUBK(myColor[0]),
|
myCOLUBK(myColor[0]),
|
||||||
myCOLUPF(myColor[1]),
|
myCOLUPF(myColor[1]),
|
||||||
|
@ -117,7 +117,7 @@ TIA::~TIA()
|
||||||
void TIA::reset()
|
void TIA::reset()
|
||||||
{
|
{
|
||||||
// Reset the sound device
|
// Reset the sound device
|
||||||
mySound->reset();
|
mySound.reset();
|
||||||
|
|
||||||
// Currently no objects are enabled
|
// Currently no objects are enabled
|
||||||
myEnabledObjects = 0;
|
myEnabledObjects = 0;
|
||||||
|
@ -228,7 +228,7 @@ void TIA::systemCyclesReset()
|
||||||
uInt32 cycles = mySystem->cycles();
|
uInt32 cycles = mySystem->cycles();
|
||||||
|
|
||||||
// Adjust the sound cycle indicator
|
// Adjust the sound cycle indicator
|
||||||
mySound->adjustCycleCounter(-1 * cycles);
|
mySound.adjustCycleCounter(-1 * cycles);
|
||||||
|
|
||||||
// Adjust the dump cycle
|
// Adjust the dump cycle
|
||||||
myDumpDisabledCycle -= cycles;
|
myDumpDisabledCycle -= cycles;
|
||||||
|
@ -357,7 +357,7 @@ bool TIA::save(Serializer& out) const
|
||||||
out.putInt(myDumpDisabledCycle);
|
out.putInt(myDumpDisabledCycle);
|
||||||
|
|
||||||
// Save the sound sample stuff ...
|
// Save the sound sample stuff ...
|
||||||
mySound->save(out);
|
mySound.save(out);
|
||||||
}
|
}
|
||||||
catch(char *msg)
|
catch(char *msg)
|
||||||
{
|
{
|
||||||
|
@ -454,7 +454,7 @@ bool TIA::load(Deserializer& in)
|
||||||
myDumpDisabledCycle = (Int32) in.getInt();
|
myDumpDisabledCycle = (Int32) in.getInt();
|
||||||
|
|
||||||
// Load the sound sample stuff ...
|
// Load the sound sample stuff ...
|
||||||
mySound->load(in);
|
mySound.load(in);
|
||||||
|
|
||||||
// Reset TIA bits to be on
|
// Reset TIA bits to be on
|
||||||
enableBits(true);
|
enableBits(true);
|
||||||
|
@ -670,12 +670,6 @@ void TIA::updateScanlineByTrace(int target)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void TIA::setSound(Sound& sound)
|
|
||||||
{
|
|
||||||
mySound = &sound;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
||||||
{
|
{
|
||||||
|
@ -2032,42 +2026,42 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
||||||
case AUDC0: // Audio control 0
|
case AUDC0: // Audio control 0
|
||||||
{
|
{
|
||||||
myAUDC0 = value & 0x0f;
|
myAUDC0 = value & 0x0f;
|
||||||
mySound->set(addr, value, mySystem->cycles());
|
mySound.set(addr, value, mySystem->cycles());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AUDC1: // Audio control 1
|
case AUDC1: // Audio control 1
|
||||||
{
|
{
|
||||||
myAUDC1 = value & 0x0f;
|
myAUDC1 = value & 0x0f;
|
||||||
mySound->set(addr, value, mySystem->cycles());
|
mySound.set(addr, value, mySystem->cycles());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AUDF0: // Audio frequency 0
|
case AUDF0: // Audio frequency 0
|
||||||
{
|
{
|
||||||
myAUDF0 = value & 0x1f;
|
myAUDF0 = value & 0x1f;
|
||||||
mySound->set(addr, value, mySystem->cycles());
|
mySound.set(addr, value, mySystem->cycles());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AUDF1: // Audio frequency 1
|
case AUDF1: // Audio frequency 1
|
||||||
{
|
{
|
||||||
myAUDF1 = value & 0x1f;
|
myAUDF1 = value & 0x1f;
|
||||||
mySound->set(addr, value, mySystem->cycles());
|
mySound.set(addr, value, mySystem->cycles());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AUDV0: // Audio volume 0
|
case AUDV0: // Audio volume 0
|
||||||
{
|
{
|
||||||
myAUDV0 = value & 0x0f;
|
myAUDV0 = value & 0x0f;
|
||||||
mySound->set(addr, value, mySystem->cycles());
|
mySound.set(addr, value, mySystem->cycles());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AUDV1: // Audio volume 1
|
case AUDV1: // Audio volume 1
|
||||||
{
|
{
|
||||||
myAUDV1 = value & 0x0f;
|
myAUDV1 = value & 0x0f;
|
||||||
mySound->set(addr, value, mySystem->cycles());
|
mySound.set(addr, value, mySystem->cycles());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2400,8 +2394,8 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
TIA::TIA(const TIA& c)
|
TIA::TIA(const TIA& c)
|
||||||
: myConsole(c.myConsole),
|
: myConsole(c.myConsole),
|
||||||
mySettings(c.mySettings),
|
|
||||||
mySound(c.mySound),
|
mySound(c.mySound),
|
||||||
|
mySettings(c.mySettings),
|
||||||
myCOLUBK(myColor[0]),
|
myCOLUBK(myColor[0]),
|
||||||
myCOLUPF(myColor[1]),
|
myCOLUPF(myColor[1]),
|
||||||
myCOLUP0(myColor[2]),
|
myCOLUP0(myColor[2]),
|
||||||
|
|
|
@ -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.hxx,v 1.51 2009-01-19 16:52:32 stephena Exp $
|
// $Id: TIA.hxx,v 1.52 2009-01-24 18:17:34 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef TIA_HXX
|
#ifndef TIA_HXX
|
||||||
|
@ -39,7 +39,7 @@ class Settings;
|
||||||
be displayed on screen.
|
be displayed on screen.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: TIA.hxx,v 1.51 2009-01-19 16:52:32 stephena Exp $
|
@version $Id: TIA.hxx,v 1.52 2009-01-24 18:17:34 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class TIA : public Device
|
class TIA : public Device
|
||||||
{
|
{
|
||||||
|
@ -50,9 +50,10 @@ class TIA : public Device
|
||||||
Create a new TIA for the specified console
|
Create a new TIA for the specified console
|
||||||
|
|
||||||
@param console The console the TIA is associated with
|
@param console The console the TIA is associated with
|
||||||
|
@param sound The sound object the TIA is associated with
|
||||||
@param settings The settings object for this TIA device
|
@param settings The settings object for this TIA device
|
||||||
*/
|
*/
|
||||||
TIA(Console& console, Settings& settings);
|
TIA(Console& console, Sound& sound, Settings& settings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destructor
|
Destructor
|
||||||
|
@ -187,11 +188,6 @@ class TIA : public Device
|
||||||
inline uInt32 scanlines() const
|
inline uInt32 scanlines() const
|
||||||
{ return ((mySystem->cycles() * 3) - myClockWhenFrameStarted) / 228; }
|
{ return ((mySystem->cycles() * 3) - myClockWhenFrameStarted) / 228; }
|
||||||
|
|
||||||
/**
|
|
||||||
Sets the sound device for the TIA.
|
|
||||||
*/
|
|
||||||
void setSound(Sound& sound);
|
|
||||||
|
|
||||||
enum TIABit {
|
enum TIABit {
|
||||||
P0, // Descriptor for Player 0 Bit
|
P0, // Descriptor for Player 0 Bit
|
||||||
P1, // Descriptor for Player 1 Bit
|
P1, // Descriptor for Player 1 Bit
|
||||||
|
@ -272,12 +268,12 @@ class TIA : public Device
|
||||||
// Console the TIA is associated with
|
// Console the TIA is associated with
|
||||||
Console& myConsole;
|
Console& myConsole;
|
||||||
|
|
||||||
|
// Sound object the TIA is associated with
|
||||||
|
Sound& mySound;
|
||||||
|
|
||||||
// Settings object the TIA is associated with
|
// Settings object the TIA is associated with
|
||||||
Settings& mySettings;
|
Settings& mySettings;
|
||||||
|
|
||||||
// Sound object the TIA is associated with
|
|
||||||
Sound* mySound;
|
|
||||||
|
|
||||||
// Pointer to the current frame buffer
|
// Pointer to the current frame buffer
|
||||||
uInt8* myCurrentFrameBuffer;
|
uInt8* myCurrentFrameBuffer;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue