1
0

Last main.c.

This commit is contained in:
Alexander Andreev 2024-03-21 17:51:03 +04:00
parent 35750274d1
commit 20c99d0540
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -1,20 +1,57 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "audio.h"
#include "crypt.h"
#define CHANNELS 1
#define SAMPLE_RATE 48000
#define FRAMES_PER_BUFFFER 480
#define BUF_SIZE (FRAMES_PER_BUFFFER * CHANNELS)
int main(int argc, char **argv) {
(void)argv;
(void)argc;
audio_t aud;
audio_init_default(&aud, 1, 48000, 480, audio_default_callback);
if (sodium_init() < 0) {
fprintf(stderr, "A Sodium cryptography library is failed to initialise!\n");
return -1;
}
printf("Listening... ");
getchar();
printf("Done!\n");
audio_destroy(&aud);
crypt_key_t own, remote;
if (crypt_key_gen(&own) < 0) {
fprintf(stderr, "Failed to generate the keys.");
return -1;
}
if (crypt_key_gen(&remote) < 0) {
fprintf(stderr, "Failed to generate the keys.");
return -1;
}
crypt_session_t sess, sess_r;
crypt_session_init(&sess, &own, &remote, true);
crypt_session_init(&sess_r, &remote, &own, false);
// audio_t aud;
// uint8_t buf[BUF_SIZE];
// memset(buf, 0, BUF_SIZE);
// audio_init(&aud, CHANNELS, SAMPLE_RATE, FRAMES_PER_BUFFFER);
// printf("Listening... ");
// for (int i = 0; i < (2 * SAMPLE_RATE)/FRAMES_PER_BUFFFER; ++i) {
// audio_read(&aud, buf, BUF_SIZE);
// audio_write(&aud, buf, BUF_SIZE);
// }
// printf("Done!\n");
// audio_destroy(&aud);
return 0;
}