1 /* 2 * drct.h 3 * Copyright 2010-2012 John Lindgren 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions, and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions, and the following disclaimer in the documentation 13 * provided with the distribution. 14 * 15 * This software is provided "as is" and without any warranty, express or 16 * implied. In no event shall the authors be liable for any damages arising from 17 * the use of this software. 18 */ 19 20 #ifndef LIBAUDCORE_DRCT_H 21 #define LIBAUDCORE_DRCT_H 22 23 #include <libaudcore/audio.h> 24 #include <libaudcore/index.h> 25 #include <libaudcore/tuple.h> 26 27 class PluginHandle; 28 29 /* CAUTION: These functions are not thread safe. */ 30 31 /* --- PLAYBACK CONTROL --- */ 32 33 void aud_drct_play(); 34 void aud_drct_play_pause(); 35 void aud_drct_pause(); 36 void aud_drct_stop(); 37 bool aud_drct_get_playing(); 38 bool aud_drct_get_ready(); 39 bool aud_drct_get_paused(); 40 41 // returns entry number of playing song (zero-based) 42 int aud_drct_get_position(); 43 44 // returns filename of playing song 45 String aud_drct_get_filename(); 46 47 // returns formatted title of playing song 48 // connect to the "title change" hook to be notified of changes 49 String aud_drct_get_title(); 50 51 // returns metadata of playing song 52 // connect to the "tuple change" hook to be notified of changes 53 Tuple aud_drct_get_tuple(); 54 55 // returns some statistics of playing song 56 // connect to the "info change" hook to be notified of changes 57 void aud_drct_get_info(int & bitrate, int & samplerate, int & channels); 58 59 int aud_drct_get_time(); 60 int aud_drct_get_length(); 61 void aud_drct_seek(int time); 62 63 /* "A-B repeat": when playback reaches point B, it returns to point A (where A 64 * and B are in milliseconds). The value -1 is interpreted as the beginning of 65 * the song (for A) or the end of the song (for B). A-B repeat is disabled 66 * entirely by setting both A and B to -1. */ 67 void aud_drct_set_ab_repeat(int a, int b); 68 void aud_drct_get_ab_repeat(int & a, int & b); 69 70 /* --- RECORDING CONTROL --- */ 71 72 /* Note that the behavior of these functions has changed in Audacious 3.9; 73 * "enabled" now means only that a plugin has been selected for recording. 74 * The "record" config option is now used to start/stop recording. */ 75 76 /* Returns the output plugin that will be used for recording, or null if none is 77 * available. Connect to the "enable record" hook to monitor changes. */ 78 PluginHandle * aud_drct_get_record_plugin(); 79 80 /* Returns true if output recording is enabled, otherwise false. Connect to the 81 * "enable record" hook to monitor changes. */ 82 bool aud_drct_get_record_enabled(); 83 84 /* Enables or disables output recording (but does not actually start recording). 85 * Returns true on success, otherwise false. */ 86 bool aud_drct_enable_record(bool enable); 87 88 /* --- VOLUME CONTROL --- */ 89 90 StereoVolume aud_drct_get_volume(); 91 void aud_drct_set_volume(StereoVolume volume); 92 int aud_drct_get_volume_main(); 93 void aud_drct_set_volume_main(int volume); 94 int aud_drct_get_volume_balance(); 95 void aud_drct_set_volume_balance(int balance); 96 97 /* --- PLAYLIST CONTROL --- */ 98 99 void aud_drct_pl_next(); 100 void aud_drct_pl_next_album(); 101 void aud_drct_pl_prev(); 102 void aud_drct_pl_prev_album(); 103 104 void aud_drct_pl_add(const char * filename, int at); 105 void aud_drct_pl_add_list(Index<PlaylistAddItem> && items, int at); 106 void aud_drct_pl_open(const char * filename); 107 void aud_drct_pl_open_list(Index<PlaylistAddItem> && items); 108 void aud_drct_pl_open_temp(const char * filename); 109 void aud_drct_pl_open_temp_list(Index<PlaylistAddItem> && items); 110 111 #endif 112