| 953 | } |
| 954 | |
| 955 | static int command_qcode (int unitnum, uae_u8 *buf, int sector, bool all) |
| 956 | { |
| 957 | struct cdunit *cdu = unitisopen (unitnum); |
| 958 | if (!cdu) |
| 959 | return 0; |
| 960 | |
| 961 | uae_u8 subbuf[SUB_CHANNEL_SIZE]; |
| 962 | uae_u8 *p; |
| 963 | int trk; |
| 964 | int pos; |
| 965 | int status; |
| 966 | |
| 967 | memset (buf, 0, SUBQ_SIZE); |
| 968 | p = buf; |
| 969 | |
| 970 | status = cdu->cdda_play_state; |
| 971 | if (cdu->cdda_play > 0 && cdu->cdda_paused) |
| 972 | status = AUDIO_STATUS_PAUSED; |
| 973 | |
| 974 | if (sector < 0) |
| 975 | pos = cdu->cd_last_pos; |
| 976 | else |
| 977 | pos = sector; |
| 978 | |
| 979 | p[1] = status; |
| 980 | p[3] = 12; |
| 981 | |
| 982 | p = buf + 4; |
| 983 | |
| 984 | struct cdtoc *td = NULL; |
| 985 | for (trk = 0; trk <= cdu->tracks; trk++) { |
| 986 | td = &cdu->toc[trk]; |
| 987 | if (pos < td->address) { |
| 988 | if (trk > 0) |
| 989 | td--; |
| 990 | break; |
| 991 | } |
| 992 | if (pos >= td->address && pos < td[1].address) |
| 993 | break; |
| 994 | } |
| 995 | if (!td) |
| 996 | return 0; |
| 997 | getsub_deinterleaved (subbuf, cdu, td, pos); |
| 998 | if (all) { |
| 999 | memcpy(buf, subbuf, SUB_CHANNEL_SIZE); |
| 1000 | } else { |
| 1001 | memcpy (p, subbuf + 12, 12); |
| 1002 | } |
| 1003 | |
| 1004 | if (cdu->cdda_play_state == AUDIO_STATUS_PLAY_COMPLETE || cdu->cdda_play_state == AUDIO_STATUS_PLAY_ERROR) |
| 1005 | cdu->cdda_play_state = AUDIO_STATUS_NO_STATUS; |
| 1006 | |
| 1007 | return 1; |
| 1008 | } |
| 1009 | |
| 1010 | static uae_u32 command_volume (int unitnum, uae_u16 volume_left, uae_u16 volume_right) |
| 1011 | { |
nothing calls this directly
no test coverage detected