I want to have module-esound-sink to respect the ESPEAKER enviroment variable and use it. This is because, sometimes ESD is started with autospawn and that uses the ESPEAKER enviroment variable to connect with the ESD server. I also want it to use the cookie which is in the homedirectory of the user.
I want to use this feature, because I need to use ESD for network transparancy. I can't use PulseAudio for it. I only want PulseAudio to be a "sound proxy" and redirects all trafic to ESD.
The ESPEAKER enviroment variable isset as the following ESPEAKER="127.0.0.1:16001". The Esound cookie files are, in my case, located in the home folder (/home/<user>/.esd_auth).
I've created some C code for it, to respect the ESPEAKER enviroment variable, but I don't know if it's going to work (not tested yet).
/* Beginning from line 366 of the original src/modules/module-esound-sink.c of the stable (0.9.5) version */
char* esdenviroment = getenv("ESPEAKER");
char* envserver;
char* envport;
int intenvport = 16001;
char* delimitpos = 0;
delimitpos = strchr(*esdenviroment, ':');
if (delimitpos != NULL)
{
strncpy(*envserver, *esdenviroment, delimitpos - esdenviroment + 1);
esdenviroment = delimitpos;
esdenviroment++;
strncpy(*envport, *esdenviroment, strlen(esdenviroment));
intenvport = atoi(envport);
}
if (!(u->client = pa_socket_client_new_string(u->core->mainloop, p = pa_modargs_get_value(ma, "server", ESD_UNIX_SOCKET_NAME), ESD_DEFAULT_PORT))) {
pa_log("failed to connect to server. Trying to use the ESPEAKER enviroment variable.");
if (!(u->client = pa_socket_client_new_string(u->core->mainloop, p = envserver, intenvport))) {
pa_log("faild to connect to server.");
goto fail;
}
}