buffer

winapi audio output

瘦欲@ 提交于 2019-12-11 03:14:49
问题 I am searching some alternative of pulseaudio for windows. Under linux there is very simple way to output raw sound (with pulseaudio): pa_simple_write(pulse, data, bufferSize, &error); It's work perfect with small buffers, that i send to function in the loop. Under windows i use something like this: void writeAudioBlock(HWAVEOUT hWaveOut, LPSTR block, DWORD size) { WAVEHDR header; ZeroMemory(&header, sizeof(WAVEHDR)); header.dwBufferLength = size; header.lpData = block; waveOutPrepareHeader

Boost.Python: Fill in a passed in buffer in Python

≡放荡痞女 提交于 2019-12-11 03:06:09
问题 I was wondering whether it's possible to fill in a buffer (with the following conditions) in Python and if so how? I have a buffer in C++ that I need to fill in Python. The Address of the buffer is obtained through the GetAddress method which returns a void pointer to the buffer's address. #include <boost/smart_ptr/shared_ptr.hpp> class Foo { public: Foo(const unsigned int length) { m_buffer = boost::shared_ptr< unsigned char >( new unsigned char[ length ] ); } ~Foo(){} void* GetAddress( )

Lazy evaluation with buffers in AdoNetAppender in Log4Net

混江龙づ霸主 提交于 2019-12-11 02:57:34
问题 I'm using Log4Net custom properties to add some environmental information into my logs. I created an utility class with global accessible properties that my program classes use to store context information (order id, user id, etc) and a lazy wrapper around them so I don't need to change Log4Net ThreadContext all the time. Something like this: public class LoggerPropertyProvider { private readonly string _value; public LoggerPropertyProvider(string value) { _value = value; } public override

Response Buffer Limit Exceeded error in ASP page

久未见 提交于 2019-12-11 02:57:08
问题 Error: Response object error 'ASP 0251 : 80004005' Response Buffer Limit Exceeded Execution of the ASP page caused the Response Buffer to exceed its configured limit. I use this code to solve this issue but problem is not solved <% Response.Buffer=False %> <% do while not objrs.eof response.flush objrs.movenext loop %> Plz, help me to solve this issue 回答1: If setting Response.Buffer to false isn't helping then you are writing too much data via a single call to Response.Write . Buffering is

Get .NET Process object to flush input stream continously?

大兔子大兔子 提交于 2019-12-11 01:57:25
问题 I am trying to change my class library that talks to the Mercurial command line client, and new in the 1.9 client is the ability to spin up a server and talk to it over the standard input/output pipes. This is really promising since one of the major headaches of using the Mercurial command line client is that since it is written in Python, there's a bit of overhead spinning up the client, even for just asking it for its version. However, there is one problem. Up until now I have retrieved the

Why doesn't getch() read the last character entered?

人盡茶涼 提交于 2019-12-11 00:48:39
问题 I am writing a snake game in C using the ncurses library, where the screen updates itself every second. As those who have played the game will know, if the user enters various keys or holds down a key for long, there should be no 'buffered' key presses which get stored. In other words, if I hold down w (the up key) and stdin receives a sequence of 20 w s, and subsequently enter a d (the right key), I expect the snake to immediately move to the right, and ignore the buffered w s. I am trying

Automatically resize vim gui according to number of vertical splits

限于喜欢 提交于 2019-12-11 00:47:47
问题 I am writing a small plugin for gvim that automatically increases or decreases the width of the gui according to the number of vertical splits. The plugin works something like this if has("gui_running") augroup resize autocmd WinEnter * call <SID>ResizeSplits() autocmd WinLeave * call <SID>ResizeSplits() autocmd BufLeave * call <SID>ResizeSplits() augroup END endif Here ResizeSplits() is the function that resizes the gui window: function! s:ResizeSplits() let l:count = 0 windo if winwidth

How do I catch the “Error during processing: buffer error” in Ruby when getting a web page?

China☆狼群 提交于 2019-12-10 23:45:43
问题 I’m using Rails 4.2.7 and this code to get a webpage through a SOCKS proxy … begin … res1 = Net::HTTP.SOCKSProxy('127.0.0.1', 50001).start(uri.host, uri.port) do |http| puts "launching #{uri}" resp = http.get(uri) status = resp.code content = resp.body content_type = resp['content-type'] content_encoding = resp['content-encoding'] end … rescue OpenURI::HTTPError => ex … rescue SocketError, Net::OpenTimeout => e … Occasionally, I get an error on the line “rest = http.get(uri)” Error during

What happens on buffer overflow?

你。 提交于 2019-12-10 23:39:14
问题 I read somewhere that every TCP connection has it's own 125kB output and input buffer. What happens if this buffer is full, and I still continue sending data on linux? According to http://www.kernel.org/doc/man-pages/online/pages/man2/send.2.html the packets are just silently dropped, without notifying me. What can I do to stop this from happening? Is there any way to find out if at least some of my data has been sent correctly, so that I can continue at a later point in time? 回答1: Short

sgetn Doesn't Null Terminate String

你。 提交于 2019-12-10 22:39:23
问题 sgetn Takes a char* for it's first argument and writes characters to it. It does not write a trailing '\0' to the char* . This behavior seems to be inconsistent with every other time that I can find a char* written to. However, it is consistent across Clang, gcc, and Visual Studio, so I can't believe it's a bug that all the compilers have. Is there a reason that the standard doesn't require the trailing '\0' to the char* ? [Live Example] 回答1: Because it can be used to read arbitrary data, not