Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105332368
portAudioPipe.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Mar 16, 09:46
Size
1 KB
Mime Type
text/x-c++
Expires
Tue, Mar 18, 09:46 (2 d)
Engine
blob
Format
Raw Data
Handle
24942839
Attached To
R2653 epfl
portAudioPipe.h
View Options
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include "PortAudio.h"
#include "soundProcessor.h"
#define SAMPLE_RATE (44100)
#define FRAMES_PER_BUFFER (4)
#define NUM_CHANNELS (1)
#define NUM_SECONDS (15)
/* @todo Underflow and overflow is disabled until we fix priming of blocking write. */
#define CHECK_OVERFLOW (0)
#define CHECK_UNDERFLOW (0)
/* Select sample format. */
#if 0
#define PA_SAMPLE_TYPE paFloat32
#define SAMPLE_SIZE (4)
#define SAMPLE_SILENCE (0.0f)
#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
#define PRINTF_S_FORMAT "%.8f"
#elif 1
#define PA_SAMPLE_TYPE paInt16
#define SAMPLE_SIZE (2)
#define SAMPLE_SILENCE (0)
#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
#define PRINTF_S_FORMAT "%d"
#elif 0
#define PA_SAMPLE_TYPE paInt24
#define SAMPLE_SIZE (3)
#define SAMPLE_SILENCE (0)
#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
#define PRINTF_S_FORMAT "%d"
#elif 0
#define PA_SAMPLE_TYPE paInt8
#define SAMPLE_SIZE (1)
#define SAMPLE_SILENCE (0)
#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
#define PRINTF_S_FORMAT "%d"
#else
#define PA_SAMPLE_TYPE paUInt8
#define SAMPLE_SIZE (1)
#define SAMPLE_SILENCE (128)
#define CLEAR( a ) { \
int i; \
for( i=0; i<FRAMES_PER_BUFFER*NUM_CHANNELS; i++ ) \
((unsigned char *)a)[i] = (SAMPLE_SILENCE); \
}
#define PRINTF_S_FORMAT "%d"
#endif
class
portAudioPipe
{
public:
portAudioPipe
();
virtual
~
portAudioPipe
();
void
Initial
();
void
Start
();
void
Stop
();
void
printOptions
();
void
error
();
void
xrun
();
public:
soundProcessor
m_soundProcessor
;
int
option
;
private:
PaStreamParameters
inputParameters
,
outputParameters
;
PaStream
*
stream
;
PaError
err
;
char
*
sampleBlock
,
*
samplePointer
;
char
*
currentBlock
;
};
Event Timeline
Log In to Comment