Commit Graph

2174 Commits

Author SHA1 Message Date
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
27c773d8b5 Fixed possible segfault on exit. 2015-02-20 22:33:06 +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
Volker Ruppert
d27972cc42 Implemented support for the new mixer thread in the lowlevel sound module 'win'.
- removed disabled code for the sndPlaySound() function.
- removed now obsolete buffer ring for wave output.
- The new mothod waveout() is driven by the mixer thread. For the best results
  you need to disable the 'realtime' sychronization and to find out a usable
  IPS vaöue. The mixer also polls data from the speaker beep generator and
  the OPL3 FM generator.
- TODO: Code cleanup in soundwin.cc, implementation in other sound modules.
2015-02-06 15:57:26 +00:00
Volker Ruppert
1e52f0cbe0 Implemented simple mixing support (addition and clipping).
Fixed minimum value of signed data types.
TODO: Use the mixer thread support in the sound modules (alsa, oss, osx, win).
2015-02-02 21:11:31 +00:00
Volker Ruppert
a0971f02f8 Some more work on the mixer thread framework.
TODO #1: Implement simple mixing (additon and clipping).
TODO #2: Use this feature in the sound modules.
2015-02-01 20:50:20 +00:00
Volker Ruppert
542e55a06b Method startwaveplayback() now completely replaced by set_pcm_params(). 2015-02-01 12:33:21 +00:00
Volker Ruppert
7dbb5185bf ALSA / OSS sound modules: startwaveplayback() rewritten to set_pcm_params()
and some related cleanups.
TODO: Replace startwaveplayback() completely.
2015-01-31 10:48:22 +00:00
Volker Ruppert
d2a85e576f Some work on the lowlevel sound code
- Moved audio buffer code and the pcm_callback function to soundlow.cc.
- Added framework for the mixer thread.
2015-01-30 22:52:56 +00:00
Volker Ruppert
38f85eaacb PCM volume now applied to the output packet in the format conversion code. 2015-01-27 19:33:28 +00:00
Volker Ruppert
12d60f5aaf Some work on the lowlevel sound code.
- soundlow: prepared code for 2 pcm parameter sets:
            emulated: requested by sendwavepacket()
            real: used for the sound output
- soundsdl: startwaveplayback() rewritten to set_pcm_data().
- soundmod: some beep init code fixes.
2015-01-26 21:10:51 +00:00
Stanislav Shwartsman
b5a603c8c7 fixed %d->%u format found by cppcheck (patch by Maxim Derbasov) 2015-01-25 21:24:13 +00:00
Volker Ruppert
23ea69f1b2 Rewrite of the audio buffer handling and small code reorganization. 2015-01-25 20:03:11 +00:00
Volker Ruppert
10cf06afbd Added pcm format conversion support to the win32 and OSX sound modules.
Changed name of the pcm conversion method and minor cleanups.
2015-01-25 11:45:13 +00:00
Volker Ruppert
2c621601cb Moved wave format conversion code to the sound lowlevel base class and added
format conversion support to the ALSA and OSS sound modules.
2015-01-24 21:01:45 +00:00
Volker Ruppert
e37498025e Some small changes in the SDL sound module.
- Store conversion multiplier in the C++ class.
- Moved wave callback structure to soundlow.h for future use.
- Removed unused methods.
2015-01-23 19:10:49 +00:00
Volker Ruppert
add5b1e61d Some work on the Bochs sound support.
- OPL3: Added support to change the samplerate of the generator.
- SDL sound: convert wave packet to 16 Bit signed stereo format.
- Increased the maximum size of a single wave packet for playbck/recording.
2015-01-22 20:28:14 +00:00
Volker Ruppert
3dca0bd8cf Some work in the soundmod beep code and multithreading improvements.
- Beep thread now only started one per simulation.
- Added some more multithreading macros and use them in rfb, vncsrv and soundmod.
- TODO: implement mixer thread and remove beep thread.
2015-01-17 19:53:03 +00:00
Volker Ruppert
dd56a4d1d3 OPL3: improved save/restore support and added SVN Id line. 2015-01-16 18:55:25 +00:00
Volker Ruppert
cf888edf81 Removed most of the incomplete legacy FM OPL emulation part of the SB16.
Only keep the OPL timer code required for chip detection. Started implementing
save/restore support in the OPL3 code ported from DOSBox.
2015-01-15 20:25:27 +00:00
Volker Ruppert
fb265dc532 Ported OPL3 emulation from DOSBox.
The code currently only works with the SDL sound output module and at 44100 Hz,
with 16 bit stereo signed little endian format. FM volume control and
save/restore support are not implemented yet. The legacy code for generating
MIDI notes still works and will be removed when mixing support is implemented
in all sound modules.
2015-01-12 21:20:18 +00:00
Volker Ruppert
f9ff6ece2d Applied some parts of the floppy patch by Ben Lunt.
- The "Read ID" command must return an error when reading with non-existant head.
- Some BX_DEBUG improvements and minor other changes.
2015-01-12 18:52:39 +00:00
Volker Ruppert
fe49c73a6b Some work on the lowlevel sound support.
- Define new structure bx_pcm_param_t and use it as a parameter for the method
  sendwavepacket(). The method startwavepacket() is now called from
  sendwavepacket() in case of a parameter change (temporary solution).
