Commit Graph

28 Commits

Author SHA1 Message Date
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
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
cbfbaaacb7 Added BX_HAVE_SOUND_* definitions to simplify code. 2015-02-23 21:32:34 +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
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
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
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
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
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
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
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
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
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
3c0ad43092 Continued preparing Bochs for SDL2 support
- added new symbol BX_WITH_SDL2 and prepared build system
- TODO #1: add new option --with-sdl2 to configure script
- TODO #2: add new file sdl2.cc (porting seems hard to do - writing from scratch
  might be better)
2014-06-23 19:37:58 +00:00
Volker Ruppert
3e27308899 Allow to specify the platform-default sound driver directly
- driver names "oss", "osx" and "win" can now be used instead of "default"
- updated sound initialization messages
2013-07-25 18:47:11 +00:00
Volker Ruppert
192aa1f369 Added global sound control option in bochsrc and config interface
- added 'sound' option to select the driver and the wave output device
  (see bochsrc sample for details)
- the wave device option of sb16 and es1370 is now only used to set up the
  wave input device (if necessary)
- cleaned up the speaker code to initialize the 'sound' case correctly
2013-06-24 19:19:12 +00:00
Volker Ruppert
095fd7d18a - added SDL sound support (wave output only) 2012-06-09 10:12:05 +00:00