HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: Chun-Yu on 2002-11-29 00:52:38

Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2002-11-29 00:52:38
I just wrote a simple Kernel Streaming output plugin for WA2 - check it out at http://www.cs.indiana.edu/~cshei/out_ks.dll (http://www.cs.indiana.edu/~cshei/out_ks.dll).  It's very experimental right now - it just uses the first output device it finds, and it's currently hard-coded to use 10 output buffers (so it might skip if you have all those WinXP visual effects enabled).  Source code is at http://www.cs.indiana.edu/~cshei/out_ks.zip (http://www.cs.indiana.edu/~cshei/out_ks.zip) (a VC++ .NET project - sorry VC++ 6 users).  I just wrote it this afternoon, because Microsoft released a Kernel Streaming demo today .  I'll be adding tons of stuff soon, including SSRC resampling (for those who are blessed with fixed sampling rate DACs  ) and selection of output device and # of buffers.

Annuka: using Kernel Streaming should prevent ALL other programs from using the sound device, which should solve the "Silence Flash" problem.

Edit: By the way, if you do give it a try, give me some comments/suggestions
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: cynix on 2002-11-29 01:36:24
will kernel streaming allow me to play mp3s while i'm in ntice?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Peter on 2002-11-29 01:38:44
out_ks.dll apparently needs msvc7 dlls, which i dont have on my win2k. i don't have msvc7 either, i use only msvc6.


Code: [Select]
dumpbin /imports out_ks.dll
Microsoft ® COFF Binary File Dumper Version 6.00.8447
Copyright © Microsoft Corp 1992-1998. All rights reserved.


Dump of file out_ks.dll

File Type: DLL

  Section contains the following imports:

    KERNEL32.DLL
              1000F064 Import Address Table
                    0 Import Name Table
                    0 time date stamp
                    0 Index of first forwarder reference

                  0  LoadLibraryA
                  0  GetProcAddress

    [b]MSVCR70.dll[/b]
              1000F070 Import Address Table
                    0 Import Name Table
                    0 time date stamp
                    0 Index of first forwarder reference

                  0  free

    SETUPAPI.dll
              1000F078 Import Address Table
                    0 Import Name Table
                    0 time date stamp
                    0 Index of first forwarder reference

                  0  SetupDiGetClassDevsA

    USER32.dll
              1000F080 Import Address Table
                    0 Import Name Table
                    0 time date stamp
                    0 Index of first forwarder reference

                  0  MessageBoxA

  Summary

        A000 UPX0
        3000 UPX1
        1000 UPX2
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Gabriel on 2002-11-29 08:03:51
Sorry, but what does "kernel streaming" means?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: cynix on 2002-11-29 10:14:50
Quote
Sorry, but what does "kernel streaming" means?

http://www.microsoft.com/hwdev/tech/stream/csa1.asp (http://www.microsoft.com/hwdev/tech/stream/csa1.asp)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: WaldoMonster on 2002-11-29 13:49:29
What are the advantages over a directsound output?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Peter on 2002-11-29 14:03:59
from my short IRC survey, you should give it a try if your favourite colors are blue and white.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2002-11-29 14:19:17
Ok - point taken, Peter.  Although I don't think msvcr70.dll is part of the .NET framework, it probably comes with it.  I've changed it to be statically linked (same URL).
Quote
What are the advantages over a directsound output?

Well, the main reason I wrote it is because Kernel Streaming prevents all other programs from playing sound, so my music won't be interrupted by some other sound (yes, I could just disable the Windows sounds, but I don't mind hearing them at other times).  Kernel Streaming bypasses the Windows KMixer and sends data directly to the audio driver, so I suppose another benefit would be that KMixer doesn't get to mess with your audio data (which can give you a warm, fuzzy feeling  ).  Generally, the main reason to use kernel streaming is to achieve extremely low latency output, because KMixer adds about 30 ms latency.  Low latency output isn't useful/possible with Winamp because the input plugins send data in like 13-26 ms bursts.  Low latency output is really useful for audio editing programs.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Peter on 2002-11-29 14:53:20
"low-latency output" is totally useless for music playback because it kills any underrun protection.
BTW, just tested your plugin, works on my win2k / terratec sixpack. i'm too lazy to look at the source but you should make sure that the thread which *started* playback doesn't die until playback is legally terminated, otherwise it makes bad sounds on stop (i had similar "problem" in out_ds a while ago, its a bug in win2k/xp WDM).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Jasper on 2002-11-29 15:18:33
Actually low-latency output doesn't have to (entirely) "kill" any underrun protection, since the audio files can usually be read faster than they are played, which means the program can still build up a buffer. Of course the small buffers that are sent to the soundcard will mean a little more skipping if you keep the processor real busy, but under normal use you shouldn't notice that a lot (I haven't had a single skip for months, and I'm using ASIO to output the sound, which has a very low latency).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Peter on 2002-11-29 15:25:32
depends what else you are using the computer playing music for.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2002-11-29 15:36:09
Quote
"low-latency output" is totally useless for music playback because it kills any underrun protection.

Yep - that pretty much what I just said in my previous post.

Quote
i'm too lazy to look at the source but you should make sure that the thread which *started* playback doesn't die until playback is legally terminated, otherwise it makes bad sounds on stop (i had similar "problem" in out_ds a while ago, its a bug in win2k/xp WDM).

Actually, I'm not starting any threads of my own - the IO is done asynchronously.  So what happens is that each buffer has an event associated with it, and IsPlaying() checks to see if any buffers aren't done playing yet.  So in theory, the input plugin should handle this, since that thread is *supposed* to check IsPlaying() and not quit until the output plugin is done playing.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Peter on 2002-11-29 15:45:42
yeah yeah. your plugin isn't creating threads, but playback is started from input plugin's thread; if user presses stop, this thread dies before you are closed. you need multithread hacks to workaround this. welcome in winamp v2.x input/output plugin hell.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2002-11-29 16:03:44
Ah! - now I see what you mean!  My plugin doesn't make werid noises when you hit stop, though.  Hmm.  I don't know - maybe the bug only happens when using DirectSound/MME?  The data is sent to the audio driver using asynchronous DeviceIoControl()s in my plugin, so I don't think the calling thread matters, as long as the buffer isn't deleted before the audio driver finishes with it.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Peter on 2002-11-29 16:11:18
i believe that exact effect depends on your drivers, i researched it back then in early out_ds2 days. the thing is, when the thread which *started* playback (eg. queued first waveOut block or called IDirectSoundBuffer::Start()) dies, playback dies too (usually with a weird sound, like on my card). this problem is relatively unimportant for basic functionality, but it will blow up when you try to add "gapless mode".
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2002-11-29 17:14:49
I'll look into it (probably just try it on a bunch of different soundcards) - thanks for the warning, Peter!  Gapless output isn't a very high priority for me right now, but it'll probably be added in the future, so I should find out about this...
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Case on 2002-11-30 13:12:52
Quote
using Kernel Streaming should prevent ALL other programs from using the sound device, which should solve the "Silence Flash" problem.

I tested this on SB Live!, SB Audigy and Turtle Beach Santa Cruz and other programs were able to play sound without any problems when out_ks was in use.

There's also very nice bug, it bluescreens my computer immediately if I don't disable my TV-tuner drivers (http://www.saunalahti.fi/cse/ati.png). It would be nice if it checked that it actually found sound card.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2002-12-01 17:32:23
Quote
Quote
using Kernel Streaming should prevent ALL other programs from using the sound device, which should solve the "Silence Flash" problem.

I tested this on SB Live!, SB Audigy and Turtle Beach Santa Cruz and other programs were able to play sound without any problems when out_ks was in use.

I suppose it depends on your audio driver.  I tested it on a Yamaha WaveForce 192 and it does allow other programs to play sound, but on a Creative AudioPCI no other programs can play sound.  Anyway, according to Microsoft's documentation, Kernel Streaming should take over the audio device:
Quote
Note

Using the DirectKS approach results in exclusive access to the audio device, which can break many aspects of the user experience, including disabling warning alert sounds and loss of interoperability with other audio applications.


Quote
There's also very nice bug, it bluescreens my computer immediately if I don't disable my TV-tuner drivers (http://www.saunalahti.fi/cse/ati.png). It would be nice if it checked that it actually found sound card.

Yep - I need to add device selection stuff.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jrj on 2002-12-02 06:21:29
On my system, currently using only a Realtek AC97 spdif out, the sample rate is being converted from 44.1 to 48 kHz as per normal kmixer experience. Shouldn't Kernel Streaming enable direct 44.1 digital output?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2002-12-02 13:24:44
Quote
On my system, currently using only a Realtek AC97 spdif out, the sample rate is being converted from 44.1 to 48 kHz as per normal kmixer experience. Shouldn't Kernel Streaming enable direct 44.1 digital output?

No, if your audio driver only outputs at 48 kHz (probably because your DAC only supports a fixed rate of 48 kHz).  I'm guessing that since the DAC is fixed at 48 kHz, so is the digital out (like the SB Live!?).  In this case, the sampling rate conversion isn't done by KMixer, but by the audio driver, which cannot be bypassed.  All I can suggest is...getting a new soundcard?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jrj on 2002-12-04 07:33:15
After a little further experimentation, it looks like your explanation is on the mark. As best I can tell, in my system, out_ks bypasses windows as desired (the winamp volume control doesn't work) and sends the bits to the Intel ICH4 chipset, which resamples to 48 kHz, then sends the bits to the Realtek AC97 Codec. That can be set to output either 48 kHz or 44.1, but since 44.1 involves another resample (down from 48) it sounds terrible. So I'm stuck resampling to 48 somewhere along the line, since the ICH4 seems to require it.

Too bad. I don't have another slot for a soundcard.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: c^2 on 2002-12-14 04:08:46
Any update on your progress, Chun-yu?  I'm really interested in this, as it would allow those of us without ASIO capable cards to bypass kmixer without using SSRC.  (SSRC uses up to 40% of my Athlon 650)

The current build works fine for me, but breaks into static when there is heavy activity on the PCI bus.  Would it be possible to put in an option to increase the buffers?  As I just use it for listening, I wouldn't mind the increased latency at all.  Or is there a bigger problem with increased buffers that I don't understand?

Edit:  I've found that if I boost Winamp's priority to high in task manager the static is no longer a problem.  I guess it was heavy CPU usage by another program that was causing the static.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: thomaspf on 2002-12-29 19:12:57
Chun-Yu,

great effort! A kernel streaming output has the potential of bypassing kmixer for more sound cards that allow pass through of PCM data but do not have an ASIO driver available.

In addition to resampling kmixer has the undesirable side effect of modifying all stream even if the input and output format are 16/44.1Khz. SSRC does not help with that either. If you upsample kmixer will mangle the upsampled stream before handing it to the sound card.  The effects of this are quite audible and affect any PCM data played through waveout or direct sound on sound cards with a native WDM audio driver. Another benefit of kernel streaming is very low overhead.

Many sound cards do have multiple devices on it and your current plugin follows the SDK sample in just taking the head of the enumerated list. One urgent feature request would be to provide for a selector for which device to use. By looking at the sample code I could not find a way to expose the actual device name but just giving the option to pick from a numbered list will do. Once you have that we could test this plugin for bit transparency via a digital output.

Cheers

    Thomas
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: KikeG on 2003-04-23 07:50:37
Ehm... any update on the plugin, Chun-Yu? 
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2003-04-23 14:21:16
Not yet - been real busy.  Should have much more time in about 2 1/2 weeks - when classes at IU end .
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: GaBMaTrIx on 2003-06-01 06:43:20
Hi,

I'm really seeking forward any update to your existing kernel streaming output plugin...! It's really an efficient plugin and bypassing the kmixer is certainly not a bad thing...

So, let us know on any update on this nice piece of work here...

Keep smiling...
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hiwi on 2003-06-23 16:58:18
Hi!

I wanted to try the plugin, too.

Using Case´s MPC-Plugin, Win98SE and Winamp 2.91, I couldn´t run the plugin.
After I selected the KS-Plugin as my Output-Plugin I get the message "CKsEnumFilters::EnumFilters failed" 

Had anyone the same message, or can somebody explain how to solve the problem.?

Thanks in regard
Hiwi
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2003-06-23 17:13:10
I don't quite remember, but I think kernel streaming only works in Windows 2000/XP (and *maybe* Me).  I'm pretty sure Windows98SE won't work.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hiwi on 2003-06-23 23:15:01
Thanks for your reply Chun-Yu!

I was just thinking of that, but i wasn´t sure, and it´s a bad feeling not really to know... 

Hiwi
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hiwi on 2003-06-23 23:16:30
Thanks for your reply Chun-Yu!

I was just thinking of that, but i wasn´t sure, and it´s a bad feeling not really to know... 

Hiwi

Edit: Sorry, just made a Doubleclick! Please remove this post!!!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: mackthen on 2003-07-01 19:55:42
wow, the improvement in sound when I use this is awesome, after trying this i enabled kernel treaming in Foobar and it sounds great too, I seem to have about three times the volume and much more clarity. 

Nice work
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: AstralStorm on 2003-07-01 20:07:46
Kernel Streaming just bypasses the mixer and its volume controls.
You shouldn't gain clarity unless you have superb equipment and ears.

(or mixing quality in Control Panel set to 'good', but that's unlikely)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Geeck on 2003-07-01 20:22:06
Quote
wow, the improvement in sound when I use this is awesome, after trying this i enabled kernel treaming in Foobar and it sounds great too...

Another placebo I guess??
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: mackthen on 2003-07-01 20:41:53
could it be that my sound levels on my system are screwed up somewhere and using this plugin bypasses the problem, because its honestly a huge improvement.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ZAKGUY on 2003-08-30 19:26:38
I love the concept of this plug-in 'cause like you I hate hearing game sounds and other Windows sounds while I listen to my music.  I do have one thing that I don't like about it that I was wondering if you could help me with.  My playlist will not automatically advnace and I have confirmed that the manual advance option is NOT checked.  Can anyone help me with this problem.  Also, I'm currently running Winamp 2.81.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2003-08-30 19:34:04
That's weird - it goes on to the next song just fine here.  Honestly, this was more just a test to try out KS than anything, I'd use Foobar2000 if you really want to use KS.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ZAKGUY on 2003-08-30 19:39:16
I assume that this is a Winamp plugin and if so, where can I find it?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ZAKGUY on 2003-08-30 19:45:33
Alright I answered my own question and it is a different program so I'm not going to get it.  However, maybe it's just that my version of Winamp won't function that way using the out_ks plugin.  What version are you running that seems to be working well with it?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2003-08-30 19:48:59
2.91, from http://classic.winamp.com/ (http://classic.winamp.com/).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ZAKGUY on 2003-08-30 19:56:50
I think I used to have that one and went back to an older version thinking it would help,  but I went ahead and got the newer winamp and I still can't get it to auto-advance my playlist.  This is beginning to seem like a lost cause.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: askoff on 2003-08-30 21:14:56
ZAKGUY: Maybay it's time for you to change audio player in windows...
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Pio2001 on 2003-08-30 21:48:07
I've got a problem that sound a bit similar : Playback freezes when the next track begins. The seek bar is at the beginning, but doesn't move.
I don't use ks, but I've got a Marian Marc 2 soundcard, that might behave alike in waveout, than another soundcard in ks.
It occurs with MP3 only, and playing with the "prebuffer" and "buffer ahead on track change" settings affects it.
Try them if they are available with KS.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ZAKGUY on 2003-08-31 00:57:12
Whoa, you're a genius that worked.  Thanks a bunch people.  Hopefully this will be my last visit here.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Krobar on 2003-11-07 17:24:22
Thanks for writing that plugin Chun-Yu,

I can pass DTS and Dolby 5.1 sucessfully through Winamp now! There are a couple of bugs I get though, the first is pretty trivial and that is there is a little pop/crackle whenever I start, stop or change track. The second issue might be driver related but Im unsure, if I for example cause a windows noise like clicking the back button in My Computer the noise occurs and then winamp and then Winamp goes silent until I change the track, no other windows sounds work afterwards either. Muting the main volume in the Sound card control panel and then making a windows noise means the one windows noise does not occur but winamp still goes silent.  Iam using a Terratec Aureon Sky card and Win2K SP3.

zZzZzZzZzZ,

I notice you use a Terratec card also, does the digital out work with the Winamp ASIO output plugin?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: quazi on 2003-11-21 19:41:37
this is weird.  While using the plugin, I still got IE to play web-sounds over the top of Winamp.  Isn't KS supposed to nuke all other channels?

OS : Windows XP Pro
Winamp : v2.91
Sound card : Sound Blaster Audigy
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ricky_casson on 2003-12-18 18:02:26
Does anyone have any tips for what I should do to start developing an application in C# that uses kernel streaming similar to Chun-Yu's to play back and audio stream?

Edit:.....


This post doesn't seem to be getting much attention, maybe being a little more specific will help.

What i'm trying to do is make the methods of the original API that has been written by Microsoft accessible through C#.
My plan has been to export classes used in the API written in C++ into a managed dll, however, I am now having problems with this approach as some of the classes allow private access via the 'friend' keyword, which in turn presents problems. Does anyone know of any way in which this problem could be dealt with?


Regards,

Richard.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: neithern on 2004-06-16 02:43:27
I have read the source code of the output plugin, but I don't found how to change the volume. Output of foobar has no volume setting, also. So Chun-Yu, can you tell me how to change volume?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2004-06-16 15:17:40
The Wave volume slider may not work, but the main one still should (in the Windows mixer).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: neithern on 2004-06-17 01:47:15
Quote
The Wave volume slider may not work, but the main one still should (in the Windows mixer).

thank you!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: hustbaer on 2004-06-29 01:05:50
@ricky_casson:

ahm. i wouldn't want to use c# for such a thing, but if you really really want...
...just pack it into a nice COM interface and use COM interop.

(creating a COM component is really pretty simple using VS2003 and attributed C++ code)

that way you'll at least get rid of the damed "managed" stuff and be fine with knowing when what happens and why in advance and not only after spending 100s of hours in the debugger.

i mean .net ist sure a neat thing for applications, but trying to pack something that handles hardware stuff at a pretty low leven (as compared to typical .net code) is nothing i'd ever want to do.

just make sure your component is at least free threaded and that you don't do any "nasty" stuff from event-handlers up in the managed code.
(e.g. making an existing control visible for the first time from a COM interop event handler is not a good thing. locks up your code - need to call .CreateControl() first because of threading issues. thanks MS)

EDIT:

anyone knows what's the official way to get those KS utility-classes from MS? are they DDK, SDK, ... ? (DX SDK summer 2003 don't even mention them)

regards,
hustbaer
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: hustbaer on 2004-06-29 02:04:14
@Chun-Yu:

nice work :-)
i don't know if you are going to do any further work on this, anyway i found 2 bugs.

1) in open() you check "if(!pin)" and do a retry "pin=create..." but never check the result of the 2nd create (could be NULL too)
2) in open() you set nBlockAlign to nch*bits/8 but i think it should be 4 (EDIT: 4*nch of course) for 20bitPCM, 24bitPCM and 32bitPCM. maybe wBitsPerSample should be 32 too and only wValidBitsPerSample set to 20/24 respectively, but ... that's one thing i don't really know too :-)

regards,

paul
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: nitecrawler on 2004-08-29 22:50:58
Im using WA.

I'm Going Nutz... with this "One at a Time" crap... Help!!!
Need Some Help!!!

Problem: I can only play one song at a time, then I have to click on the next one manually in order for it to play. It will not go to the next one automatically, And it will not start back at the begining of the song. The "slider bar thing" just sits at the end of the song.

Please do not post "Advance Playback Settings/uncheck Manual playlist advance" as this is NOT a solution to my problem.

I believe the problem is a conflict with a plugin/output called "Simple Kernel Streaming output" [out_ks.dll] and my sound card. This plug-in allows me to listen to songs without any other interference in the background. I say this because i'm running XP on both my Desktop and laptop and the desktop is fine but the laptop (with exact same settings) is causing this problem.

If anyone knows of a solution or possible alternative to listening to my songs without any other sounds comming through while playing my songs. please let me know!!!

P.S. My sound card is "SoundMAX Digital Audio"

--
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Chun-Yu on 2004-08-30 01:18:51
<cough> foobar2000 </cough>

Another solution (not a simple one) is to disable all Windows sounds (and other in-program sounds like in IM clients, etc.).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: va3atc on 2004-09-11 22:24:17
Quote
Quote
On my system, currently using only a Realtek AC97 spdif out, the sample rate is being converted from 44.1 to 48 kHz as per normal kmixer experience. Shouldn't Kernel Streaming enable direct 44.1 digital output?

No, if your audio driver only outputs at 48 kHz (probably because your DAC only supports a fixed rate of 48 kHz).  I'm guessing that since the DAC is fixed at 48 kHz, so is the digital out (like the SB Live!?).  In this case, the sampling rate conversion isn't done by KMixer, but by the audio driver, which cannot be bypassed.  All I can suggest is...getting a new soundcard? ;)
[a href="index.php?act=findpost&pid=47078"][{POST_SNAPBACK}][/a]


I have the exact same problem under Windows 2000.

I used the NVIDIA linux drivers for Realtek ALC650 (same as yours or darn close) nForce2 in Redhat 8.0 and played the 44.1khz DTS stream bit-perfect
cat my-dts-audio.wav > /dev/dsp

