Commit Graph

28 Commits

Author SHA1 Message Date
Volker Ruppert
bdd8875692 Reverted BX_THREAD_KILL() changes in the lowlevel sound code. Now using control
variables again to let the threads end normally. Re-implenented the method
closewaveoutput() for some modules, move the destructor code to it and call it
after leaving the mixer thread. This fixes a deadlock in the "soundwin" module
if Bochs is compiled with plugin support.
2017-06-02 16:56:58 +00:00
Volker Ruppert
c897ffa619 Cleanups in the Bochs system timer code
- Now using macro DEV_register_timer() in all devices and lowlevel modules.
- Removed unused timer stuff from the plugin.cc/.h code.
2017-03-30 18:08:15 +00:00
Volker Ruppert
eeec43d811 Implemented self-registering static objects in the lowlevel sound code similar
to the network module handling. Now the 'dummy' sound driver can be a real
plugin, too.
2017-03-14 18:21:05 +00:00
Volker Ruppert
60d24943c6 Rewrite of the sound driver plugin code.
- Renamed OSS sound driver files from soundlnx.cc/.h to soundoss.cc/.h.
- Removed "pseudo device plugin" containing common code and specific drivers.
- Moved common sound code, base classes of sound drivers and the dummy driver
  to the Bochs core. Now loading sound driver plugins in soundmod.cc.
- Created separate plugins for the platform/library specific drivers and the
  "file" driver.
- Modified Bochs plugin system to support now plugin type PLUGTYPE_SOUND.
2017-02-20 18:21:19 +00:00
Volker Ruppert
4502478b50 Changed a lot of malloc() / free() calls to C++ style new / delete. 2017-02-18 11:13:56 +00:00
Volker Ruppert
f844e846b7 Added PCM output data resampling in a separate thread. The resampler requires
either libsamplerate or the SoX resampler library installed. If not installed,
the data is only copied to the output buffer and sample rate of the output
driver is changed similar to legacy code. Related changes:
- Added check for libsamplerate or SoX resampler header files in configure
  script.
- Added functions for converting source format to float (requied by resampler)
  and float to output format.
- Added support for float type data in the audio buffer code. Buffer chain #0
  receives float data from sendwavepacket() and buffer #1 receives data for
  mixing and output in format "16-bit signed little endian stereo".
- ALSA: Disable builtin resampling feature if resampler is present to avoid
  doing it twice.
2017-02-05 08:33:03 +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
119971182b Include pthreads library header in soundlow.h (fixes SF bug #1373). 2015-05-09 08:31:49 +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
cbfbaaacb7 Added BX_HAVE_SOUND_* definitions to simplify code. 2015-02-23 21:32:34 +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
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
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
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
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
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
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
f35b9b23c8 Bugfix: use memmove() if source and destination range can overlap (found with valgrind). 2014-12-14 18:53:16 +00:00
Volker Ruppert
fba9145f66 Moved sources of the sound lowlevel base class ('dummy' driver) to separate files. 2014-11-24 18:25:14 +00:00
Volker Ruppert
9805324c42 Minor changes in the sound lowlevel code. 2014-11-21 23:03:19 +00:00
Volker Ruppert
9c8e43b75c Added failure handling to beep_on() and the ALSA PCM output methods (patch by
Dawn Teschendorf)
2014-05-02 06:38:49 +00:00
Volker Ruppert
b84b0eed52 Moved ALSA sound support to a separate sound driver object
- ALSA stuff moved from soundlnx.* to new soundalsa.* files
- SB16 / ES1370: including specific sound driver headers not necessary
- updated dependencies
2013-07-14 15:14:53 +00:00