Skip to content

Commit

Permalink
Bring back bandwidth display & disable TinyVGM debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ReimuNotMoe committed Jun 25, 2023
1 parent af36ffe commit 711b147
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 103 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ if(${RETROWAVE_BUILD_PLAYER} EQUAL 1)

include(${CPM_DOWNLOAD_LOCATION})

add_definitions(-DTinyVGM_DEBUG=0)

CPMAddPackage(
NAME cxxopts
GITHUB_REPOSITORY jarro2783/cxxopts
Expand Down
39 changes: 0 additions & 39 deletions Player/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,6 @@

#include "Player.hpp"

//void RetroWavePlayer::char16_to_string(std::string &str, int16_t *c16) {
// str.clear();
//
// auto cd = iconv_open("UTF8", "UTF16LE");
//
// assert(cd);
//
// size_t len_in = (tinyvgm_strlen16(c16) + 1) * 2;
// size_t len_out = len_in * 2;
//
// char *outbuf = (char *)alloca(len_out);
// memset(outbuf, 0, len_out);
//
// char *inptr = (char *)c16;
// char *outptr = outbuf;
//
// iconv(cd, &inptr, &len_in, &outptr, &len_out);
//
// str = outbuf;
// iconv_close(cd);
//}

void RetroWavePlayer::char16_to_string(std::string &str, int16_t *c16, uint32_t memsize) {
str.clear();

Expand All @@ -82,21 +60,4 @@ void RetroWavePlayer::char16_to_string(std::string &str, int16_t *c16, uint32_t

std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
str = convert.to_bytes(source);
//
// size_t buflen_in = (c16_len + 1) * 2;
//
//
//// std::locale loc("C");
// auto& f = std::use_facet<std::codecvt<char16_t, char, std::mbstate_t>>(std::locale());
//
// std::mbstate_t mb{}; // initial shift state
// str.resize(buflen_in * 2);
//
// const char16_t* from_next;
// char* to_next;
//
// f.out(mb, reinterpret_cast<const char16_t *>(c16), reinterpret_cast<const char16_t *>(c16 + c16_len),
// from_next, &str[0], &str[str.size()], to_next);
//
// str.resize(to_next - &str[0]);
}
4 changes: 2 additions & 2 deletions Player/OSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ void RetroWavePlayer::osd_show() {
}

if (s - last_secs >= 1) {
bytes_per_sec = played_bytes;
played_bytes = 0;
bytes_per_sec = queued_bytes;
queued_bytes = 0;
last_secs = s;
}

Expand Down
5 changes: 4 additions & 1 deletion Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ static int tvc_callback_command(void *userp, unsigned int cmd, const void *buf,

if (t->disabled_vgm_commands.count(cmd)) return TinyVGM_OK;

t->queued_bytes += cmd_val_len;

switch (cmd)
{
case 0x5a: return RetroWavePlayer::callback_opl2 (userp, cmd, buf, cmd_val_len);
Expand All @@ -138,6 +140,7 @@ static int tvc_callback_command(void *userp, unsigned int cmd, const void *buf,
case 0x30: return RetroWavePlayer::callback_sn76489_port1 (userp, cmd, buf, cmd_val_len);
}


return TinyVGM_OK; // ignore command
}

Expand Down Expand Up @@ -403,7 +406,7 @@ void RetroWavePlayer::playback_reset() {
last_last_slept_samples = 0;
total_samples = 0;
last_slept_usecs = 0;
played_bytes = 0;
queued_bytes = 0;
last_secs = 0;

metadata = Metadata(); // reset all pointers back to NULL
Expand Down
2 changes: 1 addition & 1 deletion Player/Player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class RetroWavePlayer {

// Playback stats
size_t played_samples = 0, last_slept_samples = 0, last_last_slept_samples = 0, total_samples = 0;
size_t played_bytes = 0, last_secs = 0, bytes_per_sec = 0;
size_t queued_bytes = 0, last_secs = 0, bytes_per_sec = 0;
uint64_t last_slept_usecs = 0;
bool sn76489_dual = false;

Expand Down
60 changes: 0 additions & 60 deletions Player/RegMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,64 +85,4 @@ void RetroWavePlayer::regmap_sn76489_insert(uint8_t chip_idx, uint8_t data) {
}
}

// uint8_t dat = retrowave_invert_byte(data);
//
// if (dat & 0x1) {
// cur_regmap.last_reg = (data >> 1) & 0x07;
// }
//
// uint8_t idx = 0, mode = 0; // 1: Freq, 2: Att
//
// switch (cur_regmap.last_reg) {
// case 0: // Tone 1 Freq, 000
// mode = 1;
// idx = 0;
// break;
// case 2: // Tone 2 Freq, 010
// mode = 1;
// idx = 1;
// break;
// case 1: // Tone 3 Freq, 100
// mode = 1;
// idx = 2;
// break;
// case 4: // Tone 1 Att
// mode = 2;
// idx = 0;
// break;
// case 6: // Tone 2 Att
// mode = 2;
// idx = 1;
// break;
// case 5: // Tone 3 Att
// mode = 2;
// idx = 2;
// break;
// case 3: // Noise ctrl, 110
// cur_regmap.noise_ctrl = (data >> 4) & 0x0f;
// break;
// case 7: // Noise att
// cur_regmap.noise_att = (data >> 4) & 0x0f;
// break;
// }
//
// if (mode == 1) { // Freq
// auto &val = cur_regmap.freq[idx];
//
// if (dat & 0x1) { // reg + upper 4 bits
// uint8_t val_upper = (data >> 4) & 0x0f; // Extract upper 4 bits
// val &= 0x3f; // Preserve lower 6 bits
// val |= val_upper << 6; // Merge
// } else { // lower 6 bits
// uint8_t val_lower = (data >> 2) & 0x3f; // Extract lower 6 bits
// val &= 0x3c0; // Preserve upper 4 bits
// val |= val_lower; // Merge
// }
// } else if (mode == 2) { // Att
// if (dat & 0x1) {
// cur_regmap.att[idx] = (data >> 4) & 0x0f;
// }
// }


}

0 comments on commit 711b147

Please sign in to comment.