mirror of https://github.com/stella-emu/stella.git
Fixed bit-rot with AtariVox stuff, and updated some of its documentation.
It now compiles and runs against the latest controller changes. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1451 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
1c1d7652e8
commit
cd9d21051f
|
@ -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.40 2008-02-06 13:45:19 stephena Exp $
|
// $Id: SoundSDL.cxx,v 1.41 2008-03-29 19:15:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef SOUND_SUPPORT
|
#ifdef SOUND_SUPPORT
|
||||||
|
@ -31,6 +31,9 @@
|
||||||
#include "System.hxx"
|
#include "System.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
|
|
||||||
|
#include "Console.hxx"
|
||||||
|
#include "AtariVox.hxx"
|
||||||
|
|
||||||
#include "SoundSDL.hxx"
|
#include "SoundSDL.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -406,7 +409,7 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len)
|
||||||
SoundSDL* sound = (SoundSDL*)udata;
|
SoundSDL* sound = (SoundSDL*)udata;
|
||||||
sound->processFragment(stream, (Int32)len);
|
sound->processFragment(stream, (Int32)len);
|
||||||
#ifdef ATARIVOX_SUPPORT
|
#ifdef ATARIVOX_SUPPORT
|
||||||
cerr << "SoundSDL::callback(): len==" << len << endl;
|
// cerr << "SoundSDL::callback(): len==" << len << endl;
|
||||||
|
|
||||||
// See if we need sound from the AtariVox
|
// See if we need sound from the AtariVox
|
||||||
AtariVox *vox = sound->myOSystem->console().atariVox();
|
AtariVox *vox = sound->myOSystem->console().atariVox();
|
||||||
|
|
|
@ -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: AtariVox.cxx,v 1.6 2008-02-06 13:45:20 stephena Exp $
|
// $Id: AtariVox.cxx,v 1.7 2008-03-29 19:15:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef ATARIVOX_SUPPORT
|
#ifdef ATARIVOX_SUPPORT
|
||||||
|
@ -21,49 +21,87 @@
|
||||||
#include "Event.hxx"
|
#include "Event.hxx"
|
||||||
#include "AtariVox.hxx"
|
#include "AtariVox.hxx"
|
||||||
#include "SpeakJet.hxx"
|
#include "SpeakJet.hxx"
|
||||||
|
#include "System.hxx"
|
||||||
|
|
||||||
#define DEBUG_ATARIVOX 0
|
#define DEBUG_ATARIVOX 0
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
AtariVox::AtariVox(Jack jack, const Event& event)
|
AtariVox::AtariVox(Jack jack, const Event& event)
|
||||||
: Controller(jack, event),
|
: Controller(jack, event, Controller::AtariVox),
|
||||||
mySpeakJet(0),
|
mySpeakJet(0),
|
||||||
mySystem(0),
|
myPinState(0),
|
||||||
myPinState(0),
|
myShiftCount(0),
|
||||||
myShiftCount(0),
|
myShiftRegister(0),
|
||||||
myShiftRegister(0),
|
myLastDataWriteCycle(0)
|
||||||
myLastDataWriteCycle(0)
|
|
||||||
{
|
{
|
||||||
myType = Controller::AtariVox;
|
|
||||||
mySpeakJet = new SpeakJet();
|
mySpeakJet = new SpeakJet();
|
||||||
|
|
||||||
|
myDigitalPinState[One] = myDigitalPinState[Two] =
|
||||||
|
myDigitalPinState[Three] = myDigitalPinState[Four] = true;
|
||||||
|
|
||||||
|
myAnalogPinValue[Five] = myAnalogPinValue[Nine] = maximumResistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
AtariVox::~AtariVox()
|
AtariVox::~AtariVox()
|
||||||
{
|
{
|
||||||
|
delete mySpeakJet;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void AtariVox::setSystem(System *system) {
|
void AtariVox::write(DigitalPin pin, bool value)
|
||||||
mySystem = system;
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
bool AtariVox::read(DigitalPin pin)
|
|
||||||
{
|
{
|
||||||
// For now, always return true, meaning the device is ready
|
|
||||||
/*
|
|
||||||
if(DEBUG_ATARIVOX)
|
if(DEBUG_ATARIVOX)
|
||||||
cerr << "AtariVox: read from SWCHA" << endl;
|
cerr << "AtariVox: write to SWCHA" << endl;
|
||||||
*/
|
|
||||||
return true;
|
// Change the pin state based on value
|
||||||
|
switch(pin)
|
||||||
|
{
|
||||||
|
// Pin 1: SpeakJet DATA
|
||||||
|
// output serial data to the speakjet
|
||||||
|
case One:
|
||||||
|
clockDataIn(value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Pin 2: SpeakJet READY
|
||||||
|
case Two:
|
||||||
|
// TODO - see how this is used
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Pin 3: EEPROM SDA
|
||||||
|
// output data to the 24LC256 EEPROM using the I2C protocol
|
||||||
|
case Three:
|
||||||
|
// TODO - implement this
|
||||||
|
if(DEBUG_ATARIVOX)
|
||||||
|
cerr << "AtariVox: value "
|
||||||
|
<< value
|
||||||
|
<< " written to SDA line at cycle "
|
||||||
|
<< mySystem->cycles()
|
||||||
|
<< endl;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Pin 4: EEPROM SCL
|
||||||
|
// output clock data to the 24LC256 EEPROM using the I2C protocol
|
||||||
|
case Four:
|
||||||
|
// TODO - implement this
|
||||||
|
if(DEBUG_ATARIVOX)
|
||||||
|
cerr << "AtariVox: value "
|
||||||
|
<< value
|
||||||
|
<< " written to SCLK line at cycle "
|
||||||
|
<< mySystem->cycles()
|
||||||
|
<< endl;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Six:
|
||||||
|
// Not connected
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Int32 AtariVox::read(AnalogPin)
|
void AtariVox::update()
|
||||||
{
|
{
|
||||||
// Analog pins are not connected in AtariVox, so we have infinite resistance
|
// Nothing to do, this seems to be an output-only device for now
|
||||||
return maximumResistance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -85,22 +123,25 @@ void AtariVox::clockDataIn(bool value)
|
||||||
<< ")"
|
<< ")"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
if(value && (myShiftCount == 0)) {
|
if(value && (myShiftCount == 0))
|
||||||
|
{
|
||||||
if(DEBUG_ATARIVOX)
|
if(DEBUG_ATARIVOX)
|
||||||
cerr << "value && (myShiftCount == 0), returning" << endl;
|
cerr << "value && (myShiftCount == 0), returning" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cycle < myLastDataWriteCycle || cycle > myLastDataWriteCycle + 1000) {
|
// If this is the first write this frame, or if it's been a long time
|
||||||
// If this is the first write this frame, or if it's been a long time
|
// since the last write, start a new data byte.
|
||||||
// since the last write, start a new data byte.
|
if(cycle < myLastDataWriteCycle || cycle > myLastDataWriteCycle + 1000)
|
||||||
|
{
|
||||||
myShiftRegister = 0;
|
myShiftRegister = 0;
|
||||||
myShiftCount = 0;
|
myShiftCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cycle < myLastDataWriteCycle || cycle >= myLastDataWriteCycle + 62) {
|
// If this is the first write this frame, or if it's been 62 cycles
|
||||||
// If this is the first write this frame, or if it's been 62 cycles
|
// since the last write, shift this bit into the current byte.
|
||||||
// since the last write, shift this bit into the current byte.
|
if(cycle < myLastDataWriteCycle || cycle >= myLastDataWriteCycle + 62)
|
||||||
|
{
|
||||||
if(DEBUG_ATARIVOX)
|
if(DEBUG_ATARIVOX)
|
||||||
cerr << "cycle >= myLastDataWriteCycle + 62, shiftIn("
|
cerr << "cycle >= myLastDataWriteCycle + 62, shiftIn("
|
||||||
<< value << ")" << endl;
|
<< value << ")" << endl;
|
||||||
|
@ -115,7 +156,8 @@ void AtariVox::shiftIn(bool value)
|
||||||
{
|
{
|
||||||
myShiftRegister >>= 1;
|
myShiftRegister >>= 1;
|
||||||
myShiftRegister |= (value << 15);
|
myShiftRegister |= (value << 15);
|
||||||
if(++myShiftCount == 10) {
|
if(++myShiftCount == 10)
|
||||||
|
{
|
||||||
myShiftCount = 0;
|
myShiftCount = 0;
|
||||||
myShiftRegister >>= 6;
|
myShiftRegister >>= 6;
|
||||||
if(!(myShiftRegister & (1<<9)))
|
if(!(myShiftRegister & (1<<9)))
|
||||||
|
@ -132,49 +174,4 @@ void AtariVox::shiftIn(bool value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
void AtariVox::write(DigitalPin pin, bool value)
|
|
||||||
{
|
|
||||||
if(DEBUG_ATARIVOX)
|
|
||||||
cerr << "AtariVox: write to SWCHA" << endl;
|
|
||||||
|
|
||||||
// Change the pin state based on value
|
|
||||||
switch(pin)
|
|
||||||
{
|
|
||||||
// Pin 1 is the DATA line, used to output serial data to the
|
|
||||||
// speakjet
|
|
||||||
case One:
|
|
||||||
clockDataIn(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Pin 2 is the SDA line, used to output data to the 24LC256
|
|
||||||
// serial EEPROM, using the I2C protocol.
|
|
||||||
// I'm not even trying to emulate this right now :(
|
|
||||||
case Two:
|
|
||||||
if(DEBUG_ATARIVOX)
|
|
||||||
cerr << "AtariVox: value "
|
|
||||||
<< value
|
|
||||||
<< " written to SDA line at cycle "
|
|
||||||
<< mySystem->cycles()
|
|
||||||
<< endl;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Pin 2 is the SCLK line, used to output clock data to the 24LC256
|
|
||||||
// serial EEPROM, using the I2C protocol.
|
|
||||||
// I'm not even trying to emulate this right now :(
|
|
||||||
case Three:
|
|
||||||
if(DEBUG_ATARIVOX)
|
|
||||||
cerr << "AtariVox: value "
|
|
||||||
<< value
|
|
||||||
<< " written to SCLK line at cycle "
|
|
||||||
<< mySystem->cycles()
|
|
||||||
<< endl;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Four:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,7 +14,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: AtariVox.hxx,v 1.8 2008-02-06 13:45:20 stephena Exp $
|
// $Id: AtariVox.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef ATARIVOX_SUPPORT
|
#ifdef ATARIVOX_SUPPORT
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
driver code.
|
driver code.
|
||||||
|
|
||||||
@author B. Watson
|
@author B. Watson
|
||||||
@version $Id: AtariVox.hxx,v 1.8 2008-02-06 13:45:20 stephena Exp $
|
@version $Id: AtariVox.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class AtariVox : public Controller
|
class AtariVox : public Controller
|
||||||
{
|
{
|
||||||
|
@ -52,25 +52,6 @@ class AtariVox : public Controller
|
||||||
virtual ~AtariVox();
|
virtual ~AtariVox();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
Read the value of the specified digital pin for this controller.
|
|
||||||
|
|
||||||
@param pin The pin of the controller jack to read
|
|
||||||
@return The state of the pin
|
|
||||||
*/
|
|
||||||
virtual bool read(DigitalPin pin);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Read the resistance at the specified analog pin for this controller.
|
|
||||||
The returned value is the resistance measured in ohms.
|
|
||||||
|
|
||||||
The AtariVox doesn't use the analog pins.
|
|
||||||
|
|
||||||
@param pin The pin of the controller jack to read
|
|
||||||
@return The resistance at the specified pin
|
|
||||||
*/
|
|
||||||
virtual Int32 read(AnalogPin pin);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write the given value to the specified digital pin for this
|
Write the given value to the specified digital pin for this
|
||||||
controller. Writing is only allowed to the pins associated
|
controller. Writing is only allowed to the pins associated
|
||||||
|
@ -81,6 +62,12 @@ class AtariVox : public Controller
|
||||||
*/
|
*/
|
||||||
virtual void write(DigitalPin pin, bool value);
|
virtual void write(DigitalPin pin, bool value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Update the entire digital and analog pin state according to the
|
||||||
|
events currently set.
|
||||||
|
*/
|
||||||
|
virtual void update();
|
||||||
|
|
||||||
SpeakJet* getSpeakJet() { return mySpeakJet; }
|
SpeakJet* getSpeakJet() { return mySpeakJet; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -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.133 2008-03-22 17:35:02 stephena Exp $
|
// $Id: Console.cxx,v 1.134 2008-03-29 19:15:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -63,6 +63,7 @@
|
||||||
Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
||||||
: myOSystem(osystem),
|
: myOSystem(osystem),
|
||||||
myProperties(props),
|
myProperties(props),
|
||||||
|
vox(0),
|
||||||
myDisplayFormat("NTSC"),
|
myDisplayFormat("NTSC"),
|
||||||
myFramerate(60),
|
myFramerate(60),
|
||||||
myUserPaletteDefined(false)
|
myUserPaletteDefined(false)
|
||||||
|
@ -149,7 +150,8 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
||||||
#ifdef ATARIVOX_SUPPORT
|
#ifdef ATARIVOX_SUPPORT
|
||||||
else if(right == "ATARIVOX")
|
else if(right == "ATARIVOX")
|
||||||
{
|
{
|
||||||
myControllers[rightPort] = new AtariVox(Controller::Right, *myEvent);
|
cerr << "atarivox added as right controller\n";
|
||||||
|
myControllers[rightPort] = vox = new AtariVox(Controller::Right, *myEvent);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
|
|
|
@ -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: M6532.cxx,v 1.14 2008-03-24 20:31:31 stephena Exp $
|
// $Id: M6532.cxx,v 1.15 2008-03-29 19:15:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
M6532::M6532(const Console& console)
|
M6532::M6532(const Console& console)
|
||||||
: myConsole(console)
|
: myConsole(console)
|
||||||
{
|
{
|
||||||
// Randomize the 128 bytes of memory
|
// Randomize the 128 bytes of memory
|
||||||
class Random random;
|
class Random random;
|
||||||
|
@ -247,24 +247,29 @@ void M6532::poke(uInt16 addr, uInt8 value)
|
||||||
{
|
{
|
||||||
myDDRA = value;
|
myDDRA = value;
|
||||||
#ifdef ATARIVOX_SUPPORT
|
#ifdef ATARIVOX_SUPPORT
|
||||||
/*
|
/*
|
||||||
20060608 bkw: Not the most elegant thing in the world...
|
20060608 bkw: Not the most elegant thing in the world...
|
||||||
When a bit in the DDR is set as input, +5V is placed on its output
|
When a bit in the DDR is set as input, +5V is placed on its output
|
||||||
pin. When it's set as output, either +5V or 0V (depending on the
|
pin. When it's set as output, either +5V or 0V (depending on the
|
||||||
contents of SWCHA) will be placed on the output pin.
|
contents of SWCHA) will be placed on the output pin.
|
||||||
The standard macros for the AtariVox use this fact to send data
|
The standard macros for the AtariVox use this fact to send data
|
||||||
to the port.
|
to the port.
|
||||||
|
|
||||||
This code isn't 100% correct: it assumes the SWCHA bits are all 0.
|
This code isn't 100% correct: it assumes the SWCHA bits are all 0.
|
||||||
This is good enough to emulate the AtariVox, if the programmer is
|
This is good enough to emulate the AtariVox, if the programmer is
|
||||||
using SWACNT to do output (e.g. the SPKOUT macro from speakjet.inc)
|
using SWACNT to do output (e.g. the SPKOUT macro from speakjet.inc)
|
||||||
and if he's leaving SWCHA alone.
|
and if he's leaving SWCHA alone.
|
||||||
|
|
||||||
The inaccuracy here means that wrongly-written code will still
|
The inaccuracy here means that wrongly-written code will still
|
||||||
be able to drive the emulated AtariVox, even though it wouldn't
|
be able to drive the emulated AtariVox, even though it wouldn't
|
||||||
work on real hardware.
|
work on real hardware.
|
||||||
*/
|
*/
|
||||||
Controller &c = myConsole.controller(Controller::Right);
|
// TODO - Fix this properly in the core
|
||||||
|
// Any time the core code needs to know what type of controller
|
||||||
|
// is connected, it's by definition a bug
|
||||||
|
// A real Atari doesn't 'know' that an AVox is connected, so we
|
||||||
|
// shouldn't either
|
||||||
|
Controller& c = myConsole.controller(Controller::Right);
|
||||||
if(c.type() == Controller::AtariVox)
|
if(c.type() == Controller::AtariVox)
|
||||||
{
|
{
|
||||||
c.write(Controller::One, !(value & 0x01));
|
c.write(Controller::One, !(value & 0x01));
|
||||||
|
@ -405,7 +410,7 @@ bool M6532::load(Deserializer& in)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
M6532::M6532(const M6532& c)
|
M6532::M6532(const M6532& c)
|
||||||
: myConsole(c.myConsole)
|
: myConsole(c.myConsole)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: SpeakJet.cxx,v 1.7 2008-02-06 13:45:22 stephena Exp $
|
// $Id: SpeakJet.cxx,v 1.8 2008-03-29 19:15:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef ATARIVOX_SUPPORT
|
#ifdef ATARIVOX_SUPPORT
|
||||||
|
@ -23,7 +23,6 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
SpeakJet::SpeakJet()
|
SpeakJet::SpeakJet()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Initialize output buffers. Each one points to the next element,
|
// Initialize output buffers. Each one points to the next element,
|
||||||
// except the last, which points back to the first.
|
// except the last, which points back to the first.
|
||||||
SpeechBuffer *first = &outputBuffers[0];
|
SpeechBuffer *first = &outputBuffers[0];
|
||||||
|
@ -87,7 +86,7 @@ void SpeakJet::write(uInt8 code)
|
||||||
{
|
{
|
||||||
// TODO: clean up this mess.
|
// TODO: clean up this mess.
|
||||||
const char *rsynthPhones = xlatePhoneme(code);
|
const char *rsynthPhones = xlatePhoneme(code);
|
||||||
cerr << "rsynth: \"" << rsynthPhones << "\"" << endl;
|
// cerr << "rsynth: \"" << rsynthPhones << "\"" << endl;
|
||||||
int len = strlen(rsynthPhones);
|
int len = strlen(rsynthPhones);
|
||||||
|
|
||||||
if(ourInputCount + len + 1 >= INPUT_BUFFER_SIZE) {
|
if(ourInputCount + len + 1 >= INPUT_BUFFER_SIZE) {
|
||||||
|
@ -96,14 +95,14 @@ void SpeakJet::write(uInt8 code)
|
||||||
}
|
}
|
||||||
|
|
||||||
uInt32 sem = SDL_SemValue(ourInputSemaphore);
|
uInt32 sem = SDL_SemValue(ourInputSemaphore);
|
||||||
cerr << "write() waiting on semaphore (value " << sem << ")" << endl;
|
// cerr << "write() waiting on semaphore (value " << sem << ")" << endl;
|
||||||
SDL_SemWait(ourInputSemaphore);
|
SDL_SemWait(ourInputSemaphore);
|
||||||
cerr << "write() got semaphore" << endl;
|
// cerr << "write() got semaphore" << endl;
|
||||||
for(int i=0; i<len; i++)
|
for(int i=0; i<len; i++)
|
||||||
phonemeBuffer[ourInputCount++] = rsynthPhones[i];
|
phonemeBuffer[ourInputCount++] = rsynthPhones[i];
|
||||||
phonemeBuffer[ourInputCount] = '\0';
|
phonemeBuffer[ourInputCount] = '\0';
|
||||||
cerr << "phonemeBuffer contains \"" << phonemeBuffer << "\"" << endl;
|
// cerr << "phonemeBuffer contains \"" << phonemeBuffer << "\"" << endl;
|
||||||
cerr << "write() releasing semaphore" << endl;
|
// cerr << "write() releasing semaphore" << endl;
|
||||||
SDL_SemPost(ourInputSemaphore);
|
SDL_SemPost(ourInputSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,9 +116,9 @@ void SpeakJet::speak()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uInt32 sem = SDL_SemValue(ourInputSemaphore);
|
uInt32 sem = SDL_SemValue(ourInputSemaphore);
|
||||||
cerr << "speak() waiting on semaphore (value " << sem << ")" << endl;
|
// cerr << "speak() waiting on semaphore (value " << sem << ")" << endl;
|
||||||
SDL_SemWait(ourInputSemaphore);
|
SDL_SemWait(ourInputSemaphore);
|
||||||
cerr << "speak() got semaphore" << endl;
|
// cerr << "speak() got semaphore" << endl;
|
||||||
|
|
||||||
// begin locked section
|
// begin locked section
|
||||||
|
|
||||||
|
@ -135,7 +134,7 @@ void SpeakJet::speak()
|
||||||
ourInputCount = 0;
|
ourInputCount = 0;
|
||||||
|
|
||||||
// end locked section
|
// end locked section
|
||||||
cerr << "speak() releasing semaphore" << endl;
|
// cerr << "speak() releasing semaphore" << endl;
|
||||||
SDL_SemPost(ourInputSemaphore);
|
SDL_SemPost(ourInputSemaphore);
|
||||||
|
|
||||||
if(foundSpace)
|
if(foundSpace)
|
||||||
|
@ -197,7 +196,7 @@ void *SpeakJet::save_sample(void *user_data,
|
||||||
// output = (uInt8)( (((float)shortSamp) + 32768.0) / 256.0 );
|
// output = (uInt8)( (((float)shortSamp) + 32768.0) / 256.0 );
|
||||||
double d = shortSamp + 32768.0;
|
double d = shortSamp + 32768.0;
|
||||||
output = (uInt8)(d/256.0);
|
output = (uInt8)(d/256.0);
|
||||||
cerr << "Output sample: " << ((int)(output)) << endl;
|
// cerr << "Output sample: " << ((int)(output)) << endl;
|
||||||
|
|
||||||
// Put in buffer
|
// Put in buffer
|
||||||
ourCurrentWriteBuffer->contents[ourCurrentWritePosition++] = output;
|
ourCurrentWriteBuffer->contents[ourCurrentWritePosition++] = output;
|
||||||
|
|
|
@ -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: SpeakJet.hxx,v 1.8 2008-02-06 13:45:22 stephena Exp $
|
// $Id: SpeakJet.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef ATARIVOX_SUPPORT
|
#ifdef ATARIVOX_SUPPORT
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
anyway).
|
anyway).
|
||||||
|
|
||||||
@author B. Watson
|
@author B. Watson
|
||||||
@version $Id: SpeakJet.hxx,v 1.8 2008-02-06 13:45:22 stephena Exp $
|
@version $Id: SpeakJet.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -115,7 +115,7 @@ class SpeakJet
|
||||||
*/
|
*/
|
||||||
SpeakJet();
|
SpeakJet();
|
||||||
|
|
||||||
~SpeakJet();
|
virtual ~SpeakJet();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue