Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
How to play audio on a loop using NAudio library?

I wrote some code that sets new playlist each time at fixed intervals and then plays it, but after the first play, it doesn't play anymore. I still get 55 printed in the console, so my code is running, it's just the player stops working.

if (AlarmSystem.OutputDevice.PlaybackState != PlaybackState.Playing)
{
  var playlist = new ConcatenatingSampleProvider(AlarmSystem.GetTriggeredAlarmsPlaylist());
  AlarmSystem.OutputDevice.Init(playlist);
  AlarmSystem.OutputDevice.Play();

  Console.WriteLine(55);
}

I checked the audio playback also seems to be interrupted even though I am checking for PlaybackState and only run the above code if it's not PlaybackState.Playing.

I tried calling Dispose before also and even recreating OutputDevice but it doesn't play again.

In my code I am getting the new playlist so I can play that one after the old one finishes.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda