.endif
load-module module-native-protocol-unix
])dnl
-ifelse(@HAVE_DBUS@, 1, [dnl
-.ifexists module-dbus-protocol@PA_SOEXT@
-load-module module-dbus-protocol
-.endif
-])dnl
### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
.fail
.endif
-### Automatically restore the default sink/source when changed by the user during runtime
+### Automatically restore the default sink/source when changed by the user
+### during runtime
+### NOTE: This should be loaded as early as possible so that subsequent modules
+### that look up the default sink/source get the right value
load-module module-default-device-restore
### Automatically move streams to the default sink if the sink they are
load-module module-filter-apply
])dnl
+ifelse(@HAVE_DBUS@, 1, [dnl
+### Load DBus protocol
+.ifexists module-dbus-protocol@PA_SOEXT@
+load-module module-dbus-protocol
+.endif
+])dnl
+
ifelse(@HAVE_X11@, 1, [dnl
# X11 modules should not be started from default.pa so that one daemon
# can be shared by multiple sessions.
.ifexists module-esound-protocol-unix@PA_SOEXT@
load-module module-esound-protocol-unix
.endif
-.ifexists module-dbus-protocol@PA_SOEXT@
-### If you want to allow TCP connections, set access to "remote" or "local,remote".
-load-module module-dbus-protocol access=local
-.endif
load-module module-native-protocol-unix
### Automatically restore the volume of streams and devices
load-module module-stream-restore
load-module module-device-restore
-### Automatically restore the default sink/source when changed by the user during runtime
+### Automatically restore the default sink/source when changed by the user
+### during runtime
+### NOTE: This should be loaded as early as possible so that subsequent modules
+### that look up the default sink/source get the right value
load-module module-default-device-restore
+.ifexists module-dbus-protocol@PA_SOEXT@
+### If you want to allow TCP connections, set access to "remote" or "local,remote".
+load-module module-dbus-protocol access=local
+.endif
+
### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams