diff options
| author | Ray <[email protected]> | 2020-01-09 12:58:24 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-01-09 12:58:24 +0100 |
| commit | 8f053222639e7b877e4800eecc080468de1229bb (patch) | |
| tree | a9c207fb96f739d589b6b31b068c6a4cd0ce9885 /examples/audio | |
| parent | 358ca7595dabf2e29733ffd8b7931319ca44d20e (diff) | |
| download | raylib-8f053222639e7b877e4800eecc080468de1229bb.tar.gz raylib-8f053222639e7b877e4800eecc080468de1229bb.zip | |
Review example and screenshots
Diffstat (limited to 'examples/audio')
| -rw-r--r-- | examples/audio/audio_multichannel_sound.c | 39 | ||||
| -rw-r--r-- | examples/audio/audio_multichannel_sound.png | bin | 0 -> 16088 bytes |
2 files changed, 6 insertions, 33 deletions
diff --git a/examples/audio/audio_multichannel_sound.c b/examples/audio/audio_multichannel_sound.c index f3db341e..d5002664 100644 --- a/examples/audio/audio_multichannel_sound.c +++ b/examples/audio/audio_multichannel_sound.c @@ -27,16 +27,7 @@ int main(void) Sound fxWav = LoadSound("resources/sound.wav"); // Load WAV audio file Sound fxOgg = LoadSound("resources/tanatana.ogg"); // Load OGG audio file - int frame = 0; - SetSoundVolume(fxWav, 0.2); - PlaySound(fxOgg); - - bool inhibitWav = false; - bool inhibitOgg = false; - int maxFrame = 60; - - int soundsCounter = 0; SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -46,26 +37,8 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - frame++; - - if (IsKeyDown(KEY_ENTER)) inhibitWav = !inhibitWav; - if (IsKeyDown(KEY_SPACE)) inhibitOgg = !inhibitOgg; - - // Deliberatly hammer the play pool to see what dropping old pool entries sounds like.... - if ((frame%5) == 0) - { - if (!inhibitWav) PlaySoundMulti(fxWav); - } - - if (frame == maxFrame) - { - if (!inhibitOgg) PlaySoundMulti(fxOgg); - - frame = 0; - maxFrame = GetRandomValue(6,12); - } - - soundsCounter = GetSoundsPlaying(); + if (IsKeyPressed(KEY_ENTER)) PlaySoundMulti(fxWav); // Play a new wav sound instance + if (IsKeyPressed(KEY_SPACE)) PlaySoundMulti(fxOgg); // Play a new ogg sound instance //---------------------------------------------------------------------------------- // Draw @@ -74,11 +47,11 @@ int main(void) ClearBackground(RAYWHITE); - DrawText("Multichannel sound abuse!", 200, 180, 20, LIGHTGRAY); - DrawText("Space to inhibit new ogg triggering", 200, 200, 20, LIGHTGRAY); - DrawText("Enter to inhibit new wav triggering", 200, 220, 20, LIGHTGRAY); + DrawText("MULTICHANNEL SOUND PLAYING", 20, 20, 20, GRAY); + DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY); + DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY); - DrawText(FormatText("Number of concurrentsounds: %i", soundsCounter), 200, 280, 20, LIGHTGRAY); + DrawText(FormatText("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/audio/audio_multichannel_sound.png b/examples/audio/audio_multichannel_sound.png Binary files differnew file mode 100644 index 00000000..4b98b26e --- /dev/null +++ b/examples/audio/audio_multichannel_sound.png |
