Remove Chuck
Chuck can be added back when the routing of MIDI between components is implemented.
This commit is contained in:
committed by
Norman Feske
parent
7cff151ecb
commit
e94b81d5d1
@@ -1,16 +0,0 @@
|
||||
diff --git a/src/core/util_string.cpp b/src/core/util_string.cpp
|
||||
index f505506..f6c0c8b 100644
|
||||
--- a/src/core/util_string.cpp
|
||||
+++ b/src/core/util_string.cpp
|
||||
@@ -41,6 +41,11 @@
|
||||
#include <linux/limits.h>
|
||||
#endif // __PLATFORM_LINUX__
|
||||
|
||||
+#ifdef __PLATFORM_GENODE__
|
||||
+#include <vfs/types.h>
|
||||
+enum { PATH_MAX = Vfs::MAX_PATH_LEN };
|
||||
+#endif
|
||||
+
|
||||
#include <stdio.h>
|
||||
using namespace std;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
ChucK is a strongly-timed concurrent music programming language.
|
||||
This directory contains an initial non-interactive frontend.
|
||||
|
||||
Configuration
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
The following configuration compiles and runs seven files:
|
||||
|
||||
! <config dac_channels="2" adc_channels="0">
|
||||
! <libc stdout="/log" stderr="/log">
|
||||
! <vfs>
|
||||
! <log/>
|
||||
! <fs/>
|
||||
! </vfs>
|
||||
! </libc>
|
||||
! <file path="otf_01.ck"/>
|
||||
! <file path="otf_02.ck"/>
|
||||
! <file path="otf_03.ck"/>
|
||||
! <file path="otf_04.ck"/>
|
||||
! <file path="otf_05.ck"/>
|
||||
! <file path="otf_06.ck"/>
|
||||
! <file path="otf_07.ck"/>
|
||||
! </config>
|
||||
@@ -1,353 +0,0 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
ChucK Concurrent, On-the-fly Audio Programming Language
|
||||
Compiler and Virtual Machine
|
||||
|
||||
Copyright (c) 2003 Ge Wang and Perry R. Cook. All rights reserved.
|
||||
http://chuck.stanford.edu/
|
||||
http://chuck.cs.princeton.edu/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
U.S.A.
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// file: component.cpp
|
||||
// desc: chuck entry point for Genode
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/* Genode includes */
|
||||
#include <audio_out_session/audio_out_session.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/log.h>
|
||||
|
||||
/* ChucK includes */
|
||||
#include "chuck.h"
|
||||
#include "chuck_audio.h"
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global variables
|
||||
//-----------------------------------------------------------------------------
|
||||
// the one ChucK, for command line host
|
||||
ChucK * the_chuck;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// name: cb()
|
||||
// desc: audio callback
|
||||
//-----------------------------------------------------------------------------
|
||||
void cb( t_CKSAMPLE * in, t_CKSAMPLE * out, t_CKUINT numFrames,
|
||||
t_CKUINT numInChans, t_CKUINT numOutChans, void * data )
|
||||
{
|
||||
// TODO: check channel numbers
|
||||
|
||||
// call up to ChucK
|
||||
the_chuck->run( in, out, numFrames );
|
||||
}
|
||||
|
||||
|
||||
struct Main
|
||||
{
|
||||
Libc::Env &env;
|
||||
|
||||
t_CKBOOL g_enable_realtime_audio = TRUE;
|
||||
t_CKBOOL enable_system_cmd = FALSE;
|
||||
|
||||
Main(Libc::Env &env): env(env) { };
|
||||
|
||||
void go()
|
||||
{
|
||||
t_CKBOOL vm_halt = TRUE;
|
||||
t_CKINT srate = SAMPLE_RATE_DEFAULT;
|
||||
t_CKBOOL force_srate = FALSE; // added 1.3.1.2
|
||||
t_CKINT buffer_size = BUFFER_SIZE_DEFAULT;
|
||||
t_CKINT num_buffers = NUM_BUFFERS_DEFAULT;
|
||||
t_CKINT dac = 0;
|
||||
t_CKINT adc = 0;
|
||||
std::string dac_name = ""; // added 1.3.0.0
|
||||
std::string adc_name = ""; // added 1.3.0.0
|
||||
t_CKINT dac_chans = 0;
|
||||
t_CKINT adc_chans = 2;
|
||||
t_CKBOOL dump = FALSE;
|
||||
t_CKBOOL auto_depend = FALSE;
|
||||
t_CKBOOL block = FALSE;
|
||||
// t_CKBOOL enable_shell = FALSE;
|
||||
t_CKBOOL no_vm = FALSE;
|
||||
t_CKBOOL load_hid = FALSE;
|
||||
t_CKBOOL enable_server = TRUE;
|
||||
t_CKBOOL do_watchdog = TRUE;
|
||||
t_CKINT adaptive_size = 0;
|
||||
t_CKINT log_level = CK_LOG_CORE;
|
||||
t_CKINT deprecate_level = 1; // 1 == warn
|
||||
t_CKINT chugin_load = 1; // 1 == auto (variable added 1.3.0.0)
|
||||
// whether to make this new VM the one that receives OTF commands
|
||||
t_CKBOOL update_otf_vm = TRUE;
|
||||
string filename = "";
|
||||
vector<string> args;
|
||||
|
||||
// list of search pathes (added 1.3.0.0)
|
||||
std::list<std::string> dl_search_path;
|
||||
// initial chug-in path (added 1.3.0.0)
|
||||
std::string initial_chugin_path;
|
||||
// if set as environment variable (added 1.3.0.0)
|
||||
if( getenv( g_chugin_path_envvar ) )
|
||||
{
|
||||
// get it from the env var
|
||||
initial_chugin_path = getenv( g_chugin_path_envvar );
|
||||
}
|
||||
else
|
||||
{
|
||||
// default it
|
||||
initial_chugin_path = g_default_chugin_path;
|
||||
}
|
||||
// parse the colon list into STL list (added 1.3.0.0)
|
||||
parse_path_list( initial_chugin_path, dl_search_path );
|
||||
// list of individually named chug-ins (added 1.3.0.0)
|
||||
std::list<std::string> named_dls;
|
||||
|
||||
#if defined(__DISABLE_WATCHDOG__)
|
||||
do_watchdog = FALSE;
|
||||
#elif defined(__MACOSX_CORE__)
|
||||
do_watchdog = TRUE;
|
||||
#elif defined(__PLATFORM_WIN32__) && !defined(__WINDOWS_PTHREAD__)
|
||||
do_watchdog = TRUE;
|
||||
#else
|
||||
do_watchdog = FALSE;
|
||||
#endif
|
||||
|
||||
t_CKUINT files = 0;
|
||||
t_CKUINT count = 1;
|
||||
t_CKINT i;
|
||||
|
||||
// set log level
|
||||
EM_setlog( log_level );
|
||||
|
||||
// add myself to the list of Chuck_Systems that might need to be cleaned up
|
||||
// g_systems.push_back( this );
|
||||
|
||||
|
||||
//------------------------- COMMAND LINE ARGUMENTS -----------------------------
|
||||
|
||||
// log level
|
||||
EM_setlog( log_level );
|
||||
|
||||
// set caution to wind
|
||||
ChucK::enableSystemCall = enable_system_cmd;
|
||||
|
||||
// check buffer size
|
||||
buffer_size = ensurepow2( buffer_size );
|
||||
// set watchdog
|
||||
g_do_watchdog = do_watchdog;
|
||||
// set adaptive size
|
||||
if( adaptive_size < 0 ) adaptive_size = buffer_size;
|
||||
|
||||
// make sure vm
|
||||
if( no_vm )
|
||||
{
|
||||
CK_FPRINTF_STDERR( "[chuck]: '--empty' can only be used with shell...\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// find dac_name if appropriate (added 1.3.0.0)
|
||||
if( dac_name.size() > 0 )
|
||||
{
|
||||
// check with RtAudio
|
||||
int dev = ChuckAudio::device_named( dac_name, TRUE, FALSE );
|
||||
if( dev >= 0 )
|
||||
{
|
||||
dac = dev;
|
||||
}
|
||||
else
|
||||
{
|
||||
CK_FPRINTF_STDERR( "[chuck]: unable to find dac '%s'...\n", dac_name.c_str() );
|
||||
exit( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
// find adc_name if appropriate (added 1.3.0.0)
|
||||
if( adc_name.size() > 0 )
|
||||
{
|
||||
// check with RtAudio
|
||||
int dev = ChuckAudio::device_named( adc_name, FALSE, TRUE );
|
||||
if( dev >= 0 )
|
||||
{
|
||||
adc = dev;
|
||||
}
|
||||
else
|
||||
{
|
||||
CK_FPRINTF_STDERR( "[chuck]: unable to find adc '%s'...\n", adc_name.c_str() );
|
||||
exit( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------- VIRTUAL MACHINE SETUP -----------------------------
|
||||
// instantiate ChucK
|
||||
the_chuck = new ChucK();
|
||||
|
||||
// set params
|
||||
the_chuck->setParam( CHUCK_PARAM_SAMPLE_RATE, Audio_out::SAMPLE_RATE );
|
||||
the_chuck->setParam( CHUCK_PARAM_INPUT_CHANNELS, 0 );
|
||||
the_chuck->setParam( CHUCK_PARAM_OUTPUT_CHANNELS, 2 );
|
||||
the_chuck->setParam( CHUCK_PARAM_VM_ADAPTIVE, adaptive_size );
|
||||
the_chuck->setParam( CHUCK_PARAM_VM_HALT, (t_CKINT)(vm_halt) );
|
||||
the_chuck->setParam( CHUCK_PARAM_OTF_ENABLE, (t_CKINT)FALSE );
|
||||
the_chuck->setParam( CHUCK_PARAM_DUMP_INSTRUCTIONS, (t_CKINT)dump );
|
||||
the_chuck->setParam( CHUCK_PARAM_AUTO_DEPEND, (t_CKINT)auto_depend );
|
||||
the_chuck->setParam( CHUCK_PARAM_DEPRECATE_LEVEL, deprecate_level );
|
||||
the_chuck->setParam( CHUCK_PARAM_USER_CHUGINS, named_dls );
|
||||
the_chuck->setParam( CHUCK_PARAM_USER_CHUGIN_DIRECTORIES, dl_search_path );
|
||||
// set hint, so internally can advise things like async data writes etc.
|
||||
the_chuck->setParam( CHUCK_PARAM_HINT_IS_REALTIME_AUDIO, TRUE );
|
||||
the_chuck->setLogLevel( log_level );
|
||||
|
||||
// initialize
|
||||
if( !the_chuck->init() )
|
||||
{
|
||||
CK_FPRINTF_STDERR( "[chuck]: failed to initialize...\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
//--------------------------- AUDIO I/O SETUP ---------------------------------
|
||||
// log
|
||||
EM_log( CK_LOG_SYSTEM, "initializing audio I/O..." );
|
||||
// push
|
||||
EM_pushlog();
|
||||
// log
|
||||
|
||||
// initialize audio system
|
||||
// TODO: refactor initialize() to take in the dac and adc nums
|
||||
ChuckAudio::m_adc_n = adc;
|
||||
ChuckAudio::m_dac_n = dac;
|
||||
t_CKBOOL retval = ChuckAudio::initialize( adc_chans, dac_chans,
|
||||
srate, buffer_size, num_buffers, cb, (void *)the_chuck, force_srate );
|
||||
// check
|
||||
if( !retval )
|
||||
{
|
||||
EM_log( CK_LOG_SYSTEM,
|
||||
"cannot initialize audio device (use --silent/-s for non-realtime)" );
|
||||
// pop
|
||||
EM_poplog();
|
||||
// done
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// log
|
||||
EM_log( CK_LOG_SYSTEM, "real-time audio: %s", g_enable_realtime_audio ? "YES" : "NO" );
|
||||
EM_log( CK_LOG_SYSTEM, "mode: %s", block ? "BLOCKING" : "CALLBACK" );
|
||||
EM_log( CK_LOG_SYSTEM, "sample rate: %ld", srate );
|
||||
EM_log( CK_LOG_SYSTEM, "buffer size: %ld", buffer_size );
|
||||
if( g_enable_realtime_audio )
|
||||
{
|
||||
EM_log( CK_LOG_SYSTEM, "num buffers: %ld", num_buffers );
|
||||
EM_log( CK_LOG_SYSTEM, "adc: %ld dac: %d", adc, dac );
|
||||
EM_log( CK_LOG_SYSTEM, "adaptive block processing: %ld", adaptive_size > 1 ? adaptive_size : 0 );
|
||||
}
|
||||
EM_log( CK_LOG_SYSTEM, "channels in: %ld out: %ld", adc_chans, dac_chans );
|
||||
|
||||
// pop
|
||||
EM_poplog();
|
||||
|
||||
// reset count
|
||||
count = 1;
|
||||
|
||||
// log
|
||||
EM_log( CK_LOG_SEVERE, "starting compilation..." );
|
||||
// push indent
|
||||
EM_pushlog();
|
||||
|
||||
|
||||
//------------------------- SOURCE COMPILATION --------------------------------
|
||||
|
||||
// loop through and process each file
|
||||
auto const arg_fn = [&] (Xml_node const &node) {
|
||||
auto const val = node.attribute_value("value", String<256>());
|
||||
char const *arg = val.string();
|
||||
// make sure
|
||||
if( arg[0] == '-' || arg[0] == '+' )
|
||||
{
|
||||
if( val == "--dump" || val == "+d" )
|
||||
the_chuck->compiler()->emitter->dump = TRUE;
|
||||
else if( val == "--nodump" || val == "-d" )
|
||||
the_chuck->compiler()->emitter->dump = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
// compile it!
|
||||
the_chuck->compileFile( arg, "" );
|
||||
++files;
|
||||
};
|
||||
|
||||
env.config([&] (Xml_node const &config) {
|
||||
config.for_each_sub_node("arg", arg_fn); });
|
||||
|
||||
if( !files && vm_halt)
|
||||
{
|
||||
CK_FPRINTF_STDERR( "[chuck]: no input files... (try --help)\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// pop indent
|
||||
EM_poplog();
|
||||
|
||||
|
||||
//-------------------------- MAIN CHUCK LOOP!!! -----------------------------
|
||||
|
||||
// log
|
||||
EM_log( CK_LOG_SYSTEM, "running main loop..." );
|
||||
// push indent
|
||||
EM_pushlog();
|
||||
|
||||
// start it!
|
||||
the_chuck->start();
|
||||
|
||||
// log
|
||||
EM_log( CK_LOG_SEVERE, "virtual machine running..." );
|
||||
// pop indent
|
||||
EM_poplog();
|
||||
|
||||
// silent mode buffers
|
||||
SAMPLE * input = new SAMPLE[buffer_size*adc_chans];
|
||||
SAMPLE * output = new SAMPLE[buffer_size*dac_chans];
|
||||
// zero out
|
||||
Genode::memset( input, 0, sizeof(SAMPLE)*buffer_size*adc_chans );
|
||||
Genode::memset( output, 0, sizeof(SAMPLE)*buffer_size*dac_chans );
|
||||
|
||||
// start audio
|
||||
ChuckAudio::start();
|
||||
|
||||
// return to entrypoint
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
init_rtaudio(env);
|
||||
|
||||
static Main main(env);
|
||||
|
||||
Libc::with_libc([&] () { main.go(); });
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
int pthread_setschedparam(pthread_t, int, const struct sched_param*) {
|
||||
return 0; }
|
||||
int pthread_getschedparam(pthread_t, int*, struct sched_param*) {
|
||||
return 0; }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
diff --git a/src/core/midiio_rtmidi.cpp b/src/core/midiio_rtmidi.cpp
|
||||
index d5e2aca..9fcec93 100644
|
||||
--- a/src/core/midiio_rtmidi.cpp
|
||||
+++ b/src/core/midiio_rtmidi.cpp
|
||||
@@ -1001,4 +1001,9 @@ MidiIn::~MidiIn()
|
||||
|
||||
}
|
||||
|
||||
+t_CKBOOL MidiIn::open( Chuck_VM *, t_CKUINT )
|
||||
+{
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
#endif // __DISABLE_MIDI__
|
||||
@@ -1,35 +0,0 @@
|
||||
#include "util_console.h"
|
||||
|
||||
|
||||
char * io_readline( const char * prompt )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void io_addhistory( const char * addme )
|
||||
{ }
|
||||
|
||||
t_CKBOOL kb_initscr()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void kb_endwin()
|
||||
{ }
|
||||
|
||||
t_CKINT kb_hit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
t_CKINT kb_getch()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ready
|
||||
t_CKBOOL kb_ready()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
diff --git a/src/core/util_hid.cpp b/src/core/util_hid.cpp
|
||||
index 4bfa8c8..a0753ef 100644
|
||||
--- a/src/core/util_hid.cpp
|
||||
+++ b/src/core/util_hid.cpp
|
||||
@@ -7733,6 +7733,56 @@ const char * Keyboard_name( int k )
|
||||
return keyboards->at( k )->name;
|
||||
}
|
||||
|
||||
+#elif defined(__PLATFORM_GENODE__)
|
||||
+
|
||||
+void Hid_init() { }
|
||||
+void Hid_poll() { }
|
||||
+void Hid_quit() { }
|
||||
+
|
||||
+void Joystick_init() { }
|
||||
+void Joystick_poll() { }
|
||||
+void Joystick_quit() { }
|
||||
+void Joystick_probe() { }
|
||||
+int Joystick_count() { return -1; }
|
||||
+int Joystick_open( int js ) { return -1; }
|
||||
+int Joystick_open_async( int js ) { return -1; }
|
||||
+int Joystick_open( const char * name ) { return -1; }
|
||||
+int Joystick_close( int js ) { return -1; };
|
||||
+int Joystick_send( int js, const HidMsg * msg ) { return -1; }
|
||||
+const char * Joystick_name( int js ) { return ""; }
|
||||
+
|
||||
+void Mouse_init() { }
|
||||
+void Mouse_poll() { }
|
||||
+void Mouse_quit() { }
|
||||
+void Mouse_probe() { }
|
||||
+int Mouse_count() { return -1; }
|
||||
+int Mouse_open( int m ) { return -1; }
|
||||
+int Mouse_open( const char * name ) { return -1; }
|
||||
+int Mouse_close( int m ) { return -1; }
|
||||
+int Mouse_send( int m, const HidMsg * msg ) { return -1; }
|
||||
+const char * Mouse_name( int m ) { return ""; }
|
||||
+int Mouse_buttons( int m ) { return -1; }
|
||||
+
|
||||
+void Keyboard_init() { }
|
||||
+void Keyboard_poll() { }
|
||||
+void Keyboard_quit() { }
|
||||
+void Keyboard_probe() { }
|
||||
+int Keyboard_count() { return -1; }
|
||||
+int Keyboard_open( int kb ) { return -1; }
|
||||
+int Keyboard_open( const char * name ) { return -1; }
|
||||
+int Keyboard_close( int kb ) { return -1; }
|
||||
+const char * Keyboard_name( int kb ) { return ""; }
|
||||
+
|
||||
+t_CKINT TiltSensor_setPollRate( t_CKINT usec )
|
||||
+{
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+t_CKINT TiltSensor_getPollRate( )
|
||||
+{
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
diff --git a/src/host/chuck_audio.cpp b/src/host/chuck_audio.cpp
|
||||
index 5e562b0..257d4c0 100644
|
||||
--- a/src/host/chuck_audio.cpp
|
||||
+++ b/src/host/chuck_audio.cpp
|
||||
@@ -155,7 +155,7 @@ void ChuckAudio::probe()
|
||||
|
||||
// allocate RtAudio
|
||||
try { audio = new RtAudio( ); }
|
||||
- catch( RtError err )
|
||||
+ catch( RtAudioError err )
|
||||
{
|
||||
// problem finding audio devices, most likely
|
||||
EM_error2b( 0, "%s", err.getMessage().c_str() );
|
||||
@@ -173,7 +173,7 @@ void ChuckAudio::probe()
|
||||
for( int i = 0; i < devices; i++ )
|
||||
{
|
||||
try { info = audio->getDeviceInfo(i); }
|
||||
- catch( RtError & error )
|
||||
+ catch( RtAudioError & error )
|
||||
{
|
||||
error.printMessage();
|
||||
break;
|
||||
@@ -213,7 +213,7 @@ t_CKUINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac,
|
||||
|
||||
// allocate RtAudio
|
||||
try { audio = new RtAudio(); }
|
||||
- catch( RtError err )
|
||||
+ catch( RtAudioError err )
|
||||
{
|
||||
// problem finding audio devices, most likely
|
||||
EM_error2b( 0, "%s", err.getMessage().c_str() );
|
||||
@@ -229,7 +229,7 @@ t_CKUINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac,
|
||||
{
|
||||
// get info
|
||||
try { info = audio->getDeviceInfo(i); }
|
||||
- catch( RtError & error )
|
||||
+ catch( RtAudioError & error )
|
||||
{
|
||||
error.printMessage();
|
||||
break;
|
||||
@@ -251,7 +251,7 @@ t_CKUINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac,
|
||||
for( int i = 0; i < devices; i++ )
|
||||
{
|
||||
try { info = audio->getDeviceInfo(i); }
|
||||
- catch( RtError & error )
|
||||
+ catch( RtAudioError & error )
|
||||
{
|
||||
error.printMessage();
|
||||
break;
|
||||
@@ -477,7 +477,7 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT num_dac_channels,
|
||||
|
||||
// allocate RtAudio
|
||||
try { m_rtaudio = new RtAudio( ); }
|
||||
- catch( RtError err )
|
||||
+ catch( RtAudioError err )
|
||||
{
|
||||
// problem finding audio devices, most likely
|
||||
EM_error2( 0, "%s", err.getMessage().c_str() );
|
||||
@@ -674,7 +674,7 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT num_dac_channels,
|
||||
CK_RTAUDIO_FORMAT, sample_rate, &bufsize,
|
||||
cb, m_cb_user_data,
|
||||
&stream_options );
|
||||
- } catch( RtError err ) {
|
||||
+ } catch( RtAudioError err ) {
|
||||
// log
|
||||
EM_log( CK_LOG_INFO, "exception caught: '%s'...", err.getMessage().c_str() );
|
||||
EM_error2( 0, "%s", err.getMessage().c_str() );
|
||||
@@ -804,7 +804,7 @@ t_CKBOOL ChuckAudio::start( )
|
||||
m_rtaudio->startStream();
|
||||
m_start = TRUE;
|
||||
}
|
||||
- catch( RtError err )
|
||||
+ catch( RtAudioError err )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -826,7 +826,7 @@ t_CKBOOL ChuckAudio::stop( )
|
||||
m_rtaudio->stopStream();
|
||||
m_start = FALSE;
|
||||
}
|
||||
- catch( RtError err )
|
||||
+ catch( RtAudioError err )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/src/core/chuck_shell.cpp b/src/core/chuck_shell.cpp
|
||||
index 7f89df7..fd8a065 100644
|
||||
--- a/src/core/chuck_shell.cpp
|
||||
+++ b/src/core/chuck_shell.cpp
|
||||
@@ -599,7 +599,7 @@ void Chuck_Shell::continue_code( string & in )
|
||||
void Chuck_Shell::do_code( string & code, string & out, string command )
|
||||
{
|
||||
// open a temporary file
|
||||
-#if defined(__PLATFORM_LINUX__) || defined(__MACOSX_CORE__)
|
||||
+#if ( defined(__PLATFORM_LINUX__) || defined(__MACOSX_CORE__) || defined(__PLATFORM_GENODE__) )
|
||||
char tmp_dir[] = "/tmp";
|
||||
char * tmp_filepath = new char [32];
|
||||
strncpy( tmp_filepath, "/tmp/chuck_file.XXXXXX", 32 );
|
||||
@@ -1,40 +0,0 @@
|
||||
TARGET := chuck
|
||||
|
||||
LIBS += base libc libm stdcxx rtaudio liblo sdl
|
||||
LIBS += libsndfile libogg libvorbis libFLAC
|
||||
|
||||
CHUCK_SRC_DIR = $(call select_from_ports,chuck)/src/app/chuck/src
|
||||
CHUCK_CORE_DIR = $(CHUCK_SRC_DIR)/core
|
||||
CHUCK_HOST_DIR = $(CHUCK_SRC_DIR)/host
|
||||
|
||||
CC_OPT += \
|
||||
-D__PLATFORM_GENODE__ \
|
||||
-D__GENODE_AUDIO__ \
|
||||
-D__DISABLE_MIDI__ \
|
||||
-DCPU_IS_LITTLE_ENDIAN=1 \
|
||||
-D__CK_SNDFILE_NATIVE__ \
|
||||
|
||||
CC_WARN += -Wno-sign-compare
|
||||
|
||||
INC_DIR += $(PRG_DIR) $(CHUCK_CORE_DIR) $(CHUCK_HOST_DIR)
|
||||
|
||||
CHUCK_SRC_C := \
|
||||
chuck.tab.c chuck.yy.c util_math.c util_network.c util_raw.c \
|
||||
util_xforms.c
|
||||
|
||||
CHUCK_SRC_CC := $(notdir $(wildcard $(CHUCK_CORE_DIR)/*.cpp))
|
||||
|
||||
CHUCK_SRC_CC_FILTER = util_console.cpp
|
||||
|
||||
LO_SRC_C := \
|
||||
lo/address.c lo/blob.c lo/bundle.c lo/message.c lo/method.c \
|
||||
lo/pattern_match.c lo/send.c lo/server.c lo/server_thread.c lo/timetag.c
|
||||
|
||||
SRC_C += $(CHUCK_SRC_C) $(util_sndfile.c)
|
||||
SRC_CC += $(filter-out $(CHUCK_SRC_CC_FILTER),$(CHUCK_SRC_CC))
|
||||
SRC_CC += dummies.cc chuck_component.cc chuck_audio.cpp
|
||||
|
||||
vpath %.c $(CHUCK_CORE_DIR)
|
||||
vpath %.cpp $(CHUCK_CORE_DIR) $(CHUCK_HOST_DIR)
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
||||
@@ -1,35 +0,0 @@
|
||||
diff --git a/src/core/util_thread.cpp b/src/core/util_thread.cpp
|
||||
index d2467c1..939e936 100644
|
||||
--- a/src/core/util_thread.cpp
|
||||
+++ b/src/core/util_thread.cpp
|
||||
@@ -389,7 +389,7 @@ void XWriteThread::flush_data_buffer()
|
||||
// name: write_cb()
|
||||
// desc: thread function
|
||||
//-----------------------------------------------------------------------------
|
||||
-#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) )
|
||||
+#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_GENODE__) )
|
||||
void * XWriteThread::write_cb(void * _thiss)
|
||||
#elif defined(__PLATFORM_WIN32__)
|
||||
unsigned XWriteThread::write_cb(void * _thiss)
|
||||
diff --git a/src/core/util_thread.h b/src/core/util_thread.h
|
||||
index c6f4a3c..24999de 100644
|
||||
--- a/src/core/util_thread.h
|
||||
+++ b/src/core/util_thread.h
|
||||
@@ -43,7 +43,7 @@ class FastCircularBuffer;
|
||||
template<typename T> class CircularBuffer;
|
||||
|
||||
|
||||
-#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) )
|
||||
+#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_GENODE__) )
|
||||
#include <pthread.h>
|
||||
#define THREAD_TYPE
|
||||
typedef pthread_t THREAD_HANDLE;
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
void flush_data_buffer();
|
||||
|
||||
// callback
|
||||
-#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) )
|
||||
+#if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_GENODE__) )
|
||||
static void * write_cb( void * _thiss );
|
||||
#elif defined(__PLATFORM_WIN32__)
|
||||
static unsigned THREAD_TYPE write_cb( void * _thiss );
|
||||
@@ -1,31 +0,0 @@
|
||||
// another candidate for lamest demo
|
||||
|
||||
// patch
|
||||
SinOsc s => JCRev r => dac;
|
||||
.5 => r.gain;
|
||||
.075 => r.mix;
|
||||
|
||||
// note number
|
||||
20 => float note;
|
||||
|
||||
// go up to 127
|
||||
while( note < 128 )
|
||||
{
|
||||
// convert MIDI note to hz
|
||||
Std.mtof( note ) => s.freq;
|
||||
// turn down the volume gradually
|
||||
.5 - (note/256.0) => s.gain;
|
||||
|
||||
// move up by whole step
|
||||
note + 2 => note;
|
||||
|
||||
// advance time
|
||||
.125::second => now;
|
||||
}
|
||||
|
||||
// turn off s
|
||||
0 => s.gain;
|
||||
// wait a bit
|
||||
2::second => now;
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// HID
|
||||
Hid hi;
|
||||
HidMsg msg;
|
||||
|
||||
// which keyboard
|
||||
0 => int device;
|
||||
// get from command line
|
||||
if( me.args() ) me.arg(0) => Std.atoi => device;
|
||||
|
||||
// open keyboard (get device number from command line)
|
||||
if( !hi.openKeyboard( device ) ) me.exit();
|
||||
<<< "keyboard '" + hi.name() + "' ready", "" >>>;
|
||||
|
||||
// patch
|
||||
BeeThree organ => JCRev r => Echo e => Echo e2 => dac;
|
||||
r => dac;
|
||||
|
||||
// set delays
|
||||
240::ms => e.max => e.delay;
|
||||
480::ms => e2.max => e2.delay;
|
||||
// set gains
|
||||
.6 => e.gain;
|
||||
.3 => e2.gain;
|
||||
.05 => r.mix;
|
||||
0 => organ.gain;
|
||||
|
||||
// infinite event loop
|
||||
while( true )
|
||||
{
|
||||
// wait for event
|
||||
hi => now;
|
||||
|
||||
// get message
|
||||
while( hi.recv( msg ) )
|
||||
{
|
||||
// check
|
||||
if( msg.isButtonDown() )
|
||||
{
|
||||
Std.mtof( msg.which + 45 ) => float freq;
|
||||
if( freq > 20000 ) continue;
|
||||
|
||||
freq => organ.freq;
|
||||
.5 => organ.gain;
|
||||
1 => organ.noteOn;
|
||||
|
||||
80::ms => now;
|
||||
}
|
||||
else
|
||||
{
|
||||
0 => organ.noteOff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
// name: mouse-fm.ck
|
||||
// desc: uses first X/Y axes of a mouse to control mf and index for FM
|
||||
// author: Spencer Salazar
|
||||
|
||||
// which mouse
|
||||
0 => int device;
|
||||
// get from command line
|
||||
if( me.args() ) me.arg(0) => Std.atoi => device;
|
||||
|
||||
// modulator to carrier
|
||||
SinOsc m => SinOsc c => Envelope e => dac;
|
||||
|
||||
// carrier frequency
|
||||
220 => c.freq;
|
||||
// modulator frequency
|
||||
550 => m.freq;
|
||||
// index of modulation
|
||||
1000 => m.gain;
|
||||
|
||||
// phase modulation is FM synthesis (sync is 2)
|
||||
2 => c.sync;
|
||||
|
||||
// attack
|
||||
10::ms => e.duration;
|
||||
.5 => e.gain;
|
||||
// variables
|
||||
int base;
|
||||
float a0;
|
||||
float a1;
|
||||
float a2;
|
||||
int count;
|
||||
|
||||
// start things
|
||||
set( base, a0, a1, a2 );
|
||||
|
||||
// hid objects
|
||||
Hid hi;
|
||||
HidMsg msg;
|
||||
|
||||
// try
|
||||
if( !hi.openMouse( device ) ) me.exit();
|
||||
<<< "mouse '" + hi.name() + "' ready...", "" >>>;
|
||||
|
||||
// infinite time loop
|
||||
while( true )
|
||||
{
|
||||
// wait on event
|
||||
hi => now;
|
||||
// loop over messages
|
||||
while( hi.recv( msg ) )
|
||||
{
|
||||
if( msg.isMouseMotion() )
|
||||
{
|
||||
msg.deltaX * .001 + a0 => a0;
|
||||
//else if( msg.which == 1 ) msg.fdata => a1;
|
||||
msg.deltaY * .001 + a1 => a1;
|
||||
set( base, a0, a1, a2 );
|
||||
}
|
||||
|
||||
else if( msg.isButtonDown() )
|
||||
{
|
||||
msg.which => base;
|
||||
count++;
|
||||
if( count == 1 ) e.keyOn();
|
||||
set( base, a0, a1, a2 );
|
||||
}
|
||||
|
||||
else if( msg.isButtonUp() )
|
||||
{
|
||||
msg.which => base;
|
||||
count--;
|
||||
if( !count ) e.keyOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// mapping function
|
||||
fun void set( int base, float v0, float v1, float v2 )
|
||||
{
|
||||
// modulator frequency
|
||||
( 500 + 5*base + ( 500 * v0) ) => m.freq;
|
||||
// carrier frequency
|
||||
( 220 + (220 * v2) ) => c.freq;
|
||||
// index of modulation
|
||||
( 1000 * (v1+1) ) => m.gain;
|
||||
<<< "carrier:", c.freq(), "modulator:", m.freq(), "index:", m.gain() >>>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user