Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5229

Graphics, sound and multimedia • Re: Using GTK4 to play sound on the RP5

$
0
0
I added/modified the following lines.

Code:

#define FILE_NAME_LENGTH 200void play( const char *name ){    char exeFile[FILE_NAME_LENGTH];    char soundFile[FILE_NAME_LENGTH];    GtkMediaStream *stream;    strcpy( exeFile, "" );    if( readlink( "/proc/self/exe", exeFile, FILE_NAME_LENGTH ) != -1 )    {        strcpy( soundFile, g_path_get_dirname( exeFile ) );        strcat( soundFile, "/" );        strcat( soundFile, name );        printf( "%s\n", soundFile );        stream = gtk_media_file_new_for_filename( soundFile );        printf( "%s\n", gtk_media_stream_get_error( stream )->message );        gtk_media_stream_set_volume( stream, 1.0 );        g_signal_connect( stream, "notify::ended", G_CALLBACK( ended ), NULL );        gtk_media_stream_play( stream );    }}
I get the following output.

/home/user/sound/sample.wav
GTK could not find a media module. Check your installation.

Why would GTK not be able to find the media modules on the system?

Statistics: Posted by rp5_art — Mon Nov 04, 2024 2:22 am



Viewing all articles
Browse latest Browse all 5229

Trending Articles