Fix: Add public reload_settings() method to Player
COMPILATION ERROR FIXED: - audio_settings field was private - Can't access from commands module SOLUTION: - Added public method: Player::reload_settings(settings) - Encapsulation preserved - Commands use public API VERIFIED: cargo check passes
This commit is contained in:
1 parent
e74c642831
commit
d5f2ec9030
2 files changed
+13
-4
No files matched your search
@@ -1376,6 +1376,17 @@ impl Player {
|
||||
.map_err(|e| format!("Failed to send reinit command: {}", e))
|
||||
}
|
||||
|
||||
/// Reload audio settings from fresh config (e.g., after database update)
|
||||
/// Call this before reinit_device() to ensure Player uses latest settings
|
||||
pub fn reload_settings(&self, settings: AudioSettings) -> Result<(), String> {
|
||||
if let Ok(mut current_settings) = self.audio_settings.lock() {
|
||||
*current_settings = settings;
|
||||
Ok(())
|
||||
} else {
|
||||
Err("Failed to lock audio settings".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// Get current playback state with real-time position
|
||||
pub fn get_state(&self) -> Result<PlaybackState, String> {
|
||||
Ok(PlaybackState {
|
||||
|
||||
Reference in new issue
Block a user