mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 21:13:12 -07:00
Improve Switch Registration Logs and Audio Level (#409)
This commit is contained in:
parent
4da09f75f3
commit
4d3f2aadbf
2 changed files with 28 additions and 4 deletions
|
@ -118,13 +118,20 @@ int Host::Register(std::string pin)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CHIAKI_LOGE(this->log, "Undefined PS4 system version (please run discover first)");
|
CHIAKI_LOGE(this->log, "Undefined PS4 system version (please run discover first)");
|
||||||
|
throw Exception("Undefined PS4 system version (please run discover first)");
|
||||||
}
|
}
|
||||||
|
|
||||||
this->regist_info.pin = atoi(pin.c_str());
|
this->regist_info.pin = atoi(pin.c_str());
|
||||||
this->regist_info.host = this->host_addr.c_str();
|
this->regist_info.host = this->host_addr.c_str();
|
||||||
this->regist_info.broadcast = false;
|
this->regist_info.broadcast = false;
|
||||||
CHIAKI_LOGI(this->log, "Registering to host `%s` `%s` with PSN AccountID `%s` pin `%s`",
|
|
||||||
this->host_name.c_str(), this->host_addr.c_str(), psn_account_id.c_str(), pin.c_str());
|
if(this->system_version >= 7000000)
|
||||||
|
CHIAKI_LOGI(this->log, "Registering to host `%s` `%s` with PSN AccountID `%s` pin `%s`",
|
||||||
|
this->host_name.c_str(), this->host_addr.c_str(), account_id.c_str(), pin.c_str());
|
||||||
|
else
|
||||||
|
CHIAKI_LOGI(this->log, "Registering to host `%s` `%s` with PSN OnlineID `%s` pin `%s`",
|
||||||
|
this->host_name.c_str(), this->host_addr.c_str(), online_id.c_str(), pin.c_str());
|
||||||
|
|
||||||
chiaki_regist_start(&this->regist, this->log, &this->regist_info, RegistEventCB, this);
|
chiaki_regist_start(&this->regist, this->log, &this->regist_info, RegistEventCB, this);
|
||||||
return HOST_REGISTER_OK;
|
return HOST_REGISTER_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,8 +243,25 @@ void IO::InitAudioCB(unsigned int channels, unsigned int rate)
|
||||||
|
|
||||||
void IO::AudioCB(int16_t * buf, size_t samples_count)
|
void IO::AudioCB(int16_t * buf, size_t samples_count)
|
||||||
{
|
{
|
||||||
//int az = SDL_GetQueuedAudioSize(host->audio_device_id);
|
for(int x=0; x < samples_count*2; x++)
|
||||||
// len the number of bytes (not samples!) to which (data) points
|
{
|
||||||
|
// boost audio volume
|
||||||
|
int sample = buf[x]*1.80;
|
||||||
|
// Hard clipping (audio compression)
|
||||||
|
// truncate value that overflow/underflow int16
|
||||||
|
if(sample > INT16_MAX)
|
||||||
|
{
|
||||||
|
buf[x] = INT16_MAX;
|
||||||
|
CHIAKI_LOGD(this->log, "Audio Hard clipping INT16_MAX < %d", sample);
|
||||||
|
}
|
||||||
|
else if(sample < INT16_MIN)
|
||||||
|
{
|
||||||
|
buf[x] = INT16_MIN;
|
||||||
|
CHIAKI_LOGD(this->log, "Audio Hard clipping INT16_MIN > %d", sample);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
buf[x] = (int16_t) sample;
|
||||||
|
}
|
||||||
int success = SDL_QueueAudio(this->sdl_audio_device_id, buf, sizeof(int16_t)*samples_count*2);
|
int success = SDL_QueueAudio(this->sdl_audio_device_id, buf, sizeof(int16_t)*samples_count*2);
|
||||||
if(success != 0)
|
if(success != 0)
|
||||||
CHIAKI_LOGE(this->log, "SDL_QueueAudio failed: %s\n", SDL_GetError());
|
CHIAKI_LOGE(this->log, "SDL_QueueAudio failed: %s\n", SDL_GetError());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue