Cosmetic changes, add audio todo.

This commit is contained in:
Christian Speckner 2018-05-02 21:30:38 +02:00
parent c905b01fca
commit 9079d77de0
4 changed files with 33 additions and 6 deletions

22
TODO_audio.md Normal file
View File

@ -0,0 +1,22 @@
# Debugging
* Log and check how queue fills
# Bugs
* Fix timeslice size
# Refactoring
* Move timing related constants and logic to separate class
# Verify
* Verify that the base unit for chrono is seconds
* Verify that FPS are still measured correctly
# Missing features
* Reimplement target FPS mode
* Implement Lanzcos resampling
* Fixup OpenGL sync

View File

@ -47,7 +47,7 @@ AudioQueue::AudioQueue(uInt32 fragmentSize, uInt8 capacity, bool isStereo, uInt1
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioQueue::~AudioQueue()
{
delete[]myFragmentBuffer;
delete[] myFragmentBuffer;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -179,9 +179,6 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
myConsoleTiming = ConsoleTiming::secam;
}
createAudioQueue();
myTIA->setAudioQueue(myAudioQueue);
bool joyallow4 = myOSystem.settings().getBool("joyallow4");
myOSystem.eventHandler().allowAllDirections(joyallow4);
@ -555,6 +552,10 @@ FBInitStatus Console::initializeVideo(bool full)
void Console::initializeAudio()
{
myOSystem.sound().close();
createAudioQueue();
myTIA->setAudioQueue(myAudioQueue);
myOSystem.sound().open(myAudioQueue);
}
@ -721,7 +722,8 @@ void Console::createAudioQueue()
throw runtime_error("invalid console timing");
}
uInt32 queueSize = (2 * myOSystem.sound().getFragmentSize() * sampleRate) / (myOSystem.sound().getSampleRate() * fragmentSize);
uInt32 queueSize =
(2 * myOSystem.sound().getFragmentSize() * sampleRate) / (fragmentSize * myOSystem.sound().getSampleRate());
myAudioQueue = make_shared<AudioQueue>(
fragmentSize,

View File

@ -38,7 +38,7 @@ Audio::Audio()
: myAudioQueue(0),
myCurrentFragment(0)
{
for (uInt8 i = 0; i <= 0x1e; i++) myMixingTableSum[i]= mixingTableEntry(i, 0x1e);
for (uInt8 i = 0; i <= 0x1e; i++) myMixingTableSum[i] = mixingTableEntry(i, 0x1e);
for (uInt8 i = 0; i <= 0x0f; i++) myMixingTableIndividual[i] = mixingTableEntry(i, 0x0f);
reset();
@ -130,6 +130,9 @@ bool Audio::save(Serializer& out) const
out.putInt(myCounter);
// The queue starts out pristine after loading, so we don't need to save
// any other parts of our state
if (!myChannel0.save(out)) return false;
if (!myChannel1.save(out)) return false;
}