Skip to content

Commit

Permalink
Update for building on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
meshula committed Jul 5, 2019
1 parent ae0f455 commit 6a88f29
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ set(CMAKE_MODULE_PATH ${LIBNYQUIST_ROOT}/cmake)

include(CXXhelpers)

option(BUILD_EXAMPLE "Build example application" ON)
if (CMAKE_OSX_ARCHITECTURES)
if(CMAKE_OSX_SYSROOT MATCHES ".*iphoneos.*")
# RtAudio is not portable to ios currently
option(BUILD_EXAMPLE "Build example application" OFF)
else()
option(BUILD_EXAMPLE "Build example application" ON)
endif()
else()
option(BUILD_EXAMPLE "Build example application" ON)
endif()

#-------------------------------------------------------------------------------

Expand Down
38 changes: 20 additions & 18 deletions third_party/opus/celt/celt_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ struct OpusCustomDecoder {
/* opus_val16 backgroundLogE[], Size = 2*mode->nbEBands */
};

int celt_decoder_get_size(int channels)
{
const CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);
return opus_custom_decoder_get_size(mode, channels);
}

OPUS_CUSTOM_NOSTATIC int opus_custom_decoder_get_size(const CELTMode *mode, int channels)
{
int size = sizeof(struct CELTDecoder)
Expand All @@ -111,6 +105,12 @@ OPUS_CUSTOM_NOSTATIC int opus_custom_decoder_get_size(const CELTMode *mode, int
return size;
}

int celt_decoder_get_size(int channels)
{
const CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);
return opus_custom_decoder_get_size(mode, channels);
}

#ifdef CUSTOM_MODES
CELTDecoder *opus_custom_decoder_create(const CELTMode *mode, int channels, int *error)
{
Expand All @@ -128,18 +128,6 @@ CELTDecoder *opus_custom_decoder_create(const CELTMode *mode, int channels, int
}
#endif /* CUSTOM_MODES */

int celt_decoder_init(CELTDecoder *st, opus_int32 sampling_rate, int channels)
{
int ret;
ret = opus_custom_decoder_init(st, opus_custom_mode_create(48000, 960, NULL), channels);
if (ret != OPUS_OK)
return ret;
st->downsample = resampling_factor(sampling_rate);
if (st->downsample==0)
return OPUS_BAD_ARG;
else
return OPUS_OK;
}

OPUS_CUSTOM_NOSTATIC int opus_custom_decoder_init(CELTDecoder *st, const CELTMode *mode, int channels)
{
Expand Down Expand Up @@ -168,6 +156,20 @@ OPUS_CUSTOM_NOSTATIC int opus_custom_decoder_init(CELTDecoder *st, const CELTMod
return OPUS_OK;
}


int celt_decoder_init(CELTDecoder *st, opus_int32 sampling_rate, int channels)
{
int ret;
ret = opus_custom_decoder_init(st, opus_custom_mode_create(48000, 960, NULL), channels);
if (ret != OPUS_OK)
return ret;
st->downsample = resampling_factor(sampling_rate);
if (st->downsample==0)
return OPUS_BAD_ARG;
else
return OPUS_OK;
}

#ifdef CUSTOM_MODES
void opus_custom_decoder_destroy(CELTDecoder *st)
{
Expand Down
12 changes: 6 additions & 6 deletions third_party/opus/celt/celt_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ struct OpusCustomEncoder {
/* opus_val16 oldLogE2[], Size = channels*mode->nbEBands */
};

int celt_encoder_get_size(int channels)
{
CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);
return opus_custom_encoder_get_size(mode, channels);
}

OPUS_CUSTOM_NOSTATIC int opus_custom_encoder_get_size(const CELTMode *mode, int channels)
{
int size = sizeof(struct CELTEncoder)
Expand All @@ -143,6 +137,12 @@ OPUS_CUSTOM_NOSTATIC int opus_custom_encoder_get_size(const CELTMode *mode, int
return size;
}

int celt_encoder_get_size(int channels)
{
CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);
return opus_custom_encoder_get_size(mode, channels);
}

#ifdef CUSTOM_MODES
CELTEncoder *opus_custom_encoder_create(const CELTMode *mode, int channels, int *error)
{
Expand Down

0 comments on commit 6a88f29

Please sign in to comment.