LancePutnam / Gamma

Generic (Sound) Synthesis Library
Other
458 stars 54 forks source link

SamplePlayer warning message on file read failure #19

Closed matthewjameswright closed 11 years ago

matthewjameswright commented 11 years ago

I changed SamplePlayer to print a warning message if it can't load the file you requested.

Also added a "tellmeeverything" method to Envelope.

Please make part of standard Gamma.

Thanks! -Matt

LancePutnam commented 11 years ago

I would prefer to call it 'print' instead of 'tellmeeverything'. Also, can we separate the declaration and definitions? It's a lot of code.

I also don't understand the purpose of the 'USE_WARN' macro.

matthewjameswright commented 11 years ago

"tellmeeverything" was a convention I developed at CNMAT for Max objects for a verbose debugging print that shows the complete state of the object, as opposed to just "print" which I might expect to summarize with something like "an Env with 6 segments". But it's your system so I want to use names you like.

No problem separating declaration and definition.

USE_WARN provides a compile-time choice between two distasteful solutions to the issue of printing the offending file path (without with the message is useless):

1) Use your gam::warn method, which takes only the name of the object and the error message as arguments, and so sprintf an error message in a probably-big-enough stack-allocated char[]

2) Directly call fprintf(stderr, ...)

thanks, -Matt

On May 16, 2013, at 7:25 AM, Lance Putnam wrote:

I would prefer to call it 'print' instead of 'tellmeeverything'. Also, can we separate the declaration and definitions? It's a lot of code.

I also don't understand the purpose of the 'USE_WARN' macro.

— Reply to this email directly or view it on GitHub.

LancePutnam commented 11 years ago

For now, I think just use fprintf directly to avoid all the complexity. gam::warn should be extended to take variable arguments, like the rest of the printf family.

matthewjameswright commented 11 years ago

Will do. Do you still prefer "print" to "tellmeeverything"? Or maybe some compromise like "printall" or "dumpstate" or something?

thanks, -Matt

On May 17, 2013, at 1:00 AM, Lance Putnam wrote:

For now, I think just use fprintf directly to avoid all the complexity. gam::warn should be extended to take variable arguments, like the rest of the printf family.

— Reply to this email directly or view it on GitHub.

LancePutnam commented 11 years ago

For now, I think simply "print". I'm not sure if it's worth the complexity of having multiple types of print methods. If going that route, I think in addition it would make sense that all ugens support the same interface.

LancePutnam commented 11 years ago

I manually merged the fprintf warning into SamplePlayer::load.

Can you please submit a separate pull request for the envelope print out?