mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-09 13:36:35 +00:00
remove latency func
This commit is contained in:
@@ -261,45 +261,4 @@ std::vector<std::string> ListSDLSinkDevices(bool is_capture) {
|
|||||||
return device_list;
|
return device_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* REVERSION to 3833 - function GetSDLLatency() REINTRODUCED FROM 3833 - DIABLO 3 FIX */
|
|
||||||
u32 GetSDLLatency() {
|
|
||||||
return TargetSampleCount * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// REVERTED back to 3833 - Below function IsSDLSuitable() removed, reverting to GetSDLLatency() above. - DIABLO 3 FIX
|
|
||||||
/*
|
|
||||||
bool IsSDLSuitable() {
|
|
||||||
#if !defined(HAVE_SDL3)
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
// Check SDL can init
|
|
||||||
if (!InitializeAudio()!
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// We can set any latency frequency we want with SDL, so no need to check that.
|
|
||||||
|
|
||||||
// Check we can open a device with standard parameters
|
|
||||||
SDL_AudioSpec spec;
|
|
||||||
spec.freq = TargetSampleRate;
|
|
||||||
spec.channels = 2u;
|
|
||||||
spec.format = AUDIO_S16SYS;
|
|
||||||
spec.samples = TargetSampleCount * 2;
|
|
||||||
spec.callback = nullptr;
|
|
||||||
spec.userdata = nullptr;
|
|
||||||
|
|
||||||
SDL_AudioSpec obtained;
|
|
||||||
auto device = SDL_OpenAudioDevice(nullptr, false, &spec, &obtained, false);
|
|
||||||
|
|
||||||
if (device == 0) {
|
|
||||||
LOG_ERROR(Audio_Sink, "SDL failed to open a device, it is not suitable. Error: {}",
|
|
||||||
SDL_GetError());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_CloseAudioDevice(device);
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
} // namespace AudioCore::Sink
|
} // namespace AudioCore::Sink
|
||||||
|
|||||||
@@ -90,20 +90,4 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::vector<std::string> ListSDLSinkDevices(bool capture);
|
std::vector<std::string> ListSDLSinkDevices(bool capture);
|
||||||
|
|
||||||
// REVERSION - function GetSDLLatency() reintroduced from EA-3833 - DIABLO 3 FIX
|
|
||||||
/**
|
|
||||||
* Get the reported latency for this sink.
|
|
||||||
*
|
|
||||||
* @return Minimum latency for this sink.
|
|
||||||
*/
|
|
||||||
u32 GetSDLLatency();
|
|
||||||
|
|
||||||
/** REVERTED back to 3833 - Below function IsSDLSuitable() removed, reverting to GetSDLLatency() above. - DIABLO 3 FIX
|
|
||||||
* Check if this backend is suitable for use.
|
|
||||||
* Checks if enabled, its latency, whether it opens successfully, etc.
|
|
||||||
*
|
|
||||||
* @return True is this backend is suitable, false otherwise.
|
|
||||||
*/
|
|
||||||
//bool IsSDLSuitable(); // REVERTED for GetSDLLatency() from EA-3833
|
|
||||||
|
|
||||||
} // namespace AudioCore::Sink
|
} // namespace AudioCore::Sink
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ struct SinkDetails {
|
|||||||
FactoryFn factory;
|
FactoryFn factory;
|
||||||
/// A method to call to list available devices.
|
/// A method to call to list available devices.
|
||||||
ListDevicesFn list_devices;
|
ListDevicesFn list_devices;
|
||||||
/// Method to get the latency of this backend - REINTRODUCED FROM 3833 - DIABLO 3 FIX
|
|
||||||
LatencyFn latency;
|
|
||||||
/// Check whether this backend is suitable to be used.
|
|
||||||
/// SuitableFn is_suitable; // REVERTED FOR LatencyFn latency ABOVE - DIABLO 3 FIX
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// sink_details is ordered in terms of desirability, with the best choice at the top.
|
// sink_details is ordered in terms of desirability, with the best choice at the top.
|
||||||
@@ -46,7 +42,6 @@ static constexpr SinkDetails sink_details[] = {
|
|||||||
return std::make_unique<SDLSink>(device_id);
|
return std::make_unique<SDLSink>(device_id);
|
||||||
},
|
},
|
||||||
&ListSDLSinkDevices,
|
&ListSDLSinkDevices,
|
||||||
&GetSDLLatency,
|
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
SinkDetails{
|
SinkDetails{
|
||||||
@@ -55,7 +50,6 @@ static constexpr SinkDetails sink_details[] = {
|
|||||||
return std::make_unique<NullSink>(device_id);
|
return std::make_unique<NullSink>(device_id);
|
||||||
},
|
},
|
||||||
[](bool capture) { return std::vector<std::string>{"null"}; },
|
[](bool capture) { return std::vector<std::string>{"null"}; },
|
||||||
[]() { return 0u; },
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,21 +61,14 @@ const SinkDetails& GetOutputSinkDetails(Settings::AudioEngine sink_id) {
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
auto iter = find_backend(sink_id);
|
auto iter = find_backend(sink_id);
|
||||||
if (sink_id == Settings::AudioEngine::Auto) {
|
if (sink_id == Settings::AudioEngine::Cubeb || sink_id == Settings::AudioEngine::Auto) {
|
||||||
#if defined(HAVE_SDL3)
|
|
||||||
iter = find_backend(Settings::AudioEngine::Sdl3);
|
iter = find_backend(Settings::AudioEngine::Sdl3);
|
||||||
#else
|
|
||||||
iter = std::begin(sink_details);
|
|
||||||
#endif
|
|
||||||
// END REINTRODUCED SECTION FROM 3833 - DIABLO 3 FIX
|
|
||||||
LOG_INFO(Service_Audio, "Auto-selecting the {} backend", Settings::CanonicalizeEnum(iter->id));
|
LOG_INFO(Service_Audio, "Auto-selecting the {} backend", Settings::CanonicalizeEnum(iter->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iter == std::end(sink_details)) {
|
if (iter == std::end(sink_details)) {
|
||||||
LOG_ERROR(Audio, "Invalid sink_id {}", Settings::CanonicalizeEnum(sink_id));
|
LOG_ERROR(Audio, "Invalid sink_id {}", Settings::CanonicalizeEnum(sink_id));
|
||||||
iter = find_backend(Settings::AudioEngine::Null);
|
iter = find_backend(Settings::AudioEngine::Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user