- soundsdl: Replaced waveready() call by some more accurate code for buffer
            space check in sendwavepacket().
- soundsdl: Moved code for reading from audio buffer to a new function.
- soundsdl: Temporarily increase the audio buffer size.
- Preparing the SB16 code for the OPL emulation port from DOSBox.
2015-01-11 20:13:50 +00:00
Volker Ruppert
7bd5eeaa87 Mix the wave input using SDL_MixAudio() (addition and clipping).
NOTE: This function is not correct in case of more than 2 active sources.
2015-01-11 07:57:35 +00:00
Volker Ruppert
15ccdef0d1 Fixed register/unregister wave callback (found while testing OPL code). 2015-01-10 19:36:50 +00:00
Volker Ruppert
fe953485b1 Some more work in the lowlevel sound code.
- Reworked wave callback code to support 2 input sources (no mixing yet).
- Fixed SDL sound output.
- Beep generator fixes.
- Prepared the SB16 code for FM OPL output support (to be ported from DOSBox).
2015-01-08 19:12:01 +00:00
Stanislav Shwartsman
055da948a0 fixed problems found by cppcheck tool (patch by Maxim Derbasov) - second round 2015-01-07 16:17:40 +00:00
Volker Ruppert
2ca192eef7 Some more work in the lowlevel sound code.
- Renamed wavedata callback type.
- Handle sample rate in the beep generator (TODO: handle data format).
- Don't call waveready() in the SB16 code.
- Attempt to fix SDL2 wave output using SDL_LockAudio() / SDL_UnlockAudio().
- SDL specific code in the beep thread no longer needed.
2015-01-05 22:07:03 +00:00
Volker Ruppert
0c205fce26 Some work in the lowlevel sound code.
- Added framework for polling wave data and use it for beep output in sdl.
- Some work in the beep thread code (to be continued).
- Moved macros required for multithreading to bochs.h.
2015-01-04 21:12:41 +00:00
Stanislav Shwartsman
1f4d3e7194 fixed problems found by cppcheck tool (patch by Maxim Derbasov) 2015-01-03 13:53:52 +00:00
Volker Ruppert
c7c92bb62b Fixed OPL chip detection.
- Increment timer counter before checking for overflow.
- Implemented ISA bus delay in the pc_system code and use it for the SB16.
  This makes OPL chip detection work at ips values > 4 Mips.
TODO: OPL chip should use wave output instead of MIDI (maybe port from DOSBox).
TODO: Use isa_bus_delay() for other legacy devices if required.
2014-12-31 12:27:32 +00:00
Volker Ruppert
ee5a416228 Now build rules for all gui and device plugins supported by MSVC nmake depend
on the related configure options.
2014-12-28 19:13:02 +00:00
Volker Ruppert
65d2bb11eb Release all pressed keys when the Bochs window gets back the keyboard focus.
- feature implemented in the wxWidgets gui
- feature not required for legacy SDL (releases keys on focus change)
- removed duplicate code in keyboard.cc
- TODO: implement feature in the win32 gui if required
2014-12-27 09:43:05 +00:00