Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellga committed Jun 20, 2024
1 parent 7d1656a commit f5b2559
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
43 changes: 34 additions & 9 deletions r-harmonium/R/000-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ HArray$new_from_values <- function(arr, dtype) {
}



#' HAudioOp
#' A collection of methods that can be applied to float 1D or 2D `HArray`s which represents audio data. \
#'
#' # Methods
#'
HAudioOp <- new.env(parent = emptyenv())

### associated functions for HAudioOp
Expand Down Expand Up @@ -425,7 +429,11 @@ HDecodedAudio_invalidate <- function(self) {
}



#' HDecodedAudio
#' An audio represented by an HArray of samples and its corresponding sampling rate. \
#'
#' # Methods
#'
HDecodedAudio <- new.env(parent = emptyenv())

### associated functions for HDecodedAudio
Expand All @@ -434,23 +442,27 @@ HDecodedAudio <- new.env(parent = emptyenv())

### wrapper functions for HDecoderStream

HDecoderStream_stream <- function(self) {
HDecoderStream_next <- function(self) {
function() {
.savvy_wrap_HArray(.Call(savvy_HDecoderStream_stream__impl, self))
.savvy_wrap_HArray(.Call(savvy_HDecoderStream_next__impl, self))
}
}

.savvy_wrap_HDecoderStream <- function(ptr) {
e <- new.env(parent = emptyenv())
e$.ptr <- ptr
e$stream <- HDecoderStream_stream(ptr)
e$next <- HDecoderStream_next(ptr)

class(e) <- "HDecoderStream"
e
}



#' HDecoderStream
#' An iterator that decodes audio in streams. \
#'
#' # Methods
#'
HDecoderStream <- new.env(parent = emptyenv())

### associated functions for HDecoderStream
Expand Down Expand Up @@ -498,7 +510,11 @@ HFftPlanner_print <- function(self) {
}



#' HFftPlanner
#' A planner is used to create FFTs. It caches results internally, so when making more than one FFT it is advisable to reuse the same planner. \
#'
#' # Methods
#'
HFftPlanner <- new.env(parent = emptyenv())

### associated functions for HFftPlanner
Expand All @@ -522,7 +538,11 @@ HFftPlanner$new <- function(dtype) {
}



#' HFile
#' A collection of methods designed to streamline input and output operations. \
#'
#' # Methods
#'
HFile <- new.env(parent = emptyenv())

### associated functions for HFile
Expand Down Expand Up @@ -789,7 +809,12 @@ HRealFftPlanner_print <- function(self) {
}



#' HRealFftPlanner
#' A planner is used to create FFTs. It caches results internally, so when making more than one FFT it is advisable to reuse the same planner. \
#' This planner is used to calculate FFTs of real valued inputs and its inverse operation. \
#'
#' # Methods
#'
HRealFftPlanner <- new.env(parent = emptyenv())

### associated functions for HRealFftPlanner
Expand Down
6 changes: 3 additions & 3 deletions r-harmonium/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ SEXP savvy_HDecodedAudio_invalidate__impl(SEXP self__) {
return handle_result(res);
}

SEXP savvy_HDecoderStream_stream__impl(SEXP self__) {
SEXP res = savvy_HDecoderStream_stream__ffi(self__);
SEXP savvy_HDecoderStream_next__impl(SEXP self__) {
SEXP res = savvy_HDecoderStream_next__ffi(self__);
return handle_result(res);
}

Expand Down Expand Up @@ -557,7 +557,7 @@ static const R_CallMethodDef CallEntries[] = {
{"savvy_HDecodedAudio_harray__impl", (DL_FUNC) &savvy_HDecodedAudio_harray__impl, 1},
{"savvy_HDecodedAudio_sr__impl", (DL_FUNC) &savvy_HDecodedAudio_sr__impl, 1},
{"savvy_HDecodedAudio_invalidate__impl", (DL_FUNC) &savvy_HDecodedAudio_invalidate__impl, 1},
{"savvy_HDecoderStream_stream__impl", (DL_FUNC) &savvy_HDecoderStream_stream__impl, 1},
{"savvy_HDecoderStream_next__impl", (DL_FUNC) &savvy_HDecoderStream_next__impl, 1},
{"savvy_HFftPlanner_new__impl", (DL_FUNC) &savvy_HFftPlanner_new__impl, 1},
{"savvy_HFftPlanner_fft__impl", (DL_FUNC) &savvy_HFftPlanner_fft__impl, 2},
{"savvy_HFftPlanner_ifft__impl", (DL_FUNC) &savvy_HFftPlanner_ifft__impl, 2},
Expand Down
2 changes: 1 addition & 1 deletion r-harmonium/src/rust/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ SEXP savvy_HDecodedAudio_sr__ffi(SEXP self__);
SEXP savvy_HDecodedAudio_invalidate__ffi(SEXP self__);

// methods and associated functions for HDecoderStream
SEXP savvy_HDecoderStream_stream__ffi(SEXP self__);
SEXP savvy_HDecoderStream_next__ffi(SEXP self__);

// methods and associated functions for HFftPlanner
SEXP savvy_HFftPlanner_new__ffi(SEXP dtype);
Expand Down

0 comments on commit f5b2559

Please sign in to comment.