dynarray: Add PA_DYNARRAY_FOREACH

The PA_DYNARRAY_FOREACH macro requires that pa_dynarray_get() returns
NULL if the index is out of bounds.
dynarray: Add pa_dynarray_remove_last()
dynarray: Add pa_dynarray_remove_all()
hashmap: Add pa_hashmap_remove_and_free()
device-port: Add pa_device_port.active

In the Tizen volume API, I create and delete volume control objects
for ports based on their state (only active ports have volume
controls). Having the pa_device_port.active flag directly accessible
is much nicer than figuring out the state by iterating through sinks
and checking what their active port is. It's also safer to get a
notification for a deactivated port before the port switch is
executed, compared to using the SINK_PORT_CHANGED hook that is fired
only after the port switch is complete.
sink, source: Assign to reference_volume from only one place

Forcing all reference volume changes to go through
set_reference_volume_direct() makes it easier to check where the
reference volume is changed, and it also allows us to have only one
place where notifications for changed reference volume are sent.
sink-input, source-output: Assign to volume from only one place

Forcing all volume changes to go through set_volume_direct() makes
it easier to check where the stream volume is changed, and it also
allows us to have only one place where notifications for changed
volume are sent.
sink, source: Return early from set_mute()

This avoids redundant set_mute() callback calls.

Some logging was added too.
sink-input, source-output: Add logging to set_mute()
sink, source: Allow calling set_mute() during initialization

Currently the alsa sink and source write directly to s->muted during
initialization, but I think it's better to avoid direct writes, and
use the set_mute() function instead, because that makes it easier to
figure out where s->muted is modified. This patch prevents the
set_mute() call from crashing in the state assertion.
echo-cancel: Remove redundant get_mute() callback

The callback just called pa_source_output_get_mute(), which doesn't
have any side effects, and the return value wasn't used either, so
the callback was essentially a no-op.
sink, source: Call set_mute() from mute_changed()

This refactoring reduces duplication, as mute_changed() used to do the
same things as set_mute(). Other benefits are improved logging
(set_mute() logs the mute change, mute_changed() used to not do that)
and the soft mute state is kept up to date, because set_mute() sends
the SET_MUTE message to the IO thread.

The set_mute_in_progress flag is an extra precaution for preventing
recursion in case a sink/source implementation's set_mute() callback
causes mute_changed() to be called. Currently there are no such
implementations, but I think that would be a valid thing to do, so
some day there might be such implementation.
sink, source: Assign to s->muted from only one place

Forcing all mute changes to go through set_mute() makes it easier to
check where the muted field is changed, and it also allows us to have
only one place where notifications for changed mute are sent.
sink-input, source-output: Remove redundant get_mute() functions

The functions just return the muted value. Callers can as well read
the struct field directly, it's simpler that way.
solaris, tunnel: Remove some redundant boolean conversions
sink, source: Add hooks for volume changes
sink-input, source-output: Add hooks for volume changes
sink, source: Add hooks for mute changes
sink-input, source-output: Add hooks for mute changes
sink: Link monitor source before activating port

The port activation hook callbacks may want to use the monitor source.