-
December 11th, 2004, 06:07 PM
#1
Senior Member
C++ buffers in buffers
Hi all,
I have a little problem. I made a program that record from the microphone and when I press a button plays it. But I want to made it to plays in realtime, not to press a button. I think it can be done by buffers. But I want to add buffers at design time (the number and the size of buffers). I tried with char buf[i]=malloc(size), but it didn't record anything. Can anybody help we. If you want I can post the source that I use.
-
December 11th, 2004, 07:56 PM
#2
I'm not sure that char buf[i] = malloc(size) makes any sense. What I would have thought you would do would be:
Code:
int length = 10, i=0;
char buf[length];
for(i=0; i<length; i++)
buf[i] = malloc(size);
My code could be wrong because I'm not certain what you're trying to do. What you have written above says "create a character array of size 'i' and allocate size memory for it" (not sure about the last part). That doesn't really make too much sense. I would expect you to create an array first, then allocate sizes for the individual elements. But then again, I could be completely wrong because I'm not a hardcore c programmer
[edit]If that's not your problem, the other thing that I would suspect is that you're not accessing the buffer correctly. When I think about it now, I think what I said above was wrong. How are you attempting to write to the buffer? Are you getting a pointer to the buffer and then using it to access it? That's what you would need to do, I think.[/edit]
Hope that helps you,
ac
-
December 13th, 2004, 03:07 PM
#3
Senior Member
Yes yes, i just type buf[i]=malloc(size) to save wirting )))
OK. My problem is:
I want to make a program that will play in real time everything I say in the microphone. I'm with Windows XP and Borland C++ Builder 6.0.
-
January 5th, 2005, 12:41 AM
#4
Senior Member
c'mon boyz I'm sure that someone can help. Please ... it is very important for. OK ... I can explain what I need. I need to write a program such a VoIP phone, but only p2p i pc2pc, not pc2phone or the other thing. Just ... argh how to say ... may be like voice chat.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|