8 Commits

Author SHA1 Message Date
garyscavone
6aacd357d7 Merge pull request #150 from donarturo11/fix-msvc-compile-error
Remove adding /clr flag to cl compiler
2025-03-29 15:24:59 -04:00
Artur Wrona
0d4bb84732 Remove adding /clr flag to cl compiler 2025-03-19 13:10:50 +01:00
garyscavone
270edc855f Sample rate fix in effects.cpp, revised code in PitShift for hanning windowing. 2024-12-18 20:45:43 -05:00
garyscavone
d7d6079f6b Merge pull request #144 from zonkmachine/modalbarcontrol
Fix mixed up control messages
2024-12-09 10:18:26 -05:00
garyscavone
cea6f547d2 Merge pull request #146 from Kreijstal/patch-1
use pkgconf if available on CMakeLists
2024-12-08 11:33:33 -05:00
Kreijstal
212950d364 use pkgconf if available on CMakeLists
Otherwise fallback
2024-12-08 17:22:22 +01:00
Oskar Wallgren
aeaef391ef Fix mixed up control messages
In ModalBar.cpp the control messages for 'Stick direct mix' and 'Vibrato amplitude'
have been mixed up. This also concerns some documentation but the description
on https://ccrma.stanford.edu/software/stk/classstk_1_1ModalBar.html, which is
generated from the source, is correct.
2023-10-06 16:39:01 +02:00
garyscavone
d0345712db Added documentation gifs to doc/html/ directory, and updated configure.ac to remove a couple deprecated functions. 2023-08-14 13:53:11 -04:00
9 changed files with 78 additions and 47 deletions

View File

@@ -12,7 +12,6 @@ SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithD
message("Build type: " ${CMAKE_BUILD_TYPE}) message("Build type: " ${CMAKE_BUILD_TYPE})
if(MSVC) if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /clr")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7 /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=2 /D_STK_DEBUG_ /D__RTAUDIO_DEBUG__ /D__RTMIDI_DEBUG__") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7 /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=2 /D_STK_DEBUG_ /D__RTAUDIO_DEBUG__ /D__RTMIDI_DEBUG__")
else() else()
@@ -46,13 +45,54 @@ file(GLOB STK_SRC "./src/*.cpp") # GLOB instead of GLOB_RECURSE as the asio depe
#========================================# #========================================#
if(REALTIME) if(REALTIME)
if(ENABLE_JACK) if(ENABLE_JACK)
find_library(JACK_LIBRARY jack) # find_package(JACK) # TODO: NEED FindJACK.cmake # Try to find PkgConfig
if(JACK_LIBRARY) find_package(PkgConfig QUIET)
message("Jack API found: ${JACK_LIBRARY}")
link_libraries(${JACK_LIBRARY}) if(PkgConfig_FOUND)
# PkgConfig is available, use it
pkg_check_modules(JACK QUIET jack)
endif()
if(NOT JACK_FOUND)
# PkgConfig was not found or Jack was not found through it, try a fallback
message(STATUS "PkgConfig not found or failed to find Jack, attempting fallback")
# Fallback: Search in common locations
find_path(JACK_INCLUDE_DIR
NAMES jack/jack.h
HINTS
ENV JACK_ROOT
"$ENV{ProgramFiles}/Jack"
/usr/local/include
/usr/include
)
find_library(JACK_LIBRARY
NAMES jack
HINTS
ENV JACK_ROOT
"$ENV{ProgramFiles}/Jack"
/usr/local/lib
/usr/lib
)
# Check if the fallback was successful
if(JACK_INCLUDE_DIR AND JACK_LIBRARY)
set(JACK_FOUND TRUE)
set(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR})
set(JACK_LIBRARIES ${JACK_LIBRARY})
message(STATUS "Found Jack (fallback):")
message(STATUS " Includes: ${JACK_INCLUDE_DIRS}")
message(STATUS " Libraries: ${JACK_LIBRARIES}")
else()
message(WARNING "Failed to find Jack library even with fallback. Please install Jack development package or ensure it is in a standard location.")
endif()
endif()
if(JACK_FOUND)
include_directories(${JACK_INCLUDE_DIRS})
link_libraries(${JACK_LIBRARIES})
add_definitions(-D__UNIX_JACK__) add_definitions(-D__UNIX_JACK__)
else()
message(WARNING "JACK support requires the jack library!")
endif() endif()
endif() endif()

View File

@@ -20,12 +20,6 @@ if [[ $AR = "no" ]] ; then
fi fi
# Checks for header files. # Checks for header files.
m4_warn([obsolete],
[The preprocessor macro `STDC_HEADERS' is obsolete.
Except in unusual embedded environments, you can safely include all
ISO C90 headers unconditionally.])dnl
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP AC_PROG_EGREP
@@ -34,19 +28,6 @@ AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h termio.h unistd.h)
# Checks for typedefs, structures, and compiler characteristics. # Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST AC_C_CONST
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
m4_warn([obsolete],
[Update your code to rely only on HAVE_SYS_TIME_H,
then remove this warning and the obsolete code below it.
All current systems provide time.h; it need not be checked for.
Not all systems provide sys/time.h, but those that do, all allow
you to include it and time.h simultaneously.])dnl
AC_CHECK_HEADERS_ONCE([sys/time.h])
# Obsolete code to be removed.
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
# End of obsolete code.
AC_C_BIGENDIAN AC_C_BIGENDIAN
AC_EGREP_CPP(yes, AC_EGREP_CPP(yes,

BIN
doc/html/ccrma.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
doc/html/mcgill.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
doc/html/princeton.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -17,7 +17,7 @@ namespace stk {
*/ */
/***************************************************/ /***************************************************/
const int maxDelay = 5024; const int maxDelay = 5000; //5024;
class PitShift : public Effect class PitShift : public Effect
{ {
@@ -64,6 +64,7 @@ class PitShift : public Effect
DelayL delayLine_; DelayL delayLine_;
StkFloat delay_[2]; StkFloat delay_[2];
StkFloat env_[2]; StkFloat env_[2];
StkFrames window_;
StkFloat rate_; StkFloat rate_;
unsigned long delayLength_; unsigned long delayLength_;
unsigned long halfLength_; unsigned long halfLength_;
@@ -73,25 +74,29 @@ class PitShift : public Effect
inline StkFloat PitShift :: tick( StkFloat input ) inline StkFloat PitShift :: tick( StkFloat input )
{ {
// Calculate the two delay length values, keeping them within the // Calculate the two delay length values, keeping them within the
// range 12 to maxDelay-12. // range 0 to delayLength.
delay_[0] += rate_; delay_[0] += rate_;
while ( delay_[0] > maxDelay-12 ) delay_[0] -= delayLength_; while ( delay_[0] >= delayLength_ ) delay_[0] -= delayLength_;
while ( delay_[0] < 12 ) delay_[0] += delayLength_; while ( delay_[0] < 0 ) delay_[0] += delayLength_;
delay_[1] = delay_[0] + halfLength_; delay_[1] = delay_[0] + halfLength_;
while ( delay_[1] > maxDelay-12 ) delay_[1] -= delayLength_; while ( delay_[1] >= delayLength_ ) delay_[1] -= delayLength_;
while ( delay_[1] < 12 ) delay_[1] += delayLength_; while ( delay_[1] < 0 ) delay_[1] += delayLength_;
// Set the new delay line lengths. // Set the new delay line lengths.
delayLine_.setDelay( delay_[0] ); delayLine_.setDelay( delay_[0] );
// Calculate a triangular envelope. // Calculate a triangular envelope.
env_[1] = fabs( ( delay_[0] - halfLength_ + 12 ) * ( 1.0 / (halfLength_ + 12 ) ) ); //env_[1] = fabs( ( delay_[0] - halfLength_ ) * ( 1.0 / (halfLength_ ) ) );
env_[0] = 1.0 - env_[1]; //env_[0] = 1.0 - env_[1];
// Or use the precomputed hanning window.
env_[1] = window_[delay_[0]];
env_[0] = window_[delay_[1]];
// Delay input and apply envelope. // Delay input and apply envelope.
lastFrame_[0] = env_[1] * delayLine_.tapOut( delay_[1] ); lastFrame_[0] = env_[1] * delayLine_.tapOut( delay_[1] );
lastFrame_[0] = +env_[0] * delayLine_.tick( input ); lastFrame_[0] += env_[0] * delayLine_.tick( input );
// Compute effect mix and output. // Compute effect mix and output.
lastFrame_[0] *= effectMix_; lastFrame_[0] *= effectMix_;

View File

@@ -219,17 +219,17 @@ int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
// If you want to change the default sample rate (set in Stk.h), do
// it before instantiating any objects! If the sample rate is
// specified in the command line, it will override this setting.
Stk::setSampleRate( 48000.0 );
TickData data; TickData data;
RtAudio adac; RtAudio adac;
int i; int i;
if ( argc < 2 || argc > 6 ) usage(); if ( argc < 2 || argc > 6 ) usage();
// If you want to change the default sample rate (set in Stk.h), do
// it before instantiating any objects! If the sample rate is
// specified in the command line, it will override this setting.
Stk::setSampleRate( 48000.0 );
// Parse the command-line arguments. // Parse the command-line arguments.
unsigned int port = 2001; unsigned int port = 2001;
for ( i=1; i<argc; i++ ) { for ( i=1; i<argc; i++ ) {

View File

@@ -9,9 +9,9 @@
Control Change Numbers: Control Change Numbers:
- Stick Hardness = 2 - Stick Hardness = 2
- Stick Position = 4 - Stick Position = 4
- Vibrato Gain = 8 - Vibrato Gain = 1
- Vibrato Frequency = 11 - Vibrato Frequency = 11
- Direct Stick Mix = 1 - Direct Stick Mix = 8
- Volume = 128 - Volume = 128
- Modal Presets = 16 - Modal Presets = 16
- Marimba = 0 - Marimba = 0
@@ -173,9 +173,9 @@ void ModalBar :: controlChange( int number, StkFloat value )
else if (number == __SK_ProphesyRibbon_) // 16 else if (number == __SK_ProphesyRibbon_) // 16
this->setPreset((int) value); this->setPreset((int) value);
else if (number == __SK_Balance_) // 8 else if (number == __SK_Balance_) // 8
vibratoGain_ = normalizedValue * 0.3;
else if (number == __SK_ModWheel_) // 1
directGain_ = normalizedValue; directGain_ = normalizedValue;
else if (number == __SK_ModWheel_) // 1
vibratoGain_ = normalizedValue * 0.3;
else if (number == __SK_ModFrequency_) // 11 else if (number == __SK_ModFrequency_) // 11
vibrato_.setFrequency( normalizedValue * 12.0 ); vibrato_.setFrequency( normalizedValue * 12.0 );
else if (number == __SK_AfterTouch_Cont_) // 128 else if (number == __SK_AfterTouch_Cont_) // 128

View File

@@ -16,15 +16,20 @@ namespace stk {
PitShift :: PitShift( void ) PitShift :: PitShift( void )
{ {
delayLength_ = maxDelay - 24; delayLength_ = maxDelay;
halfLength_ = delayLength_ / 2; halfLength_ = delayLength_ / 2;
delay_[0] = 12; delay_[0] = 0;
delay_[1] = maxDelay / 2; delay_[1] = delayLength_ / 2;
delayLine_.setMaximumDelay( maxDelay ); delayLine_.setMaximumDelay( maxDelay );
delayLine_.setDelay( delay_[0] ); delayLine_.setDelay( delay_[0] );
effectMix_ = 0.5; effectMix_ = 0.5;
rate_ = 1.0; rate_ = 1.0;
window_.resize( delayLength_, 1 );
StkFloat temp = TWO_PI / delayLength_;
for ( unsigned long i=0; i<=window_.size(); i++ )
window_[i] = (cos( i * temp ) + 1.0) / 2.0;
} }
void PitShift :: clear() void PitShift :: clear()