Skip to content

Commit

Permalink
Small fixes for Teensy audio.
Browse files Browse the repository at this point in the history
  • Loading branch information
modlfo committed Dec 2, 2022
1 parent 8167652 commit 0ae2120
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/generators/templates/teensyAudio.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ let header (params : params) (code : Pla.t) : Pla.t =
#include <math.h>
#include "vultin.h"
#include "<#tables#s>.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

<#code#>

Expand Down Expand Up @@ -144,9 +145,9 @@ let castInput params typ i acc =
let castOutput params typ value =
match typ with
| OReal when params.real = "fixed" -> [%pla {|fix_to_short(<#value#>)|}]
| OReal -> [%pla {|<#value#>|}]
| OReal -> [%pla {|(int16_t)(32768 * <#value#>)|}]
| OFix16 -> [%pla {|fix_to_short(<#value#>)|}]
| OBool -> [%pla {|<#value#>|}]
| OBool -> [%pla {|32768 * (int16_t)<#value#>|}]
| OInt -> [%pla {|<#value#>|}]
;;

Expand Down
3 changes: 2 additions & 1 deletion test/code/af_f.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "af_f.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

typedef struct Af_f__ctx_type_0 {
int x;
Expand Down
3 changes: 2 additions & 1 deletion test/code/aff_f.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "aff_f.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

typedef struct Aff_f__ctx_type_0 {
int x;
Expand Down
3 changes: 2 additions & 1 deletion test/code/aff_ff.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "aff_ff.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

typedef struct _tuple___real_real__ {
fix16_t field_0;
Expand Down
3 changes: 2 additions & 1 deletion test/code/afi_fi.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "afi_fi.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

typedef struct _tuple___real_int__ {
fix16_t field_0;
Expand Down
3 changes: 2 additions & 1 deletion test/code/sf_f.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "sf_f.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

static_inline fix16_t Sf_f_process(fix16_t input){
return fix_mul(input,input);
Expand Down
3 changes: 2 additions & 1 deletion test/code/sff_f.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "sff_f.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

static_inline fix16_t Sff_f_process(fix16_t a, fix16_t b){
return fix_mul(a,b);
Expand Down
3 changes: 2 additions & 1 deletion test/code/sff_ff.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "sff_ff.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

typedef struct _tuple___real_real__ {
fix16_t field_0;
Expand Down
3 changes: 2 additions & 1 deletion test/code/sfi_fi.h.fixed.base.teensy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <math.h>
#include "vultin.h"
#include "sfi_fi.tables.h"
#include "AudioStream.h"
#include <Audio.h>
#include <AudioStream.h>

typedef struct _tuple___real_int__ {
fix16_t field_0;
Expand Down

0 comments on commit 0ae2120

Please sign in to comment.