Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Basic parameters; check that these match your project / environment
cmake_minimum_required(VERSION 3.8)

# has to be before project
if(PICO_SDK_PATH)
include(${32BLIT_DIR}/32blit-pico/pico_sdk_import.cmake)
include(${32BLIT_DIR}/32blit-pico/pico_extras_import.cmake)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a wrapper now for this: include(${32BLIT_DIR}/32blit-pico/sdk_import.cmake). Also handles all the other methods of importing the SDK (environment, clone from git... (if that wasn't broken in -extras))



project(Super-Square-Bros)
set(PROJECT_SOURCE SuperSquareBros.cpp Audio.cpp)
set(PROJECT_SOURCE SuperSquareBros.cpp)
set(PROJECT_DISTRIBS LICENSE README.md)

# Build configuration; approach this with caution!
Expand All @@ -13,9 +20,16 @@ else()
endif()
find_package (32BLIT CONFIG REQUIRED PATHS ../32blit-sdk)

if(PICO_SDK_PATH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... which makes this not a great way to check for a pico build. The blit SDK uses 32BLIT_PICO for this.

set(PROJECT_SOURCE ${PROJECT_SOURCE} PicoAudio.cpp)
else()
set(PROJECT_SOURCE ${PROJECT_SOURCE} Audio.cpp)
endif()

blit_executable (${PROJECT_NAME} ${PROJECT_SOURCE})
blit_assets_yaml (${PROJECT_NAME} assets.yml)
blit_metadata (${PROJECT_NAME} metadata.yml)
target_compile_definitions(${PROJECT_NAME} PRIVATE ALLOW_HIRES=0)
add_custom_target (flash DEPENDS ${PROJECT_NAME}.flash)

# setup release packages
Expand Down
40 changes: 40 additions & 0 deletions PicoAudio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "PicoAudio.hpp"

// Todo: rework to pick a free channel rather than always using same one.

namespace AudioHandler {
AudioHandler::AudioHandler() { }

void AudioHandler::set_volume(uint32_t volume) {
(void)volume;
}

void AudioHandler::set_volume(uint8_t channel, uint32_t volume) {
(void)channel;
(void)volume;
}

void AudioHandler::load(uint8_t channel, const uint8_t mp3_data[], const uint32_t mp3_size) {
(void)channel;
(void *)mp3_data;
(void)mp3_size;
}

void AudioHandler::load(uint8_t target_channel, uint8_t source_channel) {
(void)target_channel;
(void)source_channel;
}

void AudioHandler::play(uint8_t channel, uint8_t flags) {
(void)channel;
(void)flags;
}

bool AudioHandler::is_playing(uint8_t channel) {
(void)channel;
return true; // Make splash wait for button press
}

void AudioHandler::update() {
}
}
19 changes: 19 additions & 0 deletions PicoAudio.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <cstdint>

namespace AudioHandler {
class AudioHandler {
public:
AudioHandler();

void set_volume(uint32_t = 0xffff);
void set_volume(uint8_t, uint32_t);

void load(uint8_t, const uint8_t[], const uint32_t);
void load(uint8_t, uint8_t);
void play(uint8_t, uint8_t = 0);
bool is_playing(uint8_t);
void update();
};
}
Loading