aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer (follow)
Commit message (Collapse)AuthorAgeFilesLines
* pulse_mixer: removed superfluous G_GNUC_UNUSED attributesMax Kellermann2009-03-271-4/+4
| | | | Those parameters are used after all.
* pulse_mixer: use local pa_cvolume variable for set_volume()Max Kellermann2009-03-271-2/+3
| | | | | | Don't mess with pulse_mixer.volume for setting the volume. This variable should only be used to transfer the current volume from sink_input_vol() to pulse_mixer_get_volume().
* pulse_mixer: wait for get_volume() operation to completeMax Kellermann2009-03-271-1/+34
| | | | | | | | | | The pa_context_get_sink_input_info() function is asynchronous, and after it returns, libpulse does not guarantee that the operation has completed yet; in fact, it is not likely. Explicitly wait for the operation to complete. The code for the new pulse_wait_for_operation() function was inspired by mplayer and xine code.
* pulse_mixer: adapted code styleMax Kellermann2009-03-271-27/+52
| | | | Use the same code style as the rest of MPD.
* pulse_mixer: removed superfluous initializationsMax Kellermann2009-03-261-7/+2
| | | | | | Don't initialize attributes which are only used in an open mixer. As long as nobody accesses them, their values are uninitialized and undefined.
* pulse_mixer: allocate "volume" staticallyMax Kellermann2009-03-261-10/+6
| | | | | | | The pm->volume attribute was allocated in pulse_mixer_init(), but is never freed. This leaks memory. Instead of adding the g_free() call to pulse_mixer_finish(), let's just make "volume" a static attribute of the pulse_mixer struct. That is easier to deal with.
* pulse_mixer: removed superfluous NULL checks in close()Max Kellermann2009-03-261-12/+4
| | | | | When the MPD core knows that the pulse mixer is open, pm->mainloop and pm->context must be non-NULL.
* pulse_mixer: initialize "online" and "index" in open()Max Kellermann2009-03-261-2/+5
| | | | | The attributes "online" and "index" were not properly reinitialized after a close/open cycle.
* pulse: make configuration strings constMax Kellermann2009-03-261-6/+6
| | | | | | Nobody needs to modify these strings. We can make them const, and convert config_dup_block_string() to config_get_block_string(). This also fixes memory leaks in the pulse mixer.
* pulse: don't check config_param!=NULLMax Kellermann2009-03-261-6/+3
| | | | | The conf.h functions deal well with config_param==NULL and will return the specified default value then.
* pulse_mixer: free libpulse objects on failureMax Kellermann2009-03-261-0/+6
| | | | | When the mixer initialization fails, we have to free the libpulse objects we have already created, to prevent resource leaks.
* pulse_mixer: unlock the mainloop on failureMax Kellermann2009-03-261-0/+2
| | | | | It's illegal to return from pulse_mixer_setup() without unlocking the main loop. In the error handling, that unlock() call was missing.
* pulse_mixer: moved code to pulse_mixer_setup()Max Kellermann2009-03-261-15/+26
| | | | Prepare for adding proper error handling.
* alsa_mixer: initialize "volume_set" in the open() methodMax Kellermann2009-03-261-2/+2
| | | | | | "volume_set" is an attribute which becomes undefined when the mixer is closed. That means, it must be initialized each time the mixer is opened.
* alsa_mixer: removed superfluous checksMax Kellermann2009-03-261-10/+6
| | | | | | The MPD core guarantees that methods are always invoked in a consistent state. This means we can remove lots of checks from the volume methods.
* alsa_mixer: pass default device to config_get_block_string()Max Kellermann2009-03-261-14/+7
| | | | | Instead of replacing NULL with the default device in the open() method, pass the default device to config_get_block_string().
* alsa_mixer: make "device" and "control" constMax Kellermann2009-03-261-6/+5
| | | | Use config_get_block_string() instead of config_dup_block_string().
* oss_mixer: call oss_find_mixer() in init() methodMax Kellermann2009-03-261-25/+26
| | | | Detect misconfiguration during MPD startup.
* oss_mixer: removed superfluous checksMax Kellermann2009-03-261-8/+8
| | | | | | The MPD core guarantees that methods are always invoked in a consistent state. This means we can remove lots of checks from the volume methods.
* oss_mixer: use g_ascii_strncasecmp() instead of strncasecmp()Max Kellermann2009-03-261-1/+1
| | | | strncasecmp() is locale dependent, but we only need ASCII here.
* oss_mixer: pass default path to config_get_block_string()Max Kellermann2009-03-261-8/+5
| | | | | Instead of replacing NULL with the default path in the open() method, pass the default path to config_get_block_string().
* oss_mixer: make "device" and "control" constMax Kellermann2009-03-261-6/+5
| | | | Use config_get_block_string() instead of config_dup_block_string().
* mixer_control: close mixer on failureMax Kellermann2009-03-262-5/+0
| | | | | When getting or setting the volume fails, the MPD core close the mixer. Moved the duplicated code from the mixer plugins.
* mixer: added flag "open"Max Kellermann2009-03-262-0/+2
| | | | | | | | | | | | Remember if a mixer object is open or closed. Don't call open() again if it is already open. This guarantees that the mixer plugin is always called in a consistent state, and we will be able to remove lots of checks from the implementations. To support mixers which are automatically opened even if the audio output is still closed (to set the volume before playback starts), this patch also adds the "global" flag to the mixer_plugin struct. Both ALSA and OSS set this flag, while PULSE does not.
* pulse_mixer: keep mixer attached when another pulse sink is closed.David Guibert2009-03-171-1/+2
| | | | | | The mixer state is defined as offline only if the associated stream is removed. Signed-off-by: David Guibert <david.guibert@gmail.com>
* pulse_mixer: closeDavid Guibert2009-03-171-1/+14
| | | | | | | | | when the mixer is closed, - the mainloop is stopped. - the context is disconnected. - then the mainloop is freed. Signed-off-by: David Guibert <david.guibert@gmail.com>
* all: Update copyright header.Avuton Olrich2009-03-133-9/+12
| | | | | | | | 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.
* pulse_mixer: allow mpd to reconnect to the pulse mixerDavid Guibert2009-03-071-29/+24
| | | | | | | | | | | | | | | | | | | | | | | | | This patch follows the commit 21bb10f4b. >From Max Kellermann: > I removed the daemonization changes in main.c. Please explain why you > changed that. If you need it for some reason, make that a separate > patch with a good description of your rationale. > That's the biggest flaw of your code: it opens the mixer device in the > init() method, while the open() method is empty. When the pulse > daemon is not available (either during MPD startup or when it dies > while MPD runs), the plugin will not even attempt to reconnect to > pulse. Please move the code to the open() method, to make that work. I changed the daemonize call as the fork losts the connection to the pulse server. According to your remark, the init() method should be moved to the open() ones. With the modification, mpd is able to reconnect the pulse mixer after restarting the pulseaudio daemon. Signed-off-by: David Guibert <david.guibert@gmail.com> Signed-off-by: Max Kellermann <max@duempel.org>
* pulse_mixer: added missing copyright headerMax Kellermann2009-03-071-0/+18
|
* pulse_mixer: added GLib log domainMax Kellermann2009-03-071-14/+16
| | | | Shorten some log messages, let GLib add the "pulse_mixer" prefix.
* pulse: clean up includesMax Kellermann2009-03-071-2/+4
| | | | | Don't include output_api.h - this is not an output plugin. Added missing explicit conf.h and string.h includes.
* pulse mixerDavid Guibert2009-03-071-0/+277
| | | | | | | | | | | | | | | | | | | | This patch introduces the mixer for the pulse output. Technically speaking, the pulse index is needed to get or set the volume. You must define callback fonctions to get this index since the pulse output in mpd is done using the simpe api. The pulse simple api does not provide the index of the newly defined output. So callback fonctions are associated to the pulse context. The list of all the sink input is then retreived. Then we select the name of the mpd pulse output and control its volume by its associated index number. Signed-off-by: Patrice Linel <patnathanael@gmail.com> Signed-off-by: David Guibert <david.guibert@gmail.com> [mk: fixed whitespace errors and broke long lines; removed daemonization changes from main.c]
* mixer_api: replaced method "control()" with "{get,set}_volume()"Max Kellermann2009-02-162-124/+116
| | | | | The method control() is too complicated, and overengineered. Replace it with two trivial functions: get_volume() and set_volume().
* mixer_api: removed struct mixer_dataMax Kellermann2009-01-252-14/+24
| | | | | The mixer plugins should re-use the mixer struct and incorporate it in their object class.
* mixer: merged methods "init" and "configure"Max Kellermann2009-01-252-46/+12
| | | | | | | Both methods are always called together. There is no point in having them separate. This simplifies the code, because the old configure() method could be called more than once, and had to free old allocations.
* mixer: removed mixer_configure_legacy(), AC_MIXER_CONFIGUREMax Kellermann2009-01-252-11/+0
| | | | Those have been superseded by the new legacy configuration code.
* mixer: make all mixer_plugin pointers constMax Kellermann2009-01-252-2/+2
| | | | The plugin structures must never be modified.
* mixer: added missing copyright headersMax Kellermann2009-01-252-0/+34
|
* conf: allow param==NULLMax Kellermann2009-01-252-6/+0
| | | | | | | | 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.
* conf: const pointers in block get functionsMax Kellermann2009-01-252-4/+4
| | | | | All config_get_block_*() functions should accept constant config_param pointers.
* conf: added config_get_block_string()Max Kellermann2009-01-182-12/+15
| | | | This replaces lots of getBlockParam() invocations.
* mixer: don't check for NULL before g_free()Max Kellermann2009-01-182-16/+11
| | | | | The g_free() function includes a NULL check. We don't have to do it twice.
* conf: no CamelCase, part IMax Kellermann2009-01-172-6/+6
| | | | Renamed functions, types, variables.
* mixer: check param==NULL in the alsa and oss mixer codeMax Kellermann2009-01-162-0/+7
| | | | | | When MPD starts without audio output configuration, the "param" variable is NULL. This triggers a segmentation fault in both mixer plugins.
* removing mixer_reconfigure memmory leak, fixing configure of alsa and oss ↵Viliam Mateicka2009-01-112-8/+26
| | | | mixer (passing parameters)
* Introducing mixer apiViliam Mateicka2009-01-102-52/+73
| | | | | 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
* renaming mixer.h to mixer_api.hViliam Mateicka2009-01-042-4/+4
|
* mixer: renamed mix_* options to mixer_*Max Kellermann2009-01-012-4/+4
| | | | There is no reason to use the shortcut "mix" instead of "mixer".
* Moving mixers to audio outputsViliam Mateicka2008-12-312-0/+403