The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
Spliting up the channels
Posted by: aquawicket | March 21, 2008 @ 3:58pm
C++ Code
[
Download
]
int AudioProc::CallBack( const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags statusFlags, void *userData ) { Device *thisDevice = (Device*)userData; //This holds the device info we need //We need to split the signal up into channels float *input = (float*)inputBuffer; std::vector<float*>channel(thisDevice->inDev.channelCount); //make an array for the number of channels for (unsigned int f=0;f<(unsigned)framesPerBuffer;f++) { for(int i=0; i< thisDevice->inDev.channelCount; i++){ *channel[i]++ = *input++; <--- OUCH.. can't ++ a vector pointer. } } /////////////////////////////////////////////////////////////////////////////////////// //On the other hand.. something like this works... //Lets pretend I have 3 channels float *input = (float*)inputBuffer; float* channel_1 = (float*)inputBuffer; float* channel_2 = (float*)inputBuffer; float* channel_3 = (float*)inputBuffer; for (unsigned int f=0;f<(unsigned)framesPerBuffer;f++) { *channel_1++ = *output++ *channel_2++ = *output++ *channel_3++ = *output++ } //So how can I do this with a pointer array like *channel[n] ??? return 0; }
Syntax Highlighting
[
Open in new window
]
Author Comments
Spliting the channels into an array is the idea channel[n]
Rating
4.55 / 8
202 Votes