What do you mean by name? The filename or the value of some tag fields?
For the filename, it would be something like this:
CODE
// tracks are identified by filename and subsong index.
// the subsong index is usually 0 for files that contain only a single track.
const char * filename = "bla.mp3";
int subsong = 0;
// retrieve the unique metadb_handle for the wanted track
metadb_handle * handle = metadb::get()->handle_create(make_playable_location(filename, subsong);
// get pointer to playlist_oper service
playlist_oper * pl = playlist_oper::get();
// search track in playlist
int n, count = pl->get_count();
for (n = 0; n < count; n++)
{
// metadb_handles can be compared by reference when checking for identity
metadb_handle * handle2 = pl->get_item(n);
if (handle == handle2)
{
pl->set_focus_sel(n);
pl->play_item(n);
n = count;
}
// we have to release all handles returned by get_item()
handle2->handle_release();
}
// release the handle returned by handle_create()
handle->handle_release();
Please note that the above code is written from memory, so it may not compile as-is.