本文整理汇总了C++中post函数的典型用法代码示例。如果您正苦于以下问题:C++ post函数的具体用法?C++ post怎么用?C++ post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oggread_open
/* open ogg/vorbis file */
static void oggread_open(t_oggread *x, t_symbol *filename)
{
int i;
x->x_stream = 0;
/* first close previous file */
if(x->x_fd > 0)
{
ov_clear(&x->x_ov);
post("oggread~: previous file closed");
}
/* open file for reading */
#ifdef WIN32
if((x->x_file = fopen(filename->s_name, "rb")) < 0)
#else
if((x->x_file = fopen(filename->s_name, "r")) < 0)
#endif
{
post("oggread~: could not open file \"%s\"", filename->s_name);
x->x_eos = 1;
x->x_fd = -1;
}
else
{
x->x_stream = 0;
x->x_eos = 0;
x->x_fd = 1;
x->x_outreadposition = 0;
x->x_outwriteposition = 0;
x->x_outunread = 0;
post("oggread~: file \"%s\" opened", filename->s_name);
outlet_float( x->x_out_position, 0);
/* try to open as ogg vorbis file */
if(ov_open(x->x_file, &x->x_ov, NULL, -1) < 0)
{ /* an error occured (no ogg vorbis file ?) */
post("oggread~: error: could not open \"%s\" as an OggVorbis file", filename->s_name);
ov_clear(&x->x_ov);
post("oggread~: file closed due to error");
x->x_fd=-1;
x->x_eos=1;
return;
}
/* print details about each logical bitstream in the input */
if(ov_seekable(&x->x_ov))
{
post("oggread~: input bitstream contained %ld logical bitstream section(s)", ov_streams(&x->x_ov));
post("oggread~: total bitstream playing time: %ld seconds", (long)ov_time_total(&x->x_ov,-1));
post("oggread~: encoded by: %s\n",ov_comment(&x->x_ov,-1)->vendor);
}
else
{
post("oggread~: file \"%s\" was not seekable\n"
"oggread~: first logical bitstream information:", filename->s_name);
}
for(i = 0; i < ov_streams(&x->x_ov); i++)
{
x->x_vi = ov_info(&x->x_ov,i);
post("\tlogical bitstream section %d information:",i+1);
post("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld",
x->x_vi->rate,x->x_vi->channels,ov_bitrate(&x->x_ov,i)/1000, ov_serialnumber(&x->x_ov,i));
post("\t\theader length: %ld bytes",(long)
(x->x_ov.dataoffsets[i] - x->x_ov.offsets[i]));
post("\t\tcompressed length: %ld bytes",(long)(ov_raw_total(&x->x_ov,i)));
post("\t\tplay time: %ld seconds\n",(long)ov_time_total(&x->x_ov,i));
}
}
}
示例2: featureMean_print
static void featureMean_print(t_featureMean *x)
{
post("averaging %i vectors with %i features", x->numFrames, x->featureLength);
}
示例3: zeroCrossing_tilde_overlap
static void zeroCrossing_tilde_overlap(t_zeroCrossing_tilde *x, t_floatarg f)
{
x->overlap = (int)f;
post("overlap: %i", x->overlap);
}
示例4: ASSERT
/*! Get sample frames
\param buf pointer array to channel buffers
\param frames number of maximum frames to get
\return frames put into buffers
*/
int Stream::doGet(int ch,float *const *buf,int frames,float sr)
{
ASSERT(ch > 0 && frames >= 0 && sr > 0);
if(isOk() && !isInitializing()) {
// signal thread worker
pthread_cond_signal(&cond);
// check/(re)allocate buffers
int strch = getChannels();
if(bufs && bufch < strch) {
delete[] decoded;
for(int i = 0; i < bufch; ++i) src_delete(src_state[i]);
delete[] src_state;
delete[] bufs; bufs = NULL;
}
if(!bufs) {
if(bufch < strch) bufch = strch;
bufs = new float *[bufch];
decoded = new Fifo<float>[bufch];
src_state = new SRC_STATE *[bufch];
for(int i = 0; i < bufch; ++i) {
int error;
src_state[i] = src_new(SRC_ZERO_ORDER_HOLD,1,&error);
if(!src_state[i]) post("src init error %i",error);
}
}
// get frames
float ratio = sr/getSamplerate();
int frneed = (int)(frames/ratio)+DECMORE; // number of frames to read from decoder fifo
if(decoded[0].Size() < frneed) {
// fifos are too small -> resize them (while keeping their contents)
for(int i = 0; i < bufch; ++i) decoded[i].Resize(frneed,true);
}
// how many frames do we need to get from decoder?
int frread = frneed-decoded[0].Have();
int ret = state == ST_WAIT?0:DataRead(frread);
if(ret < 0) {
if(debug) post("read error");
// clear output
for(int c = 0; c < ch; ++c)
memset(buf[c],0,frames*sizeof *buf[c]);
return 0;
}
else {
// how many channels do we really need for output?
// this should be set elsewhere, because we can't change anyway!!!
// (SRC_STATE for dangling channels would be incorrect)
int cmin = strch;
if(ch < cmin) cmin = ch;
// write data to fifo
for(int i = 0; i < cmin; ++i) {
int wr = decoded[i].Write(ret,bufs[i]);
if(wr < ret) post("fifo overflow");
}
// state = ST_PROCESS;
if(ratio == 1) {
// no resampling necessary
// hopefully all channel fifos advance uniformly.....
for(int i = 0; i < cmin; ++i) {
for(int got = 0; got < frames; ) {
int cnt = frames-got;
if(decoded[i].Have()) {
got += decoded[i].Read(cnt,buf[i]+got);
}
else {
state = ST_WAIT;
if(debug) post("fifo underrun");
// Buffer underrun!! -> zero output buffer
memset(buf[i]+got,0,cnt*sizeof(*buf[i]));
got += cnt;
}
}
}
}
else
{
SRC_DATA src_data;
src_data.src_ratio = ratio;
//.........这里部分代码省略.........
示例5: ViewMover
ViewMover (const GlobalRef& view_, int x_, int y_, int w_, int h_)
: view (view_), x (x_), y (y_), w (w_), h (h_)
{
post();
}
示例6: post
response const post (request const & request_, string_type const & body_) {
return post(request_, "x-application/octet-stream", body_);
}
示例7: post
HttpResponse HttpClient::post(const HttpUrl& url, const FormData& form_data){
return post(url, form_data.get_string(), form_data.get_content_type());
}
示例8: routeOSC_verbosity
static void routeOSC_verbosity(t_routeOSC *x, t_floatarg v)
{
x->x_verbosity = (v == 0)? 0: 1;
if (x->x_verbosity) post("routeOSC_verbosity(%p) is %d", x, x->x_verbosity);
}
示例9: routeOSC_doanything
static void routeOSC_doanything(t_routeOSC *x, t_symbol *s, int argc, t_atom *argv)
{
char *pattern, *nextSlash;
int i = 0, pattern_depth = 0, matchedAnything = 0;
int noPath = 0; // nonzero if we are dealing with a simple list (as from a previous [routeOSC])
pattern = s->s_name;
if (x->x_verbosity) post("routeOSC_doanything(%p): pattern is %s", x, pattern);
if (pattern[0] != '/')
{
/* output unmatched data on rightmost outlet */
if (x->x_verbosity) post("routeOSC_doanything no OSC path(%p) , %d args", x, argc);
outlet_anything(x->x_outlets[x->x_num], s, argc, argv);
return;
}
pattern_depth = routeOSC_count_slashes(pattern);
if (x->x_verbosity) post("routeOSC_doanything(%p): pattern_depth is %i", x, pattern_depth);
nextSlash = NextSlashOrNull(pattern+1);
if (*nextSlash == '\0')
{ /* pattern_depth == 1 */
/* last level of the address, so we'll output the argument list */
for (i = 0; i < x->x_num; ++i)
{
if
(
(x->x_prefix_depth[i] <= pattern_depth)
&& (MyPatternMatch(pattern+1, x->x_prefixes[i]+1))
)
{
++matchedAnything;
if (noPath)
{ // just a list starting with a symbol
// The special symbol is s
if (x->x_verbosity) post("routeOSC_doanything _1_(%p): (%d) noPath: s is \"%s\"", x, i, s->s_name);
outlet_anything(x->x_outlets[i], s, argc, argv);
}
else // normal OSC path
{
// I hate stupid Max lists with a special first element
if (argc == 0)
{
if (x->x_verbosity) post("routeOSC_doanything _2_(%p): (%d) no args", x, i);
outlet_bang(x->x_outlets[i]);
}
else if (argv[0].a_type == A_SYMBOL)
{
// Promote the symbol that was argv[0] to the special symbol
if (x->x_verbosity) post("routeOSC_doanything _3_(%p): (%d) symbol: is \"%s\"", x, i, argv[0].a_w.w_symbol->s_name);
outlet_anything(x->x_outlets[i], argv[0].a_w.w_symbol, argc-1, argv+1);
}
else if (argc > 1)
{
// Multiple arguments starting with a number, so naturally we have
// to use a special function to output this "list", since it's what
// Max originally meant by "list".
if (x->x_verbosity) post("routeOSC_doanything _4_(%p): (%d) list:", x, i);
outlet_list(x->x_outlets[i], 0L, argc, argv);
}
else
{
// There was only one argument, and it was a number, so we output it
// not as a list
if (argv[0].a_type == A_FLOAT)
{
if (x->x_verbosity) post("routeOSC_doanything _5_(%p): (%d) a single float", x, i);
outlet_float(x->x_outlets[i], argv[0].a_w.w_float);
}
else
{
pd_error(x, "* routeOSC: unrecognized atom type!");
}
}
}
}
}
}
else
{
/* There's more address after this part, so our output list will begin with
the next slash. */
t_symbol *restOfPattern = 0; /* avoid the gensym unless we have to output */
char patternBegin[1000];
/* Get the incoming pattern to match against all our prefixes */
for (i = 0; i < x->x_num; ++i)
{
restOfPattern = 0;
if (x->x_prefix_depth[i] <= pattern_depth)
{
StrCopyUntilNthSlash(patternBegin, pattern+1, x->x_prefix_depth[i]);
if (x->x_verbosity)
post("routeOSC_doanything _6_(%p): (%d) patternBegin is %s", x, i, patternBegin);
if (MyPatternMatch(patternBegin, x->x_prefixes[i]+1))
{
if (x->x_verbosity)
post("routeOSC_doanything _7_(%p): (%d) matched %s depth %d", x, i, x->x_prefixes[i], x->x_prefix_depth[i]);
++matchedAnything;
nextSlash = NthSlashOrNull(pattern+1, x->x_prefix_depth[i]);
//.........这里部分代码省略.........
示例10: IS_A_FLOAT
static void *NLMSerr_in_tilde_new(t_symbol *s, t_int argc, t_atom *argv)
{
t_NLMSerr_in_tilde *x = (t_NLMSerr_in_tilde *)pd_new(NLMSerr_in_tilde_class);
t_int i, n_order=39;
t_symbol *w_name;
t_float beta=0.01f;
t_float gammax=0.00001f;
if((argc >= 4) &&
IS_A_FLOAT(argv,0) && //IS_A_FLOAT/SYMBOL from iemlib.h
IS_A_FLOAT(argv,1) &&
IS_A_FLOAT(argv,2) &&
IS_A_SYMBOL(argv,3))
{
n_order = (t_int)atom_getintarg(0, argc, argv);
beta = (t_float)atom_getfloatarg(1, argc, argv);
gammax = (t_float)atom_getfloatarg(2, argc, argv);
w_name = (t_symbol *)atom_getsymbolarg(3, argc, argv);
if(beta < 0.0f)
beta = 0.0f;
if(beta > 2.0f)
beta = 2.0f;
if(gammax < 0.0f)
gammax = 0.0f;
if(gammax > 1.0f)
gammax = 1.0f;
if(n_order < 2)
n_order = 2;
if(n_order > 1111111)
n_order = 1111111;
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
outlet_new(&x->x_obj, &s_signal);
x->x_flt_sig_in1 = 0;
x->x_n_order = n_order;
x->x_update = 0;
x->x_beta = beta;
x->x_gamma = gammax;
// 2 times in and one time err_in memory allocation (history)
x->x_ref_filt_in_hist = (t_float *)getbytes(x->x_n_order*sizeof(t_float));
x->x_ref_adapt_in_hist = (t_float *)getbytes(x->x_n_order*sizeof(t_float));
// table-symbols will be linked to their memory in future (dsp_routine)
x->x_w_array_sym_name = gensym(w_name->s_name);
x->x_w_array_mem_beg = (t_float *)0;
x->x_rw_index = 0;
return(x);
}
else
{
post("NLMSerr_in~-ERROR: need 3 float- + 1 symbol-arguments:");
post(" order_of_filter + learnrate_beta + security_value + array_name_taps");
return(0);
}
}
示例11: routeOSC_paths
static void routeOSC_paths(t_routeOSC *x, t_symbol *s, int argc, t_atom *argv)
{ /* print out the paths we are matching */
int i;
for (i = 0; i < x->x_num; ++i) post("path[%d]: %s (depth %d)", i, x->x_prefixes[i], x->x_prefix_depth[i]);
}
示例12: kbuffer_info
void kbuffer_info(t_kbuffer *x) {
post("function length is %d samples",x->length);
post("function sampling rate is %.2f",x->ksrate);
post("function byte size is %d",x->memsize);
post("function duration is %.2f seconds",x->duration);
}
示例13: buildResource
unsigned int KeenClient::addEvents(const char *events)
{
buildResource();
setAuthorizationHeader(write_key);
return post(resource, events);
}
示例14: ctw_cancel_request
static void ctw_cancel_request(void *args) {
struct _ctw *common = args;
curl_multi_remove_handle(common->multi_handle, common->easy_handle);
common->locked = 0;
post("request cancelled.");
}
示例15: phone_to_elm
/// Append Holmes-elements for phones in (phonestr) to (eltq).
/// Returns ps->t.
unsigned phone_to_elm(phtoelm_state_t *ps, char *phonestr, dsqueue_t *eltq) {
#ifdef PHOLMES_DEBUG
post("phone_to_elm(): called with phonestr='%s'", phonestr);
#endif
ps->s = phonestr;
while (ps->s && *ps->s) {
pte_eltseq_str es = trie_lookup(&phtoelm, &(ps->s));
if (es) {
int n = *es++;
while (n-- > 0) {
int eid = *es++; // -- index of sequence-element in Elements[]
holmes_qelt_t he; // -- encoded Holmes-triple for output-queue
Elm_ptr ep = &Elements[eid]; // -- pointer to actual current element
int dur; // -- placeholder for element duration
//
// This works because only vowels have ud != du,
// and we set stress just before a vowel
//
if (!(ep->feat & vwl)) ps->stress = 0;
dur = StressDur(ep,ps->stress);
he = hqeNew(eid,dur,ps->stress);
// append the encoded element to the output queue
dsqueue_append(eltq, (void *)he);
#ifdef PHOLMES_DEBUG
post("phone_to_elm(): enqueued Holmes-triple %s,%d,%d", ep->name,dur,ps->stress);
#endif
}
}
else {
char ch = *(ps->s++);
switch (ch) {
case '\'': // Primary stress
ps->stress = 3;
break;
case ',': // Secondary stress
ps->stress = 2;
break;
case '+': // Tertiary stress
ps->stress = 1;
break;
case '-': // hyphen in input
break;
case '.': // literal dot indicates end-of-utterance
dsqueue_append(eltq, (void *)hqeNew(0,0,0));
break;
default:
{
fprintf(stderr,
"phone_to_elm(): ignoring unknown character '%c'\n",
ch);
break;
}
}
}
}
return ps->t;
}