Skip to content

Commit

Permalink
Some cmake config changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuscu committed Sep 1, 2024
1 parent fffb862 commit a84f531
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ else()
meta
memory
hid
audio
nodegraph

concurrency
filesystem
network
storage
tools
audio

physics
ecs
Expand Down
11 changes: 11 additions & 0 deletions packages/audio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
project (audio)

set(deps
various

logging
testing
memory
)

bs_generate_package(audio "tier1" "${deps}" "")
9 changes: 9 additions & 0 deletions packages/audio/include/audio/Audio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

namespace l::audio {

float GetFrequencyFromNote(float note);



}
16 changes: 16 additions & 0 deletions packages/audio/source/common/Audio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "audio/Audio.h"

#define MA_NO_DECODING
#define MA_NO_ENCODING
#define MINIAUDIO_IMPLEMENTATION

#include "various/miniaudio.h"


namespace l::audio {
float GetFrequencyFromNote(float note) {
return 440.0f * powf(2.0f, (note - 49.0f) / 12.0f);
}


}
7 changes: 7 additions & 0 deletions packages/audio/tests/common/AudioTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "testing/Test.h"

int main(int, char* argw[]) {
TEST_RUN(argw[0]);

return 0;
}
9 changes: 9 additions & 0 deletions packages/audio/tests/common/MiniAudioTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "testing/Test.h"

#include "audio/Audio.h"

TEST(MiniAudio, Setup) {


return 0;
}
5 changes: 5 additions & 0 deletions packages/nodegraph/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
project (nodegraph)

set(deps
various

logging

testing
memory
hid
audio
)

bs_generate_package(nodegraph "tier1" "${deps}" "")
6 changes: 0 additions & 6 deletions packages/nodegraph/include/nodegraph/NodeGraphOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ namespace l::nodegraph {
float mPrevTime = 0.0f;
};

namespace {
float GetFrequencyFromNote(float note) {
return 440.0f * powf(2.0f, (note - 49.0f) / 12.0f);
}
}

class GraphSourceKeyboard : public NodeGraphOp, public l::hid::INoteProcessor {
public:
GraphSourceKeyboard(NodeGraphBase* node, int32_t polyphony, l::hid::KeyState* keyState) :
Expand Down
3 changes: 2 additions & 1 deletion packages/nodegraph/source/common/NodeGraphOperations.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "nodegraph/NodeGraphOperations.h"

#include "logging/Log.h"
#include "audio/Audio.h"

#include <math.h>

Expand Down Expand Up @@ -129,7 +130,7 @@ namespace l::nodegraph {
}

void GraphSourceKeyboard::NoteOn(int32_t note) {
float frequency = GetFrequencyFromNote(static_cast<float>(note));
float frequency = l::audio::GetFrequencyFromNote(static_cast<float>(note));
int8_t channel = GetNextNoteChannel(note);
mNode->SetInput(static_cast<int8_t>(channel), frequency);
mNode->ProcessSubGraph();
Expand Down

0 comments on commit a84f531

Please sign in to comment.