mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-13 09:17:20 -05:00
M17 Cleanup and M17/Aero Jank Fixes;
This commit is contained in:
@@ -103,6 +103,12 @@ void
|
||||
noCarrier (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
|
||||
#ifdef AERO_BUILD
|
||||
//TODO: Investigate why getSymbol needs to be run first in this context...truly confused here
|
||||
if(opts->frame_m17 == 1) //&& opts->audio_in_type == 5
|
||||
for (int i = 0; i < 960; i++) getSymbol(opts, state, 1); //I think this is actually just framesync being a pain
|
||||
#endif
|
||||
|
||||
if (opts->floating_point == 1)
|
||||
{
|
||||
state->aout_gain = opts->audio_gain;
|
||||
@@ -638,8 +644,8 @@ initOpts (dsd_opts * opts)
|
||||
//this may not matter so much, since its already checked later on
|
||||
//but better safe than sorry I guess
|
||||
#ifdef AERO_BUILD
|
||||
opts->audio_in_type = 5;
|
||||
opts->audio_out_type = 5;
|
||||
opts->audio_in_type = 9; //only assign when configured
|
||||
opts->audio_out_type = 9; //only assign when configured
|
||||
#else
|
||||
opts->audio_in_type = 0;
|
||||
opts->audio_out_type = 0;
|
||||
@@ -1388,6 +1394,12 @@ if (opts->audio_out_type == 0)
|
||||
openPulseOutput(opts);
|
||||
}
|
||||
|
||||
#ifdef AERO_BUILD
|
||||
//TODO: Investigate why getSymbol needs to be run first in this context...truly confused here
|
||||
if(opts->frame_m17 == 1) //&& opts->audio_in_type == 5
|
||||
for (int i = 0; i < 960; i++) getSymbol(opts, state, 1); //I think this is actually just framesync being a pain
|
||||
#endif
|
||||
|
||||
while (!exitflag)
|
||||
{
|
||||
|
||||
@@ -2788,6 +2800,8 @@ main (int argc, char **argv)
|
||||
//TODO: Multiple output returns based on 8k/1, 8k/2, or maybe 48k/1? (2,3,5)??
|
||||
if (opts.pulse_digi_out_channels == 2)
|
||||
opts.audio_out_type = 2; //2 for 2 channel 8k OSS 16-bit short output
|
||||
else if (opts.frame_m17 == 1)
|
||||
opts.audio_out_type = 2;
|
||||
else opts.audio_out_type = 5;
|
||||
|
||||
//debug
|
||||
|
||||
195
src/m17.c
195
src/m17.c
@@ -290,181 +290,6 @@ int M17processLICH(dsd_state * state, dsd_opts * opts, uint8_t lich_bits[96])
|
||||
return err;
|
||||
}
|
||||
|
||||
// void M17processCodec2_1600(dsd_opts * opts, dsd_state * state, uint8_t payload[128])
|
||||
// {
|
||||
|
||||
// int i;
|
||||
// unsigned char voice1[8];
|
||||
// unsigned char voice2[8];
|
||||
|
||||
// for (i = 0; i < 8; i++)
|
||||
// {
|
||||
// voice1[i] = (unsigned char)ConvertBitIntoBytes(&payload[i*8+0], 8);
|
||||
// voice2[i] = (unsigned char)ConvertBitIntoBytes(&payload[i*8+64], 8);
|
||||
// }
|
||||
|
||||
// //TODO: Add some decryption methods
|
||||
// if (state->m17_enc != 0)
|
||||
// {
|
||||
// //process scrambler or AES-CTR decryption
|
||||
// //(no AES-CTR right now, Scrambler should be easy enough)
|
||||
// }
|
||||
|
||||
// if (opts->payload == 1)
|
||||
// {
|
||||
// fprintf (stderr, "\n CODEC2: ");
|
||||
// for (i = 0; i < 8; i++)
|
||||
// fprintf (stderr, "%02X", voice1[i]);
|
||||
// fprintf (stderr, " (1600)");
|
||||
|
||||
// fprintf (stderr, "\n A_DATA: "); //arbitrary data
|
||||
// for (i = 0; i < 8; i++)
|
||||
// fprintf (stderr, "%02X", voice2[i]);
|
||||
// }
|
||||
|
||||
// #ifdef USE_CODEC2
|
||||
// size_t nsam;
|
||||
// nsam = 320;
|
||||
|
||||
// short samp1[nsam];
|
||||
// memset (samp1, 0, sizeof(samp1));
|
||||
|
||||
// codec2_decode(state->codec2_1600, samp1, voice1);
|
||||
|
||||
// if (opts->audio_out_type == 0 && state->m17_enc == 0) //Pulse Audio
|
||||
// {
|
||||
// pa_simple_write(opts->pulse_digi_dev_out, samp1, nsam*2, NULL);
|
||||
// }
|
||||
|
||||
// if (opts->audio_out_type == 5 && state->m17_enc == 0) //OSS
|
||||
// {
|
||||
// write (opts->audio_out_fd, samp1, nsam*2);
|
||||
// }
|
||||
|
||||
// if (opts->audio_out_type == 1 && state->m17_enc == 0) //STDOUT
|
||||
// {
|
||||
// write (opts->audio_out_fd, samp1, nsam*2);
|
||||
// }
|
||||
|
||||
// //WIP: Wav file saving -- still need a way to open/close/label wav files similar to call history
|
||||
// if(opts->wav_out_f != NULL && state->m17_enc == 0) //WAV
|
||||
// {
|
||||
// sf_write_short(opts->wav_out_f, samp1, nsam);
|
||||
// }
|
||||
|
||||
// //TODO: Codec2 Raw file saving
|
||||
// // if(mbe_out_dir)
|
||||
// // {
|
||||
|
||||
// // }
|
||||
|
||||
// #endif
|
||||
|
||||
// }
|
||||
|
||||
// void M17processCodec2_3200(dsd_opts * opts, dsd_state * state, uint8_t payload[128])
|
||||
// {
|
||||
// int i;
|
||||
// unsigned char voice1[8];
|
||||
// unsigned char voice2[8];
|
||||
|
||||
// for (i = 0; i < 8; i++)
|
||||
// {
|
||||
// voice1[i] = (unsigned char)ConvertBitIntoBytes(&payload[i*8+0], 8);
|
||||
// voice2[i] = (unsigned char)ConvertBitIntoBytes(&payload[i*8+64], 8);
|
||||
// }
|
||||
|
||||
// //TODO: Add some decryption methods
|
||||
// if (state->m17_enc != 0)
|
||||
// {
|
||||
// //process scrambler or AES-CTR decryption
|
||||
// //(no AES-CTR right now, Scrambler should be easy enough)
|
||||
// }
|
||||
|
||||
// if (opts->payload == 1)
|
||||
// {
|
||||
// fprintf (stderr, "\n CODEC2: ");
|
||||
// for (i = 0; i < 8; i++)
|
||||
// fprintf (stderr, "%02X", voice1[i]);
|
||||
// fprintf (stderr, " (3200)");
|
||||
|
||||
// fprintf (stderr, "\n CODEC2: ");
|
||||
// for (i = 0; i < 8; i++)
|
||||
// fprintf (stderr, "%02X", voice2[i]);
|
||||
// fprintf (stderr, " (3200)");
|
||||
// }
|
||||
|
||||
// #ifdef USE_CODEC2
|
||||
// size_t nsam;
|
||||
// nsam = 160;
|
||||
// short samp1[nsam];
|
||||
// short samp2[nsam];
|
||||
// memset (samp1, 0, sizeof(samp1));
|
||||
// memset (samp2, 0, sizeof(samp2));
|
||||
|
||||
// short upsamp[nsam*6]; //having more than one causes a memory overflow issue
|
||||
// // short upsamp3[nsam*6]; //having more than one causes a memory overflow issue
|
||||
// short out[6];
|
||||
// short prev;
|
||||
// int j;
|
||||
// memset (upsamp, 0, sizeof(upsamp));
|
||||
// memset (out, 0, sizeof(out));
|
||||
|
||||
// //Still thinking codec2_decode causes a memory overflow
|
||||
// codec2_decode(state->codec2_3200, samp1, voice1);
|
||||
// codec2_decode(state->codec2_3200, samp2, voice2);
|
||||
|
||||
// if (opts->audio_out_type == 0 && state->m17_enc == 0) //Pulse Audio
|
||||
// {
|
||||
// pa_simple_write(opts->pulse_digi_dev_out, samp1, nsam*2, NULL);
|
||||
// pa_simple_write(opts->pulse_digi_dev_out, samp2, nsam*2, NULL);
|
||||
// }
|
||||
|
||||
// if (opts->audio_out_type == 5 && state->m17_enc == 0) //OSS
|
||||
// {
|
||||
// // write (opts->audio_out_fd, samp1, nsam*2);
|
||||
// // write (opts->audio_out_fd, samp2, nsam*2);
|
||||
|
||||
// //upsample to 48k and then play
|
||||
// prev = samp1[0];
|
||||
// for (i = 0; i < 160; i++)
|
||||
// {
|
||||
// upsampleS (samp1[i], prev, out);
|
||||
// for (j = 0; j < 6; j++) upsamp[(i*6)+j] = out[j];
|
||||
// }
|
||||
// write (opts->audio_out_fd, upsamp, nsam*2*6);
|
||||
// prev = samp2[0];
|
||||
// for (i = 0; i < 160; i++)
|
||||
// {
|
||||
// upsampleS (samp2[i], prev, out);
|
||||
// for (j = 0; j < 6; j++) upsamp[(i*6)+j] = out[j];
|
||||
// }
|
||||
// write (opts->audio_out_fd, upsamp, nsam*2*6);
|
||||
// }
|
||||
|
||||
// if (opts->audio_out_type == 1 && state->m17_enc == 0) //STDOUT
|
||||
// {
|
||||
// write (opts->audio_out_fd, samp1, nsam*2);
|
||||
// write (opts->audio_out_fd, samp2, nsam*2);
|
||||
// }
|
||||
|
||||
// //WIP: Wav file saving -- still need a way to open/close/label wav files similar to call history
|
||||
// if(opts->wav_out_f != NULL && state->m17_enc == 0) //WAV
|
||||
// {
|
||||
// sf_write_short(opts->wav_out_f, samp1, nsam);
|
||||
// sf_write_short(opts->wav_out_f, samp2, nsam);
|
||||
// }
|
||||
|
||||
// //TODO: Codec2 Raw file saving
|
||||
// // if(mbe_out_dir)
|
||||
// // {
|
||||
|
||||
// // }
|
||||
|
||||
// #endif
|
||||
|
||||
// }
|
||||
|
||||
void M17processCodec2_1600(dsd_opts * opts, dsd_state * state, uint8_t payload[128])
|
||||
{
|
||||
|
||||
@@ -515,10 +340,8 @@ void M17processCodec2_1600(dsd_opts * opts, dsd_state * state, uint8_t payload[1
|
||||
pa_simple_write(opts->pulse_digi_dev_out, samp1, nsam*2, NULL);
|
||||
}
|
||||
|
||||
if (opts->audio_out_type == 5 && state->m17_enc == 0) //OSS
|
||||
if (opts->audio_out_type == 5 && state->m17_enc == 0) //OSS 48k/1
|
||||
{
|
||||
// write (opts->audio_out_fd, samp1, nsam*2);
|
||||
|
||||
//upsample to 48k and then play
|
||||
prev = samp1[0];
|
||||
for (i = 0; i < 160; i++)
|
||||
@@ -535,6 +358,11 @@ void M17processCodec2_1600(dsd_opts * opts, dsd_state * state, uint8_t payload[1
|
||||
write (opts->audio_out_fd, samp1, nsam*2);
|
||||
}
|
||||
|
||||
if (opts->audio_out_type == 2 && state->m17_enc == 0) //OSS 8k/1
|
||||
{
|
||||
write (opts->audio_out_fd, samp1, nsam*2);
|
||||
}
|
||||
|
||||
//WIP: Wav file saving -- still need a way to open/close/label wav files similar to call history
|
||||
if(opts->wav_out_f != NULL && state->m17_enc == 0) //WAV
|
||||
{
|
||||
@@ -608,11 +436,8 @@ void M17processCodec2_3200(dsd_opts * opts, dsd_state * state, uint8_t payload[1
|
||||
pa_simple_write(opts->pulse_digi_dev_out, samp2, nsam*2, NULL);
|
||||
}
|
||||
|
||||
if (opts->audio_out_type == 5 && state->m17_enc == 0) //OSS
|
||||
if (opts->audio_out_type == 5 && state->m17_enc == 0) //OSS 48k/1
|
||||
{
|
||||
// write (opts->audio_out_fd, samp1, nsam*2);
|
||||
// write (opts->audio_out_fd, samp2, nsam*2);
|
||||
|
||||
//upsample to 48k and then play
|
||||
prev = samp1[0];
|
||||
for (i = 0; i < 160; i++)
|
||||
@@ -636,6 +461,12 @@ void M17processCodec2_3200(dsd_opts * opts, dsd_state * state, uint8_t payload[1
|
||||
write (opts->audio_out_fd, samp2, nsam*2);
|
||||
}
|
||||
|
||||
if (opts->audio_out_type == 2 && state->m17_enc == 0) //OSS 8k/1
|
||||
{
|
||||
write (opts->audio_out_fd, samp1, nsam*2);
|
||||
write (opts->audio_out_fd, samp2, nsam*2);
|
||||
}
|
||||
|
||||
//WIP: Wav file saving -- still need a way to open/close/label wav files similar to call history
|
||||
if(opts->wav_out_f != NULL && state->m17_enc == 0) //WAV
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user