1
0
Fork 0
Commit graph

31 commits

Author SHA1 Message Date
krcroft
eaeb001b17 Play into subsequent track(s) if playback length exceeds the the current track
Issue reported by Dagar and Pr3tty F1y, and confirmed as a bug by ripsaw8080.
Thank you!

This fixes the GoG release of Betrayal at Krondor which (either due to CD mastering
issues or a faulty rip), requests playback of a given track at the tail end
of the prior track.

In debugging and performing this fix, many debug messages were improved as well
as making some small small code adjustments, such as using iterators to point to
individual tracks (track->attribute) instead of using the tracks array
(tracks[track -1].attribute).
2019-11-24 17:34:54 +01:00
krcroft
d1a6f373cb Refactor CD-DA flow by removing intermediate buffers and loops
Thanks to @ripsaw8080 for insight into CD-DA channel mapping,
@hail-to-the-ryzen for testing and flagging a position-tracking bug,
and @dreamer_ for guidance and code review.

The CD-DA volume and channel mapping loops were moved to generic mixer
calls and no longer require a pre-processing loop:
 - Application-controlled CD-DA volume adjustment is now applied using
   an existing mixer volume scalar that was previously unused by the
   CD-DA code.
 - Mapping of CD-DA left and right channels is now applied at the tail
   end of the mixer's sample ingest sequence.

The following have been removed:
 - The CD-DA callback chunk-wise circular buffer
 - The decode buffers in the Opus and MP3 decoders
 - The decode buffer and conversion buffers in SDL_Sound
These removals and API changes allow the image player's buffer
to be passed-through ultimately to the audio codec, skipping multiple
intermediate buffers.
2019-11-12 08:16:53 +01:00
krcroft
edad78b5e0 Adapt and improve audio-handling in the CDROM sources
Runtime improvements:

- Replaces the existing audio callback routine with an efficient chunked
  circular-buffer audio reader
- Replaces assumptions that all audio tracks are 44.1 kHz & stereo.
  The mixer is now fed data at the actual compressed track's rate and
  channel count
- Eliminates all SDL locks in the audio code in favour of mixer state
  control
- Queries the codec for track-length instead of using hundreds of
  iterative decimating seeks to determine track length (loading
  a 99-track CUE now takes 0.1 user-seconds versus 3+ seconds
  previously)
- Seeks are performed within the already-decoded buffer (for all
  codecs) instead of discarding and re-running the decode sequence
- SDL_Sound's buffer-size is now set once and never resized, which
  eliminates repeated re-malloc'ing in the library
- Only one seek is performed per-playback sequence followed by
  sequential decodes, similar to a physical CDROM (The baseline dosbox
  performs a seek for every 2352-bytes of uncompressed audio)
- The DOSBox mixer is now only active during playback sequences and
  fully dormant otherwise (baseline dosbox instead performs hundreds of
  calls/second with empty data)
- When using Opus audio tracks, and if your dosbox.conf [mixer]
  rate=48000, then you will (very likely) achieve sample-exact
  unadulterated pass-through along your entire audio chain from the
  decoder, to DOSBox, to your operating system's software mixer,
  to your sound card driver, to your sound card, to your speakers,
  or to your digital receiver / USB speakers/headphones / or HDMI
  TV/screen.  This is because almost all modern hardware DACs use
  a native sample rate of 48000

Source-level maintenance improvements:

- It strips all pre-processor #ifdef branching for SDL_Sound from
  the code
- Fixes all codec compiler warnings (in the modified files); builds
  have been tested with GCC 4 to 10, Clang 6 to 10, and MSVC 14
- Tested on Linux, macOS (Xcode), and Windows (MinGW MSYS 1.0)
  operating systems
- Tested on i386, x86_64, ARM, and PowerPC (big-endian) architectures
2019-11-06 05:45:42 +01:00
Patryk Obara
fce61e33bb Implement frames/MSF conversion as functions
Macros FRAMES_TO_MSF and MSF_TO_FRAMES come from SDL_cdrom library.
SDL_cdrom was removed from SDL2 and these macros are used also in code
not directly related to SDL_cdrom library, so a replacement is needed.

