Commit 7e4abd92 authored by sletz's avatar sletz
Browse files

Cleanup encoder allocation.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@4012 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 249c0c3b
......@@ -228,7 +228,7 @@ namespace Jack
bool JackNetMasterInterface::SetParams()
{
jack_log ( "JackNetMasterInterface::SetParams" );
jack_log("JackNetMasterInterface::SetParams");
JackNetInterface::SetParams();
......@@ -236,11 +236,12 @@ namespace Jack
fRxHeader.fDataStream = 'r';
//midi net buffers
fNetMidiCaptureBuffer = new NetMidiBuffer ( &fParams, fParams.fSendMidiChannels, fTxData );
fNetMidiPlaybackBuffer = new NetMidiBuffer ( &fParams, fParams.fReturnMidiChannels, fRxData );
assert ( fNetMidiCaptureBuffer );
assert ( fNetMidiPlaybackBuffer );
if (fParams.fSendMidiChannels)
fNetMidiCaptureBuffer = new NetMidiBuffer(&fParams, fParams.fSendMidiChannels, fTxData);
if (fParams.fReturnMidiChannels)
fNetMidiPlaybackBuffer = new NetMidiBuffer(&fParams, fParams.fReturnMidiChannels, fRxData);
try {
//audio net buffers
......@@ -253,7 +254,7 @@ namespace Jack
break;
case JackIntEncoder:
fNetAudioCaptureBuffer = new NetIntAudioBuffer ( &fParams, fParams.fSendAudioChannels, fTxData );
fNetAudioCaptureBuffer = new NetIntAudioBuffer ( &fParams, fParams.fSendAudioChannels, fTxData );
break;
case JackCeltEncoder:
......@@ -269,7 +270,7 @@ namespace Jack
switch (fParams.fSampleEncoder) {
case JackFloatEncoder:
fNetAudioPlaybackBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fRxData );
fNetAudioPlaybackBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fRxData );
break;
case JackIntEncoder:
......@@ -774,39 +775,15 @@ namespace Jack
fTxHeader.fDataStream = 'r';
fRxHeader.fDataStream = 's';
//midi net buffers
fNetMidiCaptureBuffer = new NetMidiBuffer ( &fParams, fParams.fSendMidiChannels, fRxData );
fNetMidiPlaybackBuffer = new NetMidiBuffer ( &fParams, fParams.fReturnMidiChannels, fTxData );
assert ( fNetMidiCaptureBuffer );
assert ( fNetMidiPlaybackBuffer );
//audio net buffers
//fNetAudioCaptureBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
//fNetAudioPlaybackBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
try {
#ifdef CELT
if (fParams.fSendAudioChannels) {
// fNetAudioCaptureBuffer = new NetCeltAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
fNetAudioCaptureBuffer = new NetIntAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
}
if (fParams.fReturnAudioChannels) {
//fNetAudioPlaybackBuffer = new NetCeltAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
fNetAudioPlaybackBuffer = new NetIntAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
}
// fNetAudioCaptureBuffer = new NetIntAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
// fNetAudioPlaybackBuffer = new NetIntAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
#else
fNetAudioCaptureBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
fNetAudioPlaybackBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
//fNetAudioCaptureBuffer = new NetBufferedAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
//fNetAudioPlaybackBuffer = new NetBufferedAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
#endif
//midi net buffers
if (fParams.fSendMidiChannels)
fNetMidiCaptureBuffer = new NetMidiBuffer(&fParams, fParams.fSendMidiChannels, fTxData);
if (fParams.fReturnMidiChannels)
fNetMidiPlaybackBuffer = new NetMidiBuffer(&fParams, fParams.fReturnMidiChannels, fRxData);
try {
//audio net buffers
if (fParams.fSendAudioChannels) {
......@@ -817,7 +794,7 @@ namespace Jack
break;
case JackIntEncoder:
fNetAudioCaptureBuffer = new NetIntAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
fNetAudioCaptureBuffer = new NetIntAudioBuffer ( &fParams, fParams.fSendAudioChannels, fRxData );
break;
case JackCeltEncoder:
......@@ -833,7 +810,7 @@ namespace Jack
switch (fParams.fSampleEncoder) {
case JackFloatEncoder:
fNetAudioPlaybackBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
fNetAudioPlaybackBuffer = new NetFloatAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fTxData );
break;
case JackIntEncoder:
......
......@@ -304,19 +304,19 @@ namespace Jack
for (int port_index = 0; port_index < fNPorts; port_index++)
fCompressedBuffer[port_index] = new unsigned char[fCompressedSizeByte];
jack_log("fCompressedSizeByte %d", fCompressedSizeByte);
jack_log("NetCeltAudioBuffer fCompressedSizeByte %d", fCompressedSizeByte);
res1 = (fNPorts * fCompressedSizeByte) % (params->fMtu - sizeof(packet_header_t));
res2 = (fNPorts * fCompressedSizeByte) / (params->fMtu - sizeof(packet_header_t));
jack_log("res1 = %d res2 = %d", res1, res2);
jack_log("NetCeltAudioBuffer res1 = %d res2 = %d", res1, res2);
fNumPackets = (res1) ? (res2 + 1) : res2;
fSubPeriodBytesSize = fCompressedSizeByte / fNumPackets;
fLastSubPeriodBytesSize = fSubPeriodBytesSize + fCompressedSizeByte % fNumPackets;
jack_log("fNumPackets = %d fSubPeriodBytesSize = %d, fLastSubPeriodBytesSize = %d", fNumPackets, fSubPeriodBytesSize, fLastSubPeriodBytesSize);
jack_log("NetCeltAudioBuffer fNumPackets = %d fSubPeriodBytesSize = %d, fLastSubPeriodBytesSize = %d", fNumPackets, fSubPeriodBytesSize, fLastSubPeriodBytesSize);
fCycleDuration = float(fSubPeriodBytesSize / sizeof(sample_t)) / float(params->fSampleRate);
fCycleSize = params->fMtu * fNumPackets;
......@@ -710,7 +710,17 @@ namespace Jack
jack_info ( "Return channels (audio - midi) : %d - %d", params->fReturnAudioChannels, params->fReturnMidiChannels );
jack_info ( "Sample rate : %u frames per second", params->fSampleRate );
jack_info ( "Period size : %u frames per period", params->fPeriodSize );
jack_info ( "SampleEncoder : %u", params->fSampleEncoder );
switch (params->fSampleEncoder) {
case (JackFloatEncoder):
jack_info ( "SampleEncoder : %s", "Float" );
break;
case (JackIntEncoder):
jack_info ( "SampleEncoder : %s", "16 bits integer");
break;
case (JackCeltEncoder):
jack_info ( "SampleEncoder : %s", "CELT");
break;
};
jack_info ( "Slave mode : %s", ( params->fSlaveSyncMode ) ? "sync" : "async" );
jack_info ( "Network mode : %s", mode );
jack_info ( "****************************************************" );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment