mirror of
https://github.com/thestk/stk
synced 2026-01-12 04:21:52 +00:00
Compare commits
30 Commits
4.6.1
...
revert-110
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7840967816 | ||
|
|
8132c90515 | ||
|
|
73004ac9c4 | ||
|
|
a49f6e71e7 | ||
|
|
926a9faca7 | ||
|
|
34192d9a63 | ||
|
|
fb2b0aa305 | ||
|
|
ba967ff851 | ||
|
|
109f0bd9a8 | ||
|
|
7b94384705 | ||
|
|
b379160f2b | ||
|
|
4b5b142531 | ||
|
|
f1a75a8691 | ||
|
|
e5cab23433 | ||
|
|
5a8b2234c7 | ||
|
|
314835cc70 | ||
|
|
fb15f76d45 | ||
|
|
921493d4fe | ||
|
|
4cbdd0d3dc | ||
|
|
c97f5b4b3a | ||
|
|
809cb26e12 | ||
|
|
dbe725c40d | ||
|
|
f47fde31b0 | ||
|
|
5ec15d2043 | ||
|
|
33baf69d3e | ||
|
|
975c9a365f | ||
|
|
00ddf89798 | ||
|
|
a8b6affd8c | ||
|
|
444dab21fd | ||
|
|
7fc638ce32 |
@@ -13,7 +13,7 @@ Please read the [Legal and Ethical notes](#legal-and-ethical) near the bottom of
|
||||
|
||||
For compiling and installing STK, see the [INSTALL.md](INSTALL.md) file in this directory.
|
||||
|
||||
##Contents
|
||||
## Contents
|
||||
|
||||
* [Overview](#overview)
|
||||
* [System Requirements](#system-requirements)
|
||||
|
||||
55
STK.podspec
Normal file
55
STK.podspec
Normal file
@@ -0,0 +1,55 @@
|
||||
# To lint the spec:
|
||||
# pod spec lint --skip-import-validation --allow-warnings
|
||||
# To publish:
|
||||
# pod trunk push STK.podspec --skip-import-validation --allow-warnings
|
||||
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'STK'
|
||||
spec.version = '4.6.1'
|
||||
spec.summary = 'The Synthesis ToolKit in C++ is a set of open source audio signal processing and algorithmic synthesis classes.'
|
||||
spec.homepage = 'https://ccrma.stanford.edu/software/stk/'
|
||||
spec.source = { :git => 'https://github.com/thestk/stk.git', :tag => spec.version }
|
||||
spec.license = { :type => 'MIT' }
|
||||
spec.author = { "Ariel Elkin" => "ariel@arivibes.com" }
|
||||
spec.platform = :ios
|
||||
spec.ios.deployment_target = "10.0"
|
||||
spec.source_files = [
|
||||
"src/*.cpp",
|
||||
"include/*.h"
|
||||
]
|
||||
spec.public_header_files = [
|
||||
"include/*.h",
|
||||
"include/SKINImsg.h",
|
||||
"include/SKINItbl.h"
|
||||
]
|
||||
spec.exclude_files = [
|
||||
"include/Thread.h",
|
||||
"src/Thread.cpp",
|
||||
"include/Mutex.h",
|
||||
"src/Mutex.cpp",
|
||||
"include/UdpSocket.h",
|
||||
"src/UdpSocket.cpp",
|
||||
"include/Socket.h",
|
||||
"src/Socket.cpp",
|
||||
"include/TcpClient.h",
|
||||
"src/TcpClient.cpp",
|
||||
"include/TcpServer.h",
|
||||
"src/TcpServer.cpp",
|
||||
"include/InetWvIn.h",
|
||||
"src/InetWvIn.cpp",
|
||||
"include/InetWvOut.h",
|
||||
"src/InetWvOut.cpp",
|
||||
"include/RtAudio.h",
|
||||
"src/RtAudio.cpp",
|
||||
"include/RtMidi.h",
|
||||
"src/RtMidi.cpp",
|
||||
"include/RtWvIn.h",
|
||||
"src/RtWvIn.cpp",
|
||||
"include/RtWvOut.h",
|
||||
"src/RtWvOut.cpp",
|
||||
"include/RtError.h"
|
||||
]
|
||||
spec.preserve_paths = "README.MD"
|
||||
spec.resource_bundles = { "rawwaves": "rawwaves/*.raw" }
|
||||
spec.libraries = 'c++'
|
||||
end
|
||||
16
configure.ac
16
configure.ac
@@ -134,6 +134,22 @@ api="$api -D__UNIX_JACK__"
|
||||
AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))])
|
||||
|
||||
case $host in
|
||||
*-*-netbsd*)
|
||||
AS_IF([test "$api" == ""], [
|
||||
AC_MSG_RESULT(using OSS)
|
||||
api="$api -D__LINUX_OSS__"
|
||||
LIBS="$LIBS -lossaudio"
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))])
|
||||
;;
|
||||
|
||||
*-*-freebsd*)
|
||||
AS_IF([test "$api" == ""], [
|
||||
AC_MSG_RESULT(using OSS)
|
||||
api="$api -D__LINUX_OSS__"
|
||||
LIBS="$LIBS -lossaudio"
|
||||
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))])
|
||||
;;
|
||||
|
||||
*-*-linux*)
|
||||
# Look for ALSA flag
|
||||
AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)])
|
||||
|
||||
@@ -38,19 +38,19 @@ STK compiles with realtime support on the following flavors of the Unix operatin
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>ALSA</TD>
|
||||
<TD>__LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
|
||||
<TD>__LINUX_ALSA__, \__LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux</TD>
|
||||
<TD>OSS (version 4.0 only, use ALSA for MIDI support)</TD>
|
||||
<TD>__LINUX_OSS__, __LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
|
||||
<TD>__LINUX_OSS__, \__LINUX_ALSA__, \__LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Linux and Macintosh OS-X</TD>
|
||||
<TD>Jack</TD>
|
||||
<TD>__UNIX_JACK__, __LITTLE_ENDIAN__</TD>
|
||||
<TD>__UNIX_JACK__, \__LITTLE_ENDIAN__</TD>
|
||||
<TD><TT>asound, pthread, jack</TT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
|
||||
@@ -1,35 +1,43 @@
|
||||
This file contains instructions for integrating the STK in Xcode projects and solutions to common integration issues.
|
||||
# Readme
|
||||
|
||||
* [Setup](#setup)
|
||||
* [Usage](#usage)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
|
||||
## Setup
|
||||
|
||||
### If you have [CocoaPods](https://cocoapods.org)
|
||||
### [CocoaPods](https://cocoapods.org) (Recommended)
|
||||
|
||||
1. Add `pod 'STK', '~> 4.5'` to your Podfile.
|
||||
1. Add `pod 'STK', '~> 4.6'` to your Podfile.
|
||||
|
||||
1. Run `pod install`
|
||||
|
||||
### If you don't have CocoaPods
|
||||
### Manual
|
||||
|
||||
1. Clone or [download][download_link] the STK into your project's directory.
|
||||
|
||||
1. Open the **STK for iOS** folder, and drag and drop **STK.xcodeproj** into your Xcode project.
|
||||
|
||||
1. Open your project's settings, open the *Build Phases* tab. In the *Link Binary with Libraries* section, add **libSTK.a**.
|
||||
1. Open your project's settings, open the *Build Phases* tab. In the *Link Binary with Libraries* section, add **libSTK.a**.
|
||||
![][linking_libSTK_screenshot]
|
||||
|
||||
1. In the *Dependencies* section, add "rawwaves"
|
||||
|
||||
1. In your project's settings, open the *Build Settings* tab. In the *Search Paths* section, double click on the field to the right of *Header Search Paths*, and add the path to the STK's **include** directory relative to your Xcode project's directory.
|
||||
![][header_search_paths_screenshot]
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
1. Import the STK classes in the source files you require.
|
||||
1. Import the STK classes you require in your Objective-C source files (Swift does not yet support importing C++ code)
|
||||
* E.g. `#import "SineWave.h"`
|
||||
|
||||
1. Change the extension of Objective-C files that import STK files to **.mm**.
|
||||
1. Change the extension of any Objective-C files that import STK files to **.mm**.
|
||||
* E.g. **ViewController.m** —> **ViewController.mm**
|
||||
|
||||
You can also look at the [iOS Demo project](..projects/demo/iOS%20Demo) for a sample usage.
|
||||
1. If you use a class that makes use of raw wave files (such as `Mandolin`), make sure you call `Stk::setRawwavePath` beforehand in your code.
|
||||
|
||||
See the [iOS Demo project](..projects/demo/iOS%20Demo) for a sample usage.
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
@@ -38,16 +46,16 @@ You can also look at the [iOS Demo project](..projects/demo/iOS%20Demo) for a sa
|
||||
|
||||
If you get this error when `#import`ing an STK header, you have added the wrong header search path for the STK in your project's settings (see Step 4 in Setup)
|
||||
|
||||
The STK's header search path you need to add is the path to the STK's **include** directory relative to your project's directory (as if you were `cd`ing into it). For example, it is `stk/include/` if the stk directory is inside your project's directory, but it is `../stk/include/` if both share the same directory.
|
||||
The STK's header search path you need to add is the path to the STK's **include** directory relative to your project's directory (as if you were `cd`ing into it). For example, it is `stk/include/` if the stk directory is inside your project's directory, but it is `../stk/include/` if both share the same directory.
|
||||
|
||||
If this problem doesn't go away:
|
||||
|
||||
1. Delete **STK.xcodeproj** from your Xcode project
|
||||
1. Move the STK directory within your project's directory.
|
||||
1. Move the STK directory within your project's directory.
|
||||
1. Follow step 1 from **Setup**, add `stk/include` to the *Header Search Paths*.
|
||||
|
||||
If that doesn't solve it:
|
||||
Install CocoaPods and use it to install the STK. It takes one minute and will make your life easier. Visit the [CocoaPods website](https://cocoapods.org) for installation instructions.
|
||||
Install CocoaPods and use it to install the STK. It takes one minute and will make your life easier. Visit the [CocoaPods website](https://cocoapods.org) for installation instructions.
|
||||
|
||||
### FileRead::open: could not open or find file (../../rawwaves/filename.raw)!
|
||||
|
||||
@@ -56,36 +64,25 @@ If you use a class that makes use of raw waves (such as `Mandolin`, `Wurley`, or
|
||||
|
||||
#### If you're using CocoaPods
|
||||
|
||||
Add this code before using a class that needs the raw waves:
|
||||
Add this code before using a class that needs the raw waves:
|
||||
```objective-c
|
||||
stk::Stk::setRawwavePath([[[NSBundle mainBundle] pathForResource:@"rawwaves" ofType:@"bundle"] UTF8String]);
|
||||
```
|
||||
|
||||
#### If you're not using CocoaPods
|
||||
|
||||
1. Open your project's settings, open the *Build Phases* tab.
|
||||
1. In the *Copy Bundle Resources*, drag and drop **rawwaves.bundle** (it's located in **STK.xcodeproj**'s **Helpers** folder).
|
||||
1. Then add this code before using a class that needs the raw waves:
|
||||
1. Open your project's settings, open the *Build Phases* tab.
|
||||
1. In the *Copy Bundle Resources*, drag and drop **rawwaves.bundle** (it's located in **STK.xcodeproj**'s **Helpers** folder).
|
||||
1. Then add this code before using a class that needs the raw waves:
|
||||
|
||||
```objective-c
|
||||
NSBundle *rawwaveBundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"rawwaves" withExtension:@"bundle"]];
|
||||
stk::Stk::setRawwavePath([[rawwaveBundle resourcePath] UTF8String]);
|
||||
```
|
||||
|
||||
|
||||
### rawwaves.bundle: No such file or directory
|
||||
|
||||
This means that **rawwaves.bundle** hasn't been copied to the build folder, so you'll need to do it manually:
|
||||
|
||||
Select the rawwaves scheme:
|
||||
|
||||
![][rawwaves_scheme_screenshot]
|
||||
|
||||
Build it (⌘+B) then build your project's main scheme.
|
||||
|
||||
### Apple Mach-O Linker Error
|
||||
|
||||
This means that **STKLib.a** isn't being linked to your binary. Follow step 2 above in [Setup](#setup).
|
||||
This means that **STKLib.a** isn't being linked to your binary. Follow step 2 above in [Setup](#setup).
|
||||
|
||||
|
||||
[download_link]: https://github.com/thestk/stk/archive/master.zip
|
||||
|
||||
@@ -726,14 +726,15 @@
|
||||
B08F608818BA9B0600C14A90 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0720;
|
||||
LastUpgradeCheck = 1140;
|
||||
};
|
||||
buildConfigurationList = B08F608B18BA9B0600C14A90 /* Build configuration list for PBXProject "STK" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = B08F608718BA9B0600C14A90;
|
||||
productRefGroup = B05F5A5A18BC1018008EE790 /* Helpers */;
|
||||
@@ -895,7 +896,33 @@
|
||||
B08F608C18BA9B0600C14A90 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -903,6 +930,32 @@
|
||||
B08F608D18BA9B0600C14A90 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -945,7 +998,7 @@
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = "";
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -988,7 +1041,7 @@
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
This project briefly shows how to manually integrate the STK static library into an Xcode project. See the **README** file in the STK's `iOS` directory for precise instructions.
|
||||
|
||||
Currently, this project does not output sound, it only shows how to generate audio samples from the STK classes within an iOS project, and how to control STK objects via UI controls.
|
||||
Currently, this project does not output sound, it only shows how to generate audio samples from the STK classes within an iOS project, and how to control STK objects via UI controls. These samples need to be fed into an audio engine for them to be heard.
|
||||
|
||||
Note the following:
|
||||
|
||||
* ViewController needs to be renamed with the **.mm** extension as it's importing STK files, which are C++.
|
||||
* The header search paths in the *Build Settings* of **iOS Demo.xcodeproj** point to `../../include/` because the STK's `include` directory is two directories up relative to it.
|
||||
* The header search paths in the *Build Settings* of **iOS Demo.xcodeproj** point to `../../include/` because the STK's `include` directory is two directories up relative to it.
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
834A47CB24435D350028575A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = B0779A7E18D376A5004DA9B7 /* STK.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = B0EC337B18CB73480005787B;
|
||||
remoteInfo = rawwaves;
|
||||
};
|
||||
B02FD55218C520D70009ECA9 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = B02FD52A18C520D60009ECA9 /* Project object */;
|
||||
@@ -193,6 +200,7 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
834A47CC24435D350028575A /* PBXTargetDependency */,
|
||||
);
|
||||
name = "iOS Demo";
|
||||
productName = "iOS Demo";
|
||||
@@ -223,7 +231,7 @@
|
||||
B02FD52A18C520D60009ECA9 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0510;
|
||||
LastUpgradeCheck = 1140;
|
||||
ORGANIZATIONNAME = "Ariel Elkin";
|
||||
TargetAttributes = {
|
||||
B02FD54C18C520D70009ECA9 = {
|
||||
@@ -233,10 +241,11 @@
|
||||
};
|
||||
buildConfigurationList = B02FD52D18C520D60009ECA9 /* Build configuration list for PBXProject "iOS Demo" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = B02FD52918C520D60009ECA9;
|
||||
productRefGroup = B02FD53318C520D60009ECA9 /* Products */;
|
||||
@@ -315,6 +324,11 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
834A47CC24435D350028575A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = rawwaves;
|
||||
targetProxy = 834A47CB24435D350028575A /* PBXContainerItemProxy */;
|
||||
};
|
||||
B02FD55318C520D70009ECA9 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = B02FD53118C520D60009ECA9 /* iOS Demo */;
|
||||
@@ -346,22 +360,37 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@@ -374,7 +403,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
@@ -384,29 +413,43 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@@ -425,6 +468,7 @@
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
INFOPLIST_FILE = "iOS Demo/iOS Demo-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "stk.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -443,6 +487,7 @@
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
);
|
||||
INFOPLIST_FILE = "iOS Demo/iOS Demo-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "stk.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@@ -464,6 +509,7 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = "iOS DemoTests/iOS DemoTests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "stk.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
@@ -482,6 +528,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "iOS Demo/iOS Demo-Prefix.pch";
|
||||
INFOPLIST_FILE = "iOS DemoTests/iOS DemoTests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "stk.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>stk.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>stk.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace stk {
|
||||
This class implements a simple linear line envelope generator
|
||||
which is capable of ramping to an arbitrary target value by a
|
||||
specified \e rate. It also responds to simple \e keyOn and \e
|
||||
keyOff messages, ramping to 1.0 on keyOn and to 0.0 on keyOff.
|
||||
keyOff messages, ramping to a specified target (default = 1.0) on
|
||||
keyOn and to a specified target (default = 0.0) on keyOff.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995--2019.
|
||||
*/
|
||||
@@ -31,11 +32,11 @@ class Envelope : public Generator
|
||||
//! Assignment operator.
|
||||
Envelope& operator= ( const Envelope& e );
|
||||
|
||||
//! Set target = 1.
|
||||
void keyOn( void ) { this->setTarget( 1.0 ); };
|
||||
//! Start ramping to specified target (default = 1).
|
||||
void keyOn( StkFloat target = 1.0 ) { this->setTarget( target ); };
|
||||
|
||||
//! Set target = 0.
|
||||
void keyOff( void ) { this->setTarget( 0.0 ); };
|
||||
//! Start ramping to specified target (default = 0).
|
||||
void keyOff( StkFloat target = 0.0 ) { this->setTarget( target ); };
|
||||
|
||||
//! Set the \e rate.
|
||||
/*!
|
||||
@@ -46,7 +47,7 @@ class Envelope : public Generator
|
||||
//! Set the \e rate based on a positive time duration (seconds).
|
||||
/*!
|
||||
The \e rate is calculated such that the envelope will ramp from
|
||||
a value of 0.0 to 1.0 in the specified time duration.
|
||||
the current value to the current target in the specified time duration.
|
||||
*/
|
||||
void setTime( StkFloat time );
|
||||
|
||||
|
||||
@@ -123,11 +123,12 @@ inline StkFloat Flute :: tick( unsigned int )
|
||||
breathPressure += breathPressure * ( noiseGain_ * noise_.tick() + vibratoGain_ * vibrato_.tick() );
|
||||
|
||||
StkFloat temp = -filter_.tick( boreDelay_.lastOut() );
|
||||
temp = dcBlock_.tick( temp ); // Block DC on reflection.
|
||||
//temp = dcBlock_.tick( temp ); // Block DC on reflection.
|
||||
|
||||
pressureDiff = breathPressure - (jetReflection_ * temp);
|
||||
pressureDiff = jetDelay_.tick( pressureDiff );
|
||||
pressureDiff = jetTable_.tick( pressureDiff ) + (endReflection_ * temp);
|
||||
//pressureDiff = jetTable_.tick( pressureDiff ) + (endReflection_ * temp);
|
||||
pressureDiff = dcBlock_.tick(jetTable_.tick( pressureDiff )) + (endReflection_ * temp); // moved the DC blocker to after the jet non-linearity (GPS, 29 Jan. 2020)
|
||||
lastFrame_[0] = (StkFloat) 0.3 * boreDelay_.tick( pressureDiff );
|
||||
|
||||
lastFrame_[0] *= outputGain_;
|
||||
|
||||
@@ -132,17 +132,20 @@ class Guitar : public Stk
|
||||
StkFrames lastFrame_;
|
||||
};
|
||||
|
||||
// NOTE: It is not possible to implement the Smith coupled string model here because the Twang class does
|
||||
// not currently offer the chance to have access to a traveling-wave component. Thus, the coupling
|
||||
// implemented here is approximate.
|
||||
inline StkFloat Guitar :: tick( StkFloat input )
|
||||
{
|
||||
StkFloat temp, output = 0.0;
|
||||
lastFrame_[0] /= strings_.size(); // evenly spread coupling across strings
|
||||
lastFrame_[0] = couplingGain_ * couplingFilter_.tick( lastFrame_[0] ) / strings_.size();
|
||||
for ( unsigned int i=0; i<strings_.size(); i++ ) {
|
||||
if ( stringState_[i] ) {
|
||||
temp = input;
|
||||
// If pluckGain < 0.2, let string ring but don't pluck it.
|
||||
if ( filePointer_[i] < excitation_.frames() && pluckGains_[i] > 0.2 )
|
||||
temp += pluckGains_[i] * excitation_[filePointer_[i]++];
|
||||
temp += couplingGain_ * couplingFilter_.tick( lastFrame_[0] ); // bridge coupling
|
||||
temp += lastFrame_[0]; // bridge coupling
|
||||
output += strings_[i].tick( temp );
|
||||
// Check if string energy has decayed sufficiently to turn it off.
|
||||
if ( stringState_[i] == 1 ) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
//#include <cstdlib>
|
||||
|
||||
/*! \namespace stk
|
||||
@@ -82,7 +83,7 @@ typedef double StkFloat;
|
||||
be sub-classes to take care of more specific error conditions ... or
|
||||
not.
|
||||
*/
|
||||
class StkError
|
||||
class StkError : public std::exception
|
||||
{
|
||||
public:
|
||||
enum Type {
|
||||
@@ -110,10 +111,10 @@ protected:
|
||||
public:
|
||||
//! The constructor.
|
||||
StkError(const std::string& message, Type type = StkError::UNSPECIFIED)
|
||||
: message_(message), type_(type) {}
|
||||
: std::exception(), message_(message), type_(type) {}
|
||||
|
||||
//! The destructor.
|
||||
virtual ~StkError(void) {};
|
||||
virtual ~StkError(void) throw() {};
|
||||
|
||||
//! Prints thrown error message to stderr.
|
||||
virtual void printMessage(void) { std::cerr << '\n' << message_ << "\n\n"; }
|
||||
@@ -126,6 +127,8 @@ public:
|
||||
|
||||
//! Returns the thrown error message as a C string.
|
||||
virtual const char *getMessageCString(void) { return message_.c_str(); }
|
||||
|
||||
virtual const char *what(void) const throw() { return message_.c_str(); }
|
||||
};
|
||||
|
||||
|
||||
@@ -282,6 +285,9 @@ public:
|
||||
//! Overloaded constructor that initializes the frame data to the specified size with \c value.
|
||||
StkFrames( const StkFloat& value, unsigned int nFrames, unsigned int nChannels );
|
||||
|
||||
//! Overloaded constructor that wraps the provided pointer to \c data.
|
||||
StkFrames( StkFloat* data, unsigned int nFrames, unsigned int nChannels = 1 );
|
||||
|
||||
//! The destructor.
|
||||
~StkFrames();
|
||||
|
||||
@@ -321,7 +327,7 @@ public:
|
||||
self. No range checking is performed unless _STK_DEBUG_ is
|
||||
defined.
|
||||
*/
|
||||
void operator+= ( StkFrames& f );
|
||||
StkFrames& operator+= ( StkFrames& f );
|
||||
|
||||
//! Assignment by product operator into self.
|
||||
/*!
|
||||
@@ -329,7 +335,16 @@ public:
|
||||
self. No range checking is performed unless _STK_DEBUG_ is
|
||||
defined.
|
||||
*/
|
||||
void operator*= ( StkFrames& f );
|
||||
StkFrames& operator*= ( StkFrames& f );
|
||||
|
||||
//! Scaling operator (StkFrame * StkFloat).
|
||||
StkFrames operator* ( StkFloat v ) const;
|
||||
|
||||
//! Scaling operator (StkFloat * StkFrame)
|
||||
friend StkFrames operator*(StkFloat v, const StkFrames& f);
|
||||
|
||||
//! Scaling operator (inline).
|
||||
StkFrames& operator*= ( StkFloat v );
|
||||
|
||||
//! Channel / frame subscript operator that returns a reference.
|
||||
/*!
|
||||
@@ -428,6 +443,7 @@ private:
|
||||
unsigned int nChannels_;
|
||||
size_t size_;
|
||||
size_t bufferSize_;
|
||||
bool ownData_;
|
||||
|
||||
};
|
||||
|
||||
@@ -508,7 +524,7 @@ inline StkFrames StkFrames::operator+(const StkFrames &f) const
|
||||
return sum;
|
||||
}
|
||||
|
||||
inline void StkFrames :: operator+= ( StkFrames& f )
|
||||
inline StkFrames& StkFrames :: operator+= ( StkFrames& f )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( f.frames() != nFrames_ || f.channels() != nChannels_ ) {
|
||||
@@ -522,9 +538,10 @@ inline void StkFrames :: operator+= ( StkFrames& f )
|
||||
StkFloat *dptr = data_;
|
||||
for ( unsigned int i=0; i<size_; i++ )
|
||||
*dptr++ += *fptr++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void StkFrames :: operator*= ( StkFrames& f )
|
||||
inline StkFrames& StkFrames :: operator*= ( StkFrames& f )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( f.frames() != nFrames_ || f.channels() != nChannels_ ) {
|
||||
@@ -538,8 +555,40 @@ inline void StkFrames :: operator*= ( StkFrames& f )
|
||||
StkFloat *dptr = data_;
|
||||
for ( unsigned int i=0; i<size_; i++ )
|
||||
*dptr++ *= *fptr++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline StkFrames StkFrames::operator*(StkFloat v) const
|
||||
{
|
||||
StkFrames res((unsigned int)nFrames_, nChannels_);
|
||||
StkFloat *resPtr = &res[0];
|
||||
const StkFloat *dPtr = data_;
|
||||
for (unsigned int i = 0; i < size_; i++) {
|
||||
*resPtr++ = v * *dPtr++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
inline StkFrames operator*(StkFloat v, const StkFrames& f)
|
||||
{
|
||||
StkFrames res((unsigned int)f.nFrames_, f.nChannels_);
|
||||
StkFloat *resPtr = &res[0];
|
||||
StkFloat *dPtr = f.data_;
|
||||
for (unsigned int i = 0; i < f.size_; i++) {
|
||||
*resPtr++ = v * *dPtr++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
inline StkFrames& StkFrames :: operator*= ( StkFloat v )
|
||||
{
|
||||
StkFloat *dptr = data_;
|
||||
for ( unsigned int i=0; i<size_; i++ )
|
||||
*dptr++ *= v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// Here are a few other useful typedefs.
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
|
||||
@@ -35,6 +35,7 @@ DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBRARY = @LIBS@
|
||||
|
||||
REALTIME = @realtime@
|
||||
|
||||
@@ -100,7 +100,7 @@ scale .left.bPressure -from 0 -to 128 -length 200 \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
scale .left.pitch -from 0 -to 128 -length 200 \
|
||||
-command {changePitch } -variable pitch \
|
||||
-command {changePitch } -variable pitch -resolution 0.1 \
|
||||
-orient horizontal -label "MIDI Note Number" \
|
||||
-tickinterval 32 -showvalue true -bg grey66
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBRARY = @LIBS@
|
||||
|
||||
REALTIME = @realtime@
|
||||
|
||||
@@ -24,6 +24,7 @@ DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBRARY = @LIBS@
|
||||
|
||||
REALTIME = @realtime@
|
||||
|
||||
@@ -19,6 +19,12 @@ array set stringNote {
|
||||
5 59
|
||||
6 64
|
||||
}
|
||||
array set powerNote {
|
||||
1 40
|
||||
2 47
|
||||
3 52
|
||||
4 59
|
||||
}
|
||||
#array set stringAmp { 1 64 2 64 3 64 4 64 5 64 6 64 }
|
||||
array set stringAmp {
|
||||
1 64
|
||||
@@ -53,10 +59,12 @@ pack .message -padx 5 -pady 10
|
||||
|
||||
# Configure "note on" buttons
|
||||
frame .top
|
||||
button .top.on -text Strum -bg grey66 -command strum
|
||||
button .top.off -text "All Off" -bg grey66 -command allOff
|
||||
button .top.exit -text "Quit" -bg grey66 -command quit
|
||||
button .top.on -text Strum -padx 5 -bg grey66 -command strum
|
||||
button .top.power -text "Power Chord" -padx 5 -bg grey66 -command powerchord
|
||||
button .top.off -text "All Off" -padx 5 -bg grey66 -command allOff
|
||||
button .top.exit -text "Quit" -padx 5 -bg grey66 -command quit
|
||||
pack .top.on -side left -padx 5
|
||||
pack .top.power -side left -padx 5 -padx 5
|
||||
pack .top.off -side left -padx 5 -pady 10
|
||||
pack .top.exit -side left -padx 5 -pady 10
|
||||
pack .top
|
||||
@@ -117,13 +125,26 @@ proc quit {} {
|
||||
}
|
||||
|
||||
proc strum {} {
|
||||
global stringNote stringAmp
|
||||
global stringAmp stringNote
|
||||
for {set n 1} {$n < 7} {incr n} {
|
||||
puts [format "NoteOn %2.3f %d %3.2f %3.2f" [expr rand()*0.04] $n $stringNote($n) $stringAmp($n)]
|
||||
}
|
||||
flush stdout
|
||||
}
|
||||
|
||||
proc powerchord {} {
|
||||
global stringNote powerNote stringAmp cont28 cont72
|
||||
set cont72 80
|
||||
set cont28 90
|
||||
puts [format "ControlChange 0.0 0 72 %3.2f" $cont72]
|
||||
puts [format "ControlChange 0.0 0 28 %3.2f" $cont28]
|
||||
for {set n 1} {$n < 5} {incr n} {
|
||||
set stringNote($n) $powerNote($n)
|
||||
puts [format "NoteOn %2.3f %d %3.2f %3.2f" [expr rand()*0.01] $n $powerNote($n) $stringAmp($n)]
|
||||
}
|
||||
flush stdout
|
||||
}
|
||||
|
||||
proc allOff {} {
|
||||
global stringNote stringAmp
|
||||
for {set n 1} {$n < 7} {incr n} {
|
||||
@@ -167,32 +188,32 @@ proc setStringAmp {value} {
|
||||
frame .strings -bg grey88 -borderwidth 5 -relief groove
|
||||
scale .strings.s1 -from $stringMin(1) -to [expr $stringMin(1)+$stringRange] \
|
||||
-length 350 -orient horizontal -label "String 1: Note Number" \
|
||||
-tickinterval 5 -showvalue true -variable $stringNote(1) \
|
||||
-tickinterval 5 -showvalue true -variable stringNote(1) \
|
||||
-command {setNote 1}
|
||||
|
||||
scale .strings.s2 -from $stringMin(2) -to [expr $stringMin(2)+$stringRange] \
|
||||
-length 350 -orient horizontal -label "String 2: Note Number" \
|
||||
-tickinterval 5 -showvalue true -variable $stringNote(2) \
|
||||
-tickinterval 5 -showvalue true -variable stringNote(2) \
|
||||
-command {setNote 2}
|
||||
|
||||
scale .strings.s3 -from $stringMin(3) -to [expr $stringMin(3)+$stringRange] \
|
||||
-length 350 -orient horizontal -label "String 3: Note Number" \
|
||||
-tickinterval 5 -showvalue true -variable $stringNote(3) \
|
||||
-tickinterval 5 -showvalue true -variable stringNote(3) \
|
||||
-command {setNote 3}
|
||||
|
||||
scale .strings.s4 -from $stringMin(4) -to [expr $stringMin(4)+$stringRange] \
|
||||
-length 350 -orient horizontal -label "String 4: Note Number" \
|
||||
-tickinterval 5 -showvalue true -variable $stringNote(4) \
|
||||
-tickinterval 5 -showvalue true -variable stringNote(4) \
|
||||
-command {setNote 4}
|
||||
|
||||
scale .strings.s5 -from $stringMin(5) -to [expr $stringMin(5)+$stringRange] \
|
||||
-length 350 -orient horizontal -label "String 5: Note Number" \
|
||||
-tickinterval 5 -showvalue true -variable $stringNote(5) \
|
||||
-tickinterval 5 -showvalue true -variable stringNote(5) \
|
||||
-command {setNote 5}
|
||||
|
||||
scale .strings.s6 -from $stringMin(6) -to [expr $stringMin(6)+$stringRange] \
|
||||
-length 350 -orient horizontal -label "String 6: Note Number" \
|
||||
-tickinterval 5 -showvalue true -variable $stringNote(6) \
|
||||
-tickinterval 5 -showvalue true -variable stringNote(6) \
|
||||
-command {setNote 6}
|
||||
|
||||
button .strings.b1 -text Pluck -command { pluckOne 1 }
|
||||
@@ -202,7 +223,6 @@ button .strings.b4 -text Pluck -command { pluckOne 4 }
|
||||
button .strings.b5 -text Pluck -command { pluckOne 5 }
|
||||
button .strings.b6 -text Pluck -command { pluckOne 6 }
|
||||
|
||||
grid .strings -column 0 -row 0
|
||||
grid .strings.b1 -column 1 -row 0 -padx 5 -pady 5
|
||||
grid .strings.b2 -column 1 -row 1
|
||||
grid .strings.b3 -column 1 -row 2
|
||||
@@ -218,9 +238,20 @@ grid .strings.s5 -column 0 -row 4 -padx 5 -pady 5
|
||||
grid .strings.s6 -column 0 -row 5 -padx 5 -pady 5
|
||||
|
||||
set stringSelect "All"
|
||||
ttk::combobox .strings.combo \
|
||||
-values [ list "All" "String 1" "String 2" "String 3" "String 4" "String 5" "String 6" ] \
|
||||
-width 8 -textvariable stringSelect -justify center
|
||||
set values [ list "All" "String 1" "String 2" "String 3" "String 4" "String 5" "String 6" ]
|
||||
ttk::combobox .strings.combo -values $values \
|
||||
-width 10 -state readonly -textvariable stringSelect -justify center
|
||||
bind .strings.combo <<ComboboxSelected>> {
|
||||
global stringAmp velocity
|
||||
switch [%W get] {
|
||||
"String 1" { set velocity $stringAmp(1) }
|
||||
"String 2" { set velocity $stringAmp(2) }
|
||||
"String 3" { set velocity $stringAmp(3) }
|
||||
"String 4" { set velocity $stringAmp(4) }
|
||||
"String 5" { set velocity $stringAmp(5) }
|
||||
"String 6" { set velocity $stringAmp(6) }
|
||||
}
|
||||
}
|
||||
|
||||
scale .strings.velocity -from 0 -to 128 -length 350 \
|
||||
-orient horizontal -label "Note Velocity" \
|
||||
@@ -229,7 +260,7 @@ scale .strings.velocity -from 0 -to 128 -length 350 \
|
||||
grid .strings.combo -column 1 -row 7
|
||||
grid .strings.velocity -column 0 -row 7 -padx 5 -pady 10
|
||||
|
||||
pack .strings
|
||||
pack .strings -side right
|
||||
|
||||
set cbpath .strings.combo
|
||||
|
||||
@@ -261,4 +292,4 @@ proc center_the_toplevel { w } {
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBRARY = @LIBS@
|
||||
|
||||
REALTIME = @realtime@
|
||||
|
||||
@@ -14,6 +14,7 @@ DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += -I$(INCLUDE) -Iinclude
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBRARY = @LIBS@
|
||||
|
||||
REALTIME = @realtime@
|
||||
|
||||
@@ -25,6 +25,7 @@ DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBRARY = @LIBS@
|
||||
|
||||
REALTIME = @realtime@
|
||||
|
||||
@@ -5,13 +5,15 @@
|
||||
This class implements a simple linear line envelope generator
|
||||
which is capable of ramping to an arbitrary target value by a
|
||||
specified \e rate. It also responds to simple \e keyOn and \e
|
||||
keyOff messages, ramping to 1.0 on keyOn and to 0.0 on keyOff.
|
||||
keyOff messages, ramping to a specified target (default = 1.0) on
|
||||
keyOn and to a specified target (default = 0.0) on keyOff.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995--2019.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "Envelope.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace stk {
|
||||
|
||||
@@ -64,7 +66,8 @@ void Envelope :: setTime( StkFloat time )
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
rate_ = 1.0 / ( time * Stk::sampleRate() );
|
||||
//rate_ = 1.0 / ( time * Stk::sampleRate() );
|
||||
rate_ = fabs(target_ - value_) / ( time * Stk::sampleRate() );
|
||||
}
|
||||
|
||||
void Envelope :: setTarget( StkFloat target )
|
||||
|
||||
@@ -79,9 +79,8 @@ void Granulate :: setRandomFactor( StkFloat randomness )
|
||||
{
|
||||
if ( randomness < 0.0 ) gRandomFactor_ = 0.0;
|
||||
else if ( randomness > 1.0 ) gRandomFactor_ = 0.97;
|
||||
|
||||
gRandomFactor_ = 0.97 * randomness;
|
||||
};
|
||||
else gRandomFactor_ = 0.97 * randomness;
|
||||
}
|
||||
|
||||
void Granulate :: openFile( std::string fileName, bool typeRaw )
|
||||
{
|
||||
|
||||
@@ -10,16 +10,18 @@ AR = ar -rsc
|
||||
RM = /bin/rm
|
||||
LN = /bin/ln
|
||||
OBJECT_PATH = @object_path@
|
||||
LIBDIR = @libdir@
|
||||
PREFIX = @prefix@
|
||||
INCLUDEDIR = @includedir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
vpath %.o $(OBJECT_PATH)
|
||||
|
||||
OBJECTS = Stk.o Generator.o Noise.o Blit.o BlitSaw.o BlitSquare.o Granulate.o \
|
||||
Envelope.o ADSR.o Asymp.o Modulate.o SineWave.o FileLoop.o SingWave.o \
|
||||
FileRead.o FileWrite.o WvIn.o FileWvIn.o WvOut.o FileWvOut.o \
|
||||
Filter.o Fir.o Iir.o OneZero.o OnePole.o PoleZero.o TwoZero.o TwoPole.o \
|
||||
BiQuad.o FormSwep.o Delay.o DelayL.o DelayA.o \
|
||||
BiQuad.o FormSwep.o Delay.o DelayL.o DelayA.o TapDelay.o\
|
||||
\
|
||||
Effect.o PRCRev.o JCRev.o NRev.o FreeVerb.o \
|
||||
Chorus.o Echo.o PitShift.o LentPitShift.o \
|
||||
@@ -48,6 +50,7 @@ DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += $(INCLUDE) -Iinclude -fPIC
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
REALTIME = @realtime@
|
||||
@@ -93,13 +96,13 @@ $(SHAREDLIB) : $(OBJECTS)
|
||||
$(LN) -s @sharedname@ $(SHAREDLIB)
|
||||
|
||||
install-headers:
|
||||
install -d $(DESTDIR)$(PREFIX)$(INCLUDEDIR)/stk
|
||||
cp -R ../include/*.h $(DESTDIR)$(PREFIX)$(INCLUDEDIR)/stk
|
||||
install -d $(DESTDIR)$(includedir)/stk
|
||||
cp -R ../include/*.h $(DESTDIR)$(includedir)/stk
|
||||
|
||||
install: $(SHAREDLIB) install-headers
|
||||
install -d $(DESTDIR)$(PREFIX)$(LIBDIR)
|
||||
install -m 644 @sharedname@ $(DESTDIR)$(PREFIX)$(LIBDIR)
|
||||
ln -sf @sharedname@ $(DESTDIR)$(PREFIX)$(LIBDIR)/$(SHAREDLIB)
|
||||
install -d $(DESTDIR)$(libdir)
|
||||
install -m 644 @sharedname@ $(DESTDIR)$(libdir)
|
||||
ln -sf @sharedname@ $(DESTDIR)$(libdir)/$(SHAREDLIB)
|
||||
|
||||
|
||||
$(OBJECTS) : Stk.h
|
||||
|
||||
@@ -122,7 +122,7 @@ RtWvOut :: ~RtWvOut( void )
|
||||
{
|
||||
// Change status flag to signal callback to clear the buffer and close.
|
||||
status_ = EMPTYING;
|
||||
while ( status_ != FINISHED || dac_.isStreamRunning() == true ) Stk::sleep( 100 );
|
||||
while ( status_ != FINISHED && dac_.isStreamRunning() == true ) Stk::sleep( 100 );
|
||||
dac_.closeStream();
|
||||
}
|
||||
|
||||
|
||||
24
src/Stk.cpp
24
src/Stk.cpp
@@ -229,7 +229,7 @@ void Stk :: handleError( std::string message, StkError::Type type )
|
||||
//
|
||||
|
||||
StkFrames :: StkFrames( unsigned int nFrames, unsigned int nChannels )
|
||||
: data_( 0 ), nFrames_( nFrames ), nChannels_( nChannels )
|
||||
: data_( 0 ), nFrames_( nFrames ), nChannels_( nChannels ), ownData_(true)
|
||||
{
|
||||
size_ = nFrames_ * nChannels_;
|
||||
bufferSize_ = size_;
|
||||
@@ -248,7 +248,7 @@ StkFrames :: StkFrames( unsigned int nFrames, unsigned int nChannels )
|
||||
}
|
||||
|
||||
StkFrames :: StkFrames( const StkFloat& value, unsigned int nFrames, unsigned int nChannels )
|
||||
: data_( 0 ), nFrames_( nFrames ), nChannels_( nChannels )
|
||||
: data_( 0 ), nFrames_( nFrames ), nChannels_( nChannels ), ownData_(true)
|
||||
{
|
||||
size_ = nFrames_ * nChannels_;
|
||||
bufferSize_ = size_;
|
||||
@@ -266,13 +266,21 @@ StkFrames :: StkFrames( const StkFloat& value, unsigned int nFrames, unsigned in
|
||||
dataRate_ = Stk::sampleRate();
|
||||
}
|
||||
|
||||
StkFrames :: StkFrames( StkFloat* data, unsigned int nFrames, unsigned int nChannels )
|
||||
: data_( data ), nFrames_( nFrames ), nChannels_( nChannels ), ownData_(false)
|
||||
{
|
||||
size_ = nFrames_ * nChannels_;
|
||||
bufferSize_ = size_;
|
||||
dataRate_ = Stk::sampleRate();
|
||||
}
|
||||
|
||||
StkFrames :: ~StkFrames()
|
||||
{
|
||||
if ( data_ ) free( data_ );
|
||||
if ( data_ && ownData_ ) free( data_ );
|
||||
}
|
||||
|
||||
StkFrames :: StkFrames( const StkFrames& f )
|
||||
: data_(0), size_(0), bufferSize_(0)
|
||||
: data_(0), size_(0), bufferSize_(0), ownData_(true)
|
||||
{
|
||||
resize( f.frames(), f.channels() );
|
||||
dataRate_ = Stk::sampleRate();
|
||||
@@ -281,7 +289,7 @@ StkFrames :: StkFrames( const StkFrames& f )
|
||||
|
||||
StkFrames& StkFrames :: operator= ( const StkFrames& f )
|
||||
{
|
||||
if ( data_ ) free( data_ );
|
||||
if ( data_ && ownData_ ) free( data_ );
|
||||
data_ = 0;
|
||||
size_ = 0;
|
||||
bufferSize_ = 0;
|
||||
@@ -298,15 +306,19 @@ void StkFrames :: resize( size_t nFrames, unsigned int nChannels )
|
||||
|
||||
size_ = nFrames_ * nChannels_;
|
||||
if ( size_ > bufferSize_ ) {
|
||||
if ( data_ ) free( data_ );
|
||||
if ( data_ && ownData_ ) free( data_ );
|
||||
data_ = (StkFloat *) malloc( size_ * sizeof( StkFloat ) );
|
||||
#if defined(_STK_DEBUG_)
|
||||
if ( data_ == NULL ) {
|
||||
std::string error = "StkFrames::resize: memory allocation error!";
|
||||
Stk::handleError( error, StkError::MEMORY_ALLOCATION );
|
||||
}
|
||||
if ( ownData_ ) {
|
||||
Stk::handleError( "Pointer to external data was lost after resize", StkError::WARNING );
|
||||
}
|
||||
#endif
|
||||
bufferSize_ = size_;
|
||||
ownData_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user