From 0b56a247f1cc4e40523d443f52eb0a224a492bea Mon Sep 17 00:00:00 2001 From: Nat Date: Thu, 08 Nov 2007 17:42:19 +0000 Subject: aclient fix by James --- (limited to 'common/Util/Clooper') diff --git a/common/Util/Clooper/aclient.cpp b/common/Util/Clooper/aclient.cpp index 1146c3b..02b4f6c 100644 --- a/common/Util/Clooper/aclient.cpp +++ b/common/Util/Clooper/aclient.cpp @@ -550,7 +550,7 @@ struct TamTamSound int argc=3; char **argv = (char**)malloc(argc*sizeof(char*)); argv[0] = "csound"; - argv[1] = "-m0"; + argv[1] = "-m7"; argv[2] = orc; ll->printf(1, "loading csound orchestra file %s\n", orc); @@ -625,18 +625,29 @@ struct TamTamSound cbuf_pos = 0; if (csoundPerformBuffer(csound)) { messed = 1;break;} cbuf = csoundGetOutputBuffer(csound); + cursample[0] = (signed short int) (cbuf[cbuf_pos*2+0] * (1<<15)); + cursample[1] = (signed short int) (cbuf[cbuf_pos*2+1] * (1<<15)); + +/* + cbuf[cbuf_pos*2+0] *= (float) ((1<<14)); + cbuf[cbuf_pos*2+1] *= (float) ((1<<14)); + FLOAT_TO_SHORT( cbuf[cbuf_pos*2+0], cursample[0]); + FLOAT_TO_SHORT( cbuf[cbuf_pos*2+1], cursample[1]); +*/ } upbuf[2*up_pos+0] = cursample[0]; upbuf[2*up_pos+1] = cursample[1]; - if (++ratio_pos == up_ratio) { ratio_pos = 0; ++cbuf_pos; - cbuf[cbuf_pos*2+0] *= (float) ((1<<15)-100.0f); - cbuf[cbuf_pos*2+1] *= (float) ((1<<15)-100.0f); + cursample[0] = (signed short int) (cbuf[cbuf_pos*2+0] * (1<<15)); + cursample[1] = (signed short int) (cbuf[cbuf_pos*2+1] * (1<<15)); + /*cbuf[cbuf_pos*2+0] *= (float) ((1<<14)); + cbuf[cbuf_pos*2+1] *= (float) ((1<<14)); FLOAT_TO_SHORT( cbuf[cbuf_pos*2+0], cursample[0]); FLOAT_TO_SHORT( cbuf[cbuf_pos*2+1], cursample[1]); +*/ } if (++up_pos == (signed)sys_stuff->period_size) break; diff --git a/common/Util/Clooper/aclient.so b/common/Util/Clooper/aclient.so index 996e9e3..ca76f30 100755 --- a/common/Util/Clooper/aclient.so +++ b/common/Util/Clooper/aclient.so Binary files differ diff --git a/common/Util/Clooper/audio.cpp b/common/Util/Clooper/audio.cpp index 343bc99..fea9c73 100644 --- a/common/Util/Clooper/audio.cpp +++ b/common/Util/Clooper/audio.cpp @@ -119,8 +119,10 @@ struct SystemStuff snd_pcm_hw_params_get_period_size_max(hw, &maxb,&maxd); ll->printf(2, "FYI: period size range is [%li/%i,%li/%i]\n", minb,mind, maxb, maxd); - assert(mind == 0); //rate_resample 0 makes this true right? - assert(maxd == 0); //rate_resample 0 makes this true right? + if ((mind != 0) || (maxd == 0)) + { + ll->printf(2, "watch out, mind and maxd non-zero... you didn't set rate_resample to 0 did you...\n"); + } if (period0 < minb) { @@ -196,7 +198,11 @@ open_error: err = snd_pcm_writei (phandle, frame_data, frame_count ); if (err == (signed)frame_count) return 0; //success - assert(err < 0); + if (err >= 0) + { + ll->printf(0, "madness on line %s:%i\n", __FILE__, __LINE__); + return -1; + } const char * msg = NULL; snd_pcm_state_t state = snd_pcm_state(phandle); -- cgit v0.9.1