dingusppc/devices/sound/soundserver.h
Mihai Parparita f65f9b9845 Add a deterministic execution mode
Adds support for a --deterministic command-line option that makes
repeated runs the same:
- Keyboard and mouse input is ignored
- The sound server does a periodic pull from the DMA channel (so that
  it gets drained), but only does so via a periodic timer (instead of
  being driven by a cubeb callback, which could arrive at different
  times)
- Disk image writes are disabled (reads of a modified area still
  work via an in-memory copy)
- NVRAM writes are disabled
- The current time that ViaCuda initializes the guest OS is always the
  same.

This makes execution exactly the same each time, which should
make debugging of more subtle issues easier.

To validate that the deterministic mode is working, I've added a
periodic log of the current "time" (measured in cycle count), PC
and opcode. When comparing two runs with --log-no-uptime, the generated
log files are identical.
2024-11-09 22:48:06 -08:00

60 lines
1.6 KiB
C++

/*
DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-21 divingkatae and maximum
(theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/** @file Sound server definitions.
This class manages host audio HW. It's directly connected
to a sound abstraction API (libsoundio in our case).
Sound server provides a way to select between various
host input and output devices independendly of emulated
sound HW.
Emulated sound HW only need to process sound streams.
*/
#ifndef SOUND_SERVER_H
#define SOUND_SERVER_H
#include <devices/common/hwcomponent.h>
#include <memory>
class DmaOutChannel;
class SoundServer : public HWComponent {
public:
SoundServer();
~SoundServer();
int start();
void shutdown();
int open_out_stream(uint32_t sample_rate, DmaOutChannel *dma_ch);
int start_out_stream();
void close_out_stream();
private:
class Impl; // Holds private fields
std::unique_ptr<Impl> impl;
};
#endif /* SOUND_SERVER_H */