Turns out output pointer type is different on Windows (int*) than it is on
Linux (unsigned char*); given choice between using void* for parameters and
a template function, I prefer template.
2019-11-02 19:29:03 +01:00
Peter Veenstra
1fbaff47fc Update year and address of FSF
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4183
2019-01-25 14:09:58 +00:00
Peter Veenstra
5bb10db88b Time keeps on ticking
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4109
2018-05-29 12:58:58 +00:00
Peter Veenstra
6cf39c1fc6 Years update
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4021
2017-05-30 11:35:08 +00:00
Peter Veenstra
0f4c92ca32 Year update.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3878
2015-01-06 14:40:32 +00:00
Peter Veenstra
2fea508f7f Year update
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3812
2013-01-15 09:03:13 +00:00
Peter Veenstra
999f33de27 Update year. Remove CVS tags
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3700
2011-04-26 09:34:55 +00:00
Peter Veenstra
8c29440d39 Add audio volume control for mscdex. Implemented it in images and win32ioctl. Others are still open. Thanks ripsaw.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3631
2010-08-07 18:32:39 +00:00
Sebastian Strohhäcker
1bcab407ae fix cdrom ioctl raw sector reading;
add mci cd audio functionality to cdrom ioctl interface;
add direct audio extraction functionality to cdrom ioctl interface


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3233
2008-11-06 19:31:21 +00:00
Peter Veenstra
0382a13bd3 Add basic support for audio cds only when dealing with images.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2982
2007-08-22 11:54:35 +00:00
Peter Veenstra
a5ac3216ba Some more const stuff. Silences a few warnings and removes a few casts. Update description of dss.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2886
2007-06-14 08:23:46 +00:00
Peter Veenstra
8c6d24bb61 making it an abc didn't work somehow.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2882
2007-06-12 19:32:34 +00:00
Peter Veenstra
a4d1439cce Add virtual destructor.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2880
2007-06-12 19:11:38 +00:00
Peter Veenstra
2c3ae52a79 os2 cdrom support
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2393
2005-11-25 19:15:12 +00:00
Peter Veenstra
62ad4ff475 Made it gcc2.95 friendly. Fix drivelabels on iso's. Fix Various stability issues with images
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2016
2004-10-05 19:55:03 +00:00
Sjoerd van der Berg
805187b0eb Use new mixer code for cd image audio
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1915
2004-08-23 09:22:23 +00:00
Peter Veenstra
02ff2737d7 Add Patch 1001897 by Martin. Disabled modem and ipx networking by default as they depend on libraries not everybody may have. Reduces alarmed firewall people and is nicer on unix hosts as port 23 is a bit tricky
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1904
2004-08-13 19:43:02 +00:00
Ulf Wohlers
c11d895fd4 improved aspi support (thanx SaPu)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1802
2004-05-19 11:44:48 +00:00
Ulf Wohlers
3001a346b2 made interface destructors virtual
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1656
2004-02-03 14:59:58 +00:00
Peter Veenstra
3e170dbdcf Added patch 884060 from Martin Battig
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1607
2004-01-27 20:23:13 +00:00
Ulf Wohlers
640e059254 Removed HostPt in ReadSector
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1132
2003-07-14 11:35:06 +00:00
Ulf Wohlers
336e693b61 Added support for reading volume labels
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@957
2003-04-23 12:07:53 +00:00
Ulf Wohlers
eee39b3127 sdl.h ->SDL.h
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@819
2003-03-27 22:02:47 +00:00
Ulf Wohlers
57d5d97852 default cdrom interface now sdl
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@812
2003-03-27 21:15:53 +00:00
Ulf Wohlers
02934f9676 Removed scsi-3 commands
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@782
2003-03-21 14:25:32 +00:00
Ulf Wohlers
a7104cb358 fixed wrong audio cd selection (multiple cdroms)
set the GetMediaTrayStatus parameters to more common values.


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@781
2003-03-20 17:56:54 +00:00
Ulf Wohlers
6558efe97e Improved ioctl support
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@723
2003-03-06 14:29:43 +00:00
Ulf Wohlers
cfd4de316e cdrom interfaces
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@717
2003-03-06 13:34:27 +00:00