| 54 | shared_mutex mutex; |
| 55 | |
| 56 | error_code set_decode_command(s32 command) |
| 57 | { |
| 58 | decode_command = command; |
| 59 | |
| 60 | switch (command) |
| 61 | { |
| 62 | case CELL_MUSIC_DECODE_CMD_STOP: |
| 63 | { |
| 64 | decoder.stop(); |
| 65 | decode_status = CELL_MUSIC_DECODE_STATUS_DORMANT; |
| 66 | break; |
| 67 | } |
| 68 | case CELL_MUSIC_DECODE_CMD_START: |
| 69 | { |
| 70 | decode_status = CELL_MUSIC_DECODE_STATUS_DECODING; |
| 71 | read_pos = 0; |
| 72 | |
| 73 | // Decode data. The format of the decoded data is 48kHz, float 32bit, 2ch LPCM data interleaved in order from left to right. |
| 74 | cellMusicDecode.notice("set_decode_command(START): context: %s", current_selection_context.to_string()); |
| 75 | |
| 76 | music_selection_context context = current_selection_context; |
| 77 | |
| 78 | for (usz i = 0; i < context.playlist.size(); i++) |
| 79 | { |
| 80 | context.playlist[i] = vfs::get(context.playlist[i]); |
| 81 | } |
| 82 | |
| 83 | // TODO: set speed if small-memory decoding is used (music_decode2) |
| 84 | decoder.set_context(std::move(context)); |
| 85 | decoder.set_swap_endianness(true); |
| 86 | decoder.decode(); |
| 87 | break; |
| 88 | } |
| 89 | case CELL_MUSIC_DECODE_CMD_NEXT: |
| 90 | case CELL_MUSIC_DECODE_CMD_PREV: |
| 91 | { |
| 92 | decoder.stop(); |
| 93 | |
| 94 | if (decoder.set_next_index(command == CELL_MUSIC_DECODE_CMD_NEXT) == umax) |
| 95 | { |
| 96 | decode_status = CELL_MUSIC_DECODE_STATUS_DORMANT; |
| 97 | return CELL_MUSIC_DECODE_ERROR_NO_MORE_CONTENT; |
| 98 | } |
| 99 | |
| 100 | decoder.decode(); |
| 101 | break; |
| 102 | } |
| 103 | default: |
| 104 | { |
| 105 | fmt::throw_exception("Unknown decode command %d", command); |
| 106 | } |
| 107 | } |
| 108 | return CELL_OK; |
| 109 | } |
| 110 | |
| 111 | error_code finalize() |
| 112 | { |
no test coverage detected