C
Join ServerC#
help
❔ Error with Naudio
GGato2/19/2023
I only can play the audio once and then no sound is played
GGato2/19/2023
class:
public class MP3Player
{
private WaveOut Player = new WaveOut();
private WaveStream blockAlignedStream;
public void Open(string FileName)
{
blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(new Mp3FileReader(System.IO.File.OpenRead(FileName))));
Player = new WaveOut(WaveCallbackInfo.FunctionCallback());
Player.Init(blockAlignedStream);
}
public void Play()
{
Player.Play();
}
}
GGato2/19/2023
just play the sound once
GGato2/19/2023
then never plays again :c
Pphaseshift2/19/2023
Streams can normally be read once. Are you calling Open for each Play?
Rreflectronic2/20/2023
just a guess: you need to do
blockAlignedStream.Position = 0;
once you want to re-start the playbackGGato2/20/2023
yes i have to seek the stream to 0 again thanks
AAccord2/21/2023
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.