mirror of
				https://github.com/talwat/lowfi
				synced 2025-10-31 03:08:46 +00:00 
			
		
		
		
	docs(internal): add internal documentation for ui::flash_audio()
				
					
				
			This commit is contained in:
		
							parent
							
								
									67a4c4f0ea
								
							
						
					
					
						commit
						503b4fe9db
					
				| @ -9,10 +9,9 @@ use mpris_server::{ | ||||
| }; | ||||
| use tokio::sync::mpsc::Sender; | ||||
| 
 | ||||
| use super::ui; | ||||
| use super::Messages; | ||||
| 
 | ||||
| use super::ui::audio_bar_flash; | ||||
| 
 | ||||
| const ERROR: fdo::Error = fdo::Error::Failed(String::new()); | ||||
| 
 | ||||
| /// The actual MPRIS player.
 | ||||
| @ -169,7 +168,10 @@ impl PlayerInterface for Player { | ||||
|             .load() | ||||
|             .as_ref() | ||||
|             .map_or_else(Metadata::new, |track| { | ||||
|                 let mut metadata = Metadata::builder().title(track.name.clone()).album(self.player.list.name.clone()).build(); | ||||
|                 let mut metadata = Metadata::builder() | ||||
|                     .title(track.name.clone()) | ||||
|                     .album(self.player.list.name.clone()) | ||||
|                     .build(); | ||||
| 
 | ||||
|                 metadata.set_length( | ||||
|                     track | ||||
| @ -189,8 +191,7 @@ impl PlayerInterface for Player { | ||||
| 
 | ||||
|     async fn set_volume(&self, volume: Volume) -> Result<()> { | ||||
|         self.player.set_volume(volume as f32); | ||||
| 
 | ||||
|         audio_bar_flash(); | ||||
|         ui::flash_audio(); | ||||
| 
 | ||||
|         Ok(()) | ||||
|     } | ||||
|  | ||||
| @ -48,7 +48,10 @@ lazy_static! { | ||||
|     static ref VOLUME_TIMER: AtomicUsize = AtomicUsize::new(0); | ||||
| } | ||||
| 
 | ||||
| pub fn audio_bar_flash() { | ||||
| /// Sets the volume timer to one, effectively flashing the audio display in lowfi's UI.
 | ||||
| ///
 | ||||
| /// The amount of frames the audio display is visible for is determined by [AUDIO_BAR_DURATION].
 | ||||
| pub fn flash_audio() { | ||||
|     VOLUME_TIMER.store(1, Ordering::Relaxed); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -5,9 +5,7 @@ use crossterm::event::{self, EventStream, KeyCode, KeyEventKind, KeyModifiers}; | ||||
| use futures::{FutureExt, StreamExt}; | ||||
| use tokio::sync::mpsc::Sender; | ||||
| 
 | ||||
| use crate::player::Messages; | ||||
| 
 | ||||
| use super::audio_bar_flash; | ||||
| use crate::player::{ui, Messages}; | ||||
| 
 | ||||
| /// Starts the listener to recieve input from the terminal for various events.
 | ||||
| pub async fn listen(sender: Sender<Messages>) -> eyre::Result<()> { | ||||
| @ -62,10 +60,8 @@ pub async fn listen(sender: Sender<Messages>) -> eyre::Result<()> { | ||||
|             _ => continue, | ||||
|         }; | ||||
| 
 | ||||
|         // If it's modifying the volume, then we'll call audio_bar_flash func
 | ||||
|         // so that the UI thread will know that it should show the audio bar.
 | ||||
|         if let Messages::ChangeVolume(_) = messages { | ||||
|             audio_bar_flash(); | ||||
|             ui::flash_audio(); | ||||
|         } | ||||
| 
 | ||||
|         sender.send(messages).await?; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user