Commit Graph

40 Commits

Author SHA1 Message Date
Max Kellermann b40428b3fd pcm_utils: moved conversion code to pcm_convert.c
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.
2009-01-07 18:53:36 +01:00
Max Kellermann 3fd1fa31ca pcm_utils: moved code to pcm_mix.c
Moved the software mixing code (used by crossfading) to a separate
library.
2009-01-07 18:06:22 +01:00
Max Kellermann 9d0579996c pcm_utils: moved code to pcm_volume.c
Moved the software volume code to a separate library.
2009-01-07 18:05:38 +01:00
Max Kellermann e8c323ed7e pcm_utils: export pcm_range()
We are going to split the pcm_utils.c library, and pcm_range() will be
useful for several sub libraries.
2009-01-07 18:03:53 +01:00
Max Kellermann edcd45df94 pcm_volume: added constant PCM_VOLUME_1
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.
2008-11-11 16:32:32 +01:00
Max Kellermann ad77a3e0ac pcm_utils: added inline function pcm_float_to_volume() 2008-11-11 16:29:02 +01:00
Max Kellermann ea515494cb added prefix to header macros
"LOG_H" is a macro which is also used by ffmpeg/log.h.  This is
ffmpeg's fault, because short macros should be reserved for
applications, but since it's always a good idea to choose prefixed
macro names, even for applications, we are going to do that in MPD.
2008-10-31 09:19:53 +01:00
Max Kellermann 6b1c54ef96 pcm_utils: moved code to pcm_resample.c
Separate the resampling code from the rest of pcm_utils.c.  Create two
sub-libraries: pcm_resample_libsamplerate.c and
pcm_resample_fallback.c.
2008-10-23 20:00:51 +02:00
Max Kellermann 0078837a97 pcm_dither: added generic 24 to 16 bit dithering
Copied and adapted code from the mp3 decoder plugin.  This library now
replaces the old and low-quality function pcm_convert_24_to_16().
2008-10-23 16:58:07 +02:00
Max Kellermann e6d90d4e83 pcm_utils: added pcm_convert_init()
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.
2008-10-21 22:53:16 +02:00
Max Kellermann ca6e613a7f pcm_utils: no CamelCase
Renamed all functions which were still in CamelCase.
2008-10-21 22:53:13 +02:00
Max Kellermann fb416964d6 pcm_utils: renamed ConvState to struct pcm_convert_state
No CamelCase, and a struct instead of a typedef.
2008-10-21 21:59:43 +02:00
Max Kellermann c85b570ad7 pcm_utils: pass only one buffer size to pcm_mix()
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().
2008-09-29 17:25:08 +02:00
Max Kellermann a7651b9d30 assume stdint.h and stddef.h are available
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.
2008-09-29 15:53:53 +02:00
Eric Wong 0352766dca Switch to C99 types (retaining compat with old compilers)
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.
2008-09-29 13:29:33 +02:00
Max Kellermann f1dd9c209c audio_format: converted typedef AudioFormat to struct audio_format
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
2008-09-07 19:19:55 +02:00
Max Kellermann 1b845f94a0 moved struct AudioFormat to audio_format.h
We want to expose the AudioFormat structure to plugins; remove some
clutter by moving its declaration to a separate header file.
2008-08-26 08:27:06 +02:00
Max Kellermann f201f2c922 more const pointers in pcm_utils.[ch]
git-svn-id: https://svn.musicpd.org/mpd/trunk@7360 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-15 05:56:35 +00:00
Max Kellermann a5aa5a0258 yet more unsigned integers
git-svn-id: https://svn.musicpd.org/mpd/trunk@7287 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:15:10 +00:00
Max Kellermann 623a86f389 use constant pointers when possible
It is a good practice to constify pointers when their dereferenced
data is not modified within the functions or its descendants.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7234 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:07:11 +00:00
Eric Wong cb8f1af3bd Cleanup #includes of standard system headers and put them in one place
This will make refactoring features easier, especially now that
pthreads support and larger refactorings are on the horizon.

Hopefully, this will make porting to other platforms (even
non-UNIX-like ones for masochists) easier, too.

os_compat.h will house all the #includes for system headers
considered to be the "core" of MPD.  Headers for optional
features will be left to individual source files.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03 07:29:49 +00:00
Avuton Olrich 5e085751f5 A better way to do the last patch (extremely minor patch)
git-svn-id: https://svn.musicpd.org/mpd/trunk@7042 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-11-21 14:02:03 +00:00
Avuton Olrich 6f11941e5e Fix Sun C 5.9 / C99 compatiblity
git-svn-id: https://svn.musicpd.org/mpd/trunk@7041 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-11-21 13:43:37 +00:00
J. Alexander Treuman 355d18a593 Make pcm_convertAudioFormat return the buffer size. This is necessary
because lsr may return less than the input buffer size, and the rest of the
audio code needs to know the new size.  This fixes the clicking that was
introduced with recent changes to the lsr code.  A huge thanks to remiss
for figuring this out.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6273 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26 16:39:55 +00:00
J. Alexander Treuman 2814b7cfc6 Reverting to the full lsr API. Turns out the simple API needs all of the
audio at once, so it won't work for us.  The old full API code was still
heavily broken, as each call to pcm_convertSampleRate() used the same
state, even if it was processing two streams of audio.  The new code keeps
a separate state for each audio stream that's being converted.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6255 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-24 21:15:37 +00:00
J. Alexander Treuman 407497c40a Split pcm_convertAudioFormat into separate functions for bitrate, channel,
and samplerate conversion.  This makes the code much easier to read, and
fixes a few bugs that were previously there.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6224 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-22 23:11:36 +00:00
Avuton Olrich a061da8fb5 The massive copyright update
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05 03:22:33 +00:00
Avuton Olrich 0f78a76fea Typo fix
git-svn-id: https://svn.musicpd.org/mpd/trunk@4470 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 17:41:03 +00:00
Avuton Olrich 29a25b9933 Add mpd-indent.sh
Indent the entire tree, hopefully we can keep
it indented.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20 16:02:40 +00:00
Avuton Olrich a8938c91ba [CLEANUP] Remove unused function
Cleanup whitespace->tabs

git-svn-id: https://svn.musicpd.org/mpd/trunk@4338 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 20:08:35 +00:00
J. Alexander Treuman 2fa7125cce Change shank's email address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 19:37:45 +00:00
Avuton Olrich a37348a74f Huge header update, update the copyright and add
the GPL header where necessary

git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 19:20:34 +00:00
Warren Dukes 16335ba097 remove vim &*(@
git-svn-id: https://svn.musicpd.org/mpd/trunk@2500 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-03 18:28:29 +00:00
Warren Dukes 12597322a2 configure shout encoding quality and audio format
git-svn-id: https://svn.musicpd.org/mpd/trunk@2307 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-23 01:04:58 +00:00
Warren Dukes 7626d9a547 more little bits of code in prep for resample/audioFormat conversion,
now to just write the actual audioFormat conversion code!

git-svn-id: https://svn.musicpd.org/mpd/trunk@970 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-10 14:06:23 +00:00
Warren Dukes 2ec1c5ff3c some more work on organizing code for resampling/audioFormat conversion
git-svn-id: https://svn.musicpd.org/mpd/trunk@968 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-10 12:35:18 +00:00
Warren Dukes 549344d38a add vim shiznit to end of all source files
git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-14 14:53:41 +00:00
Warren Dukes 91450723b2 bunch of autotool cleanups
git-svn-id: https://svn.musicpd.org/mpd/trunk@271 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-18 03:29:25 +00:00
Warren Dukes 71a48f07bc add copyright notices to files
git-svn-id: https://svn.musicpd.org/mpd/trunk@34 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-02-24 17:06:14 +00:00
Warren Dukes d35747a40c import from SF CVS
git-svn-id: https://svn.musicpd.org/mpd/trunk@1 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-02-23 23:41:20 +00:00