<commit_before>//! Provides an interface to output sound to the user's speakers.
//!
//! It consists of two main types: [`SoundData`](struct.SoundData.html)
//! is just an array of raw sound data bytes, and a [`Source`](struct.Source.html) is a
//! `SoundData` connected to a particular sound channel ready to be played.

use std::fmt;
use std::io;
use std::io::Read;
use std::mem;
use std::path;
use std::time;

use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use mint;
use rodio;

use crate::context::Context;
use crate::error::GameError;
use crate::error::GameResult;
use crate::filesystem;

/// A trait object defining an audio context, allowing us to someday
/// use something other than `rodio` if we really want.
///
/// End-users usually don't need to mess with this, but it's there
/// if you want to bypass `ggez`'s sound functionality and write your
/// own.
pub trait AudioContext {
    /// Returns the audio device.
    fn device(&self) -> &rodio::OutputStreamHandle;
}

/// A struct that contains all information for tracking sound info.
///
/// You generally don't have to create this yourself, it will be part
/// of your `Context` object.
pub(crate) struct RodioAudioContext {
    _stream: rodio::OutputStream,
    stream_handle: rodio::OutputStreamHandle,
}

impl RodioAudioContext {<commit_msg>Removes redundant imports on audio.rs<commit_after>//! Provides an interface to output sound to the user's speakers.
//!
//! It consists of two main types: [`SoundData`](struct.SoundData.html)
//! is just an array of raw sound data bytes, and a [`Source`](struct.Source.html) is a
//! `SoundData` connected to a particular sound channel ready to be played.

use std::fmt;
use std::io;
use std::io::Read;
use std::mem;
use std::path;
use std::time;

use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

use crate::context::Context;
use crate::error::GameError;
use crate::error::GameResult;
use crate::filesystem;

/// A trait object defining an audio context, allowing us to someday
/// use something other than `rodio` if we really want.
///
/// End-users usually don't need to mess with this, but it's there
/// if you want to bypass `ggez`'s sound functionality and write your
/// own.
pub trait AudioContext {
    /// Returns the audio device.
    fn device(&self) -> &rodio::OutputStreamHandle;
}

/// A struct that contains all information for tracking sound info.
///
/// You generally don't have to create this yourself, it will be part
/// of your `Context` object.
pub(crate) struct RodioAudioContext {
    _stream: rodio::OutputStream,
    stream_handle: rodio::OutputStreamHandle,
}

impl RodioAudioContext {
{'fraction_non_alphanumeric': 0.12846441947565543, 'fraction_numerical': 0.0, 'mean_word_length': 4.146435452793834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2427991', 'n_tokens_mistral': 792, 'n_tokens_neox': 769, 'n_words': 320}