MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / set_decode_command

Method set_decode_command

ps3fw/cellMusicDecode.cpp:56–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 3

cell_music_decode_readFunction · 0.80

Calls 9

getFunction · 0.85
throw_exceptionClass · 0.85
set_swap_endiannessMethod · 0.80
set_next_indexMethod · 0.80
stopMethod · 0.45
to_stringMethod · 0.45
sizeMethod · 0.45
set_contextMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected