Exemplo n.º 1
0
Bool SetupSound ()
{
	register int i ;
	int sounds_configured = 0 ;

    if( Config == NULL ) return False ;
    /* first lets build our sounds table and see if we actually have anything to play :*/

	for( i = 0 ; i < MAX_SOUNDS ; i++ )
		if( SetupSoundEntry( i, Config->sounds[i] ) )
			sounds_configured++ ;

	if( sounds_configured <= 0 )
	{
		show_error( "no sounds configured");
		return False ;
	}

	/* now lets choose what player to use, and if we can use it at all : */
#ifdef HAVE_RPLAY_H
    /*
	 * Builtin rplay support is enabled when AudioPlayCmd == builtin-rplay.
	 */
    if (!mystrcasecmp (Config->playcmd, "builtin-rplay"))
	{
        if( Config->rplay_host )
        {
            replaceEnvVar (&(Config->rplay_host));
            rplay_fd = rplay_open (Config->rplay_host);
        }else if( (rplay_fd = rplay_open_display ()) < 0 )
			rplay_fd = rplay_open ("localhost");

		if (rplay_fd < 0)
		{
			rplay_perror (MyName);
			return False ;
		}
		audio_play = audio_player_rplay ;
        return True;
	}
#endif
    if( mystrcasecmp (Config->playcmd, "builtin-cat")== 0 )
	{
		audio_play = audio_player_cat ;
    }else if( mystrcasecmp (Config->playcmd, "builtin-stdout")== 0)
	{
		audio_play = audio_player_stdout ;
	}else
	{
		audio_play = audio_player_ext ;
        if( Config->playcmd == NULL )
            Config->playcmd = mystrdup("");
	}

	return (audio_play!=NULL) ;
}
Exemplo n.º 2
0
void ProxyViz::pressToLoad()
{
	MObject thisNode = thisMObject();
	MPlug plugc( thisNode, acachename );
	const MString filename = plugc.asString();
	if(filename != "")
		loadExternal(replaceEnvVar(filename).c_str());
	else 
		AHelper::Info<int>("ProxyViz error empty external cache filename", 0);
}
Exemplo n.º 3
0
Bool SetupSoundEntry( int code, char *sound )
{
  char *filename1, *filename2 ;

	if( sound == NULL ) return False;
	if( code < 0 || code > MAX_SOUNDS ) return False ;

    filename1 = mystrdup(sound);
    replaceEnvVar (&filename1);
    if( CheckFile( filename1 ) < 0 && Environment->audio_path != NULL )
    {
        filename2 = safemalloc( strlen(Environment->audio_path)+1+strlen(filename1)+1 );
        sprintf( filename2, "%s/%s", Environment->audio_path, filename1 );
        free( filename1 );
        filename1 = filename2 ;
        if( CheckFile( filename2 ) < 0 )
        {
            free( filename1 );
            filename1 = NULL ;
        }
    }
    if( sound_table[code] ) 
		free (sound_table[code]);
    sound_table[code] = filename1 ;

#ifdef HAVE_RPLAY_H
	if( Config->rplay_host == NULL )
		sound = sound_table[code] ;

    if( sound )
	{
		if( rplay_table[code] )
			rplay_destroy( rplay_table[code] );
		rplay_table[code] = rplay_create (RPLAY_PLAY);
		rplay_set (rplay_table[code], RPLAY_APPEND,
                   RPLAY_SOUND, sound,
                   RPLAY_PRIORITY, Config->rplay_priority,
                   RPLAY_VOLUME, Config->rplay_volume, NULL);
	}
#endif
	return True ;
}