diff --git a/cart/c/sound/assets/sound.rfx b/cart/c/sound/assets/sound.rfx
new file mode 100644
index 0000000..56f45d0
Binary files /dev/null and b/cart/c/sound/assets/sound.rfx differ
diff --git a/cart/c/sound/main.c b/cart/c/sound/main.c
index 0c4fd1d..aa98961 100755
--- a/cart/c/sound/main.c
+++ b/cart/c/sound/main.c
@@ -5,7 +5,38 @@ u32 sfx;
u32 apache;
SfxParams* params;
-// TODO: sfx seem broke
+u32 preloaded_sfx;
+
+// debug function to print a SfxParams
+void print_sfx(SfxParams sfx_params) {
+ trace("(SfxParams) {\n\
+ .randSeed=%lu,\n\
+ .waveType=%d,\n\
+ .attackTime=%ff,\n\
+ .sustainTime=%ff,\n\
+ .sustainPunch=%ff,\n\
+ .decayTime=%ff,\n\
+ .startFrequency=%ff,\n\
+ .minFrequency=%ff,\n\
+ .slide=%ff,\n\
+ .deltaSlide=%ff,\n\
+ .vibratoDepth=%ff,\n\
+ .vibratoSpeed=%ff,\n\
+ .changeAmount=%ff,\n\
+ .changeSpeed=%ff,\n\
+ .squareDuty=%ff,\n\
+ .dutySweep=%ff,\n\
+ .repeatSpeed=%ff,\n\
+ .phaserOffset=%ff,\n\
+ .phaserSweep=%ff,\n\
+ .lpfCutoff=%ff,\n\
+ .lpfCutoffSweep=%ff,\n\
+ .lpfResonance=%ff,\n\
+ .hpfCutoff=%ff,\n\
+ .hpfCutoffSweep=%ff \n\
+}",
+ (unsigned long)sfx_params.randSeed, sfx_params.waveType, sfx_params.attackTime, sfx_params.sustainTime, sfx_params.sustainPunch, sfx_params.decayTime, sfx_params.startFrequency, sfx_params.minFrequency, sfx_params.slide, sfx_params.deltaSlide, sfx_params.vibratoDepth, sfx_params.vibratoSpeed, sfx_params.changeAmount, sfx_params.changeSpeed, sfx_params.squareDuty, sfx_params.dutySweep, sfx_params.repeatSpeed, sfx_params.phaserOffset, sfx_params.phaserSweep, sfx_params.lpfCutoff, sfx_params.lpfCutoffSweep, sfx_params.lpfResonance, sfx_params.hpfCutoff, sfx_params.hpfCutoffSweep);
+}
int main() {
trace("Hello from sound.");
@@ -19,6 +50,35 @@ int main() {
sfx = new_sfx(params);
preset_sfx(params, SFX_POWERUP);
+ // example of a preloaded sound
+ SfxParams preloaded = (SfxParams) {
+ .randSeed=0,
+ .waveType=1,
+ .attackTime=0.000000f,
+ .sustainTime=0.357139f,
+ .sustainPunch=0.000000f,
+ .decayTime=0.425881f,
+ .startFrequency=0.331024f,
+ .minFrequency=0.000000f,
+ .slide=0.159528f,
+ .deltaSlide=0.000000f,
+ .vibratoDepth=0.000000f,
+ .vibratoSpeed=0.000000f,
+ .changeAmount=0.000000f,
+ .changeSpeed=0.000000f,
+ .squareDuty=1.000000f,
+ .dutySweep=0.000000f,
+ .repeatSpeed=0.000000f,
+ .phaserOffset=0.000000f,
+ .phaserSweep=0.000000f,
+ .lpfCutoff=1.000000f,
+ .lpfCutoffSweep=0.000000f,
+ .lpfResonance=0.000000f,
+ .hpfCutoff=0.000000f,
+ .hpfCutoffSweep=0.000000f
+ };
+ preloaded_sfx = new_sfx(&preloaded);
+
return 0;
}
@@ -29,6 +89,7 @@ void update() {
draw_text(0, "Press B for powerup sound.", 60, HEIGHT / 2 - 20, RAYWHITE);
draw_text(0, "Press X for coin sound.", 65, HEIGHT / 2, RAYWHITE);
draw_text(0, "Press Y for hurt sound.", 65, HEIGHT / 2 + 20, RAYWHITE);
+ draw_text(0, "Press START for hardcoded sfx struct", 18, HEIGHT / 2 + 40, RAYWHITE);
}
NULL0_EXPORT("buttonDown")
@@ -37,24 +98,29 @@ void buttonDown(GamepadButton button) {
play_sound(audioLogo, false);
}
- // disabling unload until this lands: https://github.com/RobLoach/pntr_app/pull/106
-
if (button == GAMEPAD_BUTTON_B) {
- // unload_sound(sfx);
+ unload_sound(sfx);
preset_sfx(params, SFX_POWERUP);
sfx = new_sfx(params);
play_sound(sfx, false);
+ print_sfx(*params);
}
if (button == GAMEPAD_BUTTON_X) {
- // unload_sound(sfx);
+ unload_sound(sfx);
preset_sfx(params, SFX_COIN);
sfx = new_sfx(params);
play_sound(sfx, false);
+ print_sfx(*params);
}
if (button == GAMEPAD_BUTTON_Y) {
- // unload_sound(sfx);
+ unload_sound(sfx);
preset_sfx(params, SFX_HURT);
sfx = new_sfx(params);
play_sound(sfx, false);
+ print_sfx(*params);
+ }
+
+ if (button == GAMEPAD_BUTTON_START) {
+ play_sound(preloaded_sfx, false);
}
}
\ No newline at end of file
diff --git a/docs/cart/colorbars.null0 b/docs/cart/colorbars.null0
index 7f327e2..d0f26aa 100644
Binary files a/docs/cart/colorbars.null0 and b/docs/cart/colorbars.null0 differ
diff --git a/docs/cart/draw.null0 b/docs/cart/draw.null0
index c4921a6..262c14d 100644
Binary files a/docs/cart/draw.null0 and b/docs/cart/draw.null0 differ
diff --git a/docs/cart/filesystem.null0 b/docs/cart/filesystem.null0
index b778dd3..b115f2b 100644
Binary files a/docs/cart/filesystem.null0 and b/docs/cart/filesystem.null0 differ
diff --git a/docs/cart/flappybird.null0 b/docs/cart/flappybird.null0
index a2a8513..22a0bad 100644
Binary files a/docs/cart/flappybird.null0 and b/docs/cart/flappybird.null0 differ
diff --git a/docs/cart/hello.null0 b/docs/cart/hello.null0
index ef3fa83..dfc2c14 100644
Binary files a/docs/cart/hello.null0 and b/docs/cart/hello.null0 differ
diff --git a/docs/cart/input.null0 b/docs/cart/input.null0
index 2a74aa1..1f05e85 100644
Binary files a/docs/cart/input.null0 and b/docs/cart/input.null0 differ
diff --git a/docs/cart/justlog.null0 b/docs/cart/justlog.null0
index 37bda6e..3503442 100644
Binary files a/docs/cart/justlog.null0 and b/docs/cart/justlog.null0 differ
diff --git a/docs/cart/sound.null0 b/docs/cart/sound.null0
index 6d39f1a..4dd4965 100644
Binary files a/docs/cart/sound.null0 and b/docs/cart/sound.null0 differ
diff --git a/docs/cart/tracker.null0 b/docs/cart/tracker.null0
index e6ad21e..6000096 100644
Binary files a/docs/cart/tracker.null0 and b/docs/cart/tracker.null0 differ
diff --git a/docs/cart/typesizes.null0 b/docs/cart/typesizes.null0
index 0728de5..8a99fe2 100644
Binary files a/docs/cart/typesizes.null0 and b/docs/cart/typesizes.null0 differ
diff --git a/docs/index.html b/docs/index.html
index 40d136e..3e6ee37 100755
--- a/docs/index.html
+++ b/docs/index.html
@@ -35,8 +35,7 @@
-
-
-
+
+