Old 18th October 2012, 20:53   #1
sheh
Junior Member
 
Join Date: May 2004
Posts: 10
Flush output buffer without seek?

I'm looking to do, from an input plugin, dynamic changes in the audio, with low latency. This requires flushing the output buffer, but the API only provides a combined flush/seek.

A possible indirect way to do it is to keep the output plugin starved to a smaller buffer size, but this isn't ideal.

Is there another way?
sheh is offline   Reply With Quote
Old 20th October 2012, 16:50   #2
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: On the streets of Kings County, CA.
Posts: 3,009
Send a message via Skype™ to thinktink
If you're the input plugin then you would know where the track currently is. Then you could do a flush(current_time);. However, depending on the changes you make to the audio data, you would still have to call close() and then open() again since once you open an output plugin for audio output, that plugin expects the audio parameters to remain unchanged untill the next call to close(); An alternative would really to completely bypass the output plugin altogether and output the audio data yourself in your input plugin. But you need to tell Winamp you're doing that if you do.
thinktink is offline   Reply With Quote
Old 20th October 2012, 23:46   #3
SilverBird775
Senior Member
 
SilverBird775's Avatar
 
Join Date: Jan 2009
Location: Russia
Posts: 237
Fading mechanism will genuinely ruin the idea with seeking. Stop & Start is looking like a natural solution to flush the buffer.

Much more advanced method is to call "open" again without "close"-ing the previous session. Though only very few output plugins accept such exotic treatment (plugin specific). The playback cursor will be undefined, either zeroed or continued.
SilverBird775 is offline   Reply With Quote
Old 21st October 2012, 03:11   #4
sheh
Junior Member
 
Join Date: May 2004
Posts: 10
flush(current_time) will still be subjected to the output plugin's seek behavior (e.g., cross fading), and is unlikely to be exact even if I query the output's playing time (I suspect even the output plugin itself doesn't know the *exact* playing time, just that the next buffer block hasn't been used yet).

thinktink: The basic audio parameters do not change, only the actual audio. Bypassing the output plugin somewhat beats the point of using Winamp with its configurable set of plugins. But I am curious, how do you mean telling Winamp that the input plugin also outputs directly?

SilverBird: stop/open() will crossfade, and I think also more likely to add pauses than seeking, no?

So far it looks like it's unlikely to find a reliable way to do it, especially one that works on most output plugins.
sheh is offline   Reply With Quote
Old 22nd October 2012, 18:18   #5
thinktink
Forum King
 
thinktink's Avatar
 
Join Date: May 2009
Location: On the streets of Kings County, CA.
Posts: 3,009
Send a message via Skype™ to thinktink
Quote:
Originally Posted by sheh View Post
...But I am curious, how do you mean telling Winamp that the input plugin also outputs directly?...
If you look at the input plugin SDK there's a bit flag that you can set/unset to tell Winamp that you're not using the output plugin (among other things):
#define IN_MODULE_FLAG_USES_OUTPUT_PLUGIN 1

Here's where you (un)set it:
typedef struct
{
...
int UsesOutputPlug;
...
} In_Module;
thinktink is offline   Reply With Quote
Old 23rd October 2012, 14:31   #6
sheh
Junior Member
 
Join Date: May 2004
Posts: 10
Oh. The SDK insinuated that flag must be set ("// does this plug-in use the output plug-ins? (musn't ever change, ever "), but I suppose no one can really call it detailed or up to date.
sheh is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump