[Rhythmbox-devel] monkey-media mixer queue



Hi,

Im trying to use monkey-media in a c++ app the following code is
basically what does all the playing :

void Engine::play_track() {
  GError *error = NULL;
	std::cout << "Playing: " << current_filename << "\n";
	//if monkeymedia is still playing, or paused
	if (monkey_media_mixer_get_state(mixer) !=
MONKEY_MEDIA_MIXER_STATE_STOPPED) {
	  disconnect_mixer_signal(); // disconnect the mixer signal
	  monkey_media_mixer_set_state (mixer,
MONKEY_MEDIA_MIXER_STATE_STOPPED);
	  connect_mixer_signal(); // connect the mixer signal
	  monkey_media_mixer_remove_audio_stream (mixer, stream);
	}
  /* load file from commandline */
  stream = monkey_media_audio_stream_new (current_filename.c_str(),
&error);
  if (error != NULL) {
    /* an error occured */
    std::cout << "Failed to create stream: \n" << error->message <<
"\n";
    g_error_free (error);
    exit (-1);
  }
  /* lego from now on */
  monkey_media_mixer_append_audio_stream (mixer, stream);
	//monkey_media_mixer_set_playing_audio_stream (mixer, stream);
  monkey_media_mixer_set_state (mixer,
MONKEY_MEDIA_MIXER_STATE_PLAYING);
	gorecki->set_pause_image(); // turn play button to pause
}

filename, mixer and stream are all private variables of the Engine
class.

The problem I have it that whenever I call the class to play a different
song, rather than stopping the playing of the current song and starting
the next one, it restarts the current song and adds the song i want
played into (i guess) the queue, which then plays when the song is
finished.

Please could you tell me how can I make it so it stops playing the
current song and starts playing the new song?

Thanks for any help,

-- 
Rus Hughes <rus@carpathia.force9.co.uk>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]