| Commit message (Collapse) | Author | Files | Lines |
|
All PCM sub libraries have 32 bit support now. Add support to the
glue function pcm_convert().
|
|
The function is unused, since we added the pcm_buffer library.
|
|
Removed yet another superfluous buffer layer: return the PCM buffer
from pcm_convert() instead of copying PCM data into the
caller-supplied buffer.
|
|
gcc doesn't know that g_error() never returns. Work around the gcc
warning.
|
|
dest_size is only used in an assertion. Remove its declaration and
move the formula into the assertion.
|
|
Return a temporary buffer from pcm_resample_*() and pcm_convert().
|
|
Replace a "static" buffer with the PCM buffer library.
|
|
Replace a "static" buffer with the PCM buffer library.
|
|
Free memory allocated by libsamplerate when the output or the decoder
is closed.
|
|
In generic PCM functions allowing all sample formats, pass a void
pointer instead of a char pointer.
|
|
All what's left in pcm_utils.h is the pcm_range() utility function,
which is only used internally by pcm_volume and pcm_mix.
|
|
The function does not need the full pcm_convert_state struct.
|
|
Moved all code which converts the sample format to a separate library.
|
|
Moved the software mixing code (used by crossfading) to a separate
library.
|
|
Moved the software volume code to a separate library.
|
|
We are going to split the pcm_utils.c library, and pcm_range() will be
useful for several sub libraries.
|
|
|
|
Don't use libc's rand() function, because it is slow. Our own trivial
linear congruential generator is good enough for dithering.
|
|
|
|
It is illegal to pass an empty audio buffer around. pcm_resample()
sometimes seems to result in 0 samples, maybe related to
libsamplerate. To work around that problem, add special checks after
both pcm_convert() invocations. Removed the pcm_resample()==0 checks
from pcm_convert().
|
|
libsamplerate produces cracks in the sound output when the destination
buffer is too small. This is the case when pcm_convert_size() rounds
down. Use ceil(x) instead of floor(0.5+x) there to prevent a buffer
overrun.
|
|
We want to remove gcc.h eventually. This takes care of all the
G_LIKELY/G_UNLIKELY macros.
|
|
Allow pcm_volume() to increase volume.
|
|
It may be desirable to change the range of integer volume levels
(e.g. to 1024, which may utilize shifts instead of expensive integer
divisions). Introduce the constant PCM_VOLUME_1 which describes the
integer value for "100% volume". This is currently 1000.
|
|
24 bit output is as important as 16 bit output. Provide a
pcm_convert() implementation which can convert to 24 bit with as
little quality loss as possible.
|
|
The old pcm_convert_size() ignored most of the destination format,
e.g. it did not check its sample size, and assumed it is 16 bit.
Simplify and universalize it by using audio_format_frame_size().
|
|
pcm_convert() converted only to 16 bit. To be able to support other
sample sizes, move that 16 bit specific code to a separate function.
|
|
Separate code from pcm_utils.c to keep it small and simple.
|
|
Separate the resampling code from the rest of pcm_utils.c. Create two
sub-libraries: pcm_resample_libsamplerate.c and
pcm_resample_fallback.c.
|
|
Copied and adapted code from the mp3 decoder plugin. This library now
replaces the old and low-quality function pcm_convert_24_to_16().
|
|
Splitting a frame between two buffer chunks causes distortion in the
output. MPD used to assume that the chunk size 1020 would never cause
splitted frames, but that isn't the case for 24 bit stereo (127.5
frames), and even less for files with even more channels.
|
|
Instead of manually calling memset(0) on the pcm_convert_state struct,
client code should use a library function from pcm_utils.c. This way,
we can change the semantics of the struct easily.
|
|
Renamed all functions which were still in CamelCase.
|
|
No CamelCase, and a struct instead of a typedef.
|
|
When calculating the conversion buffer size, don't hard-code the
formulas for only mono<->stereo.
|
|
Convert any number of channels to stereo. In fact, this isn't really
stereo, it's rater mono blown up to stereo. This patch should only
make it possible to play 5.1 files at all; "real" conversion to stereo
should be implemented, but for now, this is better than nothing.
|
|
In order to be able to deal with non-trivial conversions,
pcm_convertChannels() needs to know both the input and the output
channel count. Simplify buffer allocation in that function.
|
|
Moved code from pcm_convertChannels() to pcm_convert_channels_1_to_2()
and pcm_convert_channels_2_to_1(). Improved the quality of
pcm_convert_channels_2_to_1() by calculating the arithmetic mean value
of both samples.
|
|
Pass int16_t pointers instead of char pointers to functions which can
deal with 16 bit audio only.
|
|
The last bit of CamelCase in audio_format.h. Additionally, rename a
bunch of local variables.
|
|
"bits" and "channels" cannot be negative.
|
|
In the libsamplerate fallback code, a "const" attribute was missing.
|
|
"volume" was passed as an unsigned integer, which is correct. It's
just that when it was multiplied with the sample value, the whole
operation was changed to unsigned, breaking the algorithm (and Qball's
ears). Internally change "volume" to signed.
|
|
When there are standardized headers, use these instead of the bloated
os_compat.h.
|
|
Add support for 24 bit PCM samples to all functions. Note that
pcm_convertAudioFormat() converts 24 bit samples to 16 bit; to
preserve full quality, support for "real" 24 bit conversion should be
added.
|
|
Moved code into separate bit specific functions:
- pcm_volumeChange() -> pcm_volume_change_X()
- pcm_add() -> pcm_add_X()
- pcm_convertTo16bit() -> pcm_convert_8_to_16()
|
|
pcm_mix() might overflow the destination buffer if it is smaller than
the second buffer. This is ok because the physical buffer size passed
by cross_fade_apply() is always big enough, but clutters pcm_mix()
with complicated length checks and contains a dangerous buffer
overflow pitfall. Simplify pcm_mix()/pcm_add() and pass only the
smaller buffer size; let cross_fade_apply() do the memcpy().
|
|
Since we use a C99 compiler now, we can assert that the C99 standard
headers are available, no need for complicated compile time checks.
Kill mpd_types.h.
|
|
Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the
mind needs to retrain itself to skip over the first 4 tokens of
a type to get to its meaning. So avoid having extra characters
on my terminal to make it easier to follow code at 2:30 am in
the morning.
Please report any new issues you may come across on Free
toolchains. I realize how difficult it can be to build/maintain
cross-compiling toolchains and I have no intention of forcing
people to upgrade their toolchains to build mpd.
Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
|
|
Make the code more readable by moving the range checks to pcm_range().
gcc does quite a good job at optimizing it: the resulting binary is
exactly the same, although it contains a parametrized shift instead of
hard-coded boundaries.
|