Alxandr / SpotiFire

A project to make a SpotifyClient in C#
http://nudoc.azurewebsites.net/SpotiFire
40 stars 19 forks source link

No sound is output #66

Open kmcoulson opened 8 years ago

kmcoulson commented 8 years ago

Hi, I cloned the repo for the first time today and it looks really good. However, I tried running the WinForms app to test it out and although everything seems to run fine no audio is output when a track is playing. Any idea why?

Alxandr commented 8 years ago

Sorry, no. I haven't looked at it in literally years, so I have no idea what might be causing it. One thing you can do though is to make sure that the music data is actually delivered to your sink by logging something or similar.

NeoLegends commented 8 years ago

to make sure that the music data is actually delivered to your sink

This. libspotify is recently causing more and more problems itself. It's deprecated, after all.

kmcoulson commented 8 years ago

Thanks, but how do I check that? Where in the code?

NeoLegends commented 8 years ago

Insert a Console.WriteLine("Music delivered!"); or something like that into this method.

kmcoulson commented 8 years ago

Oh, it is definitely hitting that event and the e.Samples length is not zero. However if I put a breakpoint here the BufferedBytes is always zero (I don't know if that is right or not).

NeoLegends commented 8 years ago

Hah. The samples are not added to the buffer. It just outputs "Enqueue" instead of enqueueing them. :D

You're very welcome to PR this into the repo. :)

kmcoulson commented 8 years ago

OK, could you give any advice on what needs to be done?

kmcoulson commented 8 years ago

I added this: buffer.AddSamples(samples, 0, samples.Length);

before this line and it seems to work. Does that seems like the correct thing to do?

NeoLegends commented 8 years ago

Exactly. I suggest you get a little into audio programming, ie. read about what PCM, audio samples, bit rates and sample rates are (and of course how libspotify's music delivery works). You'll get a much better understanding of whats happening within the code.

kmcoulson commented 8 years ago

Thanks, yeah I am reading up on it now. What I am trying to achieve is a server that shows up as a player in the spotify app so you can control what is playing from the native app. But then for it to broadcast whatever is playing and for that broadcast to be picked up and played by Raspberry Pis that are connected to speakers around the house. So I can play spotify in any room or multiple rooms.

Alxandr commented 8 years ago

Not doable unfortunately, until we get a new libspotify.