aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/alsa_plugin.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2010-11-05output/alsa: dump buffer and period limitsMax Kellermann1-0/+20
2010-01-17output/alsa: support packed 24 bit samplesMax Kellermann1-0/+13
2010-01-16output/alsa: probe all sample formats in a loopMax Kellermann1-36/+34
More code simplification. Probe all formats, no matter which input format.
2010-01-16output/alsa: merged code into alsa_output_try_format()Max Kellermann1-51/+71
Remove the debug log messages, because they are duplicate (see ao_open() in output_thread.c).
2010-01-16output/alsa: pass sample_format to get_bitformat()Max Kellermann1-3/+3
2010-01-16output/alsa: moved code to alsa_output_setup_format()Max Kellermann1-72/+80
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
2009-12-02audio_format: changed "bits" to "enum sample_format"Max Kellermann1-29/+44
This patch prepares support for floating point samples (and probably other formats). It changes the meaning of the "bits" attribute from a bit count to a symbolic value.
2009-11-12include config.h in all sourcesMax Kellermann1-1/+2
After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
2009-11-09output/alsa: fill period buffer with silence before drainingMax Kellermann1-3/+47
ALSA passes full period buffers to the hardware. If an application doesn't finish writing a period, libasound will nonetheless send the partial buffer (with undefined trailing data). This causes noise at the end of playback. This patch attempts to track the current position within the period buffer, and generates silence at the end, before calling snd_pcm_drain().
2009-11-02alsa_plugin.c: workaround snd_pcm_drain bugJeffrey Middleton1-1/+2
Reintroduce a fix from commit 52a0653 (Warren Dukes): "don't call snd_pcm_drain unless we're already in the RUNNING state". This prevents ALSA with dmix from sometimes hanging when snd_pcm_drain is called, e.g. when moving from one song to the next (as in mantis issue 2634).
2009-10-29output_plugin: added method "drain"Max Kellermann1-3/+9
drain() is the opposite of cancel(): it waits until all data in the buffer has finished playing. Instead of implicitly draining in the close() method like the ALSA plugin has been doing it forever, let the output thread decide whether to drain or to cancel.
2009-10-29output/alsa: don't recover on CANCELMax Kellermann1-1/+1
The recovery is for nothing if we get CLOSE afterwards. Let's not recover in the cancel() method, and let the next play() call sort it out.
2009-10-20mixer/{oss,alsa}: renamed the mixer source filesMax Kellermann1-1/+2
2009-07-19Support wrong-endian ALSA outputDavid Woodhouse1-2/+50
2009-04-21alsa_output: don't use atexit() to clean up the ALSA libraryMax Kellermann1-7/+3
Call snd_config_update_free_global() manually in our finish() method, don't use atexit().
2009-03-26output_plugin: replaced output_plugin.get_mixer() with mixer_pluginMax Kellermann1-19/+1
The mixer core library is now responsible for creating and managing the mixer object. This removes duplicated code from the output plugins.
2009-03-14mixer_api: moved mixer_plugin imports to mixer_list.hMax Kellermann1-1/+1
This patch allows the output plugins to import only mixer_list.h, instead of the full mixer_api.h (which would expose internal structures).
2009-03-14mixer_api: moved functions to mixer_control.cMax Kellermann1-0/+1
mixer_control.h should provide the functions needed to manipulate a mixer, without exposing the internal mixer API (which is provided by mixer_api.h).
2009-03-13all: Update copyright header.Avuton Olrich1-6/+7
This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
2009-03-10alsa: use snd_pcm_sframes_t instead of intMax Kellermann1-2/+1
snd_pcm_writei() returns the type snd_pcm_sframes_t, not int. Use the correct variable type.
2009-03-10alsa: don't close PCM handle in alsa_recover()Max Kellermann1-13/+3
If the PCM handle gets disconnected, don't close and clear it in alsa_recover(). The MPD core will call alsa_close() anyway. This way, we can always assume that alsa_data.pcm is always valid.
2009-03-08alsa: determine buffer_time if not already knownMax Kellermann1-0/+5
This patch fixes a theoretical (but practically impossible) flaw: the variable "buffer_time" may be uninitialized when it is used. Initialize the variable with snd_pcm_hw_params_get_buffer_time().
2009-03-08alsa: better period_time default value for high sample ratesMax Kellermann1-3/+8
The default values for buffer_time and period_time were both capped by the hardware limits on practically all chips. The result was a period_time which was half as big as the buffer_time. On some chips, this led to lots of underruns when using a high sample rate (192 kHz), because MPD had very little time to send new samples to ALSA. A period time which is one fourth of the buffer time turned out to be much better. If no period_time is configured, see how much buffer_time the hardware accepts, and try to configure one fourth of it as period_time, instead of hard-coding the default period_time value. This is yet another attempt to provide a solution which is valid for all sound chips. Using the SND_PCM_NONBLOCK flag also seemed to solve the underruns, but put a lot more CPU load to MPD.
2009-03-03alsa: log period and buffer sizeMax Kellermann1-0/+3
Log the real period and buffer size. This might be useful when debugging xruns. Note that the same information is available in /proc/asound/card*/pcm*p/sub*/hw_params
2009-03-03alsa: fall back to 32 bit samples if 16 is not supportedMax Kellermann1-1/+2
There are a few high-end devices (e.g. ICE1724) which cannot even play 16 bit audio. Try the 32 bit fallback, which we already implemented for 24 bit.
2009-03-02alsa: fall back to 32 bit samples if 24 is not supportedMax Kellermann1-0/+8
Some sound chips/drivers (e.g. Intel HDA) don't support 24 bit samples, they want to get 32 bit instead. Now that MPD's PCM library supports 32 bit, add a 32 bit fallback when 24 bit is not supported.
2009-03-01output: removed duplicate debug messages from pluginsMax Kellermann1-4/+0
The MPD core logs the audio format of all audio outputs. Remove the duplicate message from the plugins.
2009-02-26output_plugin: report errors with GErrorMax Kellermann1-20/+35
Use GLib's GError library for reporting output device failures. Note that some init() methods don't clean up properly after a failure, but that's ok for now, because the MPD core will abort anyway.
2009-02-25alsa: fall back to 16 bit audioMax Kellermann1-3/+8
When the sample format is unknown, fall back to 16 bit samples.
2009-02-25alsa: moved code from alsa_open() to alsa_setup()Max Kellermann1-32/+49
Simplify error handling a bit by moving some code into a separate function. This eliminates a good bunch of gotos, but that's not finished yet.
2009-02-25output_plugin: don't pass audio_output object to method init()Max Kellermann1-2/+1
audio_output_get_name() has been removed, which was the only function left in output_api.h. The output plugin doesn't need the audio_output object at all, remove the parameter from the init() method.
2009-02-23output: pass the music chunk pointer as void*, not char*Max Kellermann1-1/+1
The meaning of the chunk depends on the audio format; don't suggest a specific format by declaring the pointer as "char*", pass "void*" instead.
2009-02-23output_api: play() returns a lengthMax Kellermann1-20/+11
The old API required an output plugin to not return until all data passed to the play() method is consumed. Some output plugins have to loop to fulfill that requirement, and may block during that. Simplify these, by letting them consume only part of the buffer: make play() return the length of the consumed data.
2009-02-16output_plugin: replaced method "control()" with "mixer()"Max Kellermann1-8/+9
The output plugin shouldn't know any specifics of the mixer API. Make it return the mixer object, and let the caller deal with it.
2009-01-25use g_free() instead of free()Max Kellermann1-1/+1
On some platforms, g_free() must be used for memory allocated by GLib. This patch intends to correct a lot of occurrences, but is probably not complete.
2009-01-25mixer: removed mixer_configure(), configure mixer in mixer_new()Max Kellermann1-7/+1
Allocate the mixer object when it is configured. Merged mixer_configure() into mixer_new(). mixer_new() was quite useless anyway.
2009-01-25mixer: return a mixer struct pointerMax Kellermann1-7/+7
Don't use statically allocated mixer objects.
2009-01-25conf: allow param==NULLMax Kellermann1-5/+2
Return the default value in the conf_get_block_*() functions when param==NULL was passed. This simplifies a lot of code, because all initialization can be done in one code path, regardless whether configuration is present.
2009-01-25conf: const pointers in block get functionsMax Kellermann1-2/+2
All config_get_block_*() functions should accept constant config_param pointers.
2009-01-25alsa: added commentsMax Kellermann1-3/+21
Document alsa_data members.
2009-01-25alsa: frame_size is size_t, not intMax Kellermann1-1/+1
frame_size is a memory size and should be a size_t, not a signed integer.
2009-01-25alsa: no CamelCaseMax Kellermann1-93/+103
Renamed types, functions, variables.
2009-01-25alsa: fix option parsing and restore default period_timeDan McGee1-3/+6
Two bugs here led to a large number of interrupts being generated on the sound card when ALSA output is being used. Because we specify no default period_time, the sound card gives us 3000 interrupts/sec rather than a more sane 20 or 30. This completes the revert of dd7711 already started by 4ca24f. The larger bug was in the change to config_get_block_unsigned() and using 0 as the default value for both 'buffer_time' and 'period_time'. This means any pre-setting of these options in newAlsaData() gets wiped out. Add a new default for period_time, and ensure default values for buffer_time and period_time are used if none are provided by the user. Signed-off-by: Dan McGee <dan@archlinux.org> [mk: set defaults in newAlsaData() to fix auto-configuration; renamed "_MS" back to "_US" because ALSA expects microseconds, not milliseconds] Signed-off-by: Max Kellermann <max@duempel.org>
2009-01-18conf: added config_get_block_unsigned()Max Kellermann1-6/+2
Eliminate some more getBlockParam() invocations.
2009-01-18conf: added config_get_block_string()Max Kellermann1-2/+1
This replaces lots of getBlockParam() invocations.
2009-01-17conf: replaced getBoolBlockParam() with config_get_block_bool()Max Kellermann1-6/+5
No "force" parameter, pass a default value instead.
2009-01-17conf: no CamelCase, part IMax Kellermann1-5/+6
Renamed functions, types, variables.
2009-01-10Introducing mixer apiViliam Mateicka1-7/+8
This patch tryes to introduce pluggable mixer (struct mixer_plugin) along with some basic infrastructure (mixer_* functions). Instance of mixer (struct mixer) is used in alsa and oss output plugin
2009-01-07pcm_utils: moved conversion code to pcm_convert.cMax Kellermann1-1/+1
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.