hfp_msbc.c (e501bae08349e058caa4648e0af3dd01cbd89d20) | hfp_msbc.c (c1ab6cc1beb14b16b46e74a3723644016d8c3cc7) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 58 unchanged lines hidden (view full) --- 67 68void hfp_msbc_init(void){ 69 btstack_sbc_encoder_init(&state, SBC_MODE_mSBC, 16, 8, 0, 16000, 26, 0); 70 msbc_buffer_offset = 0; 71 msbc_sequence_number = 0; 72} 73 74int hfp_msbc_can_encode_audio_frame_now(void){ | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 58 unchanged lines hidden (view full) --- 67 68void hfp_msbc_init(void){ 69 btstack_sbc_encoder_init(&state, SBC_MODE_mSBC, 16, 8, 0, 16000, 26, 0); 70 msbc_buffer_offset = 0; 71 msbc_sequence_number = 0; 72} 73 74int hfp_msbc_can_encode_audio_frame_now(void){ |
75 return sizeof(msbc_buffer) - msbc_buffer_offset >= MSBC_FRAME_SIZE + MSBC_EXTRA_SIZE; | 75 return (sizeof(msbc_buffer) - msbc_buffer_offset) >= MSBC_FRAME_SIZE + MSBC_EXTRA_SIZE; |
76} 77 78void hfp_msbc_encode_audio_frame(int16_t * pcm_samples){ 79 if (!hfp_msbc_can_encode_audio_frame_now()) return; 80 81 // Synchronization Header H2 82 msbc_buffer[msbc_buffer_offset++] = msbc_header_h2_byte_0; 83 msbc_buffer[msbc_buffer_offset++] = msbc_header_h2_byte_1_table[msbc_sequence_number]; --- 33 unchanged lines hidden --- | 76} 77 78void hfp_msbc_encode_audio_frame(int16_t * pcm_samples){ 79 if (!hfp_msbc_can_encode_audio_frame_now()) return; 80 81 // Synchronization Header H2 82 msbc_buffer[msbc_buffer_offset++] = msbc_header_h2_byte_0; 83 msbc_buffer[msbc_buffer_offset++] = msbc_header_h2_byte_1_table[msbc_sequence_number]; --- 33 unchanged lines hidden --- |