1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-04 10:19:27 +02:00

Refactor audio output to make it more modular.

This makes the player less hard coded to portaudio, and easier to
experiment with different backends.
This commit is contained in:
Paul Lietar 2016-03-14 00:49:21 +00:00
parent 4b73f83c5e
commit 9274a6bfb3
4 changed files with 69 additions and 30 deletions

View file

@ -10,6 +10,7 @@ use std::io::{stdout, Read, Write};
use std::path::{Path, PathBuf};
use std::thread;
use librespot::audio_sink::DefaultSink;
use librespot::authentication::Credentials;
use librespot::discovery::DiscoveryManager;
use librespot::player::Player;
@ -106,10 +107,14 @@ fn main() {
let reusable_credentials = session.login(credentials).unwrap();
reusable_credentials.save_to_file(credentials_path);
let player = Player::new(session.clone());
portaudio::initialize().unwrap();
let player = Player::new(session.clone(), || DefaultSink::open());
let spirc = SpircManager::new(session.clone(), player);
thread::spawn(move || spirc.run());
portaudio::terminate().unwrap();
loop {
session.poll();
}