Old 03-30-2017, 11:39 AM   #1
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 6,958
Default Meaning of "typebuf_sz" ?

I see in reaper_plugin_functions.h:

Code:
// GetMediaSourceType
// copies the media source type ("WAV", "MIDI", etc) to typebuf

  void (*GetMediaSourceType)(PCM_source* source, char* typebuf, int typebuf_sz);
What does typebuf_sz determine here ?
nofish is online now   Reply With Quote
Old 03-30-2017, 11:46 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,556
Default

Quote:
Originally Posted by nofish View Post
I see in reaper_plugin_functions.h:

Code:
// GetMediaSourceType
// copies the media source type ("WAV", "MIDI", etc) to typebuf

  void (*GetMediaSourceType)(PCM_source* source, char* typebuf, int typebuf_sz);
What does typebuf_sz determine here ?
You need to pass in the size of the typebuf with that. (Because raw C arrays or pointers to arrays do not carry the size information with them.)
Code:
char buf[32];
GetMediaSourceType(src,buf,sizeof(buf));
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is offline   Reply With Quote
Old 03-30-2017, 12:15 PM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 6,958
Default

Ah...this probably explains why I couldn't get it to work.

Thanks again Xen.
nofish is online now   Reply With Quote
Old 03-30-2017, 12:25 PM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 6,556
Default

Quote:
Originally Posted by nofish View Post
Ah...this probably explains why I couldn't get it to work.

Thanks again Xen.
By the way, if you are writing C++ code, you can get the media source type more directly by just doing :
Code:
const char* srctype = src->GetType();
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass and λ) :
http://xenakios.wordpress.com/
Xenakios is offline   Reply With Quote
Old 03-30-2017, 01:07 PM   #5
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 6,958
Default

Well, actually I tried to do this for determing MIDI items

http://forum.cockos.com/showpost.php...92&postcount=4

but couldn't get it to work for some reason (probably my lack of C++ skills though.)

But then I figured one can also use ->GetSampleRate() (returns 0 for MIDI) whhich is working fine, so all good.
nofish is online now   Reply With Quote
Reply

Thread Tools
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


All times are GMT -7. The time now is 01:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.