Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aure committed Jan 18, 2022
2 parents 6393a91 + c332d7a commit 0e171a6
Show file tree
Hide file tree
Showing 16 changed files with 256 additions and 41 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# AudioKit Code Owners File
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

# Primary Owners
* @aure @wtholliday @eljeff
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [aure, eljeff, megastep]
open_collective: audiokit
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
If your issue is implementing AudioKit in your own code, post your problem to [StackOverflow](https://stackoverflow.com/search?q=AudioKit) with the #AudioKit hashtag.

If you can make the issue happen on [AudioKit 5's Cookbook app](https://github.com/AudioKit/Cookbook/) then you can create an issue directly on that repository as well.

GitHub Issues should only be used for confirmed problems with AudioKit and
well-defined feature requests.

Sponsors will get more attention: https://github.com/sponsors/aure

42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Confirm you should be adding the bug here**
If your issue is implementing AudioKit in your own code, post your problem to [StackOverflow](https://stackoverflow.com/search?q=AudioKit) with the #AudioKit hashtag.

If you can make the issue happen on [AudioKit 5's Cookbook app](https://github.com/AudioKit/Cookbook/) then you can create an issue directly on that repository as well.

GitHub Issues should only be used for confirmed problems with AudioKit and
well-defined feature requests.

Sponsors will get more attention: https://github.com/sponsors/aure


**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. See / hear error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Details (please complete the following information):**
- Type: [e.g. iPhone6, iPad, Mac]
- OS: [e.g. iOS13.1]
- AudioKit Version [e.g. 5.0]

**Additional context**
Add any other context about the problem here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Assign yourself to this task**
AudioKit maintainers are not here to do your work for you, so if you can assign yourself to the feature request, that would be ideal.

**Additional context**
Add any other context or screenshots about the feature request here.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*REPLACE ALL OF THIS TEXT WITH A DESCRIPTION OF YOUR CODE CHANGES*

Try to make sure your changes conform to the [Swift API Design Guidelines](https://swift.org/documentation/api-design-guidelines/). If you have 40 minutes you'd like to have well-spent, watch [Modern Swift API Design](https://developer.apple.com/videos/play/wwdc2019/415/) from WWDC 2019.

Ready to send us a pull request? Please make sure your request is based on the a `develop` branch of the repository since `main` should only hold stable releases.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# GitHub Actions for AudioKitEX: includes builds, tests and releases
name: CI

on: [push, pull_request]
env:
XCODE_VER: 13.1

jobs:
test:
strategy:
matrix:
xcode_version: ['13.1']
runs-on: macos-11
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
steps:
- name: Check out AudioKitEX
uses: actions/checkout@v2
- name: Build AudioKitEX
run: |
set -euo pipefail
swift package clean
swift build --sanitize="address"
- name: Run Tests (ASAN)
run: |
set -euo pipefail
xcodebuild -destination 'platform=OS X,arch=x86_64' -scheme AudioKitEX -enableAddressSanitizer YES test
# Generate Wiki docs on release
docs:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Check out AudioKitEX
uses: actions/checkout@v2
- name: Generate Documentation
uses: SwiftDocOrg/swift-doc@master
with:
inputs: "Sources"
module-name: AudioKitEX
output: "Documentation"
- name: Upload Documentation to Wiki
uses: SwiftDocOrg/github-wiki-publish-action@v1
with:
path: "Documentation"
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

2 changes: 1 addition & 1 deletion Sources/AudioKitEX/Sequencing/Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public struct NoteEventSequence: Equatable {
allEvents.append(contentsOf: events)
/// Get all SequenceEvents from Notes
var noteEvents: [SequenceEvent] = []
notes.forEach { note in
for note in notes {
noteEvents.append(note.noteOn)
noteEvents.append(note.noteOff)
}
Expand Down
12 changes: 6 additions & 6 deletions Sources/AudioKitEX/Sequencing/Sequencer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ open class Sequencer {
length = tracks.max(by: { $0.length > $1.length })?.length ?? 0
}

/// Add a MIDI note to the track
/// Add a MIDI noteOn and noteOff to the track
/// - Parameters:
/// - noteNumber: MIDI Note number to add
/// - velocity: Velocity of the note
/// - channel: Channel to place the note on
/// - position: Location in beats of the new note
/// - duration: Duration in beats of the new note
/// - trackIndex: Which track to add the note to
@available(*, deprecated, message: "Access track directly for editing - sequencer.tracks[i].add(...)")
public func add(noteNumber: MIDINoteNumber,
velocity: MIDIVelocity = 127,
channel: MIDIChannel = 0,
Expand All @@ -147,6 +148,7 @@ open class Sequencer {
/// - event: Event to add
/// - position: Location in time in beats to add the event at
/// - trackIndex: Which track to add the event
@available(*, deprecated, message: "Access track directly for editing - sequencer.tracks[i].add(...)")
public func add(event: MIDIEvent, position: Double, trackIndex: Int = 0) {
guard tracks.count > trackIndex, trackIndex >= 0 else {
Log("Track index \(trackIndex) out of range (sequencer has \(tracks.count) tracks)")
Expand All @@ -157,15 +159,13 @@ open class Sequencer {

/// Remove all notes
public func clear() {
for track in tracks {
track.clear()
}
for track in tracks { track.clear() }
}

/// Move to a new time in the playback
/// - Parameter position: Time to jump to, in beats
public func seek(to position: Double) {
tracks.forEach { $0.seek(to: position) }
for track in tracks { track.seek(to: position) }
}

/// Equivalent to stop
Expand All @@ -183,7 +183,7 @@ open class Sequencer {
/// Add track associated with a node
/// - Parameter node: Node to create the track for
/// - Returns: Track associated with the given node
public func addTrack(for node: Node) -> SequencerTrack {
@discardableResult public func addTrack(for node: Node) -> SequencerTrack {
let track = SequencerTrack(targetNode: node)
tracks.append(track)
return track
Expand Down
27 changes: 27 additions & 0 deletions Sources/AudioKitEX/Sequencing/SequencerTrack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,33 @@ open class SequencerTrack {
/// Sequence on this track
public var sequence = NoteEventSequence() { didSet { updateSequence() } }

/// Add a MIDI noteOn and noteOff to the track
/// - Parameters:
/// - noteNumber: MIDI Note number to add
/// - velocity: Velocity of the note
/// - channel: Channel to place the note on
/// - position: Location in beats of the new note
/// - duration: Duration in beats of the new note
public func add(noteNumber: MIDINoteNumber,
velocity: MIDIVelocity = 127,
channel: MIDIChannel = 0,
position: Double,
duration: Double) {
sequence.add(noteNumber: noteNumber,
velocity: velocity,
channel: channel,
position: position,
duration: duration)
}

/// Add a MIDI event to the track
/// - Parameters:
/// - event: Event to add
/// - position: Location in time in beats to add the event at
public func add(event: MIDIEvent, position: Double) {
sequence.add(event: event, position: position)
}

/// Remove the notes in the track
public func clear() {
sequence = NoteEventSequence()
Expand Down
3 changes: 2 additions & 1 deletion Sources/CAudioKitEX/Nodes/CallbackInstrumentDSP.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "DSPBase.h"
#import "Internals/RingBuffer.h"
#import "CAudioKit.h"

using AudioKit::RingBuffer;

Expand Down Expand Up @@ -70,7 +71,7 @@ void setCallback(CMIDICallback func) {
CMIDICallback callback = nullptr;
};

AK_API void akCallbackInstrumentSetCallback(DSPRef dsp, CMIDICallback callback) {
void akCallbackInstrumentSetCallback(DSPRef dsp, CMIDICallback callback) {
static_cast<CallbackInstrumentDSP*>(dsp)->setCallback(callback);
}

Expand Down
4 changes: 3 additions & 1 deletion Sources/CAudioKitEX/include/CAudioKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ FOUNDATION_EXPORT const unsigned char AudioKitVersionString[];
// Swift/ObjC/C/C++ Inter-operability
#import "Interop.h"

CF_EXTERN_C_BEGIN
typedef void (^CMIDICallback)(uint8_t, uint8_t, uint8_t);
AK_API void akCallbackInstrumentSetCallback(DSPRef dsp, CMIDICallback callback);
void akCallbackInstrumentSetCallback(DSPRef dsp, CMIDICallback callback);
CF_EXTERN_C_END

// Misc
#import "BufferedAudioBus.h"
38 changes: 21 additions & 17 deletions Sources/CAudioKitEX/include/DSPBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,37 @@

#include <stdarg.h>

AK_API DSPRef akCreateDSP(OSType code);
AK_API AUParameterAddress akGetParameterAddress(const char* name);
CF_EXTERN_C_BEGIN

AK_API AUInternalRenderBlock internalRenderBlockDSP(DSPRef pDSP);
DSPRef akCreateDSP(OSType code);
AUParameterAddress akGetParameterAddress(const char* name);

AK_API size_t inputBusCountDSP(DSPRef pDSP);
AK_API bool canProcessInPlaceDSP(DSPRef pDSP);
AUInternalRenderBlock internalRenderBlockDSP(DSPRef pDSP);

AK_API void setBufferDSP(DSPRef pDSP, AudioBufferList* buffer, size_t busIndex);
AK_API void allocateRenderResourcesDSP(DSPRef pDSP, uint32_t channelCount, double sampleRate);
AK_API void deallocateRenderResourcesDSP(DSPRef pDSP);
AK_API void resetDSP(DSPRef pDSP);
size_t inputBusCountDSP(DSPRef pDSP);
bool canProcessInPlaceDSP(DSPRef pDSP);

AK_API void setParameterValueDSP(DSPRef pDSP, AUParameterAddress address, AUValue value);
AK_API AUValue getParameterValueDSP(DSPRef pDSP, AUParameterAddress address);
void setBufferDSP(DSPRef pDSP, AudioBufferList* buffer, size_t busIndex);
void allocateRenderResourcesDSP(DSPRef pDSP, uint32_t channelCount, double sampleRate);
void deallocateRenderResourcesDSP(DSPRef pDSP);
void resetDSP(DSPRef pDSP);

AK_API void setBypassDSP(DSPRef pDSP, bool bypassed);
AK_API bool getBypassDSP(DSPRef pDSP);
void setParameterValueDSP(DSPRef pDSP, AUParameterAddress address, AUValue value);
AUValue getParameterValueDSP(DSPRef pDSP, AUParameterAddress address);

AK_API void initializeConstantDSP(DSPRef pDSP, AUValue value);
void setBypassDSP(DSPRef pDSP, bool bypassed);
bool getBypassDSP(DSPRef pDSP);

AK_API void setWavetableDSP(DSPRef pDSP, const float* table, size_t length, int index);
void initializeConstantDSP(DSPRef pDSP, AUValue value);

AK_API void deleteDSP(DSPRef pDSP);
void setWavetableDSP(DSPRef pDSP, const float* table, size_t length, int index);

void deleteDSP(DSPRef pDSP);

/// Reset random seed to ensure deterministic results in tests.
AK_API void akSetSeed(unsigned int);
void akSetSeed(unsigned int);

CF_EXTERN_C_END

#ifdef __cplusplus

Expand Down
6 changes: 0 additions & 6 deletions Sources/CAudioKitEX/include/Interop.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
/// Pointer to an instance of an DSPBase subclass
typedef struct DSPBase* DSPRef;

#ifdef __cplusplus
#define AK_API extern "C"
#else
#define AK_API
#endif

/// MIDI Constants
#define MIDI_NOTE_ON 0x90
#define MIDI_NOTE_OFF 0x80
Expand Down
Loading

0 comments on commit 0e171a6

Please sign in to comment.