Commit Graph

149 Commits

Author SHA1 Message Date
Volker Ruppert
cd68194269 Added Android host platform support to Bochs based on SF patch #534.
- added Android case to the configure script.
- renamed file memory.h to memory-bochs.h to fix conflict with NDK.
- fixed Android issues in some files.
2016-08-12 17:06:14 +00:00
Volker Ruppert
eed2bb15b8 Simplified register_state() for for small byte arrays in remaining i/o devices. 2015-10-06 18:20:16 +00:00
Volker Ruppert
1df014a8ae Implemented unregister mechanism for runtime config handlers.
TODO: use it for removable devices with removable media (USB floppy / cdrom).
2015-08-23 07:04:56 +00:00
Volker Ruppert
1ac159ba52 Modified sleep rate in conversion thread to get more continuous output. 2015-08-18 17:26:25 +00:00
Volker Ruppert
ee6bfaa4c4 Added separate thread for the PCM data conversion. Only in case of dual output
sendwavepacket() directly calls the conversion method and output(). In all other
cases it puts the unmodified data into a buffer and the conversion thread is
doing the main job and puts the data into the output buffer chain.
TODO: resampling could also be done by the new thread.
2015-06-04 08:58:02 +00:00
Volker Ruppert
377d920956 Created a new class for the audio buffer handling to make multiple buffers
chains possible.
TODO: the lowlevel sound code should bbe rewritten with an additional
conversion thread.
2015-05-15 20:18:47 +00:00
Volker Ruppert
119971182b Include pthreads library header in soundlow.h (fixes SF bug #1373). 2015-05-09 08:31:49 +00:00
Volker Ruppert
fd690a3a31 Fixed compilation errors found on Cygwin64
- The 'Bits' type used in the opl files is incompatible with Bit64s. Modified
  typedef to fix this issue.
- On Windows use Sleep() directly, since msleep() doesn't exist in Cygwin.
2015-05-05 18:06:05 +00:00
Volker Ruppert
29d54ac8b8 Fixed some compilation errors / warnings found on Mac OSX (SF bug #1371). 2015-05-02 08:42:44 +00:00
Volker Ruppert
a32bc18d9e Renamed SB16 parameters "midi" to "midifile" and "wave" to "wavefile" (same
as ES1370). Legacy parameter names are still supported.
2015-04-17 18:37:51 +00:00
Volker Ruppert
d416daf51b SB16 register_state(): we have to use a constant here. 2015-04-17 11:58:15 +00:00
Volker Ruppert
92f48fa92f Implemented MIDI output support for the ES1370 soundcard. Data written to the
UART data port is sent to file or device similar to the SB16.
Minor cleanups in the SB16 code.
2015-04-16 21:18:42 +00:00
Volker Ruppert
091e01d96c Fixed UART register address in condition and added default status return value. 2015-04-12 10:48:02 +00:00
Volker Ruppert
035b133bac Improved error messages for unsupported internal memory access.
ES1370 is no longer "experimental".
2015-04-11 09:03:17 +00:00
Volker Ruppert
d8ca04c79f The current frame count registers are readable as word (not mentioned in specs).
This fixes the Win98 explorer crash.
Added BX_ERROR for the still unsupported dual output mode.
2015-04-10 21:31:44 +00:00
Volker Ruppert
a52bcdfa88 Minor fixes and cleanups in the SB16 code (no functional changes).
- the "remaplist" has 256 entries, but the limit was too high (4096).
- the "patchtable" had 4096 entries, but the index was never > 15.
- removed disabled / outdated code.
2015-04-06 16:03:04 +00:00
Volker Ruppert
72dfda5ee9 Fixed frame register writes (bug in rev. 12705) using QEMU-like code.
TODO: Win98 guest crash after wave output still not fixed.
2015-04-06 12:18:52 +00:00
Volker Ruppert
a256414d32 Some work on the ES1370 emulation.
- Undocumented "legacy" register at offset 0x1b is used to probe for the ES1370
  interrupt by the Win9x driver. Using bit #0 to control the IRQ line fixes
  driver installation.
- Added more detailed BX_ERROR messages for the UART registers.
- Small code cleanup in the write handler.
- TODO: fix possible bluescreen in Win98 guest after wave playback.
2015-04-05 11:48:44 +00:00
Volker Ruppert
79278be63f Volume control fixes and improvements
- OPL3: apply FM volume control to the output data.
- SB16: fixed missing volume update after mixer reset.
- soundlow: fixed application of the volume control to the PCM output.
2015-04-03 12:18:53 +00:00
Volker Ruppert
7ce7c70f6d Adjust DAC output timer interval depending on real packet size (fixes output
with XP guest).
2015-04-02 23:21:04 +00:00
Volker Ruppert
10d79f2e9a SB16: fixed output volume calculation.
ES1370: fixed and improved output volume calculation similar to SB16.
TODO: apply volume control to the FM output.
2015-03-31 18:01:52 +00:00
Volker Ruppert
72cbbe9e8b Fixed incorrect calls of virtual functions in constructor/destructor.
- Removed useless set_pcm_params() call in base class contructor.
- SDL waveout destructor needs to call the unregister_wave_callback() method
  of the SDL stuff, since the base class destructor doesn't do that.
2015-03-29 15:53:56 +00:00
Volker Ruppert
601493c89a Moved output volume calculation to a separate method and prepared volume
control for the FM output.
TODO #1: handle volume control in the opl code.
TODO #2: check if the output level calculation is correct.
2015-03-27 15:49:40 +00:00
Volker Ruppert
49e265f5f8 Added save/restore support for the OPL3 waveform selection. 2015-03-19 16:47:25 +00:00
Volker Ruppert
3ab5b052a1 Sound driver 'win': changed output rate to 20 packets per second. 2015-03-17 20:55:51 +00:00
Volker Ruppert
927e55f077 Improved mixer thread mutex handling.
- Moved BX_INIT_MUTEX() call to start_mixer_thread() to reduce code duplication.
- Call BX_FINI_MUTEX() only when the mixer thread and mutex was really used.
2015-03-16 19:02:31 +00:00
Volker Ruppert
924201f694 Added capability to handle floating point values with save/restore.
Improved OPL3 save/restore support.
2015-03-13 21:28:40 +00:00
Volker Ruppert
8fe902686c Separated sound lowlevel base class from dummy driver. The base class returns
NULL for all services and the dummy driver provides the stubs. Now falling
back to the dummy driver if the wavein or midiout services are not provided
by the selected driver.
2015-03-10 20:56:44 +00:00
Volker Ruppert
327f987a18 Added the capability to set up the sound driver per service. The global
sound option for setting up one driver for all services is still available.
2015-03-06 22:54:30 +00:00
Volker Ruppert
cbfbaaacb7 Added BX_HAVE_SOUND_* definitions to simplify code. 2015-02-23 21:32:34 +00:00
Volker Ruppert
3135e6a4eb Changed sound driver parameter type to bx_param_enum_c.
TODO: Add sound driver selection per service (waveout, wavein, midiout).
2015-02-22 20:29:58 +00:00
Volker Ruppert
9493a63e7a Fixes and updates in the lowlevel sound code and related stuff.
- soundlow: fixed possible segfault on exit.
- soundfile: added symbol required for win32 DLL plugins.
- bochsrc sample: fixed typo.
- VS2013Ex workspaces: partial update (sound stuff only).
2015-02-20 22:39:55 +00:00
Volker Ruppert
46b21a8373 Some failure case fixes and cleanups in the sound code.
- sound 'file' driver: added failure handling in the file open methods.
- soundmod: initialize default driver with NULL to avoid crash on failure.
- SB16: Fixed crash if no driver is present / removed unused members.
2015-02-20 16:36:26 +00:00
Volker Ruppert
16d2957cd4 Rewrite of the ES1370 wave output code and related changes.
- Implemented wave output using the 'soundfile' driver including dual wave
  output in wavemode 3. Removed now obsolete output file handling and other
  cleanups. The wave input (recording) feature is not affected by the
  wavemode setting.
- Moved VOC file handling to the soundfile code.
- Updated iodev makefile dependencies.
2015-02-19 21:31:18 +00:00
Volker Ruppert
050795ac44 Rewrite of the SB16 midi and wave output code.
- Implemented wave and midi output using the 'soundfile' driver.
- Implemented dual midi/wave output in midimode/wavemode 3.
- Removed now obsolete output file handling and other cleanups.
- The wave input (recording) and OPL3 output features are not affected by
  the wavemode setting.
- TODO: Similar rewrite of ES1370 wave output and related cleanups.
2015-02-19 18:45:43 +00:00
Volker Ruppert
b052ddcc32 Prepared lowlevel sound code for the usage with the 'wavemode' parameter.
- soundlow: use direct output if no PCM callback is registered.
- soundlow/soundfile: re-implemented openwaveoutput() method to support
  runtime changes of wave mode or file (only implemented in the 'file'
  driver, stub for others).
- soundfile: don't initialize mixer thread and PCM callback if thread is
  already running / no output() delay in that case.
2015-02-18 16:34:53 +00:00
Volker Ruppert
b1e8a6369c Some work on the sound module handling and the SB16 midi file output.
- Added the capability to load up to 4 sound drivers and added methods to
  get pointers to the waveout, wavein and midiout services of a driver.
- Rewrite of the SB16 midi file output code. In midimode 2 and 3 the midiout
  service of the 'file' driver is used. Removed obsolete midi file handling.
- Re-implemented the closemidioutput() method to make runtime changes of the
  midi setup work with the new code.
2015-02-17 18:28:25 +00:00
Volker Ruppert
c8207c7a10 Some work on the soundfile 'driver' and the sound configuration.
- waveout: added support for RIFF WAVE format and raw output. The formats
  'voc' and 'wav' are detected by file extension, raw output is used otherwise.
- midiout: added support for raw midi output (no header, no deltatime).
  The 'mid' format is detected by file extension, raw output is used otherwise.
- Added 'midiout' parameter to the global sound option to specify the device
  if necessary. The related SB16 parameter now only specifies the output file.
- TODO: Rewrite of the sound configuration and output code to support dual
  output (device and file).
2015-02-17 08:33:07 +00:00
Volker Ruppert
de08a6ba55 Added initial version of a sound "driver" that writes to file(s).
- New code is based on the dummy sound driver and file output code from SB16.
- The midiout feature supports the MIDI file format.
- The waveout feature currently only supports the VOC format.
TODO:
- Add support for a more detailed sound configuration (waveout to device,
  midiout to a file.
- The waveout feature should support WAV and RAW file formats.
- Move VOC file handling from soundmod.cc to soundfile.cc.
- Finally remove file handling code from sound devices.
2015-02-16 15:47:17 +00:00
Volker Ruppert
f19e91e2f5 Moved speaker beep generator to the speaker code. 2015-02-16 08:48:11 +00:00
Volker Ruppert
3ac8362523 Bugfix for the 'dummy' sound driver: don't add wave packet to the buffer queue
if PCM callback is not active.
2015-02-16 07:36:32 +00:00
Volker Ruppert
79058610d7 Moved midi output support to a separate C++ class. The lowlevel sound module
creates the object and returns a pointer to it. TODO: Rewrite of the sound
configuration to support a more detailed setup (e.g. waveout with alsa,
dummy wavein, midiout to a file).
2015-02-15 18:32:36 +00:00
Volker Ruppert
f84439f8e8 Moved wave input support to a separate C++ class. The lowlevel sound module
creates the object and returns a pointer to it. TODO: Do the same with the
midiout feature.
2015-02-14 17:25:39 +00:00
Volker Ruppert
0e73185efd Moved wave output support to a separate C++ class. The lowlevel sound module
creates the object and returns a pointer to it. TODO: The wavein and midiout
components should also move to separate classes. When finished, it should be
possible to configure the sound support more detailed (e.g. waveout with sdl,
midiout with alsa and the dummy driver for wavein). Creating a separate
module for the output to file(s) is also possible.
2015-02-13 11:30:46 +00:00
Volker Ruppert
52b4c20992 Fixed allocated memory and some cleanup after latest changes. 2015-02-08 10:33:12 +00:00
Volker Ruppert
739d18c48d Changed startwaverecord() to use structure bx_pcm_param_t, too. 2015-02-08 08:53:20 +00:00
Volker Ruppert
fafc153a30 Implemented support for the new mixer thread in the lowlevel sound module 'osx'
(untested). Started code cleanup in the Bochs sound code.
2015-02-07 22:15:22 +00:00
Volker Ruppert
9c1070cbed Implemented support for the new mixer thread in the lowlevel sound module
'alsa'. Cleaned up the code a little bit.
TODO #1: Implement mixer thread support in the OSX sound driver.
TODO #2: Code cleanups in the Bochs sound code.
TODO #3: Resampling support and improvements in the wave recording code.
2015-02-07 18:49:09 +00:00
Volker Ruppert
bfb5ec8cf9 Moved unregister_wave_callback() to the base class (only sdl has special code).
Some cleanups in the soundlow.* code.
2015-02-07 10:50:35 +00:00
Volker Ruppert
1ccd82ab0f Implemented support for the new mixer thread in the lowlevel sound module 'oss'.
Renamed class to bx_sound_oss_c.
2015-02-06 21:31:30 +00:00