INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Re: On going playing with DSP plugins....  (Read 5264 times)

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: On going playing with DSP plugins....
« on: June 23, 2007, 12:31:20 pm »

My Image Resizing Plugin's on hold until an issue
is resolved with MC. 

So I've been having thoughts on what to do next.
I'd like to have a play with the DSP plugin interface.

I've downloaded the SDK however simple as it might be,
I've no idea what is required, what isn't required,
how MC reacts with the plugins etc.

Could one of the developers give me a quick run down on
how the DSP plugins work please?

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #1 on: June 23, 2007, 05:08:20 pm »

I've been fooling with it as well.  Just building the plugin isn't too bad -- just inherit from the provided base class and implement the virtual functions, along with registering yourself.  Pretty much the same as the decoder and encoder plugins.  The only part that's not well defined is quite how the Process() function is supposed to work -- but it looks like we just take the input buffer, make any changes, and output it to another buffer.

The one that I've built so far at least has an interface and doesn't mess up the sound data.  I was planning on a 31-band graphic equalizer, but none of that's implemented yet.
Logged

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #2 on: June 24, 2007, 06:22:25 am »

OK Cheers I'm with you on that.
Trying to figure out what SetAudioFormat is for at the moment.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #3 on: June 25, 2007, 04:19:14 pm »

SetAudioFormat(...) will let you know what format the input data is in.  Store it for later use, or just return 0 if you don't care.

Inside Process(...), take the data, process it, and write the new data to the output using pOutput->Output(...).

All processing will be 32-bit floats.

Also, remember the difference between "bytes", "samples", and "blocks":

A sample has some number of "bytes per sample".  (4 for DSP since it's 32-bit floats)

A block is a sample for each channel.  So a left and right value for stereo.
Logged
Matt Ashland, JRiver Media Center

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #4 on: June 25, 2007, 04:28:52 pm »

Cheers Matt, I'll give my idea a go.  :)

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #5 on: June 27, 2007, 05:16:26 pm »

It's good fun getting back into VC++ with all the MFC/ATL gubbins floating around again
after a year of .NET  :)

I spent about 2 hours staring at a compiler error telling
me it couldn't find a Header file. 
Spent half an hour removing an Assertion failure and am currently looking
at a whole load of warnings telling me there's data truncation.

I've yet to write a single line of my own code.
This could take a while  :)

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #6 on: June 27, 2007, 10:11:53 pm »

The example plugin isn't bad, but it's not as helpful as one would like.  It's basically an MFC DLL with a class inherited from MJDSPPlugin.  If that helps  ;D
Logged

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #7 on: June 28, 2007, 03:38:32 am »

I did start with the example plugin, (Which built fine), I'm just
moving the classes into my own project, and mutilating it  abit.

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
On Going Travels of Playing with the DSP Interface..
« Reply #8 on: July 01, 2007, 02:33:10 pm »

Well... I'm now down to no compile errors.
No warnings.
No Assertion Failures.

The plugin registers. And I can see it in plugin manager,
abeit under the wrong name, but with the correct descriptions.

What I can't do is see it under DSP plugins yet, despite
the fact I'm still using the same stutter dialogues and code.
No error is thrown or at least not to me...

I've got my
extern "C" __declspec(dllexport) IMJDSPPlugin * GetDSPPlugin(int nIndex, IMJDSPNotification * pNotification, int nZone) function in there....

So I'm at a bit of a loss at the moment.

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #9 on: July 01, 2007, 02:36:20 pm »

Ah! MC just needed a restart!  ::)

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: On going playing with DSP plugins....
« Reply #10 on: July 08, 2007, 09:01:22 am »

I'm slightly confused by Process's nBlocks parameter.
I've interogated it and it would seem it contains the integer 64 while
I'm playing my music.

Is that just saying that the Input contains 8 Bytes worth of data,
ie 32 Bits on 2 Channels?

or is it saying that Input contains 64 bytes?
If so where is this number likely to have come from?

Or am I going down the wrong road =)

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: On going playing with DSP plugins....
« Reply #11 on: July 08, 2007, 09:28:58 am »

I guess far more likely is that it's telling me there are 64 blocks which as Matt put
else where is a sample for each channel...
so thats 64 blocks each consisting of 1 sample per channel..
each sample contains 4 bytes,
so thats 64 x 4 x 2 = 512 Bytes.

 ::)

Must have been a sleep for that one.

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: On Going Adventures of the DSP Plugin Interface
« Reply #12 on: July 16, 2007, 05:54:56 pm »

Scott hows the 32 band equalizer going?

I'm kind of stuck at the moment. I'm failing quite miserably to manipulate
the audio.

At the moment I'm just playing. Taking the buffer in, and sending it back out again.
I thought I might be able to silence the audio by looping
through the float buffer and setting each float to zero.
      int counter = 0;
      for (counter = 0; counter < 512; counter++)
      {
           pBuffer[counter]=0;
      }

However it made no difference what so ever, which was kind of suprising.
By applying various multiplications additions and such like I could
get random hickups but so far I'm not getting the big picture as to whats happening!

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: JRiver: A little help understanding the DSP Plugin Interface
« Reply #13 on: July 17, 2007, 12:10:15 am »

I've been fooling around with it, but only working on displays and whatnot, not the actual EQ.  I have been trying to avoid messing with the actual music :)  I've got a workable bar display, but I'm not exactly sure how to turn the FFT transform into the correct chart.

Weird that putting all the floats to zero won't silence the signal.  I would think that would do it.

I noticed that when my plugin is active, it sounds like the standard EQ isn't working.  There's definitely a change to the sound.
Logged

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: On going playing with DSP plugins....
« Reply #14 on: July 21, 2007, 10:59:22 am »

Made some progress.
Was doing quite a few things wrong.
For a start the wrong number of channels.
Guess I shouldn't have erased that bit of code that found out how many channels there are.
I created an empty float with 7 channels worth of empty blocks, then
sent that to the output and blisful silence was achieved =)
float* soundFloat = new float[nBlocks * 8 * 7 ];

pOutput->Output(soundFloat, nBlocks);

Should have just pressed the mute button really  :)

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: On going playing with DSP plugins....
« Reply #15 on: July 21, 2007, 11:39:15 am »

Intruigingly once I've silenced the audio...
I can't unsilence it... even though I'm directly outputing the input buffer.
Hmmmm nope none of that channel stuff I've just mentioned actually makes sense.
Time to get that channel thing back from the example me thinks...

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: On going playing with DSP plugins....
« Reply #16 on: July 21, 2007, 11:58:46 am »

Ah I needed to let MC know settings had changed
m_pNotification->SettingsChanged();

I'm learning.
I've set the channels back to
memcpy(soundFloat, pBuffer, nBlocks * sizeof(float) * m_wfeInput.nChannels);

Which makes more sense now, I can see where it's come from.

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: On going playing with DSP plugins....
« Reply #17 on: July 21, 2007, 02:58:43 pm »

Yeah, I've found they are kinda sneaky with the examples.  Lots of little things that are important but aren't very well documented.
Logged
Pages: [1]   Go Up