Though I've tried both ASIO and Kernel streaming in Win2k and it STILL upsamples to 48khz.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Sicter on 2004-09-11 23:47:41
Is there any ASIO or KS solutions for DirectShow based players? Anything bypassing kmixer for these players? If not, is there anybody trying to write such a filter?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: AstralStorm on 2004-09-12 11:42:53
As far as I know, there's none.
DirectShow plugins are codecs, not sound i/o. (Correct me if I'm wrong.)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Sicter on 2004-09-12 12:14:23
Err, DirectShow plug-ins can be anything not just codecs. WMP or Zoomplayer are DS players (among others), Winamp is not.
btw, I'm no expert at all so you correct me if I'm wrong
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Vertigo on 2005-03-29 04:35:37
Yes, you can pass directshow to winamp...otherwise it would be quite hard to play video in it.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-05 21:17:00
Hi, I've spent a little time reworking Chun-Yu's Kernel Streaming plugin and I think I've fixed most of the issues people were having with it (i.e. stability and output device selection).

If anyone is interested in trying it out, you can find the plugin here (http://tinyurl.com/ng548) and the revised source code here (http://tinyurl.com/ng548).

Essentially, I've made two major changes.

Firstly I've reworked how filters are handled so that the plugin no longer tries to delete the filter while it's still playing, it will now wait until it gets notified that playback has stopped before ever trying to delete it, this seemed to be the major cause of some pretty nasty crashes.

In addition, I've stopped the plugin from deleting and recreating the filters every time tracks are started or stopped. On the plus side, this means that track changes are now handled a lot quicker with less audible disturbance.

On the downside, it means that kernel streaming is engaged until you quit Winamp. If you attempt to switch to another output plugin and try to play without first quitting and restarting Winamp, the new filter will probably fail because kernel streaming has still got hold of the output device, it shouldn't crash, but Winamp will repeatedly attempt to restart the track and pop up an error, which can be awkard to get out of (repeatedly pressing enter while clicking on Stop seems to do the trick). I'd clean it up properly, but there doesn't appear to be any way of being notified that your plugin is being deselected.

Anyway, for safety, the golden rule is - always shut down Winamp immediately after switching from this plugin to any other.

The second major change is that I've added a simple dialog to allow the selection of different output devices, this was added primarily for my M-Audio card which needed the output routing explicitly to the SPDIF socket to get an uncorrupted (i.e. not resampled) bitstream for HDCD playback.

Unfortunately, the options listed are device paths which are not really human friendly, but at least it gives you an option to experiment with the available devices without having to recompile and hack the plugin like I originally did. If I ever find out how to derive the friendly name from the device path, I'll post an update with the fix.

I can't guarantee that the plugin will be totally stable for you, but on my test machine, with these fixes it went from crashing (and restarting the PC!) every couple of songs with the original plugin to not crashing at all so far, with several hours of random play and lots of manual track swapping under its belt.

Any feedback is welcome, if there are any problems I will attempt to fix them when time permits. Hope it proves useful for you.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-08 00:14:22
Looks like I spoke to soon about the stability. I've just posted a newer version of the plugin that doesn't crash when unpausing. I've also spotted another minor issue where the pause status gets screwed up if you change tracks while it's paused, pressing pause a further couple of times seems to rectify this. I'll sort that out over the weekend.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bansal98 on 2005-12-08 06:42:07
Quote
Looks like I spoke to soon about the stability. I've just posted a newer version of the plugin that doesn't crash when unpausing. I've also spotted another minor issue where the pause status gets screwed up if you change tracks while it's paused, pressing pause a further couple of times seems to rectify this. I'll sort that out over the weekend.
[a href="index.php?act=findpost&pid=348472"][{POST_SNAPBACK}][/a]


Cool. Will try it out today at home. I am a big fan of kernel streaming output method. Is there any way the volume control on Winamp can be used with this?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-10 10:52:12
I could implement the volume control, but it defeats the point of kernel streaming - the point being to get an uncorrupted bitstream - as I'd have to scale every sample as they pass throught the plugin - effectively corrupting them although, nothing like as much as KMixer does.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-10 19:10:06
I've fixed the pause problem mentioned above (where switching tracks while paused would require a couple of presses of the pause button to set things going again), I've also fixed the problem that someone mentioned earlier where playback would stop at the end of a track rather than moving onto the next one. I started getting this one with uncompressed WAV files, strangely I didn't get it with WavPacked files.

The latest plugin (v2.2) and source are available at the links I provided earlier, i.e.

here (http://tinyurl.com/ng548)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bansal98 on 2005-12-12 06:14:53
Quote
I've fixed the pause problem mentioned above (where switching tracks while paused would require a couple of presses of the pause button to set things going again), I've also fixed the problem that someone mentioned earlier where playback would stop at the end of a track rather than moving onto the next one. I started getting this one with uncompressed WAV files, strangely I didn't get it with WavPacked files.

The latest plugin (v2.2) and source are available at the links I provided earlier, i.e.

Plugin V2.2 (http://tinyurl.com/c496m)

Source for V2.2 (http://tinyurl.com/7q42e)
[a href="index.php?act=findpost&pid=349200"][{POST_SNAPBACK}][/a]


I am having a problem with this plugin. None of the DSP plugins are working now (with DirectSound). I generally use Ozone and it used to work fine with original KS plugin. I am using Winamp 5.12. Thanks!!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-12 22:37:53
Hi Manish, can you give me a little more details about the problem you're having. I've just downloaded iZotope Ozone Free and it seems to work fine on my development machine along with the KS plugin (I'm running Winamp 5.112).

What kind of problem are you getting? What steps are required to recreate it? Do you get an error message?

You mentioned DirectSound, are you having problems switching from KS to DirectSound? This latter issue is documented above (you need to shut down and restart Winamp when switching from this KS output plugin to any other output plugin BEFORE trying to play any further tracks because KS still has hold of the audio device).

If you can give me a more detailed overview of what's going wrong and under what circumstances it happens, I'll see if I can sort it out.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bansal98 on 2005-12-13 05:20:04
Thanks Steve. The DSPs are working now.
Is there any way to link the Winamp volume control to the main Windows volume control in the taskbar?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: iTCHYmix on 2005-12-16 08:21:50
Hello.

Good to see some progress on this (other than my own custom tweaks which i did a while back).  Thank you for the updates.

One issue i'd like to note: Since kernel stream will have exclusive access to the audio ouput, you will not hear any other sounds from other apps.  This is okay while the music is playing in winamp but lets say I press stop on winamp and have it running in the background w/o music.  Since the filter wasnt destroyed when the playback was stopped/paused, any application (such as video players - MPC, WMP, etc) will not have sound until the winamp is completely shutdown.

Heres how to recreate this scenario:

- Run winamp
- Use any movie player to start a video (video will play with sound)
- shutdown the video player and start playback of a song in winamp
- reopen movie player and replay a video (video will play without sound).  No other sound will be heard until winamp is completely shutdown and video is restarted.

I usually have winamp running constantly in the background using (Advanced Control) to keep it in the system tray so this is an issue.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-16 17:21:17
Hi iTCHYmix,

thanks for the feedback. Yes, I'm aware of that problem.

As a matter of fact, I intentionally coded it to do that for improved stability. As I use the plugin on a PC that is dedicated for music playback solely from Winamp this has not been an issue for me.

However, the main stability problem was fixed when I placed interlocks around the filter destruction so that it waited for playback to actually stop before destroying the filter. Therefore it should be possible to restore the original functionality (i.e. create filter at start of playing a track, destroy it at the end of each track) without any detriment to the stability.

When I started modifying the plugin, my main objective was to find a stable way of getting an uncorrupted bitstream out of the computer over SPDIF which I seem to have accomplished as the plugin has been rock solid since my last batch of changes and I can now externally decode HDCD (probably the litmus test of bitstream corruption).

Anyway, I'm intending to do some further work on the plugin over christmas to add some of the features people have asked for and generally tidy the thing up a bit. Currently, I'm thinking of adding the following features which should hopefully cover the requirements of both Manish and yourself;

1. An option to either hold onto the audio device (as it currently does) or release it between tracks (like it used to do).

2. Some form of volume control that can optionally be disabled to ensure an uncorrupted bitstream over SPDIF (essential for external HDCD decoding).

3. Human friendly device names in the config screen (if anyone can suggest how to derive these from the device path I'd love to know).

Hopefully I should be able to post an update in a couple of days.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-24 16:24:14
Hi all, there's an updated version of the Kernel Streaming Plugin now available here (http://tinyurl.com/ng548). This now has the following new features;

1. The WinAmp volume control now works. This can be disabled in the config if required (for example, to ensure an unmodified bitstream for HDCD).

2. The plugin will now release the audio device each time a track ends or Stop is pressed, again, this behaviour can be disabled in the config if required.

3. The Output Device list box now uses "friendly names" rather than the pretty meaningless device paths it previously used - should make it easier to tell what you're actually selecting.

4. I've added a comprehensive readme to the .zip file that details the various features of the plugin and any outstanding issues that I'm aware of.

Enjoy.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hyperion on 2005-12-24 22:06:41
Thanks for your hard work,Steve!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bansal98 on 2005-12-27 07:01:07
Thanks a lot!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Gabes Dad on 2005-12-28 19:39:30
Steve,

Great work.

One question, does anyone else have trouble using this output plugin with streams?  I get the error "sorry, can't disk write streams".  In the plugin setup I have "enable volume control" and "release audio device when stopped" checked, but after the error occurs and I open the preferences, everything is unchecked and no output devices are displayed.

It seems as though streams without a file extension ending (i.e., an ip address and port only) won't play, whereas streams with a file extension (i.e., .mp3, .acc, .ogg, etc.) will play fine.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-28 20:45:06
Hmm, I see what you mean. Looks like the plugin is being seen as a disc writer for some reason and being blocked. Other output plugins seem to work (e.g. Direct Sound) so I'm not sure what's so special about the KS one.

The problem with the settings changing looks like the KS plugin is trashing it's configuration variables which is rather suspicious, however, if you close down and restart Winamp, the previous settings are restored.

If I get a chance I'll take a look at it tomorrow with the debugger and see if I can suss out what's going on.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: krabapple on 2005-12-29 06:52:47
Quote
After a little further experimentation, it looks like your explanation is on the mark. As best I can tell, in my system, out_ks bypasses windows as desired (the winamp volume control doesn't work) and sends the bits to the Intel ICH4 chipset, which resamples to 48 kHz, then sends the bits to the Realtek AC97 Codec. That can be set to output either 48 kHz or 44.1, but since 44.1 involves another resample (down from 48) it sounds terrible. So I'm stuck resampling to 48 somewhere along the line, since the ICH4 seems to require it.

Too bad. I don't have another slot for a soundcard.
[a href="index.php?act=findpost&pid=47525"][{POST_SNAPBACK}][/a]



How does one determine in detail the pathway and conversions that audio bits take on their way out of the computer like this?  I'd love to know exactly what is happening in my PC (which succesfully outputs via kernal streaming/foobar via coaxial out of the soundcard) and laptop (which does not seem able to use kernal streaming, even though it's an option in the f2k config menu, when using f2k and a USB out for audio).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-31 15:45:37
I've posted a new version of the plugin (V2.4) here (http://tinyurl.com/ng548) which fixes the problem of settings disappearing from the config menu when no tracks are playing (as reported by Gabes Dad).

The issue where streaming media (e.g. Internet Radio) doesn't play is an interesting one. I suspect this is an anti-copy mechanism to prevent Stream Ripping. I'd guess the stream decoder checks the current output plugin to see if it's an approved plugin (such as Nullsofts own Wave Out and DS plugins) and if not, it assumes it's a stream ripper and refuses to play. I've posted a message about this in the Winamp Developer forum to confirm this or see if there's a workaround. I'll let you know what I find.

The latest version of the plugin also contains a new feature which (optionally) performs 2x oversampling on any input <= 48KHz. So, 44.1KHz becomes 88.2KHz and 48KHz becomes 96KHz. Personally, I can't hear any difference on my HiFi gear and given that most modern DAC's oversample anyway it's not really that much of a surprise. Still, it may be of benefit to someone, so I've left it in. It's disabled by default because it will block HDCD decoding (as it's basically inserting extra samples into the bitstream and therefore, in essence, corrupting the original data, although, not in the same destructive way as KMixer does with its Resampling). I'd be curious to know if anyone can hear a difference with this enabled.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-31 16:14:07
Quote
How does one determine in detail the pathway and conversions that audio bits take on their way out of the computer like this?  I'd love to know exactly what is happening in my PC (which succesfully outputs via kernal streaming/foobar via coaxial out of the soundcard) and laptop (which does not seem able to use kernal streaming, even though it's an option in the f2k config menu, when using f2k and a USB out for audio).
[a href="index.php?act=findpost&pid=352987"][{POST_SNAPBACK}][/a]


I don't think there's an easy way to determine this other than researching chipsets and drivers on the Internet and even then it's probably difficult to be sure.

However, you can prove if your bitstream is being corrupted in some way by attempting to decode HDCD recordings with an external DAC or AV amp via SPDIF. If the external decoder can successfully "lock on" to the HDCD content (usually shown by some kind of visual indicator) then the bitstream has not been corrupted. Obviously, to do this you need to possess a suitable outboard decoder (and some HDCD material), but it's one of the simplest ways to determine if your bitstream is being "modified" in any way. The slightest change to the bitstream will prevent HDCD from being decoded, this is why I recommend leaving the volume control and oversampler disabled in the Kernel Streaming plugin if you listen to a lot of HDCD recordings.

In my tests with my M-Audio Audiophile 2496 outputting via SPDIF, I could not get uncorrupted HDCD out of the card via any Winamp output plugin other than Kernel Streaming. With Kernel Streaming it just worked perfectly (unfortunately the plugin itself was very unstable - leading to my recent redevelopment of it).

Hope that helps.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ivalladt on 2005-12-31 18:07:31
Is Winamp 2 still downloadable from anywhere?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-31 18:56:10
Quote
Is Winamp 2 still downloadable from anywhere?
[a href="index.php?act=findpost&pid=353624"][{POST_SNAPBACK}][/a]


Hi, I don't actually know if you can still get hold of Winamp 2, but the plugin works with all versions of Winamp from 2 onwards. I'm using it with 5.112.

Hope that helps.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2005-12-31 19:30:49
Thanks for this plugin! My brother has tried to get bit perfect optical transfer to his stereo for some time and I hope this can do it him for.

One thing that happen for me when some load is put on is that i crackles like hell like if I used to low latency with an ASIO driver... Is it possible to add a latency option in the plugin to maybe make it less "fragile"?

Thanks alot for this one!

Best Regards
Rickard Gerthsson
Sweden
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2005-12-31 19:50:03
Your welcome, I hope it does the trick for him, although, please bear in mind that it is dependent on the hardware whether or not the bitstream gets through untouched.

I can't say that I've experienced any crackling, but I'm not using ASIO drivers and run it on a 2.6GHz PC whos sole purpose is to play music through my HiFi, so I guess I'm not really stressing the CPU.

If you are experiencing problems of this nature, make sure you've got both the oversample and volume control disabled as they both make heavy use of the CPU.

In the longer term, I'll take a look at making the packet size adjustable, it's currently 8K per packet which is roughly 46mS or 1/21 seconds, so a larger packet size may help.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-01-01 06:21:50
I am using E-MU 1820M with the latest 1.81 drivers if that might help... I also noticed that sound can go silent for like half a second if I click up mIRC or program that has been minimized. It doesn't not happen every time I do, far from, but I just wanted to let you know about it.
Regards
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-01 21:55:09
There's a new version of the plugin (V2.5) here (http://tinyurl.com/ng548) which fixes the problem with streaming media (e.g. internet radio). I've also added support for playing back 24 bit media - if anyone has any (I had to make my own  ).

I've spent quite a while looking into punkrockdude's crackling problem and I think I know why it's happening, but, it's a bit tricky to fix as it stands.

In essence, despite having an 8K output buffer, Winamp is only sending me around 2K of sample data, so each sample packet sent off to the sound card is really small (only 576 sample pairs for 16 bit stereo) which means that the plugin can be quite susceptible to heavy processor usage (causing gaps between packets as the processor gets busy doing something else).

I had a look at buffering the small packets that WinAmp sends to me then, once I've got enough for a full packet sending it off to the hardware, but, given the WinAmp plugin framework, that's quite difficult to manage leading to various new problems so I've stripped all of that out for now.

Still, if I can come up with a workable solution that doesn't cause any new problems, I'll put it in.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-01-02 02:48:22
Quote
I've spent quite a while looking into punkrockdude's crackling problem and I think I know why it's happening, but, it's a bit tricky to fix as it stands.


Thanks alot Steve! I really appreciate your help. I will download the update right away and try it out. I will get back to you and everyone else on how it works.
Happy New Year by the way!

Best Regards
Rickard G
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: callmeace on 2006-01-02 04:38:08
Thankyou very much for your improvements and time spent on this

The only problems I have had - which don't occur when I'm not using out_ks, was 'break up' of sound sometimes when dragging a scroll bar up or down in a program like internet explorer. or when another program does something intensive.

I am using:

Windows XP SP1
 
Soundcard as reported Creative AudioPCI (ES1371,ES1373) (WDM) which doesn't find an updated driver so I guess latest drivers installed. I think it is branded as a Creative PCI 128

Pentium 3 'Tualatin' 1.13ghz (not overclocked)

DirectX 9.0c

I run a generally clean system without lots of unnecassery programs running at startup. I avoid running many resource-hungry apps at the same time.
Does avoiding the Kmixer resampling mean that playing music via out_ks should takeup less system resources?

Anyway, hope my little report is some small help, thanks a lot
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-02 12:00:28
Thanks for the feedback guys, it's really appreciated.

Quote
The only problems I have had - which don't occur when I'm not using out_ks, was 'break up' of sound sometimes when dragging a scroll bar up or down in a program like internet explorer. or when another program does something intensive.
[a href="index.php?act=findpost&pid=353880"][{POST_SNAPBACK}][/a]


It sounds like the same problem as punkrockdude is experiencing, it's caused by the flow of data from Winamp to the sound card being disrupted because the CPU is busy doing other stuff (redrawing windows and so on). As Winamp is only sending very small packets to the plugin it only needs the CPU to be kept busy for a short period of time before an audible break in the data flow occurs.

As I said to punkrockdude, disabling the volume control and the oversampling may help as it reduces the amount of work the plugin is doing.

Unfortunately I can't reproduce this effect as my slowest machine is a 2.6GHz Celeron and, apart from the occasional pause when maximising windows I don't get any problems (I even tried loading the CPU up the other day doing simultaneous video and MP3 encoding with other apps while running Winamp and had no problems).

I'll try a new approach to buffering the data using another thread to drive it along and see if that helps, although that's essentially a rewrite but it may allow me to get rid of a couple of other bodges that have so far eluded me.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-01-02 15:53:51
Quote
I'll try a new approach to buffering the data using another thread to drive it along and see if that helps, although that's essentially a rewrite but it may allow me to get rid of a couple of other bodges that have so far eluded me.


I am impressed by your dedication and helping. I really look forward to every update you will make. I tried a kernel streaming output plugin in Foobar which has adjustable buffer that I adjusted higher than the standard value around 20ms which solved all my problems... But, I would like you too pull it off so I will keep "helping" you out until you have fixed it

Regards
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-02 16:16:09
Quote
I am impressed by your dedication and helping. I really look forward to every update you will make. I tried a kernel streaming output plugin in Foobar which has adjustable buffer that I adjusted higher than the standard value around 20ms which solved all my problems... But, I would like you too pull it off so I will keep "helping" you out until you have fixed it

Regards
[a href="index.php?act=findpost&pid=353967"][{POST_SNAPBACK}][/a]


Thanks, it's actually been quite fun to do. My original intention was only to sort out the stability problems which were affecting me (and from what I've read, other people too) however with that out of the way it's surprising how many other enhancements can be added to something like this.

I imagine that the Foobar API is a little more flexible than the Winamp one which is probably best described as "basic" (Foobars API looks huge from what I've seen). Still, it does make it very easy to get to grips with when starting from first principles, but it gets in the way when trying to add features such as buffering to this plugin (partly a fault of the way the plugin is currently structured too).

In order to add buffering I'm going to have to internally split the plugin into two parts, one part to talk to Winamp and a second part which will run pretty much independently handling the actual streaming side of things and acting on messages from the other half. If I can put this together in the time I have available (back to work in a couple of days - no more time to play), then I'm pretty confident it will solve your problems.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-01-02 16:56:38
Quote
Quote
I am impressed by your dedication and helping. I really look forward to every update you will make. I tried a kernel streaming output plugin in Foobar which has adjustable buffer that I adjusted higher than the standard value around 20ms which solved all my problems... But, I would like you too pull it off so I will keep "helping" you out until you have fixed it

Regards
[a href="index.php?act=findpost&pid=353967"][{POST_SNAPBACK}][/a]


Thanks, it's actually been quite fun to do. My original intention was only to sort out the stability problems which were affecting me (and from what I've read, other people too) however with that out of the way it's surprising how many other enhancements can be added to something like this.

I imagine that the Foobar API is a little more flexible than the Winamp one which is probably best described as "basic" (Foobars API looks huge from what I've seen). Still, it does make it very easy to get to grips with when starting from first principles, but it gets in the way when trying to add features such as buffering to this plugin (partly a fault of the way the plugin is currently structured too).

In order to add buffering I'm going to have to internally split the plugin into two parts, one part to talk to Winamp and a second part which will run pretty much independently handling the actual streaming side of things and acting on messages from the other half. If I can put this together in the time I have available (back to work in a couple of days - no more time to play), then I'm pretty confident it will solve your problems.

Cheers,
Steve
[a href="index.php?act=findpost&pid=353971"][{POST_SNAPBACK}][/a]


I really look forward to see what you will come up with. I will check this thread several times each day to be up to date on it
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Gabes Dad on 2006-01-02 17:13:57
Steve,

I don't know if you have used ASIO4all (http://www.asio4all.com/) or not but it has buffering built in and I believe the buffer size is changeable.  I haven't used it in a while and I believe a newer version has been released since then.  To use it with winamp, you also need the asio output plugin.

Anyway, I don't believe the source code is available, but I believe the author would be willing to give you any advice needed.

One other small thing, which really isn't an issue for me, but if you try playing something from the "winamp music" (not shoutcast radio or aol xm radio) of the online media section in the media library, it will play but choppy and at the incorrect speed.  This plays fine with DirectSound and it the winamp modern skin is showing a 44.1k sampling rate and 65 kbps bitrate, although the audio sounds like a lower sampling rate - I though it may just be a sampling rate my sound card couldn't handle.  Anyway just wanted throw this out there for troubleshooting.

By the way streaming (with and without extensions) works great on my setup.  Thanks for all the hard work.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-02 17:28:55
Quote
I don't know if you have used ASIO4all (http://www.asio4all.com/) or not but it has buffering built in and I believe the buffer size is changeable.  I haven't used it in a while and I believe a newer version has been released since then.  To use it with winamp, you also need the asio output plugin.

Anyway, I don't believe the source code is available, but I believe the author would be willing to give you any advice needed.


Hi, nope, I haven't had a play around with ASIO drivers as I'd pretty much got the Kernel Streaming plugin doing what I needed. Might take a peek though.

Quote
One other small thing, which really isn't an issue for me, but if you try playing something from the "winamp music" (not shoutcast radio or aol xm radio) of the online media section in the media library, it will play but choppy and at the incorrect speed.  This plays fine with DirectSound and it the winamp modern skin is showing a 44.1k sampling rate and 65 kbps bitrate, although the audio sounds like a lower sampling rate - I though it may just be a sampling rate my sound card couldn't handle.  Anyway just wanted throw this out there for troubleshooting.


Yep, it does the same for me (I'd never even noticed the "Winamp Music" option!). I reckon it's either the latency value I pass back to Winamp on initialisation or the GetOuptutTime/GetWrittenTime functions which (as far as I can see) don't return "proper" values. Another one for the bug list.

Quote
By the way streaming (with and without extensions) works great on my setup.  Thanks for all the hard work.


Great, glad to hear it. Once again, thanks for the feedback.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-03 13:47:13
There's an alpha version of the new plugin available here (http://tinyurl.com/ng548) (V3.0 alpha). This is an incomplete work in progress version which lacks the following features (for now);

pause
volume control
24 bit support
oversampling

It's essentially a rewrite and uses my new buffering technique which I hope will solve the crackling under load problem. It also now seems to work better with "Winamp Music" with just a little breakup at the start.

It seems to behave okay here but I'd like to know if it makes matters any better (or worse) for those of you who were getting the breakup under load problems (e.g. punkrockdude and callmeace), I'd appreciate it if you guys could give it a try and let me know how it goes.

This plugin is V3.0 alpha, so you'll have to select it as the output plugin instead of the existing one. All config settings other than Output Device are ignored for the minute and you may need to re select your output device if you are not already using the default.

This is test code and although it works fine for me it may crash your systems, so I'd recommend saving any important data before you try it. As usual, you try it at your own risk (although it shouldn't do anything catastrophic).

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-01-03 15:22:53
Great work Steve! I can't seem to get any crackling or machinery sound with the new version! Wait... some stuttering happened now. But maybe that is my computers fault and not a bug in your plugin...
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-03 15:29:01
Quote
Great work Steve! I can't seem to get any crackling or machinery sound with the new version! Wait... some stuttering happened now. But maybe that is my computers fault and not a bug in your plugin...
[a href="index.php?act=findpost&pid=354262"][{POST_SNAPBACK}][/a]


That sounds promising, I don't like the stuttering though. It might help if you can give me the following details;

When it stuttered...
What other stuff was running at that point?
Were you doing anything with the machine at that point?
Was it at the start of a track or part way through?
What kind of media were you playing (i.e. wav, mp3, radio streams etc)?
What speed / type of CPU have you got?

Thanks for your help.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Gabes Dad on 2006-01-03 15:53:35
The new alpha plugin is working well here for me as well.  I did have some stuttering before with the old plugin, but I can't remember if that was on my 1 Ghz P3 at home or my 2.8 Ghz HT P4 at work (I'm currently using my work machine).  It also works fine with Winamp music.

The only thing I noticed different when examining winamp and its associated processes with Process Explorer is that a thread for out_ks3.dll shows up as a subset of the winamp threads.  When using the out_ks25.dll output, no corresponding thread appeared under the winamp threads.  The differences are probably due to the rewrite.  There was a slight increase in winamp CPU usage (from an peak of 0.75% to 1.5%), but perhaps the old plugin showed up under a different thread.

Great Stuff.

Edit: Just noticed something quite strange.  When playback ends (for me the end of the playlist), Winamp's CPU usage jumps to a constant 50% (on a hyperthreaded machine) and when examining this in process explorer it appears that out_ks3.dll is the one using the full 50%.  The process does terminate fine when shutting down winamp so at least that is good.  Hope this helps.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-03 16:35:23
Quote
The new alpha plugin is working well here for me as well.  I did have some stuttering before with the old plugin, but I can't remember if that was on my 1 Ghz P3 at home or my 2.8 Ghz HT P4 at work (I'm currently using my work machine).  It also works fine with Winamp music.

The only thing I noticed different when examining winamp and its associated processes with Process Explorer is that a thread for out_ks3.dll shows up as a subset of the winamp threads.  When using the out_ks25.dll output, no corresponding thread appeared under the winamp threads.  The differences are probably due to the rewrite.  There was a slight increase in winamp CPU usage (from an peak of 0.75% to 1.5%), but perhaps the old plugin showed up under a different thread.

Great Stuff.
[a href="index.php?act=findpost&pid=354272"][{POST_SNAPBACK}][/a]


Yes, that's correct I create another thread. In the new plugin, I basically shove all the packets Winamp sends to me into a big buffer. The new thread you've seen simply sits there checking if there's anything in the buffer and if so it dispatches it off to the Kernel Streaming interface.

The main improvement with this new strategy is that every packet I send off to KS is full whereas in the original plugin only a quarter of each packet was used (playing 44.1K 16 bit WV files), so that didn't really give much of a safety margin between packets in case the CPU got busy. As it now stands, I can make the various buffer sizes adjustable to suit peoples needs.

The increase in CPU usage is probably down to two things, firstly, I have to copy each packet twice, once into my intermediate buffer and then a second time into the Kernel Streaming buffers. Secondly, my player thread, if starved of data will sit running in a tight loop wasting CPU time until something comes along - I'll have to see about sending it to sleep when nothing is being fed to it.

I've now got Pause and the volume control working again. I'll sort out 24 bit and post an update (plugin and source) once I've finished tidying the code up (either tonight or tomorrow).

I'm going to drop the oversampler as it doesn't seem to have any noticable benefit and I'll remove the "Release Audio Device When Stopped" option as this new plugin will always do this anyway.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-01-03 16:39:31
When it stuttered...

What other stuff was running at that point?...
- I ran quite many things. MSN, Explorer, DC++, Outlook.

Were you doing anything with the machine at that point?
- When I think about it was happening when winrar compressed some files that probably took alot of cpu

Was it at the start of a track or part way through?
- It was in th middle of songs mostly.

What kind of media were you playing (i.e. wav, mp3, radio streams etc)?
- ogg or m4a

What speed / type of CPU have you got?
- Pentium 4 2.4GH with 768 MB Ram... My soundcard is E-MU 1820M with the latest 1.82 drivers.

I hope this can help!

Best Regards
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-03 16:52:55
Quote
When it stuttered...

What other stuff was running at that point?...
- I ran quite many things. MSN, Explorer, DC++, Outlook.

Were you doing anything with the machine at that point?
- When I think about it was happening when winrar compressed some files that probably took alot of cpu

Was it at the start of a track or part way through?
- It was in th middle of songs mostly.

What kind of media were you playing (i.e. wav, mp3, radio streams etc)?
- ogg or m4a

What speed / type of CPU have you got?
- Pentium 4 2.4GH with 768 MB Ram... My soundcard is E-MU 1820M with the latest 1.82 drivers.

I hope this can help!

Best Regards
[a href="index.php?act=findpost&pid=354282"][{POST_SNAPBACK}][/a]


Thanks, that's helpful, you've got a reasonable spec system there, so it's surprising that its happening. It's probably the Winamp to KS intermediate buffer getting starved, this can hold up to around 1/3 second of data and smooths out update problems caused by thread switching, before I added this, the system constantly stuttered.

There's a second set of buffers on the KS side which hold around 1/6 second of data, if either of these two sets of buffers get starved it will stutter.

When I post the finished plugin, these buffers will be adjustable so that should help (at the cost of latency).

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-01-03 18:56:15
Quote
When I post the finished plugin, these buffers will be adjustable so that should help (at the cost of latency).

That is not a problem. Multitrack stuff that I require low latency I do in Sonar  I really look forward to the release.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-03 22:10:09
Hi all.

V3.0 is now available for download. This is essentially a complete rewrite of the plugin so there may be all kinds of new and exciting bugs in there. I've been testing it all evening (while making minor tweaks) and it seems stable for me, so fingers crossed it will be for you.

The main intention with this rewrite was to make the plugin behave in a more robust manner when the CPU is under stress. To this end, there are a couple of adjustable buffers on the config screen. If you get excessive stuttering or audio breakup, try adjusting these. Bigger values should improve the plugins resilience to external influences but will adversely affect the response times of Winamps controls, particularly the Seeking Bar, Stop button, volume control and jumping from track to track. On my system, the defaults seem fine but feel free to have a play.

I've also removed the "Release Device When Stopped" and Oversampler buttons from the config. The "Release..." option is now always done and I've just got rid of the Oversampler as it didn't really seem to achieve anything and was really just a bit of an experiment.

There are currently two known issues;
1. The visualiser synchronisation is somewhat out, plus the update rate falls off if you use larger output buffers. I'll have to find a better way of determining where the playback is up to from the filter.

2. "Winamp Music" from the library, tends to skip. Not sure what's going on here but it seems to be mucking up the input buffering somehow and needs further investigation.

The plugin can be found here (http://tinyurl.com/ng548) (V3.0)
The source code can be found here (http://tinyurl.com/ng548)

The V2.5 plugin and source may still be found at the old location (see earlier posts).

Hope it all works okay.

Have fun,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Gabes Dad on 2006-01-04 16:27:39
Quote
Edit: Just noticed something quite strange.  When playback ends (for me the end of the playlist), Winamp's CPU usage jumps to a constant 50% (on a hyperthreaded machine) and when examining this in process explorer it appears that out_ks3.dll is the one using the full 50%.  The process does terminate fine when shutting down winamp so at least that is good.  Hope this helps.
[a href="index.php?act=findpost&pid=354272"][{POST_SNAPBACK}][/a]

Steve, I don't know if you saw the edit to my post a while back before you replied or not, but the issue is still there in the current 3.0 release.  It seems to occur any time playback is stopped, similar to what you described in a post:
Quote
Secondly, my player thread, if starved of data will sit running in a tight loop wasting CPU time until something comes along - I'll have to see about sending it to sleep when nothing is being fed to it.

I don't know if you tried to resolve this or not in the 3.0 release, but it is still an issue for me.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-04 17:57:54
Quote
Quote
Edit: Just noticed something quite strange.  When playback ends (for me the end of the playlist), Winamp's CPU usage jumps to a constant 50% (on a hyperthreaded machine) and when examining this in process explorer it appears that out_ks3.dll is the one using the full 50%.  The process does terminate fine when shutting down winamp so at least that is good.  Hope this helps.
[a href="index.php?act=findpost&pid=354272"][{POST_SNAPBACK}][/a]

Steve, I don't know if you saw the edit to my post a while back before you replied or not, but the issue is still there in the current 3.0 release.  It seems to occur any time playback is stopped, similar to what you described in a post:
Quote
Secondly, my player thread, if starved of data will sit running in a tight loop wasting CPU time until something comes along - I'll have to see about sending it to sleep when nothing is being fed to it.

I don't know if you tried to resolve this or not in the 3.0 release, but it is still an issue for me.
[a href="index.php?act=findpost&pid=354545"][{POST_SNAPBACK}][/a]


Ouch! Yes, that's exactly what I was on about. I didn't get chance to sort it out for the "release" last night, I will have a look over the next couple of days.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-04 18:55:46
Okay, I've updated the plugin to fix the heavy CPU usage when the player is stopped as reported by Gabes Dad. This can be found at the same place as before here (http://tinyurl.com/ng548) (V3.1).

Now, when playback stops, the CPU load will rise dramatically for about two seconds then it should fall off to nothing as the player thread gets put to sleep.

Hope that solves the issue.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-06 01:16:03
When i try to load a new song during playback using out_ks31  the CPU usage goes up to 100%. Even the time it takes for the fileselection-box to appear takes ~extremely~ long. Since that makes the v3.x plugin currently unusable for me i'm using out_ks25 which works fine for me.

Though there is one odd behaviour which is true both for v2.5 and v3.1. When i try to play a module (mod, xm, s3m etc.) using in_mod i get disturbed soundoutput . I found out that if i play a midi file using in_midi once the  disturbances with in_mod are gone. Maybe the reason for this is that in_midi initializes the Direct Music-Port on its usage which affects winamps output pipeline in some manner? Again, after i played a midi file through in_midi once the problems are gone, even if i quit winamp and reopen it to play another module file immediately.

Specs (you might need to know):
WinXP Pro, Winamp 5.12 (in_midi + in_mod from Winamp v5.12 package)
MB nForce2, CPU Athlon 2.6GHz, 512Mb RAM, Terratec Aureon Space

Last but not least, many thanks to you for this fine plugin. It's much appreciated (damn KMixer).


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-06 10:17:12
Quote
When i try to load a new song during playback using out_ks31 the CPU usage goes up to 100%.

How are you loading songs to get this effect? I normally use the media library, but I've tried using the "Add" button at the bottom of the playlist and cannot recreate this. If you can let me know what you're doing to get this effect I'll take a look.

Quote
When i try to play a module (mod, xm, s3m etc.) using in_mod i get disturbed soundoutput

I suspect this is probably the same thing as the problem with "Winamp Music" mentioned earlier. I need to investigate this further.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-06 16:32:43
Quote
How are you loading songs to get this effect?
I was refering to the "Open file(s)" button to the right of the position-slider in the main screen of Winamp. I did'nt used the playlist to load a song at any time so i can't tell if the playlist has similar issues or not.

Quote
I suspect this is probably the same thing as the problem with "Winamp Music" mentioned earlier. I need to investigate this further.
Beside this issue there is one input-plugin which does'nt produce any soundoutput at all using out_ks25/out_ks32. It's the D00/D01-file player Ganbatte! (in_d00.dll) which can be downloaded at http://www.oplx.com/code/. Examplemodules are available on the same page. I tried every configuration option that "in_d00" has to offer (e.g. diff. samplerate settings) without success.


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-06 18:46:31
I've finally fixed the problem with "Winamp Music" which also fixes deus-ex's problem with .mod files. A new version (3.2) can be found here (http://tinyurl.com/ng548) which contains this fix.

Regarding deus_ex's other problems;

Quote
When i try to load a new song during playback using out_ks31 the CPU usage goes up to 100%. Even the time it takes for the fileselection-box to appear takes ~extremely~ long. Since that makes the v3.x plugin currently unusable for me i'm using out_ks25 which works fine for me.


I can't recreate this exactly, but, I've removed the 2 second delay before sending the player thread to sleep when it becomes idle, so this may solve your problem. If anybody now starts getting instances of the player freezing up when changing tracks, pausing or general messing around, could you please let me know.

Quote
Beside this issue there is one input-plugin which does'nt produce any soundoutput at all using out_ks25/out_ks32. It's the D00/D01-file player Ganbatte! (in_d00.dll) which can be downloaded at http://www.oplx.com/code/ (http://www.oplx.com/code/). Examplemodules are available on the same page. I tried every configuration option that "in_d00" has to offer (e.g. diff. samplerate settings) without success.


Now this one is weird. When I try to play these d00/d01 files everything gets set up as normal but my Write function never gets called (this is how Winamp should pass sample data to me). It interrogates if it can write by calling my CanWrite function (and I tell it that it can), but it never attempts to pass any data onto me and I'm not sure why. I may try mailing the author to see if he can suggest any obvious reason for this as it clearly works with other output plugins such as WaveOut.

Anyway, as always, please let me know if any new problems have been created with this build or indeed if any existing ones that I think I've fixed are still there.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-06 18:59:18
Quote
I've finally fixed the problem with "Winamp Music" which also fixes deus-ex's problem with .mod files.
Thanks for comming up with a solution immediately. Going to test the new version this evening (or night that is  ).

Quote
...I've removed the 2 second delay before sending the player thread to sleep when it becomes idle, so this may solve your problem.
I'll report back on this soon. Btw., would'nt it make sense to allow setting the buffers to zero so v3.x can behave as v2.5 if desired?

Quote
I may try mailing the author to see if he can suggest any obvious reason for this as it clearly works with other output plugins such as WaveOut.
You should definetly do that, i'm in constant contcat with him myself regarding a plugin for foobar2000.

Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-06 19:35:22
Quote
Thanks for comming up with a solution immediately. Going to test the new version this evening (or night that is  ).


Great, I hope it sorts out the problems you were having.

Quote
I'll report back on this soon. Btw., would'nt it make sense to allow setting the buffers to zero so v3.x can behave as v2.5 if desired?


That's not as easy as you might think because the v3.x variant works in a very different manner to the pre v3.0 versions. The v3.x versions were written from scratch and use a separate thread to manage the playback and communication with the Kernel Streaming interface, because of this it needs a buffer to sit between this thread and Winamp otherwise it just stutters like crazy. The original plugin (pre v.3.0) simply handed off any data packets received from Winamp directly to the Kernel Streaming interface, the problem with this approach is that Winamp can pass through some very small packets (when playing .wv files, I get packets of just 556 samples in length) which, when passed on to KS, don't leave very much time before another packet has to be sent to avoid audible breakup, this means that it was very succeptible to CPU loading as was reported earlier in the thread.

Quote
You should definetly do that, i'm in constant contcat with him myself regarding a plugin for foobar2000.


Well, I've mailed him, hopefully he'll be able to help.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-07 00:55:36
Quote
Great, I hope it sorts out the problems you were having.
All right, the 100% CPU usage issue when trying to load another file via 'Open File' button in mainscreen is fixed since your removed the 2 second delay. I did'nt wittness any problems regarding to this change.

Regarding the "in_mod" issue:
When setting the output buffer of "out_ks32" to 16k or 32k the replay is fine though at the cost of delayed visual feedback of course. And of course using "out_ks25" does'nt come with this ~price~ so currently its my prefered solution. When using "out_ks32" with its default settings the "in_mod" soundproblems still persists and again only when using "in_midi" once the stuttering disappears. Maybe "in_midi" is altering the size of winamps outputbuffer (or soundprocessing buffer) which then remains unchanged for the other in-/output plugins too?

I hope a solution can be found which then can be incorporated in both versions of your out_ks plugin.

Quote
That's not as easy as you might think because the v3.x variant works in a very different manner to the pre v3.0 versions.
I know, i followed this whole thread and also read your plugin documentation (which btw. explains kernel streaming in a very well understandable way). I just thought it can't hurt to ask, maybe you have'nt spend a thought on it yet.

Quote
Well, I've mailed him, hopefully he'll be able to help.
I hope so too, since there's a similar winamp plugin named "in_adlib" which also reproduces fm-sound which does'nt have these output problems in combination with out_ks. Currently OPLx ("in_d00" author) is in the finishing stages for a foobar compatible version of his plugin.


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-07 11:19:05
Thanks for getting back to me so quickly. Taking each point in turn;

Quote
All right, the 100% CPU usage issue when trying to load another file via 'Open File' button in mainscreen is fixed since your removed the 2 second delay. I did'nt wittness any problems regarding to this change..


Great. That's one down, looks like I was being a bit overcautious with the sleep delay thing.


Quote
When setting the output buffer of "out_ks32" to 16k or 32k the replay is fine


Sounds like it's not feeding my plugin fast enough for some reason, however I've not been able to recreate this issue with .mod files since 3.2, if you can point me at a problematic .mod file, I'll take another look at it.

Quote
I know, i followed this whole thread and also read your plugin documentation (which btw. explains kernel streaming in a very well understandable way). I just thought it can't hurt to ask, maybe you have'nt spend a thought on it yet.


Thanks for your comments, it's nice to know the docs have been useful. It's certainly possible to weld both versions together, just not something I've seriously considered doing - I'd basically have to write a whole new back end that works the same way as 2.5 but fits it in with the structure of 3.x. I may look into this at some point in the future.

Quote
I hope so too, since there's a similar winamp plugin named "in_adlib" which also reproduces fm-sound which does'nt have these output problems in combination with out_ks. Currently OPLx ("in_d00" author) is in the finishing stages for a foobar compatible version of his plugin.


Impressively, he's already got back to me and has fixed the plugin at his end. He says he will probably release the update in a few days. Now that I know what the problem was, I'll fix it at my end too (in my next release) just in case there's any other input plugins out there with the same issue.


Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-08 00:28:07
Quote
... if you can point me at a problematic .mod file, I'll take another look at it.
I made sure its not just a few particular modules rasing the problem, it happens with every module i try and i have quite a big collection. Maybe my soundcard drivers are to blame for beeing to slow, who nows? I allways have the latest (beta) driver version installed. I also tried setting the Winamp process priority to realtime (yeah that's nuts) but that did'nt do anything good.

Quote
It's certainly possible to weld both versions together, just not something I've seriously considered doing - I'd basically have to write a whole new back end that works the same way as 2.5 but fits it in with the structure of 3.x. I may look into this at some point in the future.
The idea behind my request simply is that new user may ignore "out_ks25" thinking its outdated and when one experience similar problems like me using "out_ks32" he/she would'nt think of trying out the v2.5 version.

Quote
Impressively, he's already got back to me and has fixed the plugin at his end.
Yes, OPLx is one great pal, always open for comments and a very nice and helpfull person.


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-08 22:59:14
I've posted a new version (v3.3) here (http://tinyurl.com/ng548) (same place as other v3.x versions) the source is here (http://tinyurl.com/ng548).

This versions contains the following changes;

1. a fix for the problem when playing back .d00 / .d01 files. Note that as these are presented in mono, they only play back on one channel on my system (I suspect this may be normal behaviour for other cards too). I will at some point in the future make the plugin treat a mono feed as stereo and duplicate it on both channels.

2. Increased selection of buffer sizes - the Input buffer can be 16,32,64 or 128K while the Output buffer can be 4,8,16 or 32K. Note, that the input buffer must be larger than the output buffer, this is to prevent buffer underruns which cause a rather nasty audible breakup.

3. I've added an optional status window, this can be useful when adjusting buffers.

Full details can be found in the readme.txt along with an overview of how the threads and buffering are set up and how best to adjust them.

As always, please let me know how you get on with this plugin, all feedback is appreciated (good or bad). I'll try to fix any reported bugs when I can although I'm back at work tomorrow, so I'll not be able to spend as much time on this as I have over the last couple of weeks.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Schmitty on 2006-01-09 01:45:39
Steve,
Thanks so much for all of your effort.  I had tried the original kernel streaming plugin a long time ago, but it was basically unusable.  By random chance I was on the forums and noticed this thread was bumped, I took a look and tried out your new and VERY improved plugin and was very impressed.  This plugin plays much smoother under load than the ASIO plugin I have been using for over a year. 

So pretty much what I want to say is this plugin kicks ass, keep up the hard work!  So far in versions 3.2 and 3.3 I have experienced no issues except of course lag on pause/stop and lag on the visual display, but these are things that don't bother me.


Mike
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-10 01:05:03
Quote
2. Increased selection of buffer sizes
Installed out_ks33, fired up Winamp and chose lowest buffer size available (found out later that you suggest the very same in the readme.). Now playback of MOD-files works like a charm. Though i'd like to know if im able to use even smaller buffer sizes (e.g. in 8k, out 2k). How about incorporating the buffer sizeselection as sliders with a given scale?


Quote
1. a fix for the problem when playing back .d00 / .d01 files.
Confirmed! Requires latest version of Ganbatte! (http://www.oplx.com/code/) (in_d00).


Quote
3. I've added an optional status window, this can be useful when adjusting buffers.
Great addition to the plugin which helps to verify chosen settings.


Quote
Full details can be found in the readme.txt along with an overview of how the threads and buffering are set up and how best to adjust them.
Regarding the readme i overhauled the formating, removed a few spelling errors (added some new?  ) and removed the obsolete section about the "Release Audio Device When Stopped" option.

Edit: Link removed, readme.txt send via PM.


Thank you very much for your great support and for providing updates that fast. You (your plugin) make(s) Winamp a lot more worthwhile for me now.


Best regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-10 20:31:18
Quote
Installed out_ks33, fired up Winamp and chose lowest buffer size available (found out later that you suggest the very same in the readme.). Now playback of MOD-files works like a charm. Though i'd like to know if im able to use even smaller buffer sizes (e.g. in 8k, out 2k). How about incorporating the buffer sizeselection as sliders with a given scale?


Actually, you can easily try out any sizes you like by editing winamp.ini. Search for;

[Kernel Streaming]

This shouldl be followed by two lines similar to the ones below;

input_buffer_size=16384
output_buffer_size=4096

Just edit the buffer sizes, save the file, then start Winamp. You can check that they've been picked up correctly by opening the status window. Any size should be fine, although the input buffer should always be at least 8192, possibly a little more (I would say that 16384 is the minimum safe value). Also you should really stick to powers of two (e.g. 1024,2048,4096 and so on). I may change the interface at some point, I just used radio buttons as they were easy to implement.

Quote
Confirmed! Requires latest version of Ganbatte! (in_d00).


Out of interest, did they just play out through the left hand channel or did you get the same thing out of the left and right?

Quote
Regarding the readme i overhauled the formating, removed a few spelling errors (added some new?  ) and removed the obsolete section about the "Release Audio Device When Stopped" option. You can download it here (http://rapidshare.de/users/8U3JB).


Spelling errors? Well, it was late and I was tired, at least, that's my excuse  I was rambling on a bit too wasn't I? Anyway, I'd like to download it but the hosting thingy wont work through my router, if you could PM it to me that would be great, as I'm keen to take a look.

BTW, formatting has two 't's  (sorry, I couldn't resist)

Quote
Thank you very much for your great support and for providing updates that fast. You (your plugin) make(s) Winamp a lot more worthwhile for me now.


You're welcome, I'm glad it's been useful to you and to others and it's nice to know the works been appreciated, it makes the effort worthwhile. It's also been quite interesting to see the rather varied range of requirements people had from the plugin (it was doing everything I needed when I posted 2.0!), some were quite unexpected (I'd never even heard of .d00 files before this!).

Thank you all for letting me know how you've got on with it and for the various suggestions about how it can be improved.

Best regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-11 01:06:35
Quote
Actually, you can easily try out any sizes you like by editing winamp.ini.
Great, i thought it was hardcoded. I was able to lower the size of the input buffer to 8192k and output buffer to 2048k though it does'nt run smooth when starting/running a visual plugin (stuttering). Went back to the 16384/4096k setting which runs perfect on my machine.


Quote
Out of interest, did they just play out through the left hand channel or did you get the same thing out of the left and right?
Left and right. I'd demand my money back if not.


Quote
Anyway, I'd like to download it but the hosting thingy wont work through my router, if you could PM it to me that would be great, as I'm keen to take a look.
Bombs away, sir.


Quote
BTW, formatting has two 't's   (sorry, I couldn't resist)
Hah, this was just a minor test i placed on purpose of course.


Quote
I'd never even heard of .d00 files before this!).
You should pay Modland (http://ftp://ftp.modland.com) a visit, an Eldorado for almost every existing music format you can imagine. Here's a link that leads to the D00-module directory on Modland for example:
ftp://ftp.modland.com/pub/modules/ad%20lib/jch-d00 (http://ftp://ftp.modland.com/pub/modules/ad%20lib/jch-d00)


Quote
Thank you all for letting me know how you've got on with it and for the various suggestions about how it can be improved.
Just out of curiousity, could out_ks25 be enhanced with the fixes for in_mod/in_d00 too?


Best regards,
deus-ex

Edit:4096 to 2048 in first section.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: rt87 on 2006-01-11 03:46:51
A suggestion, the plugin should have thread priority setting like what out_asio have as the thread cannot pass data if other process used up all CPU resources.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-11 23:01:20
Quote
A suggestion, the plugin should have thread priority setting like what out_asio have as the thread cannot pass data if other process used up all CPU resources.
[a href="index.php?act=findpost&pid=356221"][{POST_SNAPBACK}][/a]


A good suggestion, but, to be honest, now that the thread sleeps whenever it's idle (i.e. most of the time), I should be able to just bump the thread priority up quite a bit without adversly affecting anything else. I'll check this out at the weekend and, if it doesn't cause any issues I'll post a new version.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-21 09:21:23
Quote
I'll check this out at the weekend and, if it doesn't cause any issues I'll post a new version.

Did you yet find the time to check this out? Also i'd like you to answer my question from my previous post. What's your opinion on the overhauled 'readme.txt' i send you some time ago?


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-01-21 12:26:32
Quote
Quote
I'll check this out at the weekend and, if it doesn't cause any issues I'll post a new version.

Did you yet find the time to check this out? Also i'd like you to answer my question from my previous post. What's your opinion on the overhauled 'readme.txt' i send you some time ago?


Regards,
deus-ex
[a href="index.php?act=findpost&pid=358725"][{POST_SNAPBACK}][/a]


Hi, sorry for not getting back sooner, I've been rather busy now that I'm back at work.

I did try increasing the thread priority to Time Critical and it appears to have had no adverse side-effects. I haven't posted a new version as there are several other things I'm toying with doing, these include;

Reducing the number of output buffers or making it adjustable

I've had an idea for gapless playback that requires some further experimentation

changing the buffer size options to either sliders or combo boxes


Once I've had a look at these things, I'll post a new version.

As far as fixing KS_25 for the in_mod issue goes, yeah, it would be possible, but I'd need to increase the buffer sizes (the problem was caused by the in_mod plugin waiting until the output plugin reported the availability of a certain output buffer size, the 8K buffer as reported by the original plugin just wasn't big enough, so in_mod just sat there waiting forever). However, as I understand it OPLx was going to fix it from his end too, so, if he's posted a new plugin, that should work with KS_25 as is.

As for the readme, comparing the two, I'm rather surprised just how much obsolete stuff I'd left in. When I get round to it, I'll probably rework the readme to combine elements of both versions. Interesting point about SB's XiFi series, I wasn't aware of that.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: callmeace on 2006-01-21 13:02:41
This is really nice to have this being developed!  , looking forward to whenever you are comfortable with releasing the next version, thanks again Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-01-23 04:25:58
Quote
However, as I understand it OPLx was going to fix it from his end too, so, if he's posted a new plugin, that should work with KS_25 as is.
That is true for in_d00 (Ganbatte!). The in_mod plugin is'nt by OPLx though, it was made by former Winamp developers who (to my knowledge) all have left Nullsoft. I'm uncertain if anybody of the new (and very good) developer team is putting hands on the sourcecode of this plugin at all.


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-04 22:22:57
Hi,
I've (finally) uploaded a new version of the plugin (v3.4) with the following enhancements;

1. I've increased thread priority to time critical (the highest it will go). I've been using this on several computers for the last couple of weeks while simultaneously running various demanding tasks with no noticable negative side effects.

2. I've added an option to change the number of output buffers. You can now select between 2 and 8 (8 being the previous fixed amount). Reducing the number of buffers will significantly reduce latency, so, with an 8K output buffer you can now get it down to a minimum of 92mS with CD material.

3. I've added a Gapless mode. This basically leaves the Kernel Streaming output running after WinAmp tells me to stop it, so, if WinAmp then starts writing a new track out before the buffer has emptied the new track will be appended seamlessly onto the previous one. If the buffer underruns playback will stop. Note that Winamp does not accurately capture the start and end of tracks taken from CD so you will still get disruption with music captured by Winamp. For best results use a separate capture program such as EAC.

4. The config screen has had an overhaul and now uses sliders for the buffer sizes.

5. The readme has been rewritten as an html document to make it a bit more readable and accessible.

6. Not exactly an enhancement, but I found that the drivers for my sound card (M-Audio Audiophile 2496) crashed Windows if paused with an output buffer size less than 8KB, so I've increased the minimum output size from 4KB to 8KB. If you really need a smaller buffer size you can still circumvent this by editing the Winamp.ini file as mentioned in an earlier post, however, with the option for fewer output buffers this may not be such an issue.

The plugin and its source code can be downloaded from the same places as previous versions. These are;

Plugin: here (http://tinyurl.com/ng548)
Source: here (http://tinyurl.com/ng548)

As usual, all feedback is welcome.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hyperion on 2006-02-04 23:06:26
work fine.
thanks, Steve!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Schmitty on 2006-02-07 22:59:39
Thanks for the update, Steve.

One thing that I noticed right away with gapless playback enabled: when music is playing, and you hit next, an error message is produced and WinAmp crashes.

"Unable to create output pin"

Other than that it seems great so far! Keep up the good work.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-07 23:34:28
Quote
Thanks for the update, Steve.

One thing that I noticed right away with gapless playback enabled: when music is playing, and you hit next, an error message is produced and WinAmp crashes.

"Unable to create output pin"

Other than that it seems great so far! Keep up the good work.
[a href="index.php?act=findpost&pid=362633"][{POST_SNAPBACK}][/a]

Hi, that's very strange, I haven't seen that at all, in fact, that's the last thing I'd expect because with Gapless turned on it shouldn't destroy the output filter when changing tracks (normally it will destroy and recreate the output filter). The message you are getting occurs when creating the output filter fails, as the filter isn't normally being destroyed and recreated in gapless mode that shouldn't be happening between tracks.

In gapless mode, the filter will only get recreated if the music format changes or Winamp stops passing music to the plugin long enough for the buffers to run out (at which point the filter gets destroyed to stop any unwanted audible effects).

Can you give me a little more detail about what's going on, particularly the following points;

What kind of CPU and Sound Card do you have?

What have you got the buffers set to (sizes and number of)?

After starting playback but before pressing Next have you altered any Kernel Streaming settings or have you switched output plugins?

Do the adjacent tracks have the same format (i.e. sample rate, number of channels, sample size)?

With the Kernel Streaming status window open, can you describe the behaviour of the buffer usage indicator? Does it hit full? Does it hit empty? How often? That kind of thing.

What other applications (if any) are you running at the same time?


I've tried to recreate this problem without success on three computers, admittedly they're all reasonably fast (2.4GHz, 2.8GHz and Dual 3.0GHz) the only similar thing I've seen is a crash when track skipping while paused and I can only get that to happen on one of the above computers (that was with V3.3 anyway).

Anyway, if you can answer the above points and give me any more relevant information you can think of it may help to shed some light on the problem.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Ani47 on 2006-02-08 17:28:28
Hi steve,

I'm also getting a 'Unable to create output pin' - preceeded by a NULL pointer exception.

This is happenning when playing a from a 16bit (i think) file to a 4bit file in gapless mode. The 4bit file can be played from stopped, but not when already playing.

As I'm a programmer I'll post up some code.

Code: [Select]
    pin = filter->CreateRenderPin(&wfx.Format, FALSE);

    if (!pin)
    {
    // driver can't handle WAVEFORMATEXTENSIBLE, so fall back to
    // WAVEFORMATEX format descriptor and try again
    wfx.Format.wFormatTag = WAVE_FORMAT_PCM;
    // set unused members to zero
    wfx.Format.cbSize = 0;
    wfx.Samples.wValidBitsPerSample = 0;
    wfx.dwChannelMask = 0;
    wfx.SubFormat = GUID_NULL;

    pin = filter->CreateRenderPin(&wfx.Format, FALSE);   <---------
    }

    if (!pin)
    {
 MessageBox(hwnd, "Unable to create output pin", "Error!", MB_OK);
 return FALSE;
    }


This line fails to create the 'pin' when in gapless mode, but not when stopped. As 'pin' is left NULL the player thread then dies a horrible death .

Quote
Hi, that's very strange, I haven't seen that at all, in fact, that's the last thing I'd expect because with Gapless turned on it shouldn't destroy the output filter when changing tracks (normally it will destroy and recreate the output filter).


As I read it, from your code, it will always try to recreate 'pin' even in gapless mode if the format changes:

Code: [Select]
int KSCore::StartInternal(int samplerate, int numchannels, int bitspersamp)

...
    switch(bitspersamp)
    {
    case 20:
 MessageBox(hwnd, "20 bit audio is not currently supported", "Error!", MB_OK);
 return -1;

    case 24:
 if (numchannels == 2) {
     wfx.Format.wBitsPerSample = 32;
     wfx.Format.nBlockAlign    = 8;
 }
 else if (numchannels == 1) {
     wfx.Format.wBitsPerSample = 32;
     wfx.Format.nBlockAlign    = 4;
 }
 else {
     MessageBox(hwnd, "Only 1 or 2 channels is supported for 24 bit playback.", "Error!", MB_OK);
     return -1;
 }
 break;

    default:
 break;
    }



    // Gapless enhancement
    if (mode == MODE_STARTED) {    // already playing
 if (config->gapless_enabled) {
     if (0 == memcmp(&wfx_cur,&wfx,sizeof(WAVEFORMATEXTENSIBLE))) {
   should_be_playing = TRUE;
   return 1000;    // no format change detected, so just carry on
     }
     

 }
 else
     End();
    }

    if (!OpenOutput(wfx)) { <------ gets run if there is a format change even in gapless mode.
 return -1;
    }
...
}


This is not realy much of a problem as I dont spend my time listenning to 4bit music , but if it could fail more gacefully .


As a side note I see that you dont have 'pin' very thread safe. You are continously accessing it in your playig thread, but you also reasign it in your OpenOutput function. It doesnt seem to cause any problems on the other hand though....

[I'm assumming your using the Release CFG profile here for compiling, if your not disraguard the following....]
Do you know you have the _DEBUG macro set rather than the _NDEBUG in your release cfg profile (could cause use of debug functions etc) and you have the linker producing debug info in your DLL (47kb in release vs 264kb in release CFG).

Hope this helps.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-08 23:48:53
Hi Ani47, thanks for the report.

Yes, you are right, it will recreate the pin and , for that matter, the whole filter if the format changes, even in gapless mode (in which case it wont actually be gapless) I was hinting at that in my questions for Schmittly.

I didn't actually test this case as I don't have much music knocking around that isn't sourced from CD's so it's quite possible that my handling of the filter deletion and recreation in this instance may be flawed, particularly when you throw the player threads automatic filter deletion if it empties the buffer into the mix.

As I've been running it flawlessly all week both here and at work without any hint of a problem, but always with the same sound format, it's highly likely that this is the source of Schmitty's problem too.

As for your other points, I'll take a look at Release CFG. I wasn't aware that debug info was getting into the DLL, but I am getting a different sized dll to what you are (136KB).

With regards to the thread safe status of the plugin, excepting for possible mistakes, it should be inherently safe due to the way it's been designed.

Ignoring the issue with gapless, the player thread should never access Pin until Pin has been set up from the Winamp thread because it is asleep. Only once the Pin has been created will data be sent to the player thread, subsequently waking it up. Conversely, before the Winamp thread deletes the Pin it waits until the player thread has returned to a sleeping state, so access to Pin from the player thread should be safe. In addition, Pin is never accessed from the Winamp thread other than to create and delete it. Other than that, the only additional communication between the two threads are a couple of flags that are set in specific orders and a few Events.

Having said that, I certainly seem to have buggered something up with this gapless mode, so something is amiss. I'm rather beginning to wish I'd left the "experimental" label on the button now 

Anyhow, thanks for your feedback, it's nice to know it was worthwhile posting the code, I'll try and sort out this format change issue later in the week, hopefully it's the same problem as Schmitty is getting.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Ani47 on 2006-02-09 00:50:15
Cool, I thought that might be the case with the thread safety of 'pin'. Unfortunatly my knowleadge of thread synchronisation doesn't go much past EnterCriticalSection(), etc...

Keep up the good work .

edit:

The size difference in the DLL's could be down to the fact I'm running vs 2005, so it might put in more debug info.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Gabes Dad on 2006-02-09 15:06:18
Steve,

I love the continual work and I would like to try out v3.4, but I've had some "technical difficulties" of late.  I thought that perhaps you guys would have an answer as to how I can prevent the following in the future:

I run winamp and several other programs from my portable 200GB hard drive, which also stores my music collection.  The other morning I was transcoding some flac files to wavpack lossy to test out playback on my Palm using TCPMP.  Anyway, while that was going, I opened up winamp to download some podcasts with the new wire plugin.  Before opening winamp, however, I had copied in your new out_ks v3.4 and deleted the older out_ks v3.3 (which was the selected output method when winamp was last run).  So, winamp opened up and, since I have Dr0's Time Restore and Autoplay plugin installed and activated, automatically tried to play what was previously in my playlist.  An error popped up with something like "can't find output pin" or perhaps it was "plugin" or "device" instead of "pin".  So, I close the warning dialog and it keeps popping up because it's trying to play the next songs in the playlist.  Somewhere between trying to stop the player before going to the next song and closing the multiple warning dialogs, winamp crashed - and so did all of my other programs running from my portable hard drive (foobar, portable firefox) and they shut down instantly.

So I tried accessing my portable hard drive in windows explore and I notice that the drive's name has changed back to "local disk" and now I get an error something like "cannot access device.  file or folder is corrupt" and other various disheartening errors when accessing the drive in various ways.  I searched around on the net to find out how to fix it and it seems to the only way is to use data recovery programs (e.g., Runtime's GetBackData for NTFS) to copy off files, reformat, and then put the files back on the drive - which is a quite painful process for a large drive even halfway full.

So, I'm not blaming this plugin, or anything rash like that.  I was just wondering if you had any insight as to why this happened so I can avoid this in the future.

Thanks for the support.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-10 00:39:40
Hi Gabes Dad.

I'm really sorry to hear about your problems, from what you've described it sounds like you've been hit with a really unfortunate sequence of events.

As Winamp uses the plugin filename to keep track of which output plugin it was last using, if you have deleted the plugin that was previously selected and simply copied in the new one, then, when you restart it, Winamp will not be able to find its currently selected plugin and will pop up the message;

"Can't find output plug-in"

every time it attempts to play a track until you select a new output plugin in Winamps config (I've just tried it here). So, in this instance, it wouldn't have been using the new plugin because it hadn't been selected. To avoid this sort of situation in future, I would recommend installing the new plugin and checking it works correctly before deleting the older one.

Why Winamp and your other programs crashed at this point, I don't know as Winamp seems to be pretty stable in this "missing plugin" sort of scenario.

Several programs disappearing at once is also something I've never come across before, at least, not without Windows rebooting itself (it didn't do that did it?) and for something to take out your drive as well is a somewhat surprising thing to happen.

I wouldn't have been too surprised if you'd got a couple of corrupt files (such as the ones being encoded at the time of the crash) but to lose the drive because of a software failure is pretty unusual, I just hope you've not experienced some kind of hardware failure with your drive. A bit of a coincidence I know, but from what you've described it sounds like something more than just a Winamp problem.

I'm sorry I can't be more insightful, but it's not a sort of problem I've ever encountered. I've had drives fail on me in various strange ways over the years but never anything quite like this.

I sincerely hope you can recover your files, personally, I'm so paranoid about this sort of thing happening on my media server because of how long it took to get all of my albums onto it in the first place, that I have an external drive for the sole purpose of periodically backing up the primary media drive, just in case!

Hope you sort it out,
regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bansal98 on 2006-02-10 08:58:48
Hi Steve,
    The old plug-in by Chun-Yu used to work fine with this resampling plug-in (http://www.hqsoftproc.upcnet.ro/) but new version do not. Can you please look into this? Thanks!!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: dax- on 2006-02-11 08:00:15
Howdy, just a little feedback.. It seems to be working fine.

Running
Windows XP MCE.
nVidia nForce2 Soundstorm out via Digital Coax to Logitech Z-680's.

Was using DirectSound with Hardware acceleration.

Havent noticed any real difference in the audio. Perhaps I only have >192kbit MP3's to test. Or maybe that I wouldnt notice much of a difference anyway.

Just thought I'd let you know, not that it matters any.

Thanks for the effort!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-11 13:53:50
Hi all, I've just posted a new version which should hopefully fix the problems people were experiencing with Gapless Mode. The new version (3.5) can be found here (http://tinyurl.com/ng548) - details of the fixes can be found in the readme. If the people who were experiencing problems with 3.4's Gapless Mode could let me know if this update has solved those problems, then that would be great. As usual, although I do attempt to ensure that the plugin is as stable as possible, use of this plugin is entirely at your own risk.

All feedback, both good and bad is welcome.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-11 13:58:34
Quote
Hi Steve,
    The old plug-in by Chun-Yu used to work fine with this resampling plug-in (http://www.hqsoftproc.upcnet.ro/) but new version do not. Can you please look into this? Thanks!!
[a href="index.php?act=findpost&pid=363222"][{POST_SNAPBACK}][/a]


Hi Manish, the plugin seems to work fine for me in conjunction with the resampling one you linked to, the only thing I had to do was increase the input buffer size to 32K in my plugin to stop it stuttering (you can do this on the config page for my plugin), leave the output buffer size and count as low as you can get away with.

It does seem to upset the gapless mode a bit (not disastrously, it just stops being gapless) although an even bigger input buffer may resolve this (but I didn't try this).

Let me know how you get on. If you still have problems can you send me your settings for the resampling plugin plus a bit more of a description of the problem you are experiencing and I'll see what I can do.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-11 14:02:54
Quote
Howdy, just a little feedback.. It seems to be working fine.

Running
Windows XP MCE.
nVidia nForce2 Soundstorm out via Digital Coax to Logitech Z-680's.

Was using DirectSound with Hardware acceleration.

Havent noticed any real difference in the audio. Perhaps I only have >192kbit MP3's to test. Or maybe that I wouldnt notice much of a difference anyway.

Just thought I'd let you know, not that it matters any.

Thanks for the effort!
[a href="index.php?act=findpost&pid=363451"][{POST_SNAPBACK}][/a]


Thanks for the feedback, glad it's working okay.

Whether or not Kernel Streaming will improve your sound quality depends on several factors;

The quality of your source material - 192K MP3's may not exhibit much of a benefit.

If your sound card forces resampling as my old Terratec Aureon card did, then Kernel Streaming will probably have no noticable effect.

The quality of the rest of your replay chain (decoder, amp, speakers) has to be pretty good to hear the small improvement that Kernel Streaming can bring.

Hope that helps.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: punkrockdude on 2006-02-11 14:30:33
I use an E-MU 1820M soundcard and Tapco S8 monitor speakers and I notice the difference alot. Specially in the high end.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-11 20:53:08
Quote
I use an E-MU 1820M soundcard and Tapco S8 monitor speakers and I notice the difference alot. Specially in the high end.
[a href="index.php?act=findpost&pid=363496"][{POST_SNAPBACK}][/a]


On my own HiFi system (Tag McLaren AV32R, Bryston 4BSST Amp and B&W Nautilus 804 speakers) without Kernel Streaming, there is some noticable but difficult to quantify difference between SPDIF from my DVD Transport (a Tag McLaren DVD32FLR) and SPDIF from my computer. With someone else switching the inputs I can pick out which is which pretty much every time.

With Kernel Streaming enabled, I can't tell the two apart. Playing the same material synced up at the start they sound identical - which is great as I was never quite satisfied with the sound beforehand, so I kept falling back to playing CD's on the DVD32FLR rather than my media PC. Now I'm perfectly happy to use the media PC all the time and, as a bonus, I no longer have to get up to change discs. Just need to sort the fan noise out now and I'll be happy.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-02-11 21:54:30
Quote
If your sound card forces resampling as my old Terratec Aureon card did, then Kernel Streaming will probably have no noticable effect.
What Aureon model are you refering to? Currently i'm using an Terratec Aureon Space and as far as i can tell it does'nt force upsampling. The Creative Audigy series (as we all know) does which is why i exchanged it for the Terratec back then.

Currently i'm assembling my next machine for which i choosed a Creative product again. Based on the many very good reviews i picked an Xi-Fi Xtreme Musician (what a title). The Xi-Fi series has optional upsampling (you can switch it on/off).


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-12 00:36:58
Quote
Quote
If your sound card forces resampling as my old Terratec Aureon card did, then Kernel Streaming will probably have no noticable effect.
What Aureon model are you refering to? Currently i'm using an Terratec Aureon Space and as far as i can tell it does'nt force upsampling. The Creative Audigy series (as we all know) does which is why i exchanged it for the Terratec back then.

Currently i'm assembling my next machine for which i choosed a Creative product again. Based on the many very good reviews i picked an Xi-Fi Xtreme Musician (what a title). The Xi-Fi series has optional upsampling (you can switch it on/off).


Regards,
deus-ex
[a href="index.php?act=findpost&pid=363583"][{POST_SNAPBACK}][/a]


It was a Terratec Aureon Fun 5.1. With the control software you could set the frequency of the SPDIF output, so I had it set to 44.1KHz. With this card I couldn't get my AV32R to recognise any HDCD bitstreams as anything other than regular PCM, even with Kernel Streaming (using Chun Yu's original plugin) so it was definitely messing with the bitstream in some way.

When I fitted the M-Audio Audiophile 2496 the AV32R locked on immediately to the HDCD encoding (using KS), but the KS plugin, in conjunction with this card crashed Windows too often to be usable - this is what prompted me to look into reworking the plugin.

Did you ever try the HDCD via SPDIF decoding test with your Terratec card?

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Schmitty on 2006-02-12 05:14:46
Quote
If the people who were experiencing problems with 3.4's Gapless Mode could let me know if this update has solved those problems, then that would be great.


Sorry I could not get back to you earlier with my machine setup.  I tried the 3.5 version and the gapless no longer crashes winamp!  I did notice that gapless mode isn't entirely gapless, while watching the status thing the player thread state goes to sleep for a split second.  I went back and forth several times between gapless and non and I really can't tell the difference (in terms of the length of the gap). 

Just incase you need to know some info:
A64 3200+, 1GB ram, chaintec AV710 flashed to Prodigy 7.1 (I only use the toslink out).

input buffer set to 64, output 8, number of output buffers is 8.

not running any programs that use a significant amount of cpu time.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-12 09:14:05
Hi Schmitty, thanks for the response.

Looking at your setup I'd try reducing the number of output buffers to 2, this should reduce the likelihood of the input buffer running out between tracks - which is what sends the output thread to sleep.

Also, if your tracks were ripped with Winamp they wont play gaplessly as Winamp tends to grab a little bit of the previous track at the start of each new one. I've had to regrab several albums (mainly 70's concept stuff and Dance mixes where the tracks mix into one another) with EAC since adding this feature to the plugin.

If all that fails, are you using any other plugins upstream (the resampler mentioned a few posts back seems to disturb gapless playback a little) and what format are your tracks in (I've tested it with wav's and wv's but not mp3 or wma). Also, if the format changes between tracks then that will foil the gapless mode.

Let me know how you get on.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-02-12 21:24:46
Quote
Did you ever try the HDCD via SPDIF decoding test with your Terratec card?
No. Went googling for HDCD to find that I have no experience on that field, i don't have any HDCD mastered recordings either which are required for testing.


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-12 23:20:34
Quote
No. Went googling for HDCD to find that I have no experience on that field, i don't have any HDCD mastered recordings either which are required for testing.


Regards,
deus-ex
[a href="index.php?act=findpost&pid=363784"][{POST_SNAPBACK}][/a]


Well, it's a pretty reliable test to find out if your bitstream is being mangled in any way as the slightest change in the bitstream will prevent HDCD detection. Of course, that's assuming your processor can decode HDCD in the first place.

Personally I'm rather dubious about the sonic benefits of HDCD (20 bit sample resolution from a 16 bit stream? Hmmm.). By enabling the volume control in the KS plugin and dropping the volume down to 99% I can prevent my Tag processor from successfully detecting the HDCD encoding, so it just drops back into straight LPCM. Comparing the two, I can't personally tell any difference (even the volume difference between 100% and 99% is pretty much imperceptible). To be fair though, the handful of CD's I have that are HDCD encoded all sound very good (either with or without the correct decoding).

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Schmitty on 2006-02-14 04:12:32
Quote
Hi Schmitty, thanks for the response.

-reducing the number of output buffers to 2
-ripped with Winamp they wont play gaplessly
-plugins upstream
-format

Let me know how you get on.

Regards,
Steve
[a href="index.php?act=findpost&pid=363667"][{POST_SNAPBACK}][/a]


Thank you Steve, I reduced the output buffers to 2 and the transition is now noticeably quicker, about as fast as I would expect is possible.  All the material that I have ripped myself is from EAC (lame -aps), so that wasn't the issue for me.

I'm very grateful for the effort you have put into developing a supporting this plugin, its very useful to me and I'm sure many others.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bansal98 on 2006-02-14 04:57:47
Quote
Quote
Hi Steve,
    The old plug-in by Chun-Yu used to work fine with this resampling plug-in (http://www.hqsoftproc.upcnet.ro/) but new version do not. Can you please look into this? Thanks!!
[a href="index.php?act=findpost&pid=363222"][{POST_SNAPBACK}][/a]


Hi Manish, the plugin seems to work fine for me in conjunction with the resampling one you linked to, the only thing I had to do was increase the input buffer size to 32K in my plugin to stop it stuttering (you can do this on the config page for my plugin), leave the output buffer size and count as low as you can get away with.

It does seem to upset the gapless mode a bit (not disastrously, it just stops being gapless) although an even bigger input buffer may resolve this (but I didn't try this).

Let me know how you get on. If you still have problems can you send me your settings for the resampling plugin plus a bit more of a description of the problem you are experiencing and I'll see what I can do.

Regards,
Steve
[a href="index.php?act=findpost&pid=363491"][{POST_SNAPBACK}][/a]



Hi Steve, It is still not working. I have tried various settings of input and output buffers. Here is my configuration -
Windows XP SP2
Soundblaster Live 24 bit! (also happens with on-board audio)
Winamp 5.12 with stock mp3 decoder (I tried mpg123 decoder also but still same result)
Playing mp3s

The moment I double click on a song in Winamp, it crashes. It's not a big deal if I can't use the resampling plugin. Just something nice to have. Thanks!!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-14 08:18:20
Quote
Hi Steve, It is still not working. I have tried various settings of input and output buffers. Here is my configuration -
Windows XP SP2
Soundblaster Live 24 bit! (also happens with on-board audio)
Winamp 5.12 with stock mp3 decoder (I tried mpg123 decoder also but still same result)
Playing mp3s

The moment I double click on a song in Winamp, it crashes. It's not a big deal if I can't use the resampling plugin. Just something nice to have. Thanks!!
[a href="index.php?act=findpost&pid=364110"][{POST_SNAPBACK}][/a]


The more details you can give me, the more chance I have to recreate / diagnose the problem. The following would be useful;

What settings have you got the resampling plugin set to (frequency, sample size and so on)?

When it crashes do you get an error message or the standard Windows error message or does Windows itself crash?

What speed of CPU does your computer have?

How Much memory do you have?

Have you tried anything other than MP3's (e.g. WAV's, WV's,WMA and so on)?

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-14 08:23:33
Quote
Thank you Steve, I reduced the output buffers to 2 and the transition is now noticeably quicker, about as fast as I would expect is possible.  All the material that I have ripped myself is from EAC (lame -aps), so that wasn't the issue for me.

I'm very grateful for the effort you have put into developing a supporting this plugin, its very useful to me and I'm sure many others.
[a href="index.php?act=findpost&pid=364105"][{POST_SNAPBACK}][/a]


Ah! MP3's! I'm not sure if it will work perfectly with MP3's due to the packet granularity, in other words, I think MP3 encoders can add a brief bit of silence at the end of the track to pad the number of samples to fill the last packet.

I'm using it with losslessly compressed .WV's and it is truly gapless. When I get a chance, I'll convert some of these over to MP3 and see if they still play gaplessly.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bansal98 on 2006-02-14 08:53:25
Quote
Quote
Hi Steve, It is still not working. I have tried various settings of input and output buffers. Here is my configuration -
Windows XP SP2
Soundblaster Live 24 bit! (also happens with on-board audio)
Winamp 5.12 with stock mp3 decoder (I tried mpg123 decoder also but still same result)
Playing mp3s

The moment I double click on a song in Winamp, it crashes. It's not a big deal if I can't use the resampling plugin. Just something nice to have. Thanks!!
[a href="index.php?act=findpost&pid=364110"][{POST_SNAPBACK}][/a]


The more details you can give me, the more chance I have to recreate / diagnose the problem. The following would be useful;

What settings have you got the resampling plugin set to (frequency, sample size and so on)?

When it crashes do you get an error message or the standard Windows error message or does Windows itself crash?

What speed of CPU does your computer have?

How Much memory do you have?

Have you tried anything other than MP3's (e.g. WAV's, WV's,WMA and so on)?

Regards,
Steve
[a href="index.php?act=findpost&pid=364142"][{POST_SNAPBACK}][/a]


I have set the resampling plugin like this -
output - 16 bit
Kernel precision - 100
resampling rate - 48k
computer RAM - 512 MB
The PC is a Dell box (Optiplex GX260)
The processor is P4.
I have tried ogg files also but still the same. I have taken a screenshot of Winamp. Will send it to you thru PM. Thanks!!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: philly4 on 2006-02-15 04:15:45
Hey thanks for the plugin.  I think i found a bug with the gapless mode on.  When I play a song and let it play to the next song, the current time display and slider posiiton don't start at 0:00 for the new track, it starts at where the first track left off.  For example a 0:40 track followed by a 6:23 track.  The first track will play and gaplessly transition to the second track, but the current time display will read 0:40, 0:41 etc when the second track starts to play and continue up.  The posiiton slider also is in the poition it should be for 0:40, 0:41, but the sound is only one or two seconds into the track. This dosn't seem to happen when turning gapless mode off.

Win XP SP2
Winamp 5.13
out_ks35.dll
playing flac
chaintech AV 7-10
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hyperion on 2006-02-17 00:55:08
*Error!*
"Unable to create output pin"

why so?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-19 11:48:58
Quote
*Error!*
"Unable to create output pin"

why so?
[a href="index.php?act=findpost&pid=364867"][{POST_SNAPBACK}][/a]


Hi Hyperion, this can happen for lots of reasons, I need more information about what you were doing, what sort of files you were playing, what other programs were running at the time, what plugins you are using in conjunction with KS and so on.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-19 12:13:04
Quote
When I play a song and let it play to the next song, the current time display and slider posiiton don't start at 0:00 for the new track, it starts at where the first track left off.  For example a 0:40 track followed by a 6:23 track.  The first track will play and gaplessly transition to the second track, but the current time display will read 0:40, 0:41 etc when the second track starts to play and continue up.  The posiiton slider also is in the poition it should be for 0:40, 0:41, but the sound is only one or two seconds into the track. This dosn't seem to happen when turning gapless mode off.
[a href="index.php?act=findpost&pid=364440"][{POST_SNAPBACK}][/a]


Hi Philly4, that's not a problem I'd seen before. I've just converted a couple of tracks to FLAC and sure enough, it is happening, but only with FLAC material. I would guess that the FLAC decoder isn't behaving in the same way as the other ones I normally use (Wavpack, WMA, WAV and so on). When I get  a minute I'll have a look at this in the debugger and see if I can sort it out.

Thanks for pointing it out to me.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: avellan on 2006-02-19 14:13:04
I get the "unable to create output pin" error. KS works fine with foobar2k so I was a little surprised. Here's some info about my environment.

Soundcard: M-Audio Revolution 5.1
Windows 2000
Winamp 5.13, no additional plugins

Tried it after a clean reboot without any additional programs running. Tried with mp3, wav, flac and CD-audio. It turns out that CD-audio works, although i get the error but after click on OK it start's playing. With the other formats it just stops. Another interesting thing, if I try foobar2k after Winamp I get "KS output error: error opening device" and it can only be fixed with a reboot.
In the readme it says select another device if this error appears but there's only one selection, maybe that's the problem? Also tried the old plugin and it crashed winamp.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-19 16:00:43
Quote
I get the "unable to create output pin" error. KS works fine with foobar2k so I was a little surprised. Here's some info about my environment.

Soundcard: M-Audio Revolution 5.1
Windows 2000
Winamp 5.13, no additional plugins

Tried it after a clean reboot without any additional programs running. Tried with mp3, wav, flac and CD-audio. It turns out that CD-audio works, although i get the error but after click on OK it start's playing. With the other formats it just stops. Another interesting thing, if I try foobar2k after Winamp I get "KS output error: error opening device" and it can only be fixed with a reboot.
In the readme it says select another device if this error appears but there's only one selection, maybe that's the problem? Also tried the old plugin and it crashed winamp.
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=365541")


I've just uploaded a test version [a href="http://tinyurl.com/7r2de]here[/url] (V3.51) that will give a little more information in the error message, if you'd like to try that and send me the results it may be helpful in getting to the bottom of this. You should now get two error messages, I'm interested in both of them. Note, this version is for testing only, the V3.5 plugin is still available at the usual address, i.e. here (http://tinyurl.com/ng548) for anyone who needs it.

The error message you are seeing is a result of the sound card driver not being able to support the requested format for some reason. I get the same error with with my M-Audio Audiophile 2496 if I select "M-Audio Delta AP Mon. Mixer" as my output device, however, my card exposes three more interfaces, all of which work. If you can also send me the Output Device name as listed in the plugin config panel that may help too.

Unfortunately I don't have access to a sound card like yours or, for that matter, a Windows 2000 machine (mine are XP these days) so it may not be possible for me to fix this for you as I can't test it.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: avellan on 2006-02-19 16:44:06
Quote
I've just uploaded a test version here (http://tinyurl.com/7r2de) (V3.51) that will give a little more information in the error message, if you'd like to try that and send me the results it may be helpful in getting to the bottom of this. You should now get two error messages, I'm interested in both of them. Note, this version is for testing only, the V3.5 plugin is still available at the usual address, i.e. here (http://tinyurl.com/d3a72) for anyone who needs it.

The error message you are seeing is a result of the sound card driver not being able to support the requested format for some reason. I get the same error with with my M-Audio Audiophile 2496 if I select "M-Audio Delta AP Mon. Mixer" as my output device, however, my card exposes three more interfaces, all of which work. If you can also send me the Output Device name as listed in the plugin config panel that may help too.

Unfortunately I don't have access to a sound card like yours or, for that matter, a Windows 2000 machine (mine are XP these days) so it may not be possible for me to fix this for you as I can't test it.

Cheers,
Steve
[a href="index.php?act=findpost&pid=365567"][{POST_SNAPBACK}][/a]


Thanks for the fast reply. This is what I get with the new version

Unable to create output pin on first/second attempt
Reason: Failed to instantiate Render Pin
Format Info: nChannels 2 Freq: 44100 Sample Size: 16

In other words first and second message identical. The output device name in the plugin just says "M-Audio Revolution". CD-audio shows the same messages but still works after they're clicked away. I hope this helps.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: shaj on 2006-02-19 18:28:53
Hey Steve...

Here is the error I get...

'Unable to create output pin on first attempt
Reason: Could not find a render pin that supports the given wave format
Format info: nChannels 2 Freq: 44100 Sample size 24'

My Info:

Diamond Xtreme Sound 7.1/24bit
Input Plugin: Shibatch mpg123 plug-in v1.18y ot99 SSE2

Trying to play Mp3's. No luck.

I followed instructions on below link and the Kernel output plugin mentioned there works fine for me...but none of the new ones...

http://www.osnews.com/story.php?news_id=10324 (http://www.osnews.com/story.php?news_id=10324)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-19 18:57:32
Quote
Hey Steve...

Here is the error I get...

'Unable to create output pin on first attempt
Reason: Could not find a render pin that supports the given wave format
Format info: nChannels 2 Freq: 44100 Sample size 24'

My Info:

Diamond Xtreme Sound 7.1/24bit
Input Plugin: Shibatch mpg123 plug-in v1.18y ot99 SSE2

Trying to play Mp3's. No luck.

I followed instructions on below link and the Kernel output plugin mentioned there works fine for me...but none of the new ones...

http://www.osnews.com/story.php?news_id=10324 (http://www.osnews.com/story.php?news_id=10324)
[a href="index.php?act=findpost&pid=365603"][{POST_SNAPBACK}][/a]


Hi Shaj, it's interesting that you say the Kernel Streaming plugin mentioned there works but mine doesn't, interesting because mine is a redevelopment of that one. The bit that generates the above error is actually in the same Microsoft sample code that both plugins are built on. The only divergence at this point in the process is that my code has been expanded to support 24 bit sources which I wouldn't have expected the old plugin to work with. I'll have a quick play around and compare my setup code to Chun Yu's just to see what I've done differently.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-19 19:35:38
Hi Shaj / Avellan,

I've just posted a new test version here (http://tinyurl.com/7r2de) (same place as last time) this is V3.52.

Let me know if this makes any difference for either of you guys. If you still get an error, you will only get one now.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: avellan on 2006-02-19 19:57:04
Quote
Hi Shaj / Avellan,

I've just posted a new test version here (http://tinyurl.com/7r2de) (same place as last time) this is V3.52.

Let me know if this makes any difference for either of you guys. If you still get an error, you will only get one now.

Cheers,
Steve
[a href="index.php?act=findpost&pid=365624"][{POST_SNAPBACK}][/a]


Same error but as expected only one. Keep up the good work. Let's hope it pays off in the end.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-19 20:11:34
Quote
Same error but as expected only one. Keep up the good work. Let's hope it pays off in the end.
[a href="index.php?act=findpost&pid=365630"][{POST_SNAPBACK}][/a]


Hmmm, I suspected it might, that's a pity, although I do think it will sort out Shaj's problem. The fact that your card works with Foobar's kernel streaming is very curious, mind you I don't know if that has it's origins in the same Microsoft SDK sample code or not. I'll keep looking for a little while longer.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hyperion on 2006-02-20 04:15:29
hi Steve,

Here is the error I get...

'Unable to create output pin on second attempt
Reason: Failed to instantiate Render Pin
Format info: nChannels 2 Freq: 44100 Sample size:16'
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: shaj on 2006-02-20 20:11:23
Quote
Hmmm, I suspected it might, that's a pity, although I do think it will sort out Shaj's problem. The fact that your card works with Foobar's kernel streaming is very curious, mind you I don't know if that has it's origins in the same Microsoft SDK sample code or not. I'll keep looking for a little while longer.

Regards,
Steve
[a href="index.php?act=findpost&pid=365635"][{POST_SNAPBACK}][/a]


Hi again Steve.

I was so excited coz it played the first song I tried to...

that's when I realised I was playin an AAC file...

So I guess the output does work, but not with the mpg123 input plugin?

I'm basically gettin the same error, but with a slight difference...

now it says...

'Unable to create output pin on second attempt
Reason: Could not find a render pin that supports the given wave format
Format info: nChannels 2 Freq: 44100 Sample size 32'


Any ideas?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-20 20:41:35
Quote
Hi again Steve.

I was so excited coz it played the first song I tried to...

that's when I realised I was playin an AAC file...

So I guess the output does work, but not with the mpg123 input plugin?

I'm basically gettin the same error, but with a slight difference...

now it says...

'Unable to create output pin on second attempt
Reason: Could not find a render pin that supports the given wave format
Format info: nChannels 2 Freq: 44100 Sample size 32'


Any ideas?
[a href="index.php?act=findpost&pid=365861"][{POST_SNAPBACK}][/a]


Hey Shaj,

that's a shame. Can you confirm that it definitely workz playing mpg123 output with Chun Yu's original plugin? I'll have to double check, but my code should be falling back to the same sort of setup as his did if it fails on the first attempt.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-20 20:46:20
Quote
hi Steve,

Here is the error I get...

'Unable to create output pin on second attempt
Reason: Failed to instantiate Render Pin
Format info: nChannels 2 Freq: 44100 Sample size:16'
[a href="index.php?act=findpost&pid=365715"][{POST_SNAPBACK}][/a]


Hi Hyperion, can you give me some information about your setup? Particularly;

what type of soundcard are you using?

what operating system are you running?

are you running any other programs at the same time?

Also, didn't you say in an earlier post that it worked fine? What has changed?

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-20 21:45:05
Quote
Hi again Steve.

I was so excited coz it played the first song I tried to...

that's when I realised I was playin an AAC file...

So I guess the output does work, but not with the mpg123 input plugin?

I'm basically gettin the same error, but with a slight difference...

now it says...

'Unable to create output pin on second attempt
Reason: Could not find a render pin that supports the given wave format
Format info: nChannels 2 Freq: 44100 Sample size 32'


Any ideas?
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=365861")


Hi Shaj, I stand corrected (see earlier post), I had made a mistake in my fallback code. If you download the test plugin again from [a href="http://tinyurl.com/7r2de]here[/url] (V3.53) hopefully it will work for you now. Please give it a go and let me know how you get on.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Hyperion on 2006-02-21 04:09:07
Quote
Quote
hi Steve,

Here is the error I get...

'Unable to create output pin on second attempt
Reason: Failed to instantiate Render Pin
Format info: nChannels 2 Freq: 44100 Sample size:16'
[a href="index.php?act=findpost&pid=365715"][{POST_SNAPBACK}][/a]


Hi Hyperion, can you give me some information about your setup? Particularly;

what type of soundcard are you using?

what operating system are you running?

are you running any other programs at the same time?

Also, didn't you say in an earlier post that it worked fine? What has changed?

Cheers,
Steve
[a href="index.php?act=findpost&pid=365871"][{POST_SNAPBACK}][/a]


hi Steve,
my info:
1. AC'97
2.WinXP Home SP2
3.yes. i 'm running word2000.exe

the error happened during the playback.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: shaj on 2006-02-21 17:37:37
Quote
Hi Shaj, I stand corrected (see earlier post), I had made a mistake in my fallback code. If you download the test plugin again from here (http://tinyurl.com/7r2de) (V3.53) hopefully it will work for you now. Please give it a go and let me know how you get on.

Cheers,
Steve
[a href="index.php?act=findpost&pid=365881"][{POST_SNAPBACK}][/a]


Yippppppppppppe! It works!!! It finally works!!!

But I have a question...

you say it falls back to the same methods of the old kernel plugin?

Does that mean it's the same as usin the other plugin? or is urs still the more advanced one even after the fallback?

Thanks again Steve...
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-02-21 21:59:50
Quote
Yippppppppppppe! It works!!! It finally works!!!

But I have a question...

you say it falls back to the same methods of the old kernel plugin?

Does that mean it's the same as usin the other plugin? or is urs still the more advanced one even after the fallback?

Thanks again Steve...
[a href="index.php?act=findpost&pid=366037"][{POST_SNAPBACK}][/a]

Hey, glad to hear it's finally working. I think you may have misunderstood me about the fallback. Be assured it's still working exactly the same as before, it's just some data used to set things up that has changed. What happens is this, when I create the output pin (a software component used to feed audio data out to the sound hardware) I have to create a data structure called a WAVEFORMATEX, this describes the type of audio data I will be sending to the pin and contains information such as the number of bits in a sample, samples per second, number of channels and so on. It seems that certain device drivers cannot handle a WAVEFORMATEX under certain circumstances, your driver being one of them. As a fallback, a second attempt is made to create the pin using a simpler data structure called a WAVEFORMAT instead.

In the original plugin, certain information of the WAVEFORMATEX didn't appear to be filled in correctly, something I rectified for this plugin, however, when the fallback occurs, the WAVEFORMATEX gets certain elements modified to turn it into a WAVEFORMAT and, comparing notes against the old plugin, I wasn't doing this correctly for anything above 16 bit samples (this is why the old plugin worked in this particular instance and mine didn't).

So, you see, the only thing that has changed is a bit of initialisation data, the plugin is still my complete rewrite (except for the Microsoft bits that do the really low level stuff which are common to both plugins although I did add a few bits and pieces to these so I could get some extra information out of them).

For the moment, you will find that the volume control wont work for the mpg123 plugin, this is because it's outputting 24 bit data in a format that my volume control code currently cannot handle, it's easy enough to fix, so hopefully I'll be able to sort it out and post an "official" release at the weekend which will contain a few other bug fixes (like the FLAC one mentioned earlier and a crash I've stumbled across that can occur when WMA files are paused).

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: shaj on 2006-02-23 11:41:58
Quote
Hey, glad to hear it's finally working. I think you may have misunderstood me about the fallback. Be assured it's still working exactly the same as before, it's just some data used to set things up that has changed. What happens is this, when I create the output pin (a software component used to feed audio data out to the sound hardware) I have to create a data structure called a WAVEFORMATEX, this describes the type of audio data I will be sending to the pin and contains information such as the number of bits in a sample, samples per second, number of channels and so on. It seems that certain device drivers cannot handle a WAVEFORMATEX under certain circumstances, your driver being one of them. As a fallback, a second attempt is made to create the pin using a simpler data structure called a WAVEFORMAT instead.

In the original plugin, certain information of the WAVEFORMATEX didn't appear to be filled in correctly, something I rectified for this plugin, however, when the fallback occurs, the WAVEFORMATEX gets certain elements modified to turn it into a WAVEFORMAT and, comparing notes against the old plugin, I wasn't doing this correctly for anything above 16 bit samples (this is why the old plugin worked in this particular instance and mine didn't).

So, you see, the only thing that has changed is a bit of initialisation data, the plugin is still my complete rewrite (except for the Microsoft bits that do the really low level stuff which are common to both plugins although I did add a few bits and pieces to these so I could get some extra information out of them).

For the moment, you will find that the volume control wont work for the mpg123 plugin, this is because it's outputting 24 bit data in a format that my volume control code currently cannot handle, it's easy enough to fix, so hopefully I'll be able to sort it out and post an "official" release at the weekend which will contain a few other bug fixes (like the FLAC one mentioned earlier and a crash I've stumbled across that can occur when WMA files are paused).

Regards,
Steve
[a href="index.php?act=findpost&pid=366102"][{POST_SNAPBACK}][/a]


Awesome!

Hat's off to you Steve...
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-03-05 08:46:59
trying V3.5, doesn't work with my card.
"Error! Unable to create output pin" 

my soundcard:
Chaintech AV-710 (Envy24H-S), driver 5.00a

here are my foobar settings that work:
DSP, add Resampler
Resampler: 96000Hz, slow mode
output: Kernel Streaming -> go to settings.
Device: Envy24 Family Audio (WDM), Buffer length 1000ms
Output: 24bit fixed-point padded to 32bit.


I've even tried using a resampler plugin to resample to 96000Hz, but still the same error message.

Thanks in advance. 
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-03-05 10:15:39
Quote
trying V3.5, doesn't work with my card.
"Error! Unable to create output pin"  

[a href="index.php?act=findpost&pid=369231"][{POST_SNAPBACK}][/a]


Have you tried the test version (V3.53) linked in post #168? Give it a go and let me know how you get on.

For anyone waiting for the V3.6 release, it's still in the works but I've hit a problem getting the volume control to work with 24 bit audio in the fallback mode, so it will be delayed until I get a chance to resolve this issue.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-03-05 10:18:53
Quote
Have you tried the test version (V3.53) linked in post #168? Give it a go and let me know how you get on.

Steve
[a href="index.php?act=findpost&pid=369247"][{POST_SNAPBACK}][/a]


edit: ok, let me try.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-03-05 10:35:08
Quote
Quote
Have you tried the test version (V3.53) linked in post #168? Give it a go and let me know how you get on.

Steve
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=369247")


edit: ok, let me try.
[a href="index.php?act=findpost&pid=369248"][{POST_SNAPBACK}][/a]


ok, I tried this ks353, and it works if I set my driver to 44.1kHz.

However, I need to use at least 96kHz or 192kHz for the better DAC (rear) found in AV-710.  So I tried using [a href="http://www.winamp.com/plugins/details.php?id=144826]HQSoftProc Software Resampling v4[/url] , set it to 96000, press play in WinAmp, no error message, but does nothing (w/o err msg), stuck at 0:00.... so I'm not sure if this is the resampler bug or KS353...
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-03-05 11:23:17
Quote
ok, I tried this ks353, and it works if I set my driver to 44.1kHz.

However, I need to use at least 96kHz or 192kHz for the better DAC (rear) found in AV-710.  So I tried using HQSoftProc Software Resampling v4 (http://www.winamp.com/plugins/details.php?id=144826) , set it to 96000, press play in WinAmp, no error message, but does nothing (w/o err msg), stuck at 0:00.... so I'm not sure if this is the resampler bug or KS353...
[a href="index.php?act=findpost&pid=369251"][{POST_SNAPBACK}][/a]


Looking at your earlier post, this could be a packing problem. As far as I'm aware, the HQSoftProc plugin passes 24 bit data "as is" whereas, in your Foobar settings you are padding the 24 bit samples out to 32 bit.

My plugin uses one of two output modes, the first one it attempts will actually do this padding, unfortunately, for some reason, this mode is not supported on your card, so it falls back to an older, more widely supported mode that doesn't do the padding that your card appears to handle (although it refuses to run for some reason).

I can probably add an option to allow the packing in both modes (optional so it can be switched off if it causes problems on existing working setups). Once I've fixed the current problem (occasional data misalignment with 24 bit samples) I'll look at adding this.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-03-05 21:34:28
thank you very much Steve~ 
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: SillKotscha on 2006-03-08 22:12:23
Hi Steve,

thank you for that plugin. I've tested a bunch of files on my hdd and they played very well... and I really love the gapeless aspect!!! Nice for mixes cut into pieces.

Nevertheless I've found some files that won't play - probably because of the sampling rate. I've uploaded them for your interest.

Keep up the great work and again, thx.

Sill

file 1 [wav - 22050Hz] (http://www.speedyshare.com/886227870.html)

file 2 [he-aac.m4a - 44100Hz] (http://www.speedyshare.com/986346895.html)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2006-03-17 22:37:51
Thank you Steve for all the work on the KS plugin!

I hope that you have time to implement one more feature:

something like hybrid volume control as in the DS module.

Winamp is connect to some big amps at home () and at the moment the most of the volume control takes place between 0 - 15 pct.

thanks again for all the updates!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-03-18 11:15:08
Quote
Thank you Steve for all the work on the KS plugin!

I hope that you have time to implement one more feature:

something like hybrid volume control as in the DS module.

Winamp is connect to some big amps at home () and at the moment the most of the volume control takes place between 0 - 15 pct.

thanks again for all the updates!
[a href="index.php?act=findpost&pid=372207"][{POST_SNAPBACK}][/a]


Hi wdekler.

Not sure I'd recommend running things the way you've got them. I once tried the very same thing myself as an experiment, i.e. taking the output from my sound card directly into my Bryston 4BSST (300 watts per channel), the sound was very poor compared to running a digital feed into my AV32R then out into the Bryston.

This would in part be because the quality of the output stage in my sound card (M-Audio Audiophile 2496) is not as good as that in my AV32R but also because of the volume control in the plugin.

The plugin volume control is implemented simply by applying a multiply and divide to all the samples passing through it. So, at 15% volume you'd actually be getting an effective bit resolution of somewhere between 9 and 10 bits which is going to impact significantly on sound quality, particularly as you're then applying the full gain output of your amp to the sound cards output.

I think you'd get a far better result running your sound card through some form of analogue preamp before hitting the power amp itself. Then you could run the plugin with the volume control disabled (thereby getting the maximum dynamic range out of the sound card) and just use your preamps volume control instead to adjust the level.

Having said all that, if you're happy with the sound you're getting, fair enough, it's not too hard to add a logarithmic volume control to the plugin so I will add that to the list, however I would seriously suggest trying my suggestion above to see if you prefer the results.

Hope that's helpful,
regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2006-03-18 12:02:17
Hi Steve,


I fully agree with what you're writing. Digital attenuation is a (very) bad thing to do when you're listenening with an audiophile setup.

Currently, I have an external DAC which doesn't have a volume control, so I use an analogue attenuator after the DAC and control the volume via Winamp. You can clearly hear the sound quality degrade when you turn down the volume via Winamp due to the unavoidable "resolution" loss.

Controlling the volume via Winamp will be an interim solution for me as I'm thinking of buying a high quality DAC with a remote volume control. This DAC has a high quality resistor ladder controlled small amplifier at the output to properly handle the attenuation in 0.5db steps.  Just what the big amps need as they're rated at 500watts.

So the hybrid volume control will only be an interim solution for me, but maybe some other people would benefit as well?

thanks,


Wanne.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-03-19 20:49:13
** Important - Changes to Download Address **

Hi all, as I've recently changed ISP, all previously mentioned links to the plugin will shortly cease to work. However I've now set up a web page at my new ISP containing downloads of all versions of the plugin along with source etc. This page may be found here (http://tinyurl.com/ng548).

Unfortunately I've still not managed to get round to fixing some of the plugins existing problems (e.g. 24 bit support issues on certain cards, complete incompatibility with certain cards) so there's still no new version. I'm not strictly sure how I'm going to fix some of these issues as I don't have the relevant hardware to test on, however, as soon as there's any sort of update (other features like the log volume control for example) I'll let you know.

Cheers,
Steve

<edit> - actually, earlier links should now point to the above address as I've gone through and edited them all (except for the test ones).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: callmeace on 2006-03-21 05:10:20
Hello Steve and thanks for all the updates, and I look forward to any more 

I visited your new page just now, just one thing I noticed. I am using Internet Explorer 6 and the page title shows as a dash - whereas I think you want it to be Winamp Kernel Streaming Plugin

I mean the title that shows in the blue bar at the top of the browser window.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-03-21 22:03:36
Quote
Hello Steve and thanks for all the updates, and I look forward to any more 

I visited your new page just now, just one thing I noticed. I am using Internet Explorer 6 and the page title shows as a dash - whereas I think you want it to be Winamp Kernel Streaming Plugin

I mean the title that shows in the blue bar at the top of the browser window.
[a href="index.php?act=findpost&pid=373199"][{POST_SNAPBACK}][/a]


Yeah I know, it's an issue with my domain name host, they only allow me to have one title for all the pages accessed through their web diversion, as a result I had it set to nothing, I've changed it now to something a bit more generic.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: callmeace on 2006-03-22 04:42:59
 hee hee, an all encompassing title

  I noticed the new Foobar2000 version and wondered if you might be planning to modify your plugin to work with Foobar2000? I think I read that Peter has made it not too far removed from the Winamp plugin system (for 2.x .... )
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deus-ex on 2006-03-22 21:42:31
Quote
hee hee, an all encompassing title

  I noticed the new Foobar2000 version and wondered if you might be planning to modify your plugin to work with Foobar2000? I think I read that Peter has made it not too far removed from the Winamp plugin system (for 2.x .... )
[{POST_SNAPBACK}][/a] (http://index.php?act=findpost&pid=373721")

Steve can concentrate on further optimizing his great plugin for Winamp.
Kernel Streaming plugin for foobar2000 v0.9 is already available: [a href="http://www.foobar2000.org/components/index.html]http://www.foobar2000.org/components/index.html[/url]


Regards,
deus-ex
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: altruist on 2006-03-27 10:10:40
I get the same error as Hyperion, I am using the same setup as fanbanlo:

"Unable to create output pin on second attempt
Reason: Failed to instantiate Render Pin
Format info: nChannels 2 Freq: 44100 Sample size:16"
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: berzerka on 2006-03-27 12:23:05
Hi Steve. I own a m-audio revolution 7.1 and it might help you fixing the bug with my experience with your driver. It did work with the original soundcard drivers but after upgrading the same problems occured no matter what type of file and version of your driver. I'll guess there is more to it then a wav header interpretation. The same thing occured with the foobar 0.9 kernel driver. If it helps you debugging I can install the old soundcard drivers back and send you a comparison.

edit: the fb 8.3 driver kept working
edit2: the analog output also fine so s/pdif might be the dissident
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-03-27 22:47:54
Thanks guys, every bit of feedback helps, although, debugging without actually having problematic hardware to test on is a bit hit and miss. It's not helped by the Kernel Streaming interface being a bit minimalistic in terms of error codes. I'll have to see about putting a debug version together that can generate a diagnostic file that you guys can post to me. I might give this a go this weekend if I get enough spare time.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: blinded_with_science on 2006-04-04 16:19:42
Hi Steve!

Thanks a million for an excellent plug-in, and for releasing the source code!

Here's a modification I had to make to play 5.1 surround sound (6 channels) through your plug-in:

In KSCORE.CPP, KSCore::StartInternal, when initializing wfx.dwChannelMask:

   if(numchannels==6)
      wfx.dwChannelMask = KSAUDIO_SPEAKER_5POINT1;
   else
      wfx.dwChannelMask = KSAUDIO_SPEAKER_STEREO;

This could of course be extended for other channel configs as well. Without this modification, pPin->Instantiate(fLooped) returns E_INVALIDARG when attempting to play a 6 channel file of any format.

Thanks again, I hope this is of some use .

///Leif
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-04-04 21:50:10
Quote
Here's a modification I had to make to play 5.1 surround sound (6 channels) through your plug-in:
///Leif
[a href="index.php?act=findpost&pid=379048"][{POST_SNAPBACK}][/a]


Thanks Leif, I'll incorporate it into the next release.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-04-09 21:08:43
New Version 3.6

Hi all, I've finally had a little time to spend on the plugin, so there is a shiny new version (v3.6) here (http://tinyurl.com/ng548).

This version contains a couple of fixes and two new features.

Firstly, I've added a logarithmic option to the volume control, this is on by default but can be disabled if preferred. Secondly, I've added a Diagnostic Logging system. When activated, this will dump various bits of useful information out to a file that may help me to diagnose what's going on with some of the problems people have been experiencing.

If you are having problems with the plugin, then please turn on the logging feature and run the plugin so that it fails to work for you, then, in the folder you installed Winamp in (typically c:\program files\winamp) you should find a file called "kernel streaming log.txt", forward this file to me via pm so that I can collate them and see if I can glean a bit more of an idea as to what is going wrong.

Incidentally, because I've added the logging system, I've removed the pop up messages that appeared when the plugin failed to create a pin as these could be a real nuisance if you had a large playlist - so you wont see an error message anymore, it just simply wont play.

If there are any new problems caused by this version, please let me know and I'll see what I can do.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2006-04-16 17:38:57
Wow, gapless & a logarithmic volume control, great work, thanks! 

Not really important to me: the flac decoder fails without an error now when set to 24bit output.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-04-16 18:29:40
Wow, gapless & a logarithmic volume control, great work, thanks! 

Not really important to me: the flac decoder fails without an error now when set to 24bit output.

Did 24bit work with an earlier version? If you can send me a log and some details about your sound card, it may help in identifying the problem.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2006-04-16 21:26:37
Hi Steve,


24bit output didn't work with any version. The previous 3.5 version produced an error with flac stating "failed to create output pin". With the new version, winamp simply skips all flac files without any warning.

However, the same error appears in the log:

Kernel Streaming Plugin v3.6 (x86) Diagnostic log

input buffer configured to 65536 bytes
output buffer configured to 8192 bytes per packet
Enumerated Filter:
  Friendly Name:
  Aureon 5.1 Fun Wave
  Filter Type = 1


Constructed KSCore (Input Size:65536) (Output Size 8192) (Output Cnt 8)
OpenOutput - Current Settings:
Chosen Filter:      Aureon 5.1 Fun Wave
Input Buffer Size:  65536
Output Buffer Size  8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 32
Format.nBlockAlign          = 8
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 22
Samples.wValidBitsPerSample = 24
dwChannelMask              = 00000003


Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 24
Format.nBlockAlign          = 6
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 0
Samples.wValidBitsPerSample = 0
dwChannelMask              = 00000000

As the logfile states, I'm using an Aureon Fun 5.1 card with 5.12.1.646 drivers which should be the latest ones available.

I think it's CMI 8738 based and Winamp is able to play a 24 bit file using other output plugins although I'm not sure if the DAC actually gets the data in that format (resampling etc.).

thanks!

Wanne.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: dZeus on 2006-04-20 15:06:37
v3.6 works great here, but I'm missing one feature I really like:

fade out on buffer size, as is implemented in the default directsound output plugin (and in modified versions like the out_ds_ssrc.dll).
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: CLEITON on 2006-05-08 00:01:37
Hi Steve please, fix the link!!! so, please      PAGE NOT FOUND
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-05-08 00:19:03
Hi Steve please, fix the link!!! so, please      PAGE NOT FOUND


Er, which link? The last posted link (i.e.here (http://tinyurl.com/ng548)) works fine for me.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: CLEITON on 2006-05-08 00:20:39
thanks! now works fine
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deevee on 2006-05-18 06:11:59
The newest version seems to have a problem sometimes when I right click on a folder. It just stops playing until I get rid of the folder menu. Doesnt happen all the time but its enough to be annoying. I dont think the old version did this.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-05-18 20:33:09
The newest version seems to have a problem sometimes when I right click on a folder. It just stops playing until I get rid of the folder menu. Doesnt happen all the time but its enough to be annoying. I dont think the old version did this.


Hi, it should be the same with the last few versions as non of the core code has changed. I can't really imagine why that would be happening though unless you've got some kind of Explorer extension that is hogging CPU resources when the folder menu appears.

Can you give me some details about your setup, i.e. CPU type, CPU speed, memory size, sound card type, operating system and so on. Sending me one of the plugin debug logs as described in an earlier post may also help to identify the cause of the problem. A screen grab of the file menu may also be useful as I'll be able to see if you've got anything non-standard in there.

BTW, wdekler, I haven't forgotten about your problem from a couple of posts back. I actually have the same sound card knocking about so I can actually investigate this one properly, I just haven't had the time to stick it in my development machine so that I can run it under the debugger. When I get some spare time, I will indeed take a look.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: deevee on 2006-05-20 05:51:34
My specs are: mobo: asus a8n cpu: athlon 64 3500+ ram: 2gigs sound card: audigy 2 zs. The log file shows no errors. Music just stops playing until I get out of the menu. I am playing flac files. Music is on seperate drive than windows. It almost seems like it only does it to files/folders on some drives and not others. (i have 4 drives)

pic of menu: http://www.root-core.org/menu.jpg (http://www.root-core.org/menu.jpg)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2006-05-25 17:56:06
After using the plugin a lot I've noticed two small issues in the latest version:

- A zero-byte logfile appears in the directory where the music files are located, not very often though (logging is turned of).

- You can sometimes hear a part of a previous track when you start to play a new one. I think that it is some data which is still in the buffer (64KB). Maybe the buffer isn't cleared when I select a new track? Seems to be happening during high CPU load and when I directly change tracks from the explorer.


Wanne.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: bex000 on 2006-05-28 05:25:08
can you please explain all the settings provided in the menu. sounds good too
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-05-28 09:57:44
After using the plugin a lot I've noticed two small issues in the latest version:

- A zero-byte logfile appears in the directory where the music files are located, not very often though (logging is turned of).

- You can sometimes hear a part of a previous track when you start to play a new one. I think that it is some data which is still in the buffer (64KB). Maybe the buffer isn't cleared when I select a new track? Seems to be happening during high CPU load and when I directly change tracks from the explorer.


Wanne.


I'm surprised the empty logfile is appearing in your music directory, I would expect it to always appear in the Winamp folder. The logging function always creates the empty logfile irrespective of whether logging is enabled or not.

I'm not sure why you should get a little bit of the buffer repeated when switching tracks. One question though, were the tracks ripped with Winamp as this tends to grab a bit of the previous track at the start of each new one.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-05-28 09:58:56
so... any luck on making AV-710 (Envy24-HTS) working yet?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-05-28 09:59:46
can you please explain all the settings provided in the menu. sounds good too


Hi, check out the readme.html file which accompanies the plugin, it "should" answer all of your questions. Let me know if you require further clarification.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-05-28 10:22:54
so... any luck on making AV-710 (Envy24-HTS) working yet?


No, sorry, I haven't had a chance to do any significant development work on the plugin for quite some time. When I get round to fixing any of the outstanding problems I'll post here.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-05-28 10:27:19

so... any luck on making AV-710 (Envy24-HTS) working yet?


No, sorry, I haven't had a chance to do any significant development work on the plugin for quite some time. When I get round to fixing any of the outstanding problems I'll post here.

Regards,
Steve

Thank you Steve, if this work, Winamp will be the first KS-enabled video player for AV-710/Envy24-HTS.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: dZeus on 2006-05-28 11:47:24


so... any luck on making AV-710 (Envy24-HTS) working yet?


No, sorry, I haven't had a chance to do any significant development work on the plugin for quite some time. When I get round to fixing any of the outstanding problems I'll post here.

Regards,
Steve

Thank you Steve, if this work, Winamp will be the first KS-enabled video player for AV-710/Envy24-HTS.


doesn't ReClock beta work on your system with KS (in a DirectShow player)?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-05-28 20:50:39
doesn't ReClock beta work on your system with KS (in a DirectShow player)?

I haven't tried, let me check it out.  Thank you.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: fanbanlo on 2006-05-28 21:28:04

doesn't ReClock beta work on your system with KS (in a DirectShow player)?

I haven't tried, let me check it out.  Thank you.

I just checked, its KS renderer doesn't work with my card (AV-710, Via Envy24 HT-S).

Does it really help with sync / frame drop?  Do you use it?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: dZeus on 2006-05-29 16:26:00


doesn't ReClock beta work on your system with KS (in a DirectShow player)?

I haven't tried, let me check it out.  Thank you.

I just checked, its KS renderer doesn't work with my card (AV-710, Via Envy24 HT-S).

Does it really help with sync / frame drop?  Do you use it?


yes it helps tons on my system (playing back 24 or 25fps content to a PAL TV)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2006-05-31 20:58:27
Steve,

I haven't been able to reproduce the repeating sound issue when starting to play. The tracks weren't ripped with winamp. They were from a splitted ape file (split with cuesplitter). I suspect that the issue was more to blame on the high systemload than on the KS plugin specifically.

I found a way to get the zero byte logfiles...! If I start (load) Winamp by doubleclicking a mp3 file a logfile appears in the same directory. I don't think that there's a way to produce them once Winamp is running.


Wanne.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-06-01 21:18:26
Steve,

I haven't been able to reproduce the repeating sound issue when starting to play. The tracks weren't ripped with winamp. They were from a splitted ape file (split with cuesplitter). I suspect that the issue was more to blame on the high systemload than on the KS plugin specifically.

I found a way to get the zero byte logfiles...! If I start (load) Winamp by doubleclicking a mp3 file a logfile appears in the same directory. I don't think that there's a way to produce them once Winamp is running.


Wanne.


Hi Wanne,
thanks for investigating further, I just wanted to rule out this annoying trait that Winamp has when ripping files - namely that it doesn't correctly grab the start of most tracks, tending to grab a little bit of what immediately preceeded it on the disc. You're probably right, it will be a combination of system load and driver implementation, given that the behaviour of the Kernel Streaming interface seems to vary from card to card.

As for the log file, Winamp does indeed seem to inherit different working directories depending on how it is launched - I noticed something similar while launching it from the debugger. I'll look at locking the directory the log file gets written into for the next version - whenever that happens.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2006-06-03 13:04:34
Let me know if I can do some testing 


cheers,


Wanne.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: DjLECTRix on 2006-07-07 10:48:49
Hi Steve great pluggin' but i can't use this pluggin with my M-Audio Audiophile USB ... i can't set my m-audio at 44khz. i can 48 or 96 24bit maybe i do an error can you help me you think? thanks.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: audioaficionado on 2006-07-27 02:56:25
Kudos to Steve Monks

Now I can listen to music in Vista.  I went back to XP and gave up testing this beta2 evaluation as I won't tolorate no music on my computer.  So far no skips in 30 minutes.  It used to skip within 30 seconds or less.

Vista's k-mixer caused my SoundMax AD1980 onboard sound to skip whenever I tried to play music.  It does this in WMP11 too so it's a Vista issue with my digital out stream drivers feeding my digital receiver through a toslink.

Thanx again Steve

BTW I couldn't try the foobar2000 ks driver as foobar keeps crashing in Vista but that's another topic.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: nogus on 2006-08-02 14:07:50
Hello Steve


1. Have bug report

On Windows 2000 sp4, winamp 2.95, Creative Live! 5.1 with last Creative drivers

I have windows crush (blue screen or hard reboot) when shutting windows down while winamp playing with out_ks36.dll GAPLESS mode.
I have same crush when killing winamp process while playing (ANY mode).
I have NO such crush when closing winamp with WM_CLOSE while playing.
I have NO such crush with out_ds or out_wave

2. About log file creation even if logging disabled. I have added check "if (logging_enabled) " so no log file created at all when logging disabled.

static void InitLogging(void)
{
  FILE *fh;
  if (logging_enabled) {
    fh = fopen("kernel streaming log.txt","wb");
    if (fh) {
      fclose(fh);
    }
  }
}

3. May win32/release build will help with buffer underruns?

Thank You
Oleg
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2006-08-30 20:38:42
Hey Steve, thanks for your plugin, it sounds really useful!

Im using an M-Audio revolution 5.1 soundcard connected thru SPDIF to a 20bit, 44/48Khz capable external DAC. Playing back mostly 'CD quality' (16/44) media.

Am I correct that your plugin, paired with the HQSoftProc Resampling plugin (http://www.hqsoftproc.upcnet.ro/ ) is the perfect audiophile setup for playing back music bit-accurately?

More specifically, what Im doing is using the resampling plugin to upconvert (not resample!) lossless audio files from 16bit to 24bit, (my DAC will ignore the top 4 bits and use 20), then send its output to your plugin. If volume is 100%, the output will be 'bit perfect' in the sense that bits 17-20 will be '000000' and the rest is an exact copy. If volume is less than 100, well then I use the extra 4 bits to cover up the attenuation loss. (I hope your plugin has a high-quality attenuation routine).

Any thoughts? Am I right in my above description or am I missing something fundamental?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2006-09-06 21:57:45
Additionally, I think the logfile creation stuff simply happens if you doubleclick a file to play it. Doing that doesn't change the current dir to 'winamp' like starting winamp first, then loading music.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2006-09-06 23:18:43
1. Have bug report

On Windows 2000 sp4, winamp 2.95, Creative Live! 5.1 with last Creative drivers

I have windows crush (blue screen or hard reboot) when shutting windows down while winamp playing with out_ks36.dll GAPLESS mode.
I have same crush when killing winamp process while playing (ANY mode).
I have NO such crush when closing winamp with WM_CLOSE while playing.
I have NO such crush with out_ds or out_wave

Hmm I have never had it crash on my machine. (winXP sp2, winamp 5.24, 24bit sources only)
did you try the KS drivers for your soundcard to make sure that isnt the problem?
Quote
2. About log file creation even if logging disabled. I have added check "if (logging_enabled) " so no log file created at all when logging disabled.

static void InitLogging(void)
{
  FILE *fh;
  if (logging_enabled) {
    fh = fopen("kernel streaming log.txt","wb");
    if (fh) {
      fclose(fh);
    }
  }
}

Yep, noticed this too. Sadly Steve seems a bit busy. Did you try to compile your DLL? Mind sharing?
Quote
3. May win32/release build will help with buffer underruns?

The main thing that helped me with buffer underruns/stuffering is to improve winamps main priority! Set it to high or realtime and the problem disappeared 99.9% on my machine (Ath64-3000)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-09-06 23:22:27
Hi all, just to catch up with a few of the points above;

DjLECTRix
Quote
Hi Steve great pluggin' but i can't use this pluggin with my M-Audio Audiophile USB ... i can't set my m-audio at 44khz. i can 48 or 96 24bit maybe i do an error can you help me you think? thanks.

Send me an error log and I'll see if it gives any clues, although it could just be a limitation of your card. If all else fails, you could always use the HQSoft resampling plugin if 48/96KHz works with your card.

nogus
Quote
I have windows crush (blue screen or hard reboot) when shutting windows down while winamp playing with out_ks36.dll GAPLESS mode.

My plugin doesn't get any notification that the machine is shutting down, so there's not a lot I can do about it, although it does seem to be down to the robustness of the sound card driver just how well the plugin behaves under these conditions. However I have noticed that the latest version of Winamp closes itself whenever the computer is shut down or sent into hibernation, so maybe this issue has gone away.


Quote
I have same crush when killing winamp process while playing (ANY mode).

Interesting, killing the process probably doesn't give Winamp any notification that it's about to disappear, as such it's still playing when the rug is pulled from under it.


Quote
I have NO such crush when closing winamp with WM_CLOSE while playing.

This is because Winamp notifies my plugin that it is about to stop, so I can clean up nicely.


Quote
I have NO such crush with out_ds or out_wave

This doesn't surprise me as both of these interfaces are a lot more robust than the Kernel Streaming interface which, as it's talking to the driver at a much lower level than either DSound or WaveOut, seems to be very sensitive to how the driver has been written.


Quote
2. About log file creation even if logging disabled. I have added check "if (logging_enabled) " so no log file created at all when logging disabled

The logfile is opened in this way at start up to clear out any existing log files, however this doesn't always work correctly depending on how Winamp was launched because this seems to affect the working directory. Disabling it like this just stops it being flushed out when working normally.


Quote
3. May win32/release build will help with buffer underruns?

Making a release build may help with buffer underruns as the generated code will be a lot more optimal. The builds I have posted have all been release builds although I've never suffered from buffer underruns in normal use when using a debug build.


puntloos
Quote
Am I correct that your plugin, paired with the HQSoftProc Resampling plugin (http://www.hqsoftproc.upcnet.ro/ ) is the perfect audiophile setup for playing back music bit-accurately?



This is an interesting idea to work around the loss caused by the digital volume control.

Can your 20 bit DAC actually handle a 24 bit digital feed? I would have thought that it would only accept 16 bit and internally use the extra four bits of precision to interpolate between samples or even decode HDCD streams.

If your DAC can accept a 24 bit input and ignore the bottom four bits, then yes it would probably improve on the usual loss that the volume control causes although an analogue domain volume control would still be preferable. I'll be interested to know how you get on. Bear in mind that on certain cards the KS plugin doesn't support a volume control for 24 bit data, it only works if your card can support 24 bit samples embedded in a 32 bit packet - you can tell if this is the case because the volume control stops working even if it has been enabled.

Cheers,
Steve

Quote
I hope your plugin has a high-quality attenuation routine

It's something along the lines of;

v2 = v1 x vol / 256
Where v2 = final sample value, v1 = initial sample value, vol = Winamp volume 0 to 255. So nothing elaborate and, as I've just noticed, the calculation is indeed slightly wrong as it should be;

v2 = v1 x vol / 255

however, when vol = 255 I disable the volume control processing, so at 100% volume the samples still get through unmolested.

Quote
Additionally, I think the logfile creation stuff simply happens if you doubleclick a file to play it. Doing that doesn't change the current dir to 'winamp' like starting winamp first, then loading music.


Yep, I think you're right, that's probably what is going on after all. If I ever get round to releasing another update I'll sort this out.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-09-06 23:47:41
Wow, I took that long typing the last reply that you nipped in with another reply!

Quote
The main thing that helped me with buffer underruns/stuffering is to improve winamps main priority! Set it to high or realtime and the problem disappeared 99.9% on my machine (Ath64-3000)


I'm kind of surprised that you are suffering from buffer underruns on an Athlon64-3000. I never experience any problems of this nature on any of the following setups, all of which are running Winamp with normal priority with the buffering set to 32K input, 8K output, 8 output buffers;

3.0GHz Pentium D (2GB Ram) - I usually listen to music when I'm programming or editing, this usually means I'm running a combination of Visual Studio .NET 2003 and / or ProDG (a professional console debugger which can place quite a significant load on the system) or Photoshop and Edius. I also occasionally burn CDs and DVDs, browse the internet and leave Outlook running all the time with no noticable side effects.

2.6GHz Celeron (512MB Ram) - again, no noticable issues although as this is my media PC it seldom does much more than just run Winamp, although I do carry out the odd bit of browsing on this machine. I do also sometimes rip tracks with EAC and convert them to WavPack format while playing Winamp, again with no obvious problems.

2.8GHz Pentium (1GB Ram) - this is my machine at work so it's often simultaneously running Visual Studio, ProDG, Outlook, Photoshop, Nero.

Quote
Yep, noticed this too. Sadly Steve seems a bit busy. Did you try to compile your DLL? Mind sharing?

Yep, spot on, I have been a bit busy. It should be easy to put together a proper fix for this although it's so long since I've worked on the plugin I'm not sure what state it's in relative to the published source (I forgot to tag it in CVS). When I get a minute I'll take a look at this if it's proving to be a nuisance.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2006-09-07 00:07:32
Wow, I took that long typing the last reply that you nipped in with another reply!

Maybe I just type faster than my own shadow! Muhahaha!
Quote
I'm kind of surprised that you are suffering from buffer underruns on an Athlon64-3000. I never experience any problems of this nature on any of the following setups, all of which are running Winamp with normal priority with the buffering set to 32K input, 8K output, 8 output buffers;

That might be it though, I tinkered with the settings, maybe the defaults are the only ones that work reliably? Anyway well, the strange thing was that my system was completely unloaded as well. Y'see I now do run winamp as my main audio source and just sit in my living room.

Perhaps it again is a matter of drivers and caching. KS being as finnicky as it is.

I'm using an m-audio revolution 5.1 btw.

Quote
Yep, spot on, I have been a bit busy. It should be easy to put together a proper fix for this although it's so long since I've worked on the plugin I'm not sure what state it's in relative to the published source (I forgot to tag it in CVS). When I get a minute I'll take a look at this if it's proving to be a nuisance.

The way I use it it hardly is a nuisance (I usually do start winamp first, then start adding stuff to playlists.. but well why go for next-to-perfect, eh? You're almost there methinks.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2006-09-07 00:24:28
Hi all, just to catch up with a few of the points above;

Quote

Am I correct that your plugin, paired with the HQSoftProc Resampling plugin (http://www.hqsoftproc.upcnet.ro/ ) is the perfect audiophile setup for playing back music bit-accurately?

This is an interesting idea to work around the loss caused by the digital volume control.

Can your 20 bit DAC actually handle a 24 bit digital feed? I would have thought that it would only accept 16 bit and internally use the extra four bits of precision to interpolate between samples or even decode HDCD streams.

If your DAC can accept a 24 bit input and ignore the bottom four bits, then yes it would probably improve on the usual loss that the volume control causes although an analogue domain volume control would still be preferable. I'll be interested to know how you get on. Bear in mind that on certain cards the KS plugin doesn't support a volume control for 24 bit data, it only works if your card can support 24 bit samples embedded in a 32 bit packet - you can tell if this is the case because the volume control stops working even if it has been enabled.

Yep, my DAC accepts 24bits (listening to some nice Manu Katche as we speak), upsampled by the resampling plugin, and volume controlled (when I have to) by your plugin. *happy camper* I guess I was lucky with the M-Audio card. I did choose it specifically for its reputation in ASIO etc, and hey, it also supports 24bit 192Khz output, so I can probably survive another format upgrade before I have to trade it in.

Indeed, digital theory says that the dac should just discard the top4 bits, it certainly sounds just fine, although frankly I don't think I would spot the difference between 16bit and 20bit with the casual, non-ABX listening Im doing. Currently I use remoteamp on my PDA (over bluetooth, of course) to control winamp.. and yep, I can quickly control the volume from anywhere in my appartment if need be, and my preamp infrared remote is lost/out of range.
Quote
(about attenuation)It's something along the lines of;

v2 = v1 x vol / 256
Where v2 = final sample value, v1 = initial sample value, vol = Winamp volume 0 to 255. So nothing elaborate and, as I've just noticed, the calculation is indeed slightly wrong as it should be;

v2 = v1 x vol / 255

however, when vol = 255 I disable the volume control processing, so at 100% volume the samples still get through unmolested.

Ah but the pinch is more in the rounding error, not the initial division.

Do you round? (1.45=1, 1.51=2) or do you just chop (1.99=1)
More advanced methods involve dithering where you spread the rounding error across the neighboring samples, but there is much debate on what the best is. Chopping is the worst by far, of course.

On an unrelated note, are you open for donations? Do you have a paypal address or something? I've spent quite a few $ on my stereo over the last couple of months, Ive even invested money in speaker cables (where the best of my microelectronics knowledge - and I am an university microelectronics graduate - cannot justify this).. something as obviously helpful as your plugin would warrant at least a token gift.

No strings attached by the way, I wont start to make demands regarding updates etc
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-09-07 21:15:47
Quote
Ah but the pinch is more in the rounding error, not the initial division.

Do you round? (1.45=1, 1.51=2) or do you just chop (1.99=1)
More advanced methods involve dithering where you spread the rounding error across the neighboring samples, but there is much debate on what the best is. Chopping is the worst by far, of course.


As it's just a simple integer calculation it will just round off, but your suggestion of upsampling to 24 bits before hand will effectively give you an 8 bit of fractional component to pass on to your DAC. It would however be relatively easy to make it round up or down correctly by adjusting the calculation as so;

v2 = (v1 * vol + 127) / 255

I'd be impressed if anyone could hear the difference though. Dithering is a whole other kettle of fish of course.

One other thing to bear in mind, I'm not entirely sure what the HQSoftProc plugin actually does to each sample. If it just multiplies the sample by 256, then this theory would be sound, as the highest possible value, 0x7fff would now be 0x7fff00. However, if it scales the sample, i.e.

v2 = v1 * 0x7fffff / 0x7fff

this will give a completely different result as 0x7fff would now be 0x7fffff. I'll have to make up some test tracks, pass them through and look at what's coming into my plugin to be sure just what it's doing. I wouldn't be surprised if it's also applying dither too.

Quote
On an unrelated note, are you open for donations? Do you have a paypal address or something? I've spent quite a few $ on my stereo over the last couple of months, Ive even invested money in speaker cables (where the best of my microelectronics knowledge - and I am an university microelectronics graduate - cannot justify this).. something as obviously helpful as your plugin would warrant at least a token gift.

No strings attached by the way, I wont start to make demands regarding updates etc


It's kind of you to offer but I'd rather not get into accepting donations for the work I've done on the plugin. I originally rewrote it for my own use as I was fed up of the original one crashing if you happened to look the wrong way at the computer, so rather than just keeping it to myself it seemed to reasonable to offer it to others, along with the source code so that anyone with suitable knowledge could adapt it as they saw fit.

Personally, I'm very happy with the plugin as it stands, in fact I was pretty happy way back on version 2.5, although I'm a lot happier with it since I rewrote it from the ground up and this probably accounts for the slowdown in development in recent months just as much as my busy life.

I now listen to all of my CD's as lossless rips from media PC instead of using my ludicrously expensive TagMcLaren DVD32FLR (which I still use for DVDs, so it's not going to waste) as I can no longer tell any difference. Without the plugin, the crimes of KMixer become glaringly obvious, so I use it for all the music I play and it never gives me any grief.

I'd still like to get to the bottom of some of the problems other people are experiencing, but without the relevant hardware it's a bit of a guessing game trying to work out what's going wrong and I've got far too many other diversions to occupy my time just at the moment.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: nogus on 2006-09-12 13:33:51
Hello Steve

1. Crush on ENDSESSION with Live! 5.1 creative drivers:

I have just tried out_ks36 with winamp 5.24. Have same crushes on endsession while winamp playing. As i noticed, it depends on which another plugins are loaded to winamp. Sometimes i have just write assertion to address 0x10. As I understood, you have no call from winamp when windows sends winamp WM_QUERYENDSESSION message. So you can't cleanup gracefully. But if winamp have WM_CLOSE, it  normally calls EndPlayback and Quit to plugin. Is'nt it winamp or winamp plugin protocol bug? Can you tell me exactly which calls winamp makes to plugin in both cases. It is hard to debug when windows shuttig down.

2 puntloos: I can't use KX driver because it still not supoport AC3 passthough mode for my damn soundcard. I think I can buy new soundcar d

2. Superfluous log file creation:

How about this?

static void InitLogging(void)
{
    FILE *fh;
    fh = fopen(LOG_FILE, "rb");         // check if exists
    if (fh) {
        fclose(fh);
        fh = fopen(LOG_FILE, "wb");      // clear log
        if (fh) {
            fclose(fh);
        }
    }
}

2 puntloos: Yes i have compiled this feature.

Regards, Oleg
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2006-09-13 11:45:55
Quote
Ah but the pinch is more in the rounding error, not the initial division.

Do you round? (1.45=1, 1.51=2) or do you just chop (1.99=1)
More advanced methods involve dithering where you spread the rounding error across the neighboring samples, but there is much debate on what the best is. Chopping is the worst by far, of course.


As it's just a simple integer calculation it will just round off, but your suggestion of upsampling to 24 bits before hand will effectively give you an 8 bit of fractional component to pass on to your DAC. It would however be relatively easy to make it round up or down correctly by adjusting the calculation as so;

v2 = (v1 * vol + 127) / 255

I'd be impressed if anyone could hear the difference though. Dithering is a whole other kettle of fish of course.

From what I heard, you will start hearing this when you also heavily attenuate your audio digitally. Yes, you would be 'consciously' generating a sub-optimal situation, however it does happen!
Quote
One other thing to bear in mind, I'm not entirely sure what the HQSoftProc plugin actually does to each sample. If it just multiplies the sample by 256, then this theory would be sound, as the highest possible value, 0x7fff would now be 0x7fff00. However, if it scales the sample, i.e.

v2 = v1 * 0x7fffff / 0x7fff

this will give a completely different result as 0x7fff would now be 0x7fffff. I'll have to make up some test tracks, pass them through and look at what's coming into my plugin to be sure just what it's doing. I wouldn't be surprised if it's also applying dither too.


I've asked the maker of HQSoftProc. If you tell it to resample, it will dither, if you tell it to just upconvert from 16 to 24, it will simply add 8 zeroes at the end of the sample block.
Quote
Quote
On an unrelated note, are you open for donations? Do you have a paypal address or something? I've spent quite a few $ on my stereo over the last couple of months, Ive even invested money in speaker cables (where the best of my microelectronics knowledge - and I am an university microelectronics graduate - cannot justify this).. something as obviously helpful as your plugin would warrant at least a token gift.

No strings attached by the way, I wont start to make demands regarding updates etc


It's kind of you to offer but I'd rather not get into accepting donations for the work I've done on the plugin. I originally rewrote it for my own use as I was fed up of the original one crashing if you happened to look the wrong way at the computer, so rather than just keeping it to myself it seemed to reasonable to offer it to others, along with the source code so that anyone with suitable knowledge could adapt it as they saw fit.

That's cool, I also contribute to the 'open source' community myself, but I figured I'd offer. If you change your mind, let us know.. I guess setting up the infrastructure for donations might cost you more hassle than it will get you money (although a paypal link is made quickly). Your call. At least know I muchly appreciate your work!!

Quote
Personally, I'm very happy with the plugin as it stands, in fact I was pretty happy way back on version 2.5, although I'm a lot happier with it since I rewrote it from the ground up and this probably accounts for the slowdown in development in recent months just as much as my busy life.

I now listen to all of my CD's as lossless rips from media PC instead of using my ludicrously expensive TagMcLaren DVD32FLR (which I still use for DVDs, so it's not going to waste) as I can no longer tell any difference. Without the plugin, the crimes of KMixer become glaringly obvious, so I use it for all the music I play and it never gives me any grief.

Ditto. I can wholeheartedly reccommend loading up a PDA (with bluetooth activesync) to the program 'remoteamp'. You will be able to browse your audio directories (or artists, if you tagged your files properly), play, add to playlists, alter volume *cough* etc!

Quote
I'd still like to get to the bottom of some of the problems other people are experiencing, but without the relevant hardware it's a bit of a guessing game trying to work out what's going wrong and I've got far too many other diversions to occupy my time just at the moment.

Yeah, busy lives, way of the world.

2 puntloos: I can't use KX driver because it still not supoport AC3 passthough mode for my damn soundcard. I think I can buy new soundcar d

Perhaps a worthy idea 
Quote
2. Superfluous log file creation:

How about this?

static void InitLogging(void)
{
    FILE *fh;
    fh = fopen(LOG_FILE, "rb");         // check if exists
    if (fh) {
        fclose(fh);
        fh = fopen(LOG_FILE, "wb");      // clear log
        if (fh) {
            fclose(fh);
        }
    }
}

2 puntloos: Yes i have compiled this feature.


So, share the source, share the DLL
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: nogus on 2006-09-13 14:38:25
out_ks 3.6 + Superfluous log file creation fix, source + dll
http://rapidshare.de/files/32972612/out_ks36.oleg.rar.html (http://rapidshare.de/files/32972612/out_ks36.oleg.rar.html)

NOTE:
this is unofficial build on older msvc .NET version, hope Steve to include this in 3.7
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: DjLECTRix on 2006-09-23 04:12:31
Code: [Select]
End(force=1)
EndInternal() - mode=0 force=1
Attempting to close player thread
Gapless mode buffer underrun - Player Thread is stopping KS player
End(force=1)
EndInternal() - mode=0 force=1
Player Thread - closing
Player thread has closed
Destructed KSCore
input buffer configured to 16384 bytes
output buffer configured to 8192 bytes per packet
Enumerated Filter:
  Friendly Name:
  Sound Blaster Audigy
  Filter Type = 1


Enumerated Filter:
  Friendly Name:
  Creative Sound Blaster PCI
  Filter Type = 1


Enumerated Filter:
  Friendly Name:
  M-Audio Audiophile USB Line
  Filter Type = 1


Enumerated Filter:
  Friendly Name:
  M-Audio Audiophile USB SPDIF
  Filter Type = 1


Constructed KSCore (Input Size:16384) (Output Size 8192) (Output Cnt 8)
OpenOutput - Current Settings:
Chosen Filter:       M-Audio Audiophile USB Line
Input Buffer Size:   16384
Output Buffer Size   8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 44100
Format.wBitsPerSample       = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize               = 22
Samples.wValidBitsPerSample = 16
dwChannelMask               = 00000003


Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 44100
Format.wBitsPerSample       = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize               = 0
Samples.wValidBitsPerSample = 0
dwChannelMask               = 00000000


OpenOutput - Current Settings:
Chosen Filter:       M-Audio Audiophile USB Line
Input Buffer Size:   16384
Output Buffer Size   8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 44100
Format.wBitsPerSample       = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize               = 22
Samples.wValidBitsPerSample = 16
dwChannelMask               = 00000003


Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 44100
Format.wBitsPerSample       = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize               = 0
Samples.wValidBitsPerSample = 0
dwChannelMask               = 00000000


OpenOutput - Current Settings:
Chosen Filter:       M-Audio Audiophile USB Line
Input Buffer Size:   16384
Output Buffer Size   8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 44100
Format.wBitsPerSample       = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize               = 22
Samples.wValidBitsPerSample = 16
dwChannelMask               = 00000003


Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 44100
Format.wBitsPerSample       = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize               = 0
Samples.wValidBitsPerSample = 0
dwChannelMask               = 00000000


My soundcard are set to 48khz 24bit i can't change the khz lower than 48khz.. i can only up it work when i open some port or close. like spdif out or in on the khz get 48khz. and if i close some get up like 96khz... and when i try to use kernel streaming its this log i get when i change some song for playing and nothing play. hehe
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: nogus on 2006-09-24 00:06:40
more about ENDSESSION crush on Live! 5.1

winamp 5.24 used

I have traced Initialise, Quit, StartPlayback,   EndPlayback methods with winamp 5.24

At first i have detected a non-critical bug in Adrian Paul's HQSoftProc software resampling plugin. It calls Initialise two times. I've put flag to skip superfluous Initialise call but no behaviour changes were detected.

When winamp have WM_CLOSE it calls EndPlayBack and Quit.
When session finishing I have crush and no EndPlayback and Quit calls at all.

I have commented out all the code to make fake output plugin that does nothing, but pretends to winamp to be playing. Crush has gone but still no calls to EndPlayBack and Quit when session finished.

So winamp not allows any output plugin to cleanup gracefully on endsession.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: nogus on 2006-10-16 17:15:35
Latest official Creative Live 5.1 driver (LiveDrvPack.exe, LiveDrvPack_Patch.exe) is really unstable with kernel streaming
Crash has gone since I have installed latest audigy driver (SBAX_WBUP2_LB_2_09_0016.EXE) on my Live! 5.1

Add folloving lines to Support.Cab\Common\WebDrv.ini to install
[Hardware.Map16]
ID = 00801061, 00801062, 00801064, 00801069, 0080106A, 0080106B, 0080106C, 00801065, 00801066, 00801067, 00110001, 0010000A
ProductName = Sound Blaster Live!
DefAppPath = \Creative\SBLive
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: yongwpi on 2006-11-15 22:09:40
Hi, where can I find the source code of version 2.5? Thanks in advance.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2006-11-15 23:34:46
Hi, where can I find the source code of version 2.5? Thanks in advance.


Hi, I've added the source code to 2.5 and 2.4 at the bottom of my download page which may be found here (http://tinyurl.com/ng548).

The 2.4 download is a zip of the code I released along with the 2.4 plugin. I was unable to find an original zip of the 2.5 code, so I've zipped up the last code from my old working repository (I started a new repository for 3.x) and posted it as 2.5. However, this may not actually be the exact 2.5 code as I may have altered it before beginning 3.x, I don't think I did, but it's difficult to tell.

Do you need it for anything in particular?

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: yongwpi on 2006-11-30 16:12:01
Thank you very much. Since the old the version has fewer features, and I am new to directks, it will be easier for me to learn directks. BTW, do you try directks in audio capture? I have problems in audio capture. As I set the state to KSSTATE_RUN, the system crushed, and the computer restarted by itself. The program died at SetState(run)->DeviceIoControl(...). I do not know much about driver. Do you have suggestions? Thank you.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: kron on 2006-12-21 14:02:12
Hi,

the site from Steve Monks seems to be out of order,
could anyone upload or give a working link to the the latest version please?

EDIT: Nevermind, works now!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2007-01-03 17:03:09
I'm currently using a Chaintech AV 710 card with the kernel streaming output because it has (24) bit-perfect output.

With all the Via drivers which I tried, 3.10A being the most stable, I noticed that Winamp's time/song position is wrong. A song which should play for 2 minutes for example, goes on to about 2:40, while still sounding fine.

Foobar KS and Winamp with DS work fine; is this a bug in the kernel streaming module?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-01-03 19:56:18
I'm currently using a Chaintech AV 710 card with the kernel streaming output because it has (24) bit-perfect output.

With all the Via drivers which I tried, 3.10A being the most stable, I noticed that Winamp's time/song position is wrong. A song which should play for 2 minutes for example, goes on to about 2:40, while still sounding fine.

Foobar KS and Winamp with DS work fine; is this a bug in the kernel streaming module?


Yep, it's a bug in the Kernel Streaming plugin, it looks like I'm using the total amount of data written to the output device along with the format of the input data to calculate the current play position - which Winamp interrogates for it's time and graphic equaliser display - when I should really be using the format of the output device in the calculation.

If I get a chance I'll fix it and post a new one. Don't hold your breath though.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-01-03 20:36:38
Actually, scratch that, I am using the output format in the calculation, so that does in fact look correct.

I've tried running a few tracks through the plugin using the HQSoft resampling plugin to upconvert the input data to 24 and 32 bit formats which forces the output to the same format, and the timings I'm getting are correct. Can you post a diagnostic log to give me some idea of what's going in and out of the plugin? Also, can you let me know about any other plugins you are using at the same time?

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: MoSPDude on 2007-01-04 15:56:05
Hi,
I've a feeling it differs with the sound card and drivers. On my Prodigy 192 the visualisation were lagging FAR behind, so I modified the code to help bring them back. When Winamp wanted to know the current output time, the plug-in was reporting written time to the KS interface ignoring the output lag, and when Winamp wanted to know the written time from the input plug-in, it wasn't taking into account the data in the input buffer. This mean that when Winamp wanted written time it was reporting a time in the past, and for output time it was giving a time in the future. These changes bring the time delay down a lot but still not quite perfect.

Code: [Select]
int KSCore::GetKSTime(void)
{
    unsigned int bytes_per_sec, t;
    bytes_per_sec = wfx_cur.Format.nAvgBytesPerSec;

    t =  written_data / bytes_per_sec * 1000; // time to nearest second in mS
    t += (written_data % bytes_per_sec) * 1000 / bytes_per_sec;    // add in fractional component

    return t;
}

int KSCore::GetOutputTime(void)
{
    float packet_lat, out_lat = 0.0;
    unsigned int bytes_per_sec;
    int t;
    bytes_per_sec = wfx_cur.Format.nAvgBytesPerSec;
    packet_lat = (float)packet_size * 1000.0 / (float)bytes_per_sec;
    for (int n = 0; n < num_packets; n++)
    {
        if (WaitForSingleObject(events[n+EV_KSPACKET], 0) != WAIT_OBJECT_0)
        {
            out_lat += packet_lat;
        }
    }

    t = GetKSTime(); // get time written to KS interface
    t -= (int)(out_lat); // apply output latency

    return t;
}

int KSCore::GetWrittenTime(void)
{
    float in_lat;
    unsigned int bytes_per_sec;
    int t;
    bytes_per_sec = wfx_cur.Format.nAvgBytesPerSec;

    in_lat = (float)input_buffer_len * 1000.0 / (float)bytes_per_sec;
    t = GetKSTime(); // get time written to KS interface
    t += (int)(in_lat); // apply input latency

    return t;
}


The above helps the Prodigy 192, but makes things worse for the Nvidia onboard sound. Also, with the prodigy I had to properly pad the data to 32bit when using 24bit.

Thanks for making this excellent plug-in! 

Craig
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-01-04 16:16:04
Cheers, it's nice to see people modifying the code to suit their own purposes.

I never bothered trying to account for latency because, as you've found out, different cards seem to handle consumption of the output buffers in a variety of ways.

However, the buffer latency wouldn't account for a difference of 40 seconds on the duration of a two minute song as wdekler is seeing, so I'm still a bit curious as to why that's happening.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2007-01-04 23:46:43
Hi Steve,


I've just measured a song to get a bit more exact data:

A song of 3:10 ends up at 4:14 in Winamp.

24 bit or 16 bit output doesn't matter.

Here's the logfile:

Kernel Streaming Plugin v3.6 (x86) Diagnostic log

input buffer configured to 65536 bytes
output buffer configured to 8192 bytes per packet
Enumerated Filter:
  Friendly Name:
  Envy24 Family Audio (WDM)
  Filter Type = 1


Constructed KSCore (Input Size:65536) (Output Size 8192) (Output Cnt 8)

(shouldn't it contain more detail when playing a song?)

The plugin is running at the default + logging and there are no other "special" plugins installed...

I also noticed that the analogue output doesn't work with Winamp KS and Foobar KS. Probably a driver issue...

There seem to be several hardware versions around with this popular soundchip. It's possible to flash a Chaintech card to a Prodigy card, see: http://www.head-fi.org/forums/showthread.p...2155&page=2 (http://www.head-fi.org/forums/showthread.php?t=132155&page=2)

There are various crystal speeds but they seem to be for getting the 48khz and derived rates. So that couldn't explain the difference between the Prodigy and the Chaintech cards for playing at 44.1 as there's a dedicated crystal for that on all VIA Envy cards.

Flashing to the Prodigy isn't an option for me as you'll lose the analogue output which I still sometimes use with DS applications.

Regards and thanks for looking into it!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2007-01-06 20:08:40
What could also be a quick and dirty solution is to add an extra configuration option where a time correction can be given. For example:

A song that is 3:10 and plays for up to 4:14 can be corrected with: 190/254=0.748 as it probably is the same for all my other songs as well with this card & driver...?

Not a perfect solution by far, but maybe it is fairly easy to implement?

Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-01-06 22:03:38
What could also be a quick and dirty solution is to add an extra configuration option where a time correction can be given. For example:

A song that is 3:10 and plays for up to 4:14 can be corrected with: 190/254=0.748 as it probably is the same for all my other songs as well with this card & driver...?

Not a perfect solution by far, but maybe it is fairly easy to implement?



Somehow, I don't think I'll be doing that 

Also, there's something wrong with your log as it's missing the important information, namely stuff like this;

Quote
Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 16
Format.nBlockAlign          = 4
Format.nAvgBytesPerSec      = 176400
Format.cbSize              = 22
Samples.wValidBitsPerSample = 16
dwChannelMask              = 00000003


OpenOutput: Successfully Created Pin, Format - BPS: 16 FREQ: 44100 NCHANNELS: 2 VALIDBPS: 16


which is the kind of information I needed. This is only written into the file once playback has started.

I've posted a new version (3.61) which fixes the issue where log files could be created in different places depending on how Winamp had been launched, this may have caused the information mentioned above to have ended up in a different logfile created somewhere else, so you may like to grab this version and resend me the logfile you get when you play a track. As always the plugin may be found here (http://tinyurl.com/ng548).

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2007-01-07 10:45:17
Thanks for the updated version Steve! The logging works fine now.

Although I thought otherwise, the problem must be related be related to a specific plugin. 

I'm still using this FLAC plugin because it can force output to 24bit which can be a good thing when using replaygain: http://www.facquet.com/en/projects-4/winam...ownload-78.html (http://www.facquet.com/en/projects-4/winamp-plug-ins-9/flac-bundle-65/flac-input-67/download-78.html)

During the previous tests, I used the Winamp playback option to allow for 24bit or not, now I changed the option in this flac decoder and it shows that 24bit is still used when the "allow 24bit" option is unchecked:

OpenOutput - Current Settings:
Chosen Filter:      Envy24 Family Audio (WDM)
Input Buffer Size:  65536
Output Buffer Size  8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 32
Format.nBlockAlign          = 8
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 22
Samples.wValidBitsPerSample = 24
dwChannelMask              = 00000003


OpenOutput: Successfully Created Pin, Format - BPS: 32 FREQ: 44100 NCHANNELS: 2 VALIDBPS: 24
Output Opened


I think that this debug information possibly explans what's going wrong: the format is 32bits per sample, and the samples are 24bits. In an earlier post I noticed that the time was incorrect by a factor of 0,748 which is almost 24/32 ...? Is the padding to 32bit the culprit here?

I'm not sure why I previously thought that the problem also happened without FLAC, maybe the non 3.10A drivers were also interfering just as with the Prodigy drivers?

Thanks! :cheers:
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-01-07 16:14:19
Hi all. I've posted a new version (3.62) here (http://tinyurl.com/ng548) which fixes this timing problem with 24 bit data.

I worked out what the problem was quite quickly, but couldn't reproduce it when testing, even though, according to the information I was getting back from the debugger it should have been going wrong.

In the end, it turns out that the input plugin is responsible for reporting back to Winamp where playback is currently up to and the Wavpack input plugin (which almost all of my music is encoded for) just calculates this on it's own, ignoring any timing information coming from the output plugin (i.e. Kernel Streaming) therefore masking the problem. Switching over to a plain WAV file for testing immediately highlighted the problem.

This also means that any attempts to fix timing errors due to latency in the Kernel Streaming plugin will be rather hit and miss depending what (if anything) the input plugin does with the information passed back to it.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: MoSPDude on 2007-01-07 18:01:28
Cheers for that fix, I've applied the changes I made (and a minor bug fix - in config.cpp it doesn't read output_buffer_cnt from config file) and it looks like the latency problem on both sound cards has gone completely.

The in_mad input plug-in uses its own internal timer and takes account of the latency from the output plug-in (GetOutputTime - GetWrittenTime). The input plug-in is entirely responsible for controlling the output chain. This is one of the reasons why I'm patching out_ks, as it makes debugging the in_mad plug-in a little bit easier

Would you be interested in applying my changes to fix the timing and improve the latency to your code base?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2007-01-07 23:12:58
Steve, the Winamp timer works fine now with the first couple of files I tried. Great work, thanks!

Title: Winamp 2 Kernel Streaming Output Plugin
Post by: CLEITON on 2007-01-28 22:19:14
Hi Steve,

Doesn't work on my win vista

this have compatibility with new OS Vista?

thanks.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-01-28 23:58:33
Hi Steve,

Doesn't work on my win vista

this have compatibility with new OS Vista?

thanks.


Hi Cleiton, I couldn't say for sure as I don't have a Vista installation to test it on, however I seem to recall someone earlier in this thread saying it worked fine on Vista for him, but like I said, I can't personally test it in a Vista environment and the plugin contains no Vista specific code.

The documentation that accompanies the Microsoft Kernel Streaming SDK does suggest that the Kernel Streaming interface may not be compatible with future versions of Windows as they may contain some alternative but incompatible low level interface. Personally, I don't know if this is the case or not.

Sorry I can't be more helpful.

Regards,
Steve

p.s. I've recently posted a slightly newer version (V3.63) here (http://www.tinyurl.com/ng548) that fixes an occasional timing related crash that occurred (for me) when I tried to play WAV files. As it was timing related, it may affect other filetypes on different setups, to be honest, I'm not sure how this bug managed to stay in the code for so long without me or anyone else falling foul of it. Give this version a go and let me know if it fixes your problem.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: mugen on 2007-01-29 09:24:03
I don't seem to be able to play back DTS-WAV files with this plugin.  My receiver reports that it is receiving a DTS signal when I use ASIO to output the stream from Winamp, but when I try to use KS I only get the static that indicates that the stream has not survived in bit-perfect form.  Any ideas why that might be, Steve?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2007-06-29 16:25:36
For those who have a cheap CMI8738/8768 based card: the non wavert version of Dogbert's free CMI drivers (http://cmediadrivers.googlepages.com/faq) works with the 3.63 KS plugin under Vista!

The soundcard isn't displayed in the output devicelist but it works... (only tested with PCM 44.1)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: 3ngel on 2007-07-22 12:09:03
@Steve Monks
Hi,
i'm trying your plugin, and i came from DSOutputSSRC.
Now i wonder, how can i coniugate your KS and SSRC?
There is a separate SSRC plugin which i'm not aware of?
Or are you planning to add it directly to your KS?
Thank you
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-07-22 13:24:46
@Steve Monks
Hi,
i'm trying your plugin, and i came from DSOutputSSRC.
Now i wonder, how can i coniugate your KS and SSRC?
There is a separate SSRC plugin which i'm not aware of?
Or are you planning to add it directly to your KS?
Thank you


Hi, I have no plans to add SSRC (Software Sample Rate Conversion - I had to look it up) to the Kernel Streaming plugin. At one point I had a simple upsampler built in as a test but, as I could determine no perceivable improvement in sound quality I removed it. Any form of resampling effectively mangles HDCD data and as the primary point of the plugin for me was to get unmolested data out of the PC and into my outboard DAC it kind of went against the grain a bit.

If you really need SSRC, why not use the HQSoftProc Resampling Plugin, this can be setup to feed its output to the Kernel Streaming plugin. I've just tried this on my dev PC and it seems to work okay with a variety of sample rates and word lengths (I tried 96 and 192KHz and 16 and 24 bit) although at these higher rates the buffering takes a battering (open the KS status window to see) so it would be advisable to increase the buffer sizes from the defaults if you experience audio breakup.

Also be aware that support for certain frequencies and word lengths is somewhat variable in the Kernel Streaming interface across different sound cards, so you may find that certain combinations that you'd expect to work don't, you may also find that the volume control stops working with 24 bit feeds, this is due to variations in the data packing format that I haven't catered for.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: 3ngel on 2007-07-22 13:58:58
If you really need SSRC, why not use the HQSoftProc Resampling Plugin, this can be setup to feed its output to the Kernel Streaming plugin. I've just tried this on my dev PC and it seems to work okay with a variety of sample rates and word lengths (I tried 96 and 192KHz and 16 and 24 bit) although at these higher rates the buffering takes a battering (open the KS status window to see) so it would be advisable to increase the buffer sizes from the defaults if you experience audio breakup.

Thanks for the reply Steve,
i've downloaded HQSoft 4.6 Pro then trying it with your KS.
At 16 bit (96khz) all goes well, but setting the HQSoft to 24bit that's the result

(http://img329.imageshack.us/img329/7835/25150317db2.png)

At 32bit it just shows 0 0 0 0 etc

Why's this?

EDIT: I've tried all the versions on your site including the very old. And no one does work.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-07-22 14:18:21
I don't know. As I said, it worked fine for me with 3.63 on my Dev machine using the following combinations;

96KHz 16 bit
96KHz 24 bit
192KHz 16 bit
192KHz 24 bit

Looking at your screen grab of the status screen, something's gone horribly wrong with what the plugin is being fed from the resampler, i.e. 26284288Hz, 29540 bits per sample into 401 channels - that's some level of resampling!

Assuming you've got logging enabled (tick the "enable logging" box in the Kernel Streaming Settings dialog) you should find a file called kernel stream,ing log.txt in the winamp folder. Can you PM this file to me and I'll take a quick look to see if I can work out what's happened.

Also, can you give me some details about your computer, i.e. CPU type/speed, memory size, operating system etc.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: 3ngel on 2007-07-22 14:35:51
You have a PM with the log.
I've an Audigy4 with 2Gig ram, AMD 64 FX, XpSp2
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-07-22 15:01:30
From the PM:

Quote
Code: [Select]
OpenOutput - Current Settings:
Chosen Filter:       kX Wave kX Generic [ac00] 0/1
Input Buffer Size:   65536
Output Buffer Size   8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 96000
Format.wBitsPerSample       = 32
Format.nBlockAlign          = 8
Format.nAvgBytesPerSec      = 768000
Format.cbSize               = 22
Samples.wValidBitsPerSample = 24
dwChannelMask               = 00000003


Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 96000
Format.wBitsPerSample       = 24
Format.nBlockAlign          = 6
Format.nAvgBytesPerSec      = 576000
Format.cbSize               = 0
Samples.wValidBitsPerSample = 0
dwChannelMask               = 00000000


An important thing, it does work with standard DirectSound plugin in any combination up to 32bits.


By the look of it, the chosen Kernel Streaming interface for your card does not accept the requested format for output. The plugin first tries to establish the required output format using the newer WAVEFORMATEXTENSIBLE structure to describe the format to the driver, if the driver doesn't support this, the plugin then tries to use the older and less flexible WAVEFORMAT structure, which is more widely accepted. If the plugin had succeeded in establishing an output, you'd see something like the following in the log (taken from my Dev machine with onboard Realtek HD Audio);

Code: [Select]
Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec       = 96000
Format.wBitsPerSample       = 32
Format.nBlockAlign          = 8
Format.nAvgBytesPerSec      = 768000
Format.cbSize               = 22
Samples.wValidBitsPerSample = 24
dwChannelMask               = 00000003


OpenOutput: Successfully Created Pin, Format - BPS: 32 FREQ: 96000 NCHANNELS: 2 VALIDBPS: 24
Output Opened


As your log doesn't contain anything like this, it looks like even the fallback has failed for this format. Do you get any other options in the "Output Device" list of the KS config dialog? If so, it may be worth trying one of them.

The fact that using a directsound output plugin works is irrelevant here as it uses a different interface to communicate with the card. Kernel Streaming is not always well supported by the sound card driver, so, as I mentioned earlier you do get variable behaviour between different cards. If you haven't done so already, it may be worth getting the latest sound card driver, other than that I don't really know what to suggest.


Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: 3ngel on 2007-07-22 15:13:39
I informed you of the DirectSound compatibility just for chronicle. I suspected that Kernel Streaming was just a different matter, and that would involve a more strict contact with the hardware, and so possibly incompatibility.
So in other words you're saying it's a driver issue, that for some reason doesn't accept the 24bit (ore more precisely the WAV format)? But that's different from 16bit? Why 16bit yes and 24bit no?
In the output device i have a list of outputs but none works.
Oh i forgot, i use Kx Drivers 3537 (official), that is an alternative driver for creative cards.
I'll try stick with installing different driver version to see what happen.
BTW thanks for the moment
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: eevan on 2007-07-22 15:58:56
You have to output to kX HQ device in order to use 24 bit output. I have an Audigy2 ZS and use kX Driver 3538m. Everything works fine with HQSoftProc Resampling Plugin set to output to Kernel Streaming, and KS output set to kX Wave SB0350 10k2[d000] HQ device. Default device (0/1) won't accept 24bit streams through kernel streaming interface.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-07-22 16:04:29
You have to output to kX HQ device in order to use 24 bit output. I have an Audigy2 ZS and use kX Driver 3538m. Everything works fine with HQSoftProc Resampling Plugin set to output to Kernel Streaming, and KS output set to kX Wave SB0350 10k2[d000] HQ device. Default device (0/1) won't accept 24bit streams through kernel streaming interface.


That would explain a lot, thanks eevan. 3ngel, does that sort it out for you?

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2007-07-25 09:39:40
My issue with my playback seems to be related to your plugin (since its often reported as the crashing module). What my problem is is that I've told winamp to read in metadata when files are loaded. (preferences -> general -> titles) and then load a huuuuge playlist.

While this happens I think something is timing out. I do use the hqsoftproc module as well, by the way. Could it be that the kernel streamer still doesn't handle 'timeouts' well? Or is this maybe hqsoftproc after all?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: _Raziel-BG on 2007-08-01 15:06:10
I looked thorugh the thread but didn't find information about my problem, which doesn't mean there coulnd't be any, I just didnt' have time to look more thoroughly.
Everyhting is fine except one thing - settings for Number of output buffers are not remembered. No matter what number I set, the next time I start Winamp the number is back to 8. Is this a bug of some kind or is it intentional?
Hardware: TerraTec Aureon Space flashed into Audiotrak Prodigy
Software: Windows XP Pro SP2, Winamp 5.35 (but it applies for earlier versions as well), Audiotrak driver ver. 2.18

One more thing... I do hear difference between DirectSound and KS. As if KS makes music more dynamic, adds more volume to the whole sound and the treble is far more pronounced. If DS and KS truly should be the same, then I don't have an explanation as to why there is such a huge difference.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-08-01 16:21:09
My issue with my playback seems to be related to your plugin (since its often reported as the crashing module). What my problem is is that I've told winamp to read in metadata when files are loaded. (preferences -> general -> titles) and then load a huuuuge playlist.

While this happens I think something is timing out. I do use the hqsoftproc module as well, by the way. Could it be that the kernel streamer still doesn't handle 'timeouts' well? Or is this maybe hqsoftproc after all?


Does this happen if you don't use HQSoftProc? A timing related error in the KS plugin is possible due to its mult threaded nature although, due to the way it's written (i.e. very little cross thread interaction) should be pretty unlikely. I'll have to see if I can recreate the crash to be sure.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-08-01 16:53:49
I looked thorugh the thread but didn't find information about my problem, which doesn't mean there coulnd't be any, I just didnt' have time to look more thoroughly.
Everyhting is fine except one thing - settings for Number of output buffers are not remembered. No matter what number I set, the next time I start Winamp the number is back to 8. Is this a bug of some kind or is it intentional?
Hardware: TerraTec Aureon Space flashed into Audiotrak Prodigy
Software: Windows XP Pro SP2, Winamp 5.35 (but it applies for earlier versions as well), Audiotrak driver ver. 2.18


You're right, I've just tried it and it doesn't retain the number of buffers, if you look at the Winamp.ini file, it does actually save the correct value, but it doesn't seem to act on it when initialising the plugin. I'm surprised no one (including myself) has spotted this earlier.

One more thing... I do hear difference between DirectSound and KS. As if KS makes music more dynamic, adds more volume to the whole sound and the treble is far more pronounced. If DS and KS truly should be the same, then I don't have an explanation as to why there is such a huge difference.


That doesn't surprise me at all as the Direct Sound plugin doesn't work in exclusive mode, so it's still at the mercy of KMixer (the dll that merges the sound output of windows programs together before passing them to the sound card), so, even if Winamp is the only thing playing, the bitstream it outputs still gets manipulated in one way or another by KMixer when using the Direct Sound plugin. Also, due to the general flexibility of Direct Sound (i.e. it will quite happily mix secondary bufers of varying sample rates and bit depths to yield a single output in whatever the primary buffer format is set to) I wouldn't be at all surprised if the bitstream gets trampled somewhat on its journey between the secondary buffer the Direct Sound plugin writes into and the sound card driver.

As I've said before, the sure fire way to check if the bitstream is being tampered with at all is to play a track of HDCD material digitally into a DAC capable of handling it (and signalling its presence). If the bitstream is being interfered with in any way, the DAC will fail to detect the HDCD encoding. Note that this will only work if you are not resampling and have the volume control disabled (or set to 100%) as both of these processes change the original bitstream.

I'm not sure about your particular model, but I used to use a Terratec Aureon Fun 5.1 and found that this could not pass HDCD streeams unchanged even with the KS plugin - although Kernel Streaming still sounded better than Direct Sound, it still sounded noticably rough compared to playing original CD's directly on my CD transport. I'm currently using an M-Audio Audiophile 2496 sound card digitally connected to my Tag McLaren AV32R and find that this works very well and (to my ears at least) is indistinguishable to playing material on the CD transport.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: eevan on 2007-08-01 18:10:58
I'm surprised no one (including myself) has spotted this earlier.

That's because I've never tried to lower the number of buffers. I'm ok with 8
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: _Raziel-BG on 2007-08-01 19:20:01
You're right, I've just tried it and it doesn't retain the number of buffers, if you look at the Winamp.ini file, it does actually save the correct value, but it doesn't seem to act on it when initialising the plugin. I'm surprised no one (including myself) has spotted this earlier.

You and me both.  I tweak the number of output buffers as with 8 there is a small delay before Winamp actually reacts, which kinda irritates me. 

That doesn't surprise me at all as the Direct Sound plugin doesn't work in exclusive mode, so it's still at the mercy of KMixer (the dll that merges the sound output of windows programs together before passing them to the sound card), so, even if Winamp is the only thing playing, the bitstream it outputs still gets manipulated in one way or another by KMixer when using the Direct Sound plugin. Also, due to the general flexibility of Direct Sound (i.e. it will quite happily mix secondary bufers of varying sample rates and bit depths to yield a single output in whatever the primary buffer format is set to) I wouldn't be at all surprised if the bitstream gets trampled somewhat on its journey between the secondary buffer the Direct Sound plugin writes into and the sound card driver.

As I've said before, the sure fire way to check if the bitstream is being tampered with at all is to play a track of HDCD material digitally into a DAC capable of handling it (and signalling its presence). If the bitstream is being interfered with in any way, the DAC will fail to detect the HDCD encoding. Note that this will only work if you are not resampling and have the volume control disabled (or set to 100%) as both of these processes change the original bitstream.

I'm not sure about your particular model, but I used to use a Terratec Aureon Fun 5.1 and found that this could not pass HDCD streeams unchanged even with the KS plugin - although Kernel Streaming still sounded better than Direct Sound, it still sounded noticably rough compared to playing original CD's directly on my CD transport. I'm currently using an M-Audio Audiophile 2496 sound card digitally connected to my Tag McLaren AV32R and find that this works very well and (to my ears at least) is indistinguishable to playing material on the CD transport.

Cheers,
Steve

Both Terratec Aureon Space and Audiotrak Prodigy use the Envy24HT chipfrom IC Ensamble. M-Audio Revolution uses it too.
On my system KS works simultaneously with all other sounds and that actually makes me happy as I want to hear other sounds. This still means KS is independent and doesn pass through KMixer, right? It's also up to the audio driver to do be able to play KS AND other sounds simultaneously (correct me if i'm wrong).

Actually the only thing I'm missing from the DS plugin is the fading. I really liked the crossfading effect. But quality is more important so I'm getting used to listening without fades. It would be nice to add them to the KS plugin (if possible)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2007-08-14 09:50:29
Steve,

When you're busy building the better and next version, may I humbly suggest an added feature:

- Could you build some code that allows us, the faithful users, to set the output bit depth?

This would make me (and possibly others) very happy. Additionally it is pretty simple to do. All you need to do is either add '00000000' at the end of each word, or removing the last bits.

The added bonus for adding bit depth is that since your plugin does allow volume control, small volume changes (ie. in the 17+ bitrange) will actually be lossless, and larger ones will be handled more precisely as well.

I don't know why anyone would need a reduction of bit depth at the KS plugin location but its equally easy to do, so why not.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-08-14 22:29:46
- Could you build some code that allows us, the faithful users, to set the output bit depth?


You can effectively already do this by using the HQSoftProc resampler plugin and setting the output bit depth to 24 or 32.

All you need to do is either add '00000000' at the end of each word


Actually I would have thought that the correct maths would be to multiply each sample by 0x7fffff then divide it by 0x7fff because you would want 0x7fff to be output as 0x7fffff and not 0x7fff00.

Additionally it is pretty simple to do


I love it when people say that. Well, the source code is out there, feel free to add it 

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2007-08-15 11:29:02
You can effectively already do this by using the HQSoftProc resampler plugin and setting the output bit depth to 24 or 32.

I know, but I strongly suspect the plugin of being the cause of my crashes, and the developer has given up on the project (doesn't respond to mails, last new version is years old)
Quote

All you need to do is either add '00000000' at the end of each word


Actually I would have thought that the correct maths would be to multiply each sample by 0x7fffff then divide it by 0x7fff because you would want 0x7fff to be output as 0x7fffff and not 0x7fff00.


My binary math dates back from 10 years ago, so uh.. maybe you're right.

All I know is that essentially a 16-bit sample would be (say) 111111111111111 and to make that 24bit you would need it to go 11111111111111100000000. Of course there are probably 'headers' etc that need to be modified as well, but raw-data-wise that is all there is, isn't it?
Quote

Additionally it is pretty simple to do


I love it when people say that. Well, the source code is out there, feel free to add it 

Hah, well, the thing is that
a/ I'm not a C programmer, I do an incredibly minor amount of java and the rest is PHP/SQL99 etc. While I'm sure there are some obstacles I could not foresee, I currently think that it shouldn't be that hard in general, just by comparing it to how hard it would be in PHP. Am I wrong?
b/ Even if I were a C programmer, you are the guy who is intimately familiar with your code. Regardless of my personal 'have to learn C first' startup time, I suspect that for you it would take a much shorter time to know where to put the code in your framework

But, I did not mean it disrespectfully, and don't want to imply that your time is less valuable etc. I just hope you will consider it  (plus hey Id be happy to donate.. paypal?)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-08-15 22:08:43
Quote
But, I did not mean it disrespectfully, and don't want to imply that your time is less valuable etc.

Don't worry, I'm not offended in any way I just couldn't resist rising to that comment 

In many ways you're right, it is relatively simple to scale the sample data as it passes through the plugin (just a multiply followed by a divide or a shift if your not too bothered about absolute accuracy) although it's slightly more complicated because you'd have to deal with 32 bit overflow (unless we assume the availability of 64 bit operands on the CPU which introduces potential compatibility issues).

The more involved bit is adding extra interface code to let the user choose this mode of operation and additional setup code to handle attempting to set up the output pin accordingly and falling back to straight pass through should this fail and so on. None of this is truly difficult but it's a lot of work for minimal gain (none whatsoever for me as I just want a transparent digital pass-through from my PC) and runs the risk of introducing new bugs into the plugin.

Quote
but I strongly suspect the plugin of being the cause of my crashes

I'd forgotten about that. When I get a moment I'll have a go at recreating this crash to see what happens. Roughly how many files does it take to crash it and what type of files are they?

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: M95D on 2007-12-09 00:25:11
Hi Steve.

I think the is a memory leak in status window. Memory and resources are consumed in a few seconds after I open the status window and are released only when I close Winamp.

I'm using: Windows 98 SE, Winamp v2.95 and KS v3.63.

Thank you.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-12-09 13:28:21
Hi Steve.

I think the is a memory leak in status window. Memory and resources are consumed in a few seconds after I open the status window and are released only when I close Winamp.

I'm using: Windows 98 SE, Winamp v2.95 and KS v3.63.

Thank you.


Hi, it's not exactly a memory leak, it's just that it allocates resources when the panels are opened for the first time and holds onto them rather than cleaning up and reallocating things every time. If it allocated more resources every time the panel was opened, then I'd be worried.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: M95D on 2007-12-11 19:39:48
No. It's more than that, but I tried the same thing on WinXP and there was no problem at all.
I know that Win98 is old, but please test your plugin in Win98. Just play something in Winamp and leave the status window open for a minute. See what happens.

Here are some screen captures:

First image:
Notice the slow increase of allocated memory (dark blue histogram) and swap file (dark violet) and the decrease of unused memory (light blue).
(http://dinu.marius.home.ro/KS/Clipboard01.png)

Second image:
When resources (USER and GDI) are full, this message appears.
I closed the status window to prevent the crash.
(http://dinu.marius.home.ro/KS/Clipboard02.png)

Third image:
When I close Winamp, all resources are restored to normal. Notice the free memory and allocated memory.
(http://dinu.marius.home.ro/KS/Clipboard03.png)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2007-12-14 13:05:22
That's easier said than done as I no longer have access to a Windows 98 machine, they're all XP here at home, we don't even support Windows 98 any more at work (I'm a game developer). You say the problem only occurs when the status window is open? I'll take a look at the code when I get a moment and see if there's anything obvious going on.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Gabor on 2008-01-01 14:23:45
Hi Steve!

Happy new year! :-)
I've a problem. I like your WA KS, but I couldn't solve a simple thing.
I use late night a headphone and speakers during the day.
The amplifier hasn't headphone output connector so I tried to connect the headphone and the amplifier same time to my Audigy card. (e.g. amplifier to front channels and headphone to rear channels)
I wanted to set same outputs for front and rear channels, but I couldn't find any solution.
I'm thinking about that how can I set KS output to 4 channel? (same output to front and rear channels)
Is there any solution to listen through 4 channels the music?


Thanks!

Gabor
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: eevan on 2008-01-01 19:31:50
You can do this if you use kX Audio Driver (http://www.driverheaven.net/general-discussion/144178-3539-released.html)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: dd_wizard on 2008-01-05 08:15:41
I found a reference to this error from around 2003 in this thread, but that was for a Windows 98 system.  I'm running Vista with a RealTek High Definition Audio sound device. When I start Winamp 5.51 with the KS 3.63 plugin, I get the following error dialog:

CksEnumFilters::EnumFilters failed

I looked on the RealTek and Microsoft sites, but didn't have much luck.  It does look like Vista supports Kernel Streaming, though. Before I embark on a major search, I thought I'd ask if any Vista users have already resolved this issue.

Thanks for any help,
dd_wizard
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2008-01-05 12:52:46
I found a reference to this error from around 2003 in this thread, but that was for a Windows 98 system.  I'm running Vista with a RealTek High Definition Audio sound device. When I start Winamp 5.51 with the KS 3.63 plugin, I get the following error dialog:

CksEnumFilters::EnumFilters failed

I looked on the RealTek and Microsoft sites, but didn't have much luck.  It does look like Vista supports Kernel Streaming, though. Before I embark on a major search, I thought I'd ask if any Vista users have already resolved this issue.

Thanks for any help,
dd_wizard


Hi, presumably you get this error when you start playing a track and not when you start Winamp? What format of audio are you playing? e.g. two channel 44.1KHz @ 16 bit? Are you using any resampling pluigins such as HQSoft?

The error occurs when the plugin attempts to create an output pin that can handle the format of what you are  trying to play, so this could fail either because the specific format is not supported or because Kernel Streaming is not supported on the selected device. Check what device is selected in the Kernel Streaming configuration panel, if there are several options, try a different one.

Several people have reported success running Kernel Streaming on Vista, so it does appear to work in some cases, I haven't personally tried it as I don't have access to a Vista based machine, however, support may be driver dependent.

It may be helpful if you can post an error log so I can check all of the above directly. Launch Winamp, enable logging in the Kernel Streaming configuration, then try to play something. Close Winamp and the log should be in the folder where Winamp is installed and will be called "kernel streaming log.txt"

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: dd_wizard on 2008-01-05 18:06:18
Hi, presumably you get this error when you start playing a track and not when you start Winamp? What format of audio are you playing? e.g. two channel 44.1KHz @ 16 bit? Are you using any resampling pluigins such as HQSoft?
Steve


Thanks for the reply!  Actually, I get this error when I start Winamp.  So I never get a chance to play any type of file through the Kernel Stream.  In case it matters, I'm using 44.8 KHz @ 24 bits which works fine with the normal Winamp DirectSound output plugin. From reading this thread, I didn't think enabling logging would help since the failure occurs on initialization. Is there a way to find out why the failure occurs when Winamp starts?

Thanks,
dd_wizard
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2008-01-05 20:02:23
Thanks for the reply!  Actually, I get this error when I start Winamp.  So I never get a chance to play any type of file through the Kernel Stream.  In case it matters, I'm using 44.8 KHz @ 24 bits which works fine with the normal Winamp DirectSound output plugin. From reading this thread, I didn't think enabling logging would help since the failure occurs on initialization. Is there a way to find out why the failure occurs when Winamp starts?

Thanks,
dd_wizard


Presumably you mean 44.1KHz not 44.8KHz which is a non standard sample rate.

Try dropping down to 16 bit samples as this may help too. Bear in mind that the output from the Directsound plugin still goes through KMixer, so it can allow you to feed it sample rates and sizes that your hardware cannot handle directly. Kernel Streaming goes in at a lower level bypassing any form of sampe rate or length conversion improving quality but reducing compatibility down to whatever your driver can directly handle.

If enabled, logging operates from the moment the plugin is started, so the early portion of the log could be useful.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: dd_wizard on 2008-01-05 22:56:57
Sorry, I meant 48KHz @24 bits.  The hardware can handle up to 96K @ 24 bits. Here is the log file, I hope it helps.

Kernel Streaming Plugin v3.63 (x86) Diagnostic log

input buffer configured to 65536 bytes
output buffer configured to 8192 bytes per packet
Constructed KSCore (Input Size:65536) (Output Size 8192) (Output Cnt 8)
End(force=1)
EndInternal() - mode=0 force=1
Attempting to close player thread
Player Thread - closing
Player thread has closed
Destructed KSCore

Besides the "CksEnumFilters::EnumFilters failed" error message at startup, I get this error message when I click play:

"Could not find suitable output filter"

I installed the latest drivers, dated 25-12-2007, from RealTek and set the sound device back to 44.1KHz @ 16 bits and disabled 24 bits in Winamp. These changes haven't affected the behavior, so I may be stuck.

EDIT: I was able to get the Otachan ASIO output plugin to work, but I had to install ASIO4ALL to connect the out_asio.dll to the WDM device that my RealTek ALC861 codec supports.  ASIO support isn't that common from what I've been reading, but I'm starting to wonder if the ALC861 drivers support Kernel Streaming.  Do you have any idea what dll file I should be looking for in my driver configuration to see if it does support KS?

Oh, there were no devices listed in the KS plugin configuration screen, that may be a clue.

Thanks again,
dd_wizard
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: wdekler on 2008-01-12 11:41:10
I also had some disappointing experiences with the onboard Realtek chip. It turned out the Realtek chip only outputs higher bitrates with AC3/DTS streams. If you pick up a dirt cheap CMI8738 based card and use Dogbert's drivers you're way better off.

However, if you're looking for 24bit capability you can't use this CMI chipset. The datasheets states that it is capable but as far as I know, no board actually outputs 24bit. A VIA Envy24 based card can do this, but I still use the CMI card because Dogbert's drivers are better.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: NoX1911 on 2008-01-15 03:04:58
Bug: 'Number of output buffers' always jumps back to '8' at next winamp session. The value will be saved correctly in 'winamp.ini' though.

I'm trying to set all buffers to lowest values to get a responsive Winamp (seeking).

WinXPSP2
Winamp v5.51
SB-Live! Value (CT4670)
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: steamer on 2008-01-25 22:05:05
KS 3.63 bug.

On my system the 'Number of output buffers' always jumps back to '8' at next winamp restart.

'winamp.ini' has the correct values though.

I'm using these low buffers to get a responsive winamp

XPSP2
Winamp v5.53
SB-Xfi
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: _Raziel-BG on 2008-03-01 17:48:37
KS 3.63 bug.

On my system the 'Number of output buffers' always jumps back to '8' at next winamp restart.

'winamp.ini' has the correct values though.

I'm using these low buffers to get a responsive winamp

XPSP2
Winamp v5.53
SB-Xfi

A already mentioned that. Waiting for the new version/build. 
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: mojo-chan on 2008-03-16 18:05:29
I too get the visualisation/timing issues with the KS plugin. Other than that though, it's fantastic. Gapless playback in particular works flawlessly, while with ASIO it doesn't.

Regarding the timing issues, I can report that I don't have the problems with ASIO so there is probably a solution somewhere. My guess is that ASIO sends much smaller chunks of data to the soundcard. Maybe you could split the 8k output buffer down into 256 byte chunks or something.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: rt87 on 2008-03-18 11:21:32
just noticed that winamp keeps writing winamp.m3u/winamp.m3u8 after installing out_ks363. Can anyone confirm about this?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2008-08-17 13:52:12

Hey, one year ago!
Quote
In many ways you're right, it is relatively simple to scale the sample data as it passes through the plugin (just a multiply followed by a divide or a shift if your not too bothered about absolute accuracy) although it's slightly more complicated because you'd have to deal with 32 bit overflow (unless we assume the availability of 64 bit operands on the CPU which introduces potential compatibility issues).

The more involved bit is adding extra interface code to let the user choose this mode of operation and additional setup code to handle attempting to set up the output pin accordingly and falling back to straight pass through should this fail and so on. None of this is truly difficult but it's a lot of work for minimal gain (none whatsoever for me as I just want a transparent digital pass-through from my PC) and runs the risk of introducing new bugs into the plugin.

Fair enough, bad luck for me I guess. (unless you've suddenly come into the possession of an audiophile system  )
Quote
Quote
but I strongly suspect the plugin of being the cause of my crashes

I'd forgotten about that. When I get a moment I'll have a go at recreating this crash to see what happens. Roughly how many files does it take to crash it and what type of files are they?


i think the main problem is with files that have nonstandard bit depths or sample rates. I have a few DTS files that play back fine through winampac3 -> kernel streaming but fail on winampac3 -> hqsoftproc -> kernel streaming, and work with winampac3 -> hqsoftproc -> directsound output

Mind: I get slightly better luck (but not always) when playing something else first and then adding the DTS to the playlist.

Additionally, since you're obviously bored  - here's another feature request: prebuffering track changes to facilitate gapless playback. They've built it in the directsound plugin.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2008-08-17 21:53:31
Additionally, since you're obviously bored  - here's another feature request: prebuffering track changes to facilitate gapless playback. They've built it in the directsound plugin.


Erm, it's had true gapless playback for years now, you probably just need to enable it in the config panel.

Bear in mind, this is true gapless playback which joins the tracks together without disruption, so, albums where the tracks merge into each other (such as dance mixes or 70's concept albums) should play just as they would on a CD. I think the direct sound plugin does some kind of whacky crossfade which would actually disrupt such material (unless it's been updated since I last looked at it a couple of years ago).

The only time you should get unintentional gaps when this is enabled is when the format changes (bit rate, bit depth or number of channels) as the plugin has to release and reacquire a suitable output pin.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: puntloos on 2008-08-19 21:48:05

Additionally, since you're obviously bored  - here's another feature request: prebuffering track changes to facilitate gapless playback. They've built it in the directsound plugin.


Erm, it's had true gapless playback for years now, you probably just need to enable it in the config panel.

Bear in mind, this is true gapless playback which joins the tracks together without disruption, so, albums where the tracks merge into each other (such as dance mixes or 70's concept albums) should play just as they would on a CD. I think the direct sound plugin does some kind of whacky crossfade which would actually disrupt such material (unless it's been updated since I last looked at it a couple of years ago).

The only time you should get unintentional gaps when this is enabled is when the format changes (bit rate, bit depth or number of channels) as the plugin has to release and reacquire a suitable output pin.

Steve


Ah, yeah I suppose that might be it, the directsound plugin indeed prebuffers which helps things a little bit in those rare cases, but indeed I didn't notice any stutters with ks and my new setup. My old server was only a P3-800 which sometimes struggled at this.

Any thoughts on the resampling (bit depth upconverting) issues?

-M
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Qjimbo on 2009-01-05 19:41:23
Any chance of a post-XP compatible update?

Vista introduced a terrible sound system that "grainifies" everything. At the moment I'm using a Windows 7 beta and the problem is still there. Right now I'm using the ASIO output plugin to my digidesign mbox, but to have the kernel streaming plugin would be great.

Shame Microsoft can't just fix the audio really. The problem exists on every soundcard I've tried.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-01-05 20:32:41
Any chance of a post-XP compatible update?

Vista introduced a terrible sound system that "grainifies" everything. At the moment I'm using a Windows 7 beta and the problem is still there. Right now I'm using the ASIO output plugin to my digidesign mbox, but to have the kernel streaming plugin would be great.

Shame Microsoft can't just fix the audio really. The problem exists on every soundcard I've tried.


As far as I'm aware the plug-in should be compatible with any Windows operating system that supports Kernel Streaming (i.e. Windows 2000 onwards) as long as the sound card drivers support it too. I seem to recall reports of it working in Vista, but I can't comment on the Windows 7 Beta. I also don't have either of these operating systems installed on any of my PC's so I can't do any development work specific to them.

Sounds card drivers are very important from the point of view of Kernel Streaming compatibility, for example, I've found that the latest XP drivers for the M-Audio audiophile 2496 don't seem to work for some reason although earlier ones do.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: NoX1911 on 2009-01-05 23:19:10
There is still that 'number of output buffers' setting not saved over sessions bug present. Can't you fix that? It's really annoying and seems to be fixable quite easily.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Qjimbo on 2009-01-06 01:53:22
As far as I'm aware the plug-in should be compatible with any Windows operating system that supports Kernel Streaming (i.e. Windows 2000 onwards) as long as the sound card drivers support it too. I seem to recall reports of it working in Vista, but I can't comment on the Windows 7 Beta. I also don't have either of these operating systems installed on any of my PC's so I can't do any development work specific to them.

Sounds card drivers are very important from the point of view of Kernel Streaming compatibility, for example, I've found that the latest XP drivers for the M-Audio audiophile 2496 don't seem to work for some reason although earlier ones do.

Ah, I see. Well in my case I'm trying it with Realtek onboard sound (one of the high definition ones), and the XP driver works with Kernel Streaming, but the Vista 32bit and 64bit drivers don't seem to, which is disappointing. Perhaps I should see if I can install the XP driver...

Thanks for the quick reply by the way
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: ton on 2009-01-30 00:51:22
At first I apologize for not having read this very long thread. Also it is rather technical for me and I still don't understand everything.
I tried to use the KS 3.63 in Winamp 5.541 but it does not work with 24 bit, although my soundcard (Theatron Agrippa = Auzentech Explosion) should support that.
Maybe I am doing something completely wrong, but I cannot find out what. Btw, I am on Windows XP.
I enabled logging and this is what is reported:

OpenOutput - Current Settings:
Chosen Filter:      Theatron Agrippa Wave Device
Input Buffer Size:  65536
Output Buffer Size  8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 32
Format.nBlockAlign          = 8
Format.nAvgBytesPerSec      = 352800
Format.cbSize              = 22
Samples.wValidBitsPerSample = 24
dwChannelMask              = 00000003


Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 24
Format.nBlockAlign          = 6
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 0
Samples.wValidBitsPerSample = 0
dwChannelMask              = 00000000

What is wrong ?
Thanks in advance.
Ton



Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-02-01 16:50:14
Hi ton,

KS 3.63 supports 24 bit audio and I've used it to successfully play various 24/96 "studio master" tracks I've downloaded from Linn Records on my M-Audio Audiophile 24/96 sound card.

The dump indicates that the Kernel Streaming plugin has attempted to connect to your sound cards driver with a 44.1KHz 24 bit sample format using two different methods. When the first attempt failed, it tried the second, fallback method (which works with drivers that don't support WaveFormatExtensible format specifications) and I presume that failed as well because it didn't work for you. The values look right for 24/44.1 playback so the fact it's failed indicates that your driver doesn't support this format.

Apparently, your card is based on a C-Media 8770 chipset which, looking at the data sheet on C-Media's website here (http://www.cmedia.com.tw/?q=en/PCI/cmi8770), only appears to support 16 bit samples. Usually, this will be masked by Windows K-Mixer automatically converting whatever you throw at it into the correct format, but with Kernel Streaming, the data format has to be one that the sound cards driver and hardware supports.

Out of curiousity, what are you trying to play in 24/44.1 format? I don't believe that's a particularly common sample rate / sample length combination.

Regards,
Steve



At first I apologize for not having read this very long thread. Also it is rather technical for me and I still don't understand everything.
I tried to use the KS 3.63 in Winamp 5.541 but it does not work with 24 bit, although my soundcard (Theatron Agrippa = Auzentech Explosion) should support that.
Maybe I am doing something completely wrong, but I cannot find out what. Btw, I am on Windows XP.
I enabled logging and this is what is reported:

OpenOutput - Current Settings:
Chosen Filter:      Theatron Agrippa Wave Device
Input Buffer Size:  65536
Output Buffer Size  8192
Output Buffer Count: 8


Attempting to CreateRenderPin with the following WaveFormatExtensible (first attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 32
Format.nBlockAlign          = 8
Format.nAvgBytesPerSec      = 352800
Format.cbSize              = 22
Samples.wValidBitsPerSample = 24
dwChannelMask              = 00000003


Failed to create pin on first attempt!

Attempting to CreateRenderPin with the following WaveFormat (2nd attempt):
Format.nChannels            = 2
Format.nSamplesPerSec      = 44100
Format.wBitsPerSample      = 24
Format.nBlockAlign          = 6
Format.nAvgBytesPerSec      = 264600
Format.cbSize              = 0
Samples.wValidBitsPerSample = 0
dwChannelMask              = 00000000

What is wrong ?
Thanks in advance.
Ton

Title: Winamp 2 Kernel Streaming Output Plugin
Post by: witlily on 2009-03-19 00:31:09
Hi, Steve

Thank's for this KS, this best perfomance sound for my onboard realtek alc888 HD with winamp 5.5 without DSP and equalizer (Win XP SP2 + Logitech Z-2200 2.1)   
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jessenov1 on 2009-05-13 13:49:41
Hi Steve

I recently discovered your plugin - it sounds very good, currently my preferred playback option. I would like to experiment with different compiler settings, and different compilers (MS vs. Intel), to see how (if at all) it affects performance. Based on my previous experience doing that with ASIO plugin, it might.

Problem is, source code for ver. 3.63 is unavailable, and ver. 3.62 causes winamp to crash on start of playback, which is exactly what was fixed in 3.63.

Would you be so kind to share the changes that were made in ver. 3.63?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-05-13 22:49:02
Hi Steve

I recently discovered your plugin - it sounds very good, currently my preferred playback option. I would like to experiment with different compiler settings, and different compilers (MS vs. Intel), to see how (if at all) it affects performance. Based on my previous experience doing that with ASIO plugin, it might.

Problem is, source code for ver. 3.63 is unavailable, and ver. 3.62 causes winamp to crash on start of playback, which is exactly what was fixed in 3.63.

Would you be so kind to share the changes that were made in ver. 3.63?


Hi,

the crash fixed in 3.63 was caused by a simple divide by zero in the function KSCore::GetWrittenTime(). As the plugin is driven in a multi threaded manner, it's possible that Winamp can call GetWrittenTime before KSCore::Start() has finished executing. In this situation, wfx_cur.Format.nAvgBytesPerSec will not have been initialised when GetWrittenTime() is called and is therefore zero. Looking at the CVS logs, the only change between 3.62 and 3.63 is an early throwout added to GetWrittenTime(). The revised function should read as follows (added code marked in red);

int KSCore::GetWrittenTime(void)
{
[blockquote]unsigned int bytes_per_sec, t;

bytes_per_sec = wfx_cur.Format.nAvgBytesPerSec;


if (!bytes_per_sec) {
[blockquote]DebugMsg("KSCore::GetWrittenTime - format not initialised");
return 0;
[/blockquote]}

t =  written_data / bytes_per_sec * 1000;                     // time to nearest second in mS
t += (written_data % bytes_per_sec) * 1000 / bytes_per_sec;   // add in fractional component

return t;
[/blockquote]}
[/font]

At some point I may get round to posting a full release of the 3.63 version of the source, but for now, that should sort you out (I'm pretty certain it's the only practical difference), let me know how you get on.

Regards,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jessenov1 on 2009-05-14 04:09:29
Steve,

Thanks so much. By the time I saw your reply, I already had debugger tripping on division by 0 line, but of course was nowhere close to solving the problem.

I've already tried some different compiler settings, and also MS vs. Intel (VS.NET 2008). Will keep you posted.


P.S.: Post edited to comply with TOS #8.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-05-14 21:47:06
Steve,

Thanks so much. By the time I saw your reply, I already had debugger tripping on division by 0 line, but of course was nowhere close to solving the problem.

I've already tried some different compiler settings, and also MS vs. Intel (VS.NET 2008). Will keep you posted.


P.S.: Post edited to comply with TOS #8.


Glad that sorted it out for you. It'd be interesting to know if a change of compiler makes much of a difference performance wise. There are only really a couple of areas in the plugin that would significantly benefit from a better compiler (or for that matter being rewritten to use MMX/SSE etc) and these are basically just copying sample data from Winamp to the plugins input buffer and subsequently from there to the Kernel Streaming interfaces input buffer applying reformatting and packing where appropriate. The volume control if enabled and not set to 100% may also show up on a profiler although I can't see any of it having a major impact on a modern(ish) PC. Anyway, have fun and if you have any questions about what's going on inside the plugin, let me know and I'll help where possible.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jessenov1 on 2009-05-14 22:38:26
Steve,

I fixed small problem with "Number of Output Buffers" setting not being read from config file, just adding the following missing line to Config::Read :

   ReadInt("output_buffer_cnt",   &output_buffer_cnt   );


The thing is - I'm not really C/C++ developer, and while the small stuff like above is something I can fix, it's way beyond my capabilities to rewrite the code to use SIMDs, that you mention. I'm pretty sure there would be benefits, and if you could during some free time have a look at what's involved - it would be great.

Again, thank you - I really appreciate your work.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-05-14 23:06:38
No worries and thanks for tracing that number of buffers bug. I never got round to looking into that since it was pointed out to me a couple of years ago, so I think it's unlikely I'll be doing a SIMD rewrite any time soon myself. I'll try and get round to posting a new version incorporating your fix at some point in the near future.

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jessenov1 on 2009-05-16 20:17:30
Steve,

There's one small annoyance I would like to try fixing. Any time playback is started, there's one single "pop" - it sounds like buffer is not empty, and sample(s) that's left there are being played for a fraction of second. If that's so, then buffer needs to be forcibly "flushed" when playback is stopped in Winamp. I guess it could be either input or output buffer.

What do you think about that possibility? Where in the code would you suggest to look if that's the case, and how would you suggest to empty the buffer?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-05-18 21:27:11
Steve,

There's one small annoyance I would like to try fixing. Any time playback is started, there's one single "pop" - it sounds like buffer is not empty, and sample(s) that's left there are being played for a fraction of second. If that's so, then buffer needs to be forcibly "flushed" when playback is stopped in Winamp. I guess it could be either input or output buffer.

What do you think about that possibility? Where in the code would you suggest to look if that's the case, and how would you suggest to empty the buffer?


Hi. I don't actually think that's the KS plugin itself as it's not something I get with my setup (and it would drive me up the wall if I did). Chances are it's actually a driver issue relating to how the hardware buffers are fed on your sound card from the KS interface.

Off the top of my head, the input buffer is a single large looping buffer. I keep track of where winamp has written up to and where the KS side of the plugin has read out from (this is done to ensure the input doesn't overwrite the output by refusing data from Winamp until there is enough space to accomodate it), so there's little scope for problems at that end otherwise it would be failing all the time.

There are multiple output buffers, these are allocated and retained for the lifetime of the plugin (unless the settings change). The status of the output buffers are tracked by the plugin. Individually, they can be in one of two states, free - meaning they're empty and not being used by the KS interface or busy - meaning the KS interface is currently making use of them. If an output buffer is free, it is filled in its entirety by copying the next available block of memory from the input buffer to the output buffer and then handing it off to the KS interface. If there isn't enough data in the input buffer to fill the output buffer, the plugin will hang onto the buffer until there is, only dispatching it when full. The exception to this when the user presses stop, in which case the partially filled buffer is handed off to the KS interface, however, the amount of data it contains is set in a header during the handoff, so any unused portion of the buffer should be ignored by the KS interface - I think this is where you may be experiencing a problem, depending on how the driver is coded. In the event of a stop signal, you could try padding out the remainder of the buffer with zeros and see if that solves your problem. Have a look in kscore.cpp for the line;

if (full || mode == MODE_STOPPING) {      // packet was filled, needs to be sent

this particular case is handled inside the following scope, so that would be a good place to flush the remainder of the buffer to see if that helps.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jessenov1 on 2009-05-20 15:56:53
Steve,

I confirmed that it's interaction of KS plugin with the particular driver (ASUS Xonar), exactly as you said. Winamp can be closed, then opened again - the "pop" still will be there when starting playback. Definitely something can be done, since ASIO plugin, for instance, doesn't behave the same way.

I think it's a good idea to try padding the buffer with 0's, with the intention for the driver to get "silence" to play for a fraction of second. But I'm not sure how to do that. In the code below, I will split (mode == MODE_STOPPING) case, but how to do actual padding?

         if (full || mode == MODE_STOPPING) {      // packet was filled, needs to be sent
            packets[cur_packet].Header.FrameExtent = packets[cur_packet].Header.DataUsed;
            written_data += packets[cur_packet].Header.DataUsed;
            ResetEvent(packets[cur_packet].Signal.hEvent);
            hr = pin->WriteData(&packets[cur_packet].Header, &packets[cur_packet].Signal);
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-05-20 20:05:56
Quote
Definitely something can be done, since ASIO plugin, for instance, doesn't behave the same way.


Not necessarily, the ASIO plugin talks to the driver via a different interface within the driver. The fact that the ASIO plugin does not exhibit the same problem merely suggests that this path into the driver is probably more robust than the drivers KS implementation, particularly when you consider that the KS plugin does not exhibit this problem when used with many other types of sound card.

Taking another look, I don't think zeroing out the remainder of the packet buffer will help as it stands, because buffer space beyond what is used never gets sent, however if you really want to try it, you may find filling the remainder of the packet with zeros and sending the whole packet instead of just the bit that's been used may help. You'd probably want to add something along the following lines to KSCore::PlayerThread() (new code in red, original code in black);

if (full || mode == MODE_STOPPING) {      // packet was filled, needs to be sent
[blockquote]if ((mode == MODE_STOPPING) && ((int)packets[cur_packet].Header.DataUsed < packet_size)) {
[blockquote]memset(packets[cur_packet].Header.Data, 0, packet_size - packets[cur_packet].Header.DataUsed);
packets[cur_packet].Header.DataUsed = packet_size;
[/blockquote]}


packets[cur_packet].Header.FrameExtent = packets[cur_packet].Header.DataUsed;

[/blockquote]

This will cause it to pad out each final packet to the full size specified in the settings dialog, even if the packet contains only a couple of bytes of useful data. I haven't actually tested this code, other than to check that it builds, but give it a go and see if it helps.

Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jessenov1 on 2009-05-29 17:35:42
Steve,

I finally had a chance to try the code - it didn't work initially, in the sense that padding the buffer didn't seem to change anything. I decided to dig in a little, and it turns out that whole code section in KSCore::PlayerThread is skipped, if gapless mode is enabled (as is the case for me). The reason is this piece of code in KSCore::EndInternal(int force):

   if (config->gapless_enabled && !force)
      return;

This causes this line, that is down below in the same method, to never execute if gapless mode is enabled:

   mode = MODE_STOPPING;   // tell player thread that we are stopping


Is there a reason why it's done like this? Would it be safe to just remove this "if" statement, so it continues the same as if gapless isn't enabled? If not - what would be best solution?
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-05-29 19:58:37
Quote
Is there a reason why it's done like this? Would it be safe to just remove this "if" statement, so it continues the same as if gapless isn't enabled? If not - what would be best solution?


No, I wouldn't remove the "if" statement.

Unfortunately there is no distinction in the signals the plugin receives from Winamp between a "stop because the current track has ended" or a "stop because the user pressed stop", this poses a problem for gapless mode. In gapless mode, the plugin has to leave the KS output open between tracks, because, if you close it, even momentarily, the sound card output will be disrupted (causing a pop or a click) which clearly isn't desirable when playing tracks which run continuously into each other.

KSCore::EndInternal() is the function that gets called whenever a stop signal is received from Winamp, this happens at the end of every track and whenever the user presses stop or the application is closed. So that there is no disruption between tracks, most of this function gets ignored when gapless mode is active. The plugin keeps track of the requested state but is only allowed to close the KS output under certain circumstances;



If you search through kscore.cpp for End(TRUE) you should find the locations where these three cases are handled (each accompanied by a comment describing why it's being called). I imagine what could be happening is that the plugin is closing the KS interface while there are still samples in buffers that have already been handed off to the KS interface. I guess in this case, your sound cards KS driver isn't cleaning these up properly, so when you, say, manually stop the player and then start a new track, it dumps the remaining buffer contents to the sound card causing the problem you're experiencing.

Just to verify I've got the correct handle on your problem, can you confirm that;



Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: jessenov1 on 2009-05-29 20:23:07
  • From a cold boot, the first track played in Winamp doesn't exhibit this problem
  • Adjacent tracks in the playlist of the same format (i.e. sample rate, word length and number of channels) don't exhibit this problem between them
  • The problem only occurs if you manually stop (not pause) the player while a track is still playing and then manually start a track playing - may also occur if you quit Winamp mid track and restart it or if the format changes - the important point being that audible sound was being output when the plugin was stopped


The answer is "YES" to all 3:

- no problem with first track from cold boot;
- no problem between adjacent tracks;
- the same problem when stop/start playback or quit Winamp/start Winamp/start playback mid-track; no problem when paused/restarted.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Riptor on 2009-09-29 16:17:31
Sorry for interrupting your dialogue, but since i was not able to find any e-mail, blog, forum, etc. on the Kernel Streaming for Winamp's webpage i'm disturbing you here


Winamp 5.541 + Kernel Audio 3.63 + SB Audigy 2SE (24bit) + Latest official drivers.

When i play a normal (16bit) mp3 file, Kernel streaming always says: Sample size: 24 bits. When i play 16bit FLAC file - it says Sample size: 16 bits. When i play 24 bit 96khz file - it's displayed correctly.
Is it normal for FLAC and mp3 files to be streamed differently?


I have a small utility attached to Creative's sound driver. I can select PCM sample rate(44.1,48,96) and "Enable Bit-perfect Playback" and some Dolby Digital options.

Does Kernel Streaming go around these options or it obeys them too?


Thanks!
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: lvqcl on 2009-09-29 18:14:24
Quote
When i play a normal (16bit) mp3 file


MP3 file doesn't have such thing as bit depth.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2009-09-29 18:34:38
Sorry for interrupting your dialogue, but since i was not able to find any e-mail, blog, forum, etc. on the Kernel Streaming for Winamp's webpage i'm disturbing you here


Winamp 5.541 + Kernel Audio 3.63 + SB Audigy 2SE (24bit) + Latest official drivers.

When i play a normal (16bit) mp3 file, Kernel streaming always says: Sample size: 24 bits. When i play 16bit FLAC file - it says Sample size: 16 bits. When i play 24 bit 96khz file - it's displayed correctly.
Is it normal for FLAC and mp3 files to be streamed differently?


I have a small utility attached to Creative's sound driver. I can select PCM sample rate(44.1,48,96) and "Enable Bit-perfect Playback" and some Dolby Digital options.

Does Kernel Streaming go around these options or it obeys them too?


Thanks!


Hi,

the sample size and sample rate displayed in the KS status dialog (assuming this is what you are referring to) describe the format of the output stream from the plugin into the KS interface of the sound cards driver. The KS plugin doesn't generally attempt to reformat what is fed to it in any way and it's totally unaware of the source format (MP3, PCM, FLAC etc) as the data has already been decoded into raw PCM by the time it gets to the KS plugin, so I would suspect that it is actually being fed 24 bit samples from Winamp for some reason if that's what it's putting out to the card. Are you using a non standard MP3 decoder or are you using any DSP/Effect plugins that may cause resampling?

As for your sound cards driver utility, it's entirely down to the implementation of the driver whether KS will bypass this or not. The KS plugin merely talks to the sound card driver via an alternative interface to the usual one, so the behaviour of card specific features is totally in the hands of the driver designer. I suppose the question to ask is, can you hear any difference when you adjust these features while using KS?

Cheers,
Steve
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Riptor on 2009-09-30 15:00:24
The only winamp feature i can see enabled in winamp is in "Playback" - "Allow 24 bit". But if i disable it, 24/96 FLACs are played through Kernel Streaming as 16 bit /96Khz. So i guess everything is OK with Kernel Streaming, Winamp is the reason.


As to the sound difference.. There is difference only when i enable "Allow 24 bit" in Winamp. I was not able to catch any difference with or without bitperfect and 44.1/96khz selector, when Kernel Streaming is enabled (but there is difference without it). Basically, sound is less annoying and more open.. .but very hard to explain and very very small difference.

Thanks for the quick reply
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: englishtim on 2010-01-05 18:58:37
Hi Everyone,

I hope this is the right place to post general questions about Chun Yu & Steve's Winamp Kernel Streaming plugin - my profuse apologies if not, and I'll gladly heed advice about the correct place to post this.

I'm having a frustrating problem with the plugin (v363, Winamp v5.57) on a PC with two sets of sound hardware - here's the scenario:

I want to use Winamp and the KS plugin for high-quality playback (44.1k end-to-end, not resampled up to 48k and back again) via my shiny new M-Audio Audiophile 2496 card (the line-out ports of which are fed in to a hi-fi amp), and the PC's motherboard sound hardware (Realtek AC97 chipset) for Windows system sounds and general stuff.

However, when I select the AP2496 analogue output in the KS config screen and then start playing a track, Winamp hangs with the track timer frozen at "0:00". The only way out is to forcibly close Winamp from the Windows Taskbar.

Everything works really nicely when the KS plugin's pointed at the Realtek chipset. The AP2496 works fine via the Nullsoft DirectSound plugin. For the record I'm using Win XP Home SP3, with all updates applied. I've also seen similar symptoms on a different PC (a laptop with a Conexant sound chipset) when it's hooked up to an external USB sound-card.

Any idea what's going on? Has anyone else seen symptoms like this? Is the only option to disable / uninstall the motherboard sound drivers? Or is there something simple that I've missed?

Despite these problems, big thanks to Chun Yu and Steve for a really great plugin!

Thanks in advance!

Cheers,
englishtim
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: corumuk on 2010-10-29 10:26:44
hi steve, just in case you still check in on this thread i thought i'd provide this feedback...
i recently started using an external dac (dacmagic) and via usb your kernel streaming plugin for winamp worked really well (using win7 x64).
due to the dac's limitation of 16 bit over usb i have now switched to coaxial spdif output from the motherboards onboard realtek chip (motherboard is gigabyte 965P DS3 using a Realtek ALC883 8 Channel Audio Codec) and as a result the plugin no longer works. Latest realtek drivers are being used.
when winamp is started the error message (as previously reported by another user)
'CKsEnumFilters::EnumFilters failed'
is displayed in a dialogue box, even before kernel streaming been set as the output method. after closing the box and setting kernel streaming as the output, no devices are shown as being available.

Log is shown below

Kernel Streaming Plugin v3.63 (x86) Diagnostic log

input buffer configured to 65536 bytes
output buffer configured to 8192 bytes per packet
Constructed KSCore (Input Size:65536) (Output Size 8192) (Output Cnt 8)
End()
End(force=0)
EndInternal() - mode=0 force=0
End()
End(force=0)
EndInternal() - mode=0 force=0
End()
End(force=0)
EndInternal() - mode=0 force=0
End(force=1)
EndInternal() - mode=0 force=1
Attempting to close player thread
Gapless mode buffer underrun - Player Thread is stopping KS player
End(force=1)
EndInternal() - mode=0 force=1
Player Thread - closing
Player thread has closed
Destructed KSCore

the asio plugins still work with spdif but it would be nice to have the option of kernel streaming as it works without the need to install additional software (other than the plug in itself) and so is a notch more streamlined. anyhows, good luck with any ongoing developments and heres hoping for version 4.0 before too long!

regards,
corumuk
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: mcow on 2011-06-24 06:16:54
after closing the box and setting kernel streaming as the output, no devices are shown as being available.


I don't know if you ever solved the filters-error problem, but "no devices are shown" is a problem that I see with ks363 (on 64 bit WinXP). The problem is strictly cosmetic, however: in my case, there are two audio devices (mobo's RealTek HD and a USB speaker-pair from Logitec, which gets all the system sounds). These items are present but not visible in the Kernel Streaming Settings dialog. It took me a while to determine this was the problem; as I recall, I just happened to click on the second location in the listbox and it showed as selected. It's really pretty annoying—so annoying, in fact, that when I first encountered the problem, I moved on to the asio_out(dll) plugin and ASIO4ALL.

But recently, I encountered a weird bug with that plugin under MediaMonkey (MM was hanging if I paused the track); once I'd discovered the cause of the hang, I tried KS again. And guess what: KS handles gapless transition much better than the asio plugin; since switching, I have yet to hear any artifact at track transitions.

Steve Monk, if you ever update to fix this problem (if you haven't abandoned the whole thing now that WASAPI is standard), may I suggest you also fix the tab-order in the dialog? But other than the slight weakness in the UI, this plugin is really high quality.
Title: Winamp 2 Kernel Streaming Output Plugin
Post by: Steve Monks on 2011-07-10 11:17:47
Hi all, I'm not sure why, but I haven't seen any notifications from this thread for ages, so I haven't been aware of the last few posts. Anyway, in reverse order;

I don't know if you ever solved the filters-error problem, but "no devices are shown" is a problem that I see with ks363 (on 64 bit WinXP). The problem is strictly cosmetic


That's interesting, as it implies the friendly name look up for the devices are failing on your configuration. Unfortunately I don't have that particular configuration to test against, so I can't really investigate what's going wrong. I was running the plugin at work on 64 bit XP about three years ago and I vaguely recall seeing the same sort of problem. I've been running it on a 64 Bit Win 7 machine for the last year or so and that displayed the device names correctly so I can only presume it's a quirk of 64 bit XP. Either that or it's a driver specific issue.

corumuk:
Quote
CKsEnumFilters::EnumFilters failed


When you see this error it means the plugin has failed during initialisation (i.e. when first launched and way before you get to the point of playing anything). The error indicates that the plugin has failed to find any compatible devices, most likely because your driver doesn't support Kernel Streaming.

Interestingly I've currently got the opposite problem on my home machine (32 bit XP), I want to run my Dac Magic over USB but with the stock drivers Kernel Streaming locks up, although the Win 7 stock drivers are absolutely fine with it.

englishtim:

I've seen this before, it's definitely a driver problem. The most recent AP2496 drivers lock up when fed from the plugin (just like the stock XP CMedia ones for the DacMagic do). The simplest fix is to download and install an earlier set. I'm not sure which specific version you want, but it's one or two back from the latest release, that should sort it out.