Skip to content

Listen Symphonia Decoded Audio from Cpal #280

Closed Answered by Tahinli
Tahinli asked this question in Q&A
Discussion options

You must be logged in to vote

Okay solved, main problem was I only play one channel. second problem is sample rate difference, I used rubato to make sample rate equal as my output device. I hardcoded some values as you can see, you can change them, it's just concept code.

use std::{fs::File, time::Duration};
 
use cpal::{traits::{DeviceTrait, HostTrait, StreamTrait}, FromSample};
use ringbuf::HeapRb;
use rubato::{Resampler, SincFixedIn, SincInterpolationParameters, SincInterpolationType, WindowFunction};
use symphonia::core::{
    audio::{AudioBufferRef, SampleBuffer, Signal},
    codecs::{DecoderOptions, CODEC_TYPE_NULL},
    formats::FormatOptions,
    io::MediaSourceStream,
    meta::MetadataOptions,
    probe::Hint,

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Tahinli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant