| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#include "pa_stream.h" |
| 40 |
|
| 41 |
|
| 42 |
void PaUtil_InitializeStreamInterface( PaUtilStreamInterface *streamInterface, |
| 43 |
PaError (*Close)( PaStream* ), |
| 44 |
PaError (*Start)( PaStream* ), |
| 45 |
PaError (*Stop)( PaStream* ), |
| 46 |
PaError (*Abort)( PaStream* ), |
| 47 |
PaError (*IsStopped)( PaStream* ), |
| 48 |
PaError (*IsActive)( PaStream* ), |
| 49 |
PaTime (*GetTime)( PaStream* ), |
| 50 |
double (*GetCpuLoad)( PaStream* ), |
| 51 |
PaError (*Read)( PaStream*, void *, unsigned long ), |
| 52 |
PaError (*Write)( PaStream*, const void *, unsigned long ), |
| 53 |
signed long (*GetReadAvailable)( PaStream* ), |
| 54 |
signed long (*GetWriteAvailable)( PaStream* ) ) |
| 55 |
{ |
| 56 |
streamInterface->Close = Close; |
| 57 |
streamInterface->Start = Start; |
| 58 |
streamInterface->Stop = Stop; |
| 59 |
streamInterface->Abort = Abort; |
| 60 |
streamInterface->IsStopped = IsStopped; |
| 61 |
streamInterface->IsActive = IsActive; |
| 62 |
streamInterface->GetTime = GetTime; |
| 63 |
streamInterface->GetCpuLoad = GetCpuLoad; |
| 64 |
streamInterface->Read = Read; |
| 65 |
streamInterface->Write = Write; |
| 66 |
streamInterface->GetReadAvailable = GetReadAvailable; |
| 67 |
streamInterface->GetWriteAvailable = GetWriteAvailable; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
void PaUtil_InitializeStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation, |
| 72 |
PaUtilStreamInterface *streamInterface, |
| 73 |
PaStreamCallback *streamCallback, |
| 74 |
void *userData ) |
| 75 |
{ |
| 76 |
streamRepresentation->magic = PA_STREAM_MAGIC; |
| 77 |
streamRepresentation->nextOpenStream = 0; |
| 78 |
streamRepresentation->streamInterface = streamInterface; |
| 79 |
streamRepresentation->streamCallback = streamCallback; |
| 80 |
streamRepresentation->streamFinishedCallback = 0; |
| 81 |
|
| 82 |
streamRepresentation->userData = userData; |
| 83 |
|
| 84 |
streamRepresentation->streamInfo.inputLatency = 0.; |
| 85 |
streamRepresentation->streamInfo.outputLatency = 0.; |
| 86 |
streamRepresentation->streamInfo.sampleRate = 0.; |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
void PaUtil_TerminateStreamRepresentation( PaUtilStreamRepresentation *streamRepresentation ) |
| 91 |
{ |
| 92 |
streamRepresentation->magic = 0; |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
PaError PaUtil_DummyRead( PaStream* stream, |
| 97 |
void *buffer, |
| 98 |
unsigned long frames ) |
| 99 |
{ |
| 100 |
(void)stream; |
| 101 |
(void)buffer; |
| 102 |
(void)frames; |
| 103 |
|
| 104 |
return paCanNotReadFromACallbackStream; |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
PaError PaUtil_DummyWrite( PaStream* stream, |
| 109 |
const void *buffer, |
| 110 |
unsigned long frames ) |
| 111 |
{ |
| 112 |
(void)stream; |
| 113 |
(void)buffer; |
| 114 |
(void)frames; |
| 115 |
|
| 116 |
return paCanNotWriteToACallbackStream; |
| 117 |
} |
| 118 |
|
| 119 |
|
| 120 |
signed long PaUtil_DummyGetReadAvailable( PaStream* stream ) |
| 121 |
{ |
| 122 |
(void)stream; |
| 123 |
|
| 124 |
return paCanNotReadFromACallbackStream; |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
signed long PaUtil_DummyGetWriteAvailable( PaStream* stream ) |
| 129 |
{ |
| 130 |
(void)stream; |
| 131 |
|
| 132 |
return paCanNotWriteToACallbackStream; |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
double PaUtil_DummyGetCpuLoad( PaStream* stream ) |
| 137 |
{ |
| 138 |
(void)stream; |
| 139 |
|
| 140 |
return 0.0; |
| 141 |
} |