1 /* -*- c -*- 2 Copyright (C) 2005, 2007, 2008, 2019 Rocky Bernstein <rocky@gnu.org> 3 4 This program is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 3 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 /** \file audio.h 19 * 20 * \brief The top-level header for CD audio-related libcdio 21 * calls. These control playing of the CD-ROM through its 22 * line-out jack. 23 */ 24 #ifndef CDIO_AUDIO_H_ 25 #define CDIO_AUDIO_H_ 26 27 #include <cdio/types.h> 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif /* __cplusplus */ 32 33 /*! This struct is used by the cdio_audio_read_subchannel */ 34 typedef struct cdio_subchannel_s 35 { 36 uint8_t format; 37 uint8_t audio_status; 38 uint8_t address: 4; 39 uint8_t control: 4; 40 uint8_t track; 41 uint8_t index; 42 msf_t abs_addr; 43 msf_t rel_addr; 44 } cdio_subchannel_t; 45 46 /*! This struct is used by cdio_audio_get_volume and cdio_audio_set_volume */ 47 typedef struct cdio_audio_volume_s 48 { 49 uint8_t level[4]; 50 } cdio_audio_volume_t; 51 52 53 /*! This struct is used by the CDROMPLAYTRKIND ioctl */ 54 typedef struct cdio_track_index_s 55 { 56 uint8_t i_start_track; /**< start track */ 57 uint8_t i_start_index; /**< start index */ 58 uint8_t i_end_track; /**< end track */ 59 uint8_t i_end_index; /**< end index */ 60 } cdio_track_index_t; 61 62 /*! 63 Get volume of an audio CD. 64 65 @param p_cdio the CD object to be acted upon. 66 @param p_volume place to put the list of volume outputs levels 67 68 \p p_volume can be \p NULL in which case we return only whether 69 the driver has the ability to get the volume or not. 70 71 */ 72 driver_return_code_t cdio_audio_get_volume (CdIo_t *p_cdio, /*out*/ 73 cdio_audio_volume_t *p_volume); 74 75 /*! 76 Return the number of seconds (discarding frame portion) of an MSF 77 */ 78 uint32_t cdio_audio_get_msf_seconds(msf_t *p_msf); 79 80 /*! 81 Pause playing CD through analog output 82 83 @param p_cdio the CD object to be acted upon. 84 */ 85 driver_return_code_t cdio_audio_pause (CdIo_t *p_cdio); 86 87 /*! 88 Playing CD through analog output at the given MSF. 89 90 @param p_cdio the CD object to be acted upon. 91 @param p_start_msf pointer to staring MSF 92 @param p_end_msf pointer to ending MSF 93 */ 94 driver_return_code_t cdio_audio_play_msf (CdIo_t *p_cdio, 95 /*in*/msf_t *p_start_msf, 96 /*in*/ msf_t *p_end_msf); 97 98 /*! 99 Playing CD through analog output at the desired track and index 100 101 @param p_cdio the CD object to be acted upon. 102 @param p_track_index location to start/end. 103 */ 104 driver_return_code_t cdio_audio_play_track_index 105 ( CdIo_t *p_cdio, cdio_track_index_t *p_track_index); 106 107 /*! 108 Get subchannel information. 109 110 @param p_cdio the CD object to be acted upon. 111 @param p_subchannel place for returned subchannel information 112 */ 113 driver_return_code_t cdio_audio_read_subchannel (CdIo_t *p_cdio, 114 /*out*/ cdio_subchannel_t *p_subchannel); 115 116 /*! 117 Resume playing an audio CD. 118 119 @param p_cdio the CD object to be acted upon. 120 121 */ 122 driver_return_code_t cdio_audio_resume (CdIo_t *p_cdio); 123 124 /*! 125 Set volume of an audio CD. 126 127 @param p_cdio the CD object to be acted upon. 128 @param p_volume place for returned volume-level information 129 130 */ 131 driver_return_code_t cdio_audio_set_volume (CdIo_t *p_cdio, /*out*/ 132 cdio_audio_volume_t *p_volume); 133 134 /*! 135 Stop playing an audio CD. 136 137 @param p_cdio the CD object to be acted upon. 138 139 */ 140 driver_return_code_t cdio_audio_stop (CdIo_t *p_cdio); 141 142 #ifdef __cplusplus 143 } 144 #endif /* __cplusplus */ 145 146 #endif /* CDIO_AUDIO_H_ */ 147