add RtMini test/library (works under Windows)
minor cleanups
This commit is contained in:
29
btgui/MidiTest/LICENSE.txt
Normal file
29
btgui/MidiTest/LICENSE.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
|
||||
|
||||
RtMidi: realtime MIDI i/o C++ classes
|
||||
Copyright (c) 2003-2012 Gary P. Scavone
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Any person wishing to distribute modifications to the Software is
|
||||
asked to send the modifications to the original developer so that
|
||||
they can be incorporated into the canonical version. This is,
|
||||
however, not a binding provision of this license.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
60
btgui/MidiTest/RtError.h
Normal file
60
btgui/MidiTest/RtError.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/************************************************************************/
|
||||
/*! \class RtError
|
||||
\brief Exception handling class for RtAudio & RtMidi.
|
||||
|
||||
The RtError class is quite simple but it does allow errors to be
|
||||
"caught" by RtError::Type. See the RtAudio and RtMidi
|
||||
documentation to know which methods can throw an RtError.
|
||||
|
||||
*/
|
||||
/************************************************************************/
|
||||
|
||||
#ifndef RTERROR_H
|
||||
#define RTERROR_H
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
class RtError : public std::exception
|
||||
{
|
||||
public:
|
||||
//! Defined RtError types.
|
||||
enum Type {
|
||||
WARNING, /*!< A non-critical error. */
|
||||
DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */
|
||||
UNSPECIFIED, /*!< The default, unspecified error type. */
|
||||
NO_DEVICES_FOUND, /*!< No devices found on system. */
|
||||
INVALID_DEVICE, /*!< An invalid device ID was specified. */
|
||||
MEMORY_ERROR, /*!< An error occured during memory allocation. */
|
||||
INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
|
||||
INVALID_USE, /*!< The function was called incorrectly. */
|
||||
DRIVER_ERROR, /*!< A system driver error occured. */
|
||||
SYSTEM_ERROR, /*!< A system error occured. */
|
||||
THREAD_ERROR /*!< A thread error occured. */
|
||||
};
|
||||
|
||||
//! The constructor.
|
||||
RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
|
||||
|
||||
//! The destructor.
|
||||
virtual ~RtError( void ) throw() {}
|
||||
|
||||
//! Prints thrown error message to stderr.
|
||||
virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
|
||||
|
||||
//! Returns the thrown error message type.
|
||||
virtual const Type& getType(void) const throw() { return type_; }
|
||||
|
||||
//! Returns the thrown error message string.
|
||||
virtual const std::string& getMessage(void) const throw() { return message_; }
|
||||
|
||||
//! Returns the thrown error message as a c-style string.
|
||||
virtual const char* what( void ) const throw() { return message_.c_str(); }
|
||||
|
||||
protected:
|
||||
std::string message_;
|
||||
Type type_;
|
||||
};
|
||||
|
||||
#endif
|
||||
3747
btgui/MidiTest/RtMidi.cpp
Normal file
3747
btgui/MidiTest/RtMidi.cpp
Normal file
File diff suppressed because it is too large
Load Diff
675
btgui/MidiTest/RtMidi.h
Normal file
675
btgui/MidiTest/RtMidi.h
Normal file
@@ -0,0 +1,675 @@
|
||||
/**********************************************************************/
|
||||
/*! \class RtMidi
|
||||
\brief An abstract base class for realtime MIDI input/output.
|
||||
|
||||
This class implements some common functionality for the realtime
|
||||
MIDI input/output subclasses RtMidiIn and RtMidiOut.
|
||||
|
||||
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
|
||||
|
||||
RtMidi: realtime MIDI i/o C++ classes
|
||||
Copyright (c) 2003-2012 Gary P. Scavone
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Any person wishing to distribute modifications to the Software is
|
||||
asked to send the modifications to the original developer so that
|
||||
they can be incorporated into the canonical version. This is,
|
||||
however, not a binding provision of this license.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
/*!
|
||||
\file RtMidi.h
|
||||
*/
|
||||
|
||||
// RtMidi: Version 2.0.1
|
||||
|
||||
#ifndef RTMIDI_H
|
||||
#define RTMIDI_H
|
||||
|
||||
#include "RtError.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class RtMidi
|
||||
{
|
||||
public:
|
||||
|
||||
//! MIDI API specifier arguments.
|
||||
enum Api {
|
||||
UNSPECIFIED, /*!< Search for a working compiled API. */
|
||||
MACOSX_CORE, /*!< Macintosh OS-X Core Midi API. */
|
||||
LINUX_ALSA, /*!< The Advanced Linux Sound Architecture API. */
|
||||
UNIX_JACK, /*!< The Jack Low-Latency MIDI Server API. */
|
||||
WINDOWS_MM, /*!< The Microsoft Multimedia MIDI API. */
|
||||
WINDOWS_KS, /*!< The Microsoft Kernel Streaming MIDI API. */
|
||||
RTMIDI_DUMMY /*!< A compilable but non-functional API. */
|
||||
};
|
||||
|
||||
//! A static function to determine the available compiled MIDI APIs.
|
||||
/*!
|
||||
The values returned in the std::vector can be compared against
|
||||
the enumerated list values. Note that there can be more than one
|
||||
API compiled for certain operating systems.
|
||||
*/
|
||||
static void getCompiledApi( std::vector<RtMidi::Api> &apis ) throw();
|
||||
|
||||
//! Pure virtual openPort() function.
|
||||
virtual void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi" ) ) = 0;
|
||||
|
||||
//! Pure virtual openVirtualPort() function.
|
||||
virtual void openVirtualPort( const std::string portName = std::string( "RtMidi" ) ) = 0;
|
||||
|
||||
//! Pure virtual getPortCount() function.
|
||||
virtual unsigned int getPortCount() = 0;
|
||||
|
||||
//! Pure virtual getPortName() function.
|
||||
virtual std::string getPortName( unsigned int portNumber = 0 ) = 0;
|
||||
|
||||
//! Pure virtual closePort() function.
|
||||
virtual void closePort( void ) = 0;
|
||||
|
||||
//! A basic error reporting function for RtMidi classes.
|
||||
static void error( RtError::Type type, std::string errorString );
|
||||
|
||||
protected:
|
||||
|
||||
RtMidi() {};
|
||||
virtual ~RtMidi() {};
|
||||
};
|
||||
|
||||
/**********************************************************************/
|
||||
/*! \class RtMidiIn
|
||||
\brief A realtime MIDI input class.
|
||||
|
||||
This class provides a common, platform-independent API for
|
||||
realtime MIDI input. It allows access to a single MIDI input
|
||||
port. Incoming MIDI messages are either saved to a queue for
|
||||
retrieval using the getMessage() function or immediately passed to
|
||||
a user-specified callback function. Create multiple instances of
|
||||
this class to connect to more than one MIDI device at the same
|
||||
time. With the OS-X and Linux ALSA MIDI APIs, it is also possible
|
||||
to open a virtual input port to which other MIDI software clients
|
||||
can connect.
|
||||
|
||||
by Gary P. Scavone, 2003-2012.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
// **************************************************************** //
|
||||
//
|
||||
// RtMidiIn and RtMidiOut class declarations.
|
||||
//
|
||||
// RtMidiIn / RtMidiOut are "controllers" used to select an available
|
||||
// MIDI input or output interface. They present common APIs for the
|
||||
// user to call but all functionality is implemented by the classes
|
||||
// MidiInApi, MidiOutApi and their subclasses. RtMidiIn and RtMidiOut
|
||||
// each create an instance of a MidiInApi or MidiOutApi subclass based
|
||||
// on the user's API choice. If no choice is made, they attempt to
|
||||
// make a "logical" API selection.
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
class MidiInApi;
|
||||
class MidiOutApi;
|
||||
|
||||
class RtMidiIn : public RtMidi
|
||||
{
|
||||
public:
|
||||
|
||||
//! User callback function type definition.
|
||||
typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData);
|
||||
|
||||
//! Default constructor that allows an optional api, client name and queue size.
|
||||
/*!
|
||||
An exception will be thrown if a MIDI system initialization
|
||||
error occurs. The queue size defines the maximum number of
|
||||
messages that can be held in the MIDI queue (when not using a
|
||||
callback function). If the queue size limit is reached,
|
||||
incoming messages will be ignored.
|
||||
|
||||
If no API argument is specified and multiple API support has been
|
||||
compiled, the default order of use is JACK, ALSA (Linux) and CORE,
|
||||
Jack (OS-X).
|
||||
*/
|
||||
RtMidiIn( RtMidi::Api api=UNSPECIFIED,
|
||||
const std::string clientName = std::string( "RtMidi Input Client"),
|
||||
unsigned int queueSizeLimit = 100 );
|
||||
|
||||
//! If a MIDI connection is still open, it will be closed by the destructor.
|
||||
~RtMidiIn ( void ) throw();
|
||||
|
||||
//! Returns the MIDI API specifier for the current instance of RtMidiIn.
|
||||
RtMidi::Api getCurrentApi( void ) throw();
|
||||
|
||||
//! Open a MIDI input connection.
|
||||
/*!
|
||||
An optional port number greater than 0 can be specified.
|
||||
Otherwise, the default or first port found is opened.
|
||||
*/
|
||||
void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Input" ) );
|
||||
|
||||
//! Create a virtual input port, with optional name, to allow software connections (OS X and ALSA only).
|
||||
/*!
|
||||
This function creates a virtual MIDI input port to which other
|
||||
software applications can connect. This type of functionality
|
||||
is currently only supported by the Macintosh OS-X and Linux ALSA
|
||||
APIs (the function does nothing for the other APIs).
|
||||
*/
|
||||
void openVirtualPort( const std::string portName = std::string( "RtMidi Input" ) );
|
||||
|
||||
//! Set a callback function to be invoked for incoming MIDI messages.
|
||||
/*!
|
||||
The callback function will be called whenever an incoming MIDI
|
||||
message is received. While not absolutely necessary, it is best
|
||||
to set the callback function before opening a MIDI port to avoid
|
||||
leaving some messages in the queue.
|
||||
*/
|
||||
void setCallback( RtMidiCallback callback, void *userData = 0 );
|
||||
|
||||
//! Cancel use of the current callback function (if one exists).
|
||||
/*!
|
||||
Subsequent incoming MIDI messages will be written to the queue
|
||||
and can be retrieved with the \e getMessage function.
|
||||
*/
|
||||
void cancelCallback();
|
||||
|
||||
//! Close an open MIDI connection (if one exists).
|
||||
void closePort( void );
|
||||
|
||||
//! Return the number of available MIDI input ports.
|
||||
unsigned int getPortCount();
|
||||
|
||||
//! Return a string identifier for the specified MIDI input port number.
|
||||
/*!
|
||||
An empty string is returned if an invalid port specifier is provided.
|
||||
*/
|
||||
std::string getPortName( unsigned int portNumber = 0 );
|
||||
|
||||
//! Specify whether certain MIDI message types should be queued or ignored during input.
|
||||
/*!
|
||||
o By default, MIDI timing and active sensing messages are ignored
|
||||
during message input because of their relative high data rates.
|
||||
MIDI sysex messages are ignored by default as well. Variable
|
||||
values of "true" imply that the respective message type will be
|
||||
ignored.
|
||||
*/
|
||||
void ignoreTypes( bool midiSysex = true, bool midiTime = true, bool midiSense = true );
|
||||
|
||||
//! Fill the user-provided vector with the data bytes for the next available MIDI message in the input queue and return the event delta-time in seconds.
|
||||
/*!
|
||||
This function returns immediately whether a new message is
|
||||
available or not. A valid message is indicated by a non-zero
|
||||
vector size. An exception is thrown if an error occurs during
|
||||
message retrieval or an input connection was not previously
|
||||
established.
|
||||
*/
|
||||
double getMessage( std::vector<unsigned char> *message );
|
||||
|
||||
protected:
|
||||
void openMidiApi( RtMidi::Api api, const std::string clientName, unsigned int queueSizeLimit );
|
||||
MidiInApi *rtapi_;
|
||||
|
||||
};
|
||||
|
||||
/**********************************************************************/
|
||||
/*! \class RtMidiOut
|
||||
\brief A realtime MIDI output class.
|
||||
|
||||
This class provides a common, platform-independent API for MIDI
|
||||
output. It allows one to probe available MIDI output ports, to
|
||||
connect to one such port, and to send MIDI bytes immediately over
|
||||
the connection. Create multiple instances of this class to
|
||||
connect to more than one MIDI device at the same time. With the
|
||||
OS-X and Linux ALSA MIDI APIs, it is also possible to open a
|
||||
virtual port to which other MIDI software clients can connect.
|
||||
|
||||
by Gary P. Scavone, 2003-2012.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
class RtMidiOut : public RtMidi
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor that allows an optional client name.
|
||||
/*!
|
||||
An exception will be thrown if a MIDI system initialization error occurs.
|
||||
|
||||
If no API argument is specified and multiple API support has been
|
||||
compiled, the default order of use is JACK, ALSA (Linux) and CORE,
|
||||
Jack (OS-X).
|
||||
*/
|
||||
RtMidiOut( RtMidi::Api api=UNSPECIFIED,
|
||||
const std::string clientName = std::string( "RtMidi Output Client") );
|
||||
|
||||
//! The destructor closes any open MIDI connections.
|
||||
~RtMidiOut( void ) throw();
|
||||
|
||||
//! Returns the MIDI API specifier for the current instance of RtMidiOut.
|
||||
RtMidi::Api getCurrentApi( void ) throw();
|
||||
|
||||
//! Open a MIDI output connection.
|
||||
/*!
|
||||
An optional port number greater than 0 can be specified.
|
||||
Otherwise, the default or first port found is opened. An
|
||||
exception is thrown if an error occurs while attempting to make
|
||||
the port connection.
|
||||
*/
|
||||
void openPort( unsigned int portNumber = 0, const std::string portName = std::string( "RtMidi Output" ) );
|
||||
|
||||
//! Close an open MIDI connection (if one exists).
|
||||
void closePort( void );
|
||||
|
||||
//! Create a virtual output port, with optional name, to allow software connections (OS X and ALSA only).
|
||||
/*!
|
||||
This function creates a virtual MIDI output port to which other
|
||||
software applications can connect. This type of functionality
|
||||
is currently only supported by the Macintosh OS-X and Linux ALSA
|
||||
APIs (the function does nothing with the other APIs). An
|
||||
exception is thrown if an error occurs while attempting to create
|
||||
the virtual port.
|
||||
*/
|
||||
void openVirtualPort( const std::string portName = std::string( "RtMidi Output" ) );
|
||||
|
||||
//! Return the number of available MIDI output ports.
|
||||
unsigned int getPortCount( void );
|
||||
|
||||
//! Return a string identifier for the specified MIDI port type and number.
|
||||
/*!
|
||||
An empty string is returned if an invalid port specifier is provided.
|
||||
*/
|
||||
std::string getPortName( unsigned int portNumber = 0 );
|
||||
|
||||
//! Immediately send a single message out an open MIDI output port.
|
||||
/*!
|
||||
An exception is thrown if an error occurs during output or an
|
||||
output connection was not previously established.
|
||||
*/
|
||||
void sendMessage( std::vector<unsigned char> *message );
|
||||
|
||||
protected:
|
||||
void openMidiApi( RtMidi::Api api, const std::string clientName );
|
||||
MidiOutApi *rtapi_;
|
||||
};
|
||||
|
||||
|
||||
// **************************************************************** //
|
||||
//
|
||||
// MidiInApi / MidiOutApi class declarations.
|
||||
//
|
||||
// Subclasses of MidiInApi and MidiOutApi contain all API- and
|
||||
// OS-specific code necessary to fully implement the RtMidi API.
|
||||
//
|
||||
// Note that MidiInApi and MidiOutApi are abstract base classes and
|
||||
// cannot be explicitly instantiated. RtMidiIn and RtMidiOut will
|
||||
// create instances of a MidiInApi or MidiOutApi subclass.
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
class MidiInApi
|
||||
{
|
||||
public:
|
||||
|
||||
MidiInApi( unsigned int queueSizeLimit );
|
||||
virtual ~MidiInApi( void );
|
||||
virtual RtMidi::Api getCurrentApi( void ) = 0;
|
||||
virtual void openPort( unsigned int portNumber, const std::string portName ) = 0;
|
||||
virtual void openVirtualPort( const std::string portName ) = 0;
|
||||
virtual void closePort( void ) = 0;
|
||||
void setCallback( RtMidiIn::RtMidiCallback callback, void *userData );
|
||||
void cancelCallback( void );
|
||||
virtual unsigned int getPortCount( void ) = 0;
|
||||
virtual std::string getPortName( unsigned int portNumber ) = 0;
|
||||
virtual void ignoreTypes( bool midiSysex, bool midiTime, bool midiSense );
|
||||
double getMessage( std::vector<unsigned char> *message );
|
||||
|
||||
// A MIDI structure used internally by the class to store incoming
|
||||
// messages. Each message represents one and only one MIDI message.
|
||||
struct MidiMessage {
|
||||
std::vector<unsigned char> bytes;
|
||||
double timeStamp;
|
||||
|
||||
// Default constructor.
|
||||
MidiMessage()
|
||||
:bytes(0), timeStamp(0.0) {}
|
||||
};
|
||||
|
||||
struct MidiQueue {
|
||||
unsigned int front;
|
||||
unsigned int back;
|
||||
unsigned int size;
|
||||
unsigned int ringSize;
|
||||
MidiMessage *ring;
|
||||
|
||||
// Default constructor.
|
||||
MidiQueue()
|
||||
:front(0), back(0), size(0), ringSize(0) {}
|
||||
};
|
||||
|
||||
// The RtMidiInData structure is used to pass private class data to
|
||||
// the MIDI input handling function or thread.
|
||||
struct RtMidiInData {
|
||||
MidiQueue queue;
|
||||
MidiMessage message;
|
||||
unsigned char ignoreFlags;
|
||||
bool doInput;
|
||||
bool firstMessage;
|
||||
void *apiData;
|
||||
bool usingCallback;
|
||||
void *userCallback;
|
||||
void *userData;
|
||||
bool continueSysex;
|
||||
|
||||
// Default constructor.
|
||||
RtMidiInData()
|
||||
: ignoreFlags(7), doInput(false), firstMessage(true),
|
||||
apiData(0), usingCallback(false), userCallback(0), userData(0),
|
||||
continueSysex(false) {}
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void initialize( const std::string& clientName ) = 0;
|
||||
RtMidiInData inputData_;
|
||||
|
||||
void *apiData_;
|
||||
bool connected_;
|
||||
std::string errorString_;
|
||||
};
|
||||
|
||||
class MidiOutApi
|
||||
{
|
||||
public:
|
||||
|
||||
MidiOutApi( void );
|
||||
virtual ~MidiOutApi( void );
|
||||
virtual RtMidi::Api getCurrentApi( void ) = 0;
|
||||
virtual void openPort( unsigned int portNumber, const std::string portName ) = 0;
|
||||
virtual void openVirtualPort( const std::string portName ) = 0;
|
||||
virtual void closePort( void ) = 0;
|
||||
virtual unsigned int getPortCount( void ) = 0;
|
||||
virtual std::string getPortName( unsigned int portNumber ) = 0;
|
||||
virtual void sendMessage( std::vector<unsigned char> *message ) = 0;
|
||||
|
||||
protected:
|
||||
virtual void initialize( const std::string& clientName ) = 0;
|
||||
|
||||
void *apiData_;
|
||||
bool connected_;
|
||||
std::string errorString_;
|
||||
};
|
||||
|
||||
// **************************************************************** //
|
||||
//
|
||||
// Inline RtMidiIn and RtMidiOut definitions.
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
inline RtMidi::Api RtMidiIn :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
|
||||
inline void RtMidiIn :: openPort( unsigned int portNumber, const std::string portName ) { return rtapi_->openPort( portNumber, portName ); }
|
||||
inline void RtMidiIn :: openVirtualPort( const std::string portName ) { return rtapi_->openVirtualPort( portName ); }
|
||||
inline void RtMidiIn :: closePort( void ) { return rtapi_->closePort(); }
|
||||
inline void RtMidiIn :: setCallback( RtMidiCallback callback, void *userData ) { return rtapi_->setCallback( callback, userData ); }
|
||||
inline void RtMidiIn :: cancelCallback( void ) { return rtapi_->cancelCallback(); }
|
||||
inline unsigned int RtMidiIn :: getPortCount( void ) { return rtapi_->getPortCount(); }
|
||||
inline std::string RtMidiIn :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
|
||||
inline void RtMidiIn :: ignoreTypes( bool midiSysex, bool midiTime, bool midiSense ) { return rtapi_->ignoreTypes( midiSysex, midiTime, midiSense ); }
|
||||
inline double RtMidiIn :: getMessage( std::vector<unsigned char> *message ) { return rtapi_->getMessage( message ); }
|
||||
|
||||
inline RtMidi::Api RtMidiOut :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
|
||||
inline void RtMidiOut :: openPort( unsigned int portNumber, const std::string portName ) { return rtapi_->openPort( portNumber, portName ); }
|
||||
inline void RtMidiOut :: openVirtualPort( const std::string portName ) { return rtapi_->openVirtualPort( portName ); }
|
||||
inline void RtMidiOut :: closePort( void ) { return rtapi_->closePort(); }
|
||||
inline unsigned int RtMidiOut :: getPortCount( void ) { return rtapi_->getPortCount(); }
|
||||
inline std::string RtMidiOut :: getPortName( unsigned int portNumber ) { return rtapi_->getPortName( portNumber ); }
|
||||
inline void RtMidiOut :: sendMessage( std::vector<unsigned char> *message ) { return rtapi_->sendMessage( message ); }
|
||||
|
||||
// **************************************************************** //
|
||||
//
|
||||
// MidiInApi and MidiOutApi subclass prototypes.
|
||||
//
|
||||
// **************************************************************** //
|
||||
|
||||
#if !defined(__LINUX_ALSA__) && !defined(__UNIX_JACK__) && !defined(__MACOSX_CORE__) && !defined(__WINDOWS_MM__) && !defined(__WINDOWS_KS__)
|
||||
#define __RTMIDI_DUMMY__
|
||||
#endif
|
||||
|
||||
#if defined(__MACOSX_CORE__)
|
||||
|
||||
class MidiInCore: public MidiInApi
|
||||
{
|
||||
public:
|
||||
MidiInCore( const std::string clientName, unsigned int queueSizeLimit );
|
||||
~MidiInCore( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutCore: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
MidiOutCore( const std::string clientName );
|
||||
~MidiOutCore( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::MACOSX_CORE; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( std::vector<unsigned char> *message );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__UNIX_JACK__)
|
||||
|
||||
class MidiInJack: public MidiInApi
|
||||
{
|
||||
public:
|
||||
MidiInJack( const std::string clientName, unsigned int queueSizeLimit );
|
||||
~MidiInJack( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutJack: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
MidiOutJack( const std::string clientName );
|
||||
~MidiOutJack( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::UNIX_JACK; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( std::vector<unsigned char> *message );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__LINUX_ALSA__)
|
||||
|
||||
class MidiInAlsa: public MidiInApi
|
||||
{
|
||||
public:
|
||||
MidiInAlsa( const std::string clientName, unsigned int queueSizeLimit );
|
||||
~MidiInAlsa( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutAlsa: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
MidiOutAlsa( const std::string clientName );
|
||||
~MidiOutAlsa( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::LINUX_ALSA; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( std::vector<unsigned char> *message );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__WINDOWS_MM__)
|
||||
|
||||
class MidiInWinMM: public MidiInApi
|
||||
{
|
||||
public:
|
||||
MidiInWinMM( const std::string clientName, unsigned int queueSizeLimit );
|
||||
~MidiInWinMM( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutWinMM: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
MidiOutWinMM( const std::string clientName );
|
||||
~MidiOutWinMM( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_MM; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( std::vector<unsigned char> *message );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__WINDOWS_KS__)
|
||||
|
||||
class MidiInWinKS: public MidiInApi
|
||||
{
|
||||
public:
|
||||
MidiInWinKS( const std::string clientName, unsigned int queueSizeLimit );
|
||||
~MidiInWinKS( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_KS; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
class MidiOutWinKS: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
MidiOutWinKS( const std::string clientName );
|
||||
~MidiOutWinKS( void );
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::WINDOWS_KS; };
|
||||
void openPort( unsigned int portNumber, const std::string portName );
|
||||
void openVirtualPort( const std::string portName );
|
||||
void closePort( void );
|
||||
unsigned int getPortCount( void );
|
||||
std::string getPortName( unsigned int portNumber );
|
||||
void sendMessage( std::vector<unsigned char> *message );
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__RTMIDI_DUMMY__)
|
||||
|
||||
class MidiInDummy: public MidiInApi
|
||||
{
|
||||
public:
|
||||
MidiInDummy( const std::string clientName, unsigned int queueSizeLimit ) : MidiInApi( queueSizeLimit ) { errorString_ = "MidiInDummy: This class provides no functionality."; RtMidi::error( RtError::WARNING, errorString_ ); };
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; };
|
||||
void openPort( unsigned int portNumber, const std::string portName ) {};
|
||||
void openVirtualPort( const std::string portName ) {};
|
||||
void closePort( void ) {};
|
||||
unsigned int getPortCount( void ) { return 0; };
|
||||
std::string getPortName( unsigned int portNumber ) { return ""; };
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName ) {};
|
||||
};
|
||||
|
||||
class MidiOutDummy: public MidiOutApi
|
||||
{
|
||||
public:
|
||||
MidiOutDummy( const std::string clientName ) { errorString_ = "MidiOutDummy: This class provides no functionality."; RtMidi::error( RtError::WARNING, errorString_ ); };
|
||||
RtMidi::Api getCurrentApi( void ) { return RtMidi::RTMIDI_DUMMY; };
|
||||
void openPort( unsigned int portNumber, const std::string portName ) {};
|
||||
void openVirtualPort( const std::string portName ) {};
|
||||
void closePort( void ) {};
|
||||
unsigned int getPortCount( void ) { return 0; };
|
||||
std::string getPortName( unsigned int portNumber ) { return ""; };
|
||||
void sendMessage( std::vector<unsigned char> *message ) {};
|
||||
|
||||
protected:
|
||||
void initialize( const std::string& clientName ) {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
111
btgui/MidiTest/cmidiin.cpp
Normal file
111
btgui/MidiTest/cmidiin.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
//*****************************************//
|
||||
// cmidiin.cpp
|
||||
// by Gary Scavone, 2003-2004.
|
||||
//
|
||||
// Simple program to test MIDI input and
|
||||
// use of a user callback function.
|
||||
//
|
||||
//*****************************************//
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include "RtMidi.h"
|
||||
|
||||
void usage( void ) {
|
||||
// Error function in case of incorrect command-line
|
||||
// argument specifications.
|
||||
std::cout << "\nuseage: cmidiin <port>\n";
|
||||
std::cout << " where port = the device to use (default = 0).\n\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
void mycallback( double deltatime, std::vector< unsigned char > *message, void *userData )
|
||||
{
|
||||
unsigned int nBytes = message->size();
|
||||
for ( unsigned int i=0; i<nBytes; i++ )
|
||||
std::cout << "Byte " << i << " = " << (int)message->at(i) << ", ";
|
||||
if ( nBytes > 0 )
|
||||
std::cout << "stamp = " << deltatime << std::endl;
|
||||
}
|
||||
|
||||
// This function should be embedded in a try/catch block in case of
|
||||
// an exception. It offers the user a choice of MIDI ports to open.
|
||||
// It returns false if there are no ports available.
|
||||
bool chooseMidiPort( RtMidiIn *rtmidi );
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
RtMidiIn *midiin = 0;
|
||||
|
||||
// Minimal command-line check.
|
||||
if ( argc > 2 ) usage();
|
||||
|
||||
try {
|
||||
|
||||
// RtMidiIn constructor
|
||||
midiin = new RtMidiIn();
|
||||
|
||||
// Call function to select port.
|
||||
if ( chooseMidiPort( midiin ) == false ) goto cleanup;
|
||||
|
||||
// Set our callback function. This should be done immediately after
|
||||
// opening the port to avoid having incoming messages written to the
|
||||
// queue instead of sent to the callback function.
|
||||
midiin->setCallback( &mycallback );
|
||||
|
||||
// Don't ignore sysex, timing, or active sensing messages.
|
||||
midiin->ignoreTypes( false, false, false );
|
||||
|
||||
std::cout << "\nReading MIDI input ... press <enter> to quit.\n";
|
||||
char input;
|
||||
std::cin.get(input);
|
||||
|
||||
} catch ( RtError &error ) {
|
||||
error.printMessage();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
delete midiin;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool chooseMidiPort( RtMidiIn *rtmidi )
|
||||
{
|
||||
std::cout << "\nWould you like to open a virtual input port? [y/N] ";
|
||||
|
||||
std::string keyHit;
|
||||
std::getline( std::cin, keyHit );
|
||||
if ( keyHit == "y" ) {
|
||||
rtmidi->openVirtualPort();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string portName;
|
||||
unsigned int i = 0, nPorts = rtmidi->getPortCount();
|
||||
if ( nPorts == 0 ) {
|
||||
std::cout << "No input ports available!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( nPorts == 1 ) {
|
||||
std::cout << "\nOpening " << rtmidi->getPortName() << std::endl;
|
||||
}
|
||||
else {
|
||||
for ( i=0; i<nPorts; i++ ) {
|
||||
portName = rtmidi->getPortName(i);
|
||||
std::cout << " Input port #" << i << ": " << portName << '\n';
|
||||
}
|
||||
|
||||
do {
|
||||
std::cout << "\nChoose a port number: ";
|
||||
std::cin >> i;
|
||||
} while ( i >= nPorts );
|
||||
}
|
||||
|
||||
std::getline( std::cin, keyHit ); // used to clear out stdin
|
||||
rtmidi->openPort( i );
|
||||
|
||||
return true;
|
||||
}
|
||||
33
btgui/MidiTest/premake4.lua
Normal file
33
btgui/MidiTest/premake4.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
project "rtMidiTest"
|
||||
|
||||
kind "ConsoleApp"
|
||||
|
||||
-- defines { }
|
||||
|
||||
targetdir "../../bin"
|
||||
|
||||
includedirs
|
||||
{
|
||||
".",
|
||||
}
|
||||
|
||||
|
||||
-- links { }
|
||||
|
||||
|
||||
files {
|
||||
"**.cpp",
|
||||
"**.h"
|
||||
}
|
||||
if os.is("Windows") then
|
||||
links {"winmm"}
|
||||
defines {"__WINDOWS_MM__", "WIN32"}
|
||||
end
|
||||
|
||||
if os.is("Linux") then
|
||||
end
|
||||
|
||||
if os.is("MacOSX") then
|
||||
links{"Cocoa.framework"}
|
||||
end
|
||||
@@ -208,7 +208,6 @@ void btDefaultMouseMoveCallback( float x, float y)
|
||||
|
||||
void btDefaultKeyboardCallback(int key, int state)
|
||||
{
|
||||
printf("world2\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -91,22 +91,23 @@
|
||||
|
||||
|
||||
if not _OPTIONS["ios"] then
|
||||
include "../opencl/vector_add_simplified"
|
||||
include "../opencl/vector_add"
|
||||
include "../opencl/basic_initialize"
|
||||
include "../opencl/parallel_primitives/host"
|
||||
include "../opencl/parallel_primitives/test"
|
||||
include "../opencl/parallel_primitives/benchmark"
|
||||
include "../opencl/lds_bank_conflict"
|
||||
include "../opencl/reduce"
|
||||
include "../opencl/gpu_broadphase/test"
|
||||
include "../opencl/gpu_sat/test"
|
||||
include "../demo/gpudemo"
|
||||
include "../btgui/MidiTest"
|
||||
-- include "../opencl/vector_add_simplified"
|
||||
-- include "../opencl/vector_add"
|
||||
-- include "../opencl/basic_initialize"
|
||||
-- include "../opencl/parallel_primitives/host"
|
||||
-- include "../opencl/parallel_primitives/test"
|
||||
-- include "../opencl/parallel_primitives/benchmark"
|
||||
-- include "../opencl/lds_bank_conflict"
|
||||
-- include "../opencl/reduce"
|
||||
-- include "../opencl/gpu_broadphase/test"
|
||||
-- include "../opencl/gpu_sat/test"
|
||||
include "../btgui/Gwen"
|
||||
include "../btgui/GwenOpenGLTest"
|
||||
include "../btgui/OpenGLTrueTypeFont"
|
||||
include "../btgui/OpenGLWindow"
|
||||
include "../demo/gpudemo"
|
||||
include "../demo/ObjLoader"
|
||||
-- include "../btgui/OpenGLTrueTypeFont"
|
||||
-- include "../btgui/OpenGLWindow"
|
||||
-- include "../demo/ObjLoader"
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -32,20 +32,22 @@ public:
|
||||
float gapZ;
|
||||
GLInstancingRenderer* m_instancingRenderer;
|
||||
class btgWindowInterface* m_window;
|
||||
class GwenUserInterface* m_gui;
|
||||
|
||||
ConstructionInfo()
|
||||
:useOpenCL(true),
|
||||
preferredOpenCLPlatformIndex(-1),
|
||||
preferredOpenCLDeviceIndex(-1),
|
||||
arraySizeX(10),
|
||||
arraySizeY(20),
|
||||
arraySizeY(10),
|
||||
arraySizeZ(10),
|
||||
m_useConcaveMesh(false),
|
||||
gapX(14.3),
|
||||
gapY(14.0),
|
||||
gapZ(14.3),
|
||||
m_instancingRenderer(0),
|
||||
m_window(0)
|
||||
m_window(0),
|
||||
m_gui(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,22 +64,22 @@ btAlignedObjectArray<const char*> demoNames;
|
||||
int selectedDemo = 0;
|
||||
GpuDemo::CreateFunc* allDemos[]=
|
||||
{
|
||||
|
||||
GpuConvexScene::MyCreateFunc,
|
||||
ConcaveScene::MyCreateFunc,
|
||||
|
||||
GpuConvexScene::MyCreateFunc,
|
||||
GpuCompoundScene::MyCreateFunc,
|
||||
PairBench::MyCreateFunc,
|
||||
|
||||
|
||||
GpuRigidBodyDemo::MyCreateFunc,
|
||||
//GpuRigidBodyDemo::MyCreateFunc,
|
||||
|
||||
//BroadphaseBenchmark::CreateFunc,
|
||||
//GpuBoxDemo::CreateFunc,
|
||||
|
||||
PairBench::MyCreateFunc,
|
||||
|
||||
|
||||
ParticleDemo::MyCreateFunc,
|
||||
//ParticleDemo::MyCreateFunc,
|
||||
|
||||
|
||||
//SpheresDemo::CreateFunc,
|
||||
@@ -381,7 +381,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
args.GetCmdLineArgument("selected_demo",selectedDemo);
|
||||
|
||||
useNewBatchingKernel = args.CheckCmdLineFlag("new_batching");
|
||||
|
||||
if (args.CheckCmdLineFlag("new_batching"))
|
||||
{
|
||||
useNewBatchingKernel = true;
|
||||
}
|
||||
bool benchmark=args.CheckCmdLineFlag("benchmark");
|
||||
dump_timings=args.CheckCmdLineFlag("dump_timings");
|
||||
ci.useOpenCL = !args.CheckCmdLineFlag("disable_opencl");
|
||||
@@ -563,6 +567,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
ci.m_instancingRenderer = new GLInstancingRenderer(maxObjectCapacity);//render.getInstancingRenderer();
|
||||
ci.m_window = window;
|
||||
ci.m_gui = gui;
|
||||
ci.m_instancingRenderer->init();
|
||||
ci.m_instancingRenderer->InitShaders();
|
||||
|
||||
@@ -615,11 +620,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
window->startRendering();
|
||||
|
||||
char msg[1024];
|
||||
int numInstances = 0;//ci.m_instancingRenderer->getNumInstances();
|
||||
sprintf(msg,"Num objects = %d",numInstances);
|
||||
gui->setStatusBarMessage(msg,true);
|
||||
|
||||
glClearColor(0.6,0.6,0.6,1);
|
||||
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "gpu_rigidbody/host/btGpuNarrowPhase.h"
|
||||
#include "gpu_rigidbody/host/btConfig.h"
|
||||
#include "GpuRigidBodyDemoInternalData.h"
|
||||
#include "../gwenUserInterface.h"
|
||||
|
||||
|
||||
void GpuConvexScene::setupScene(const ConstructionInfo& ci)
|
||||
{
|
||||
@@ -85,5 +87,10 @@ void GpuConvexScene::setupScene(const ConstructionInfo& ci)
|
||||
//float camPos[4]={1,12.5,1.5,0};
|
||||
m_instancingRenderer->setCameraTargetPosition(camPos);
|
||||
m_instancingRenderer->setCameraDistance(120);
|
||||
|
||||
|
||||
|
||||
char msg[1024];
|
||||
int numInstances = index;
|
||||
sprintf(msg,"Num objects = %d",numInstances);
|
||||
ci.m_gui->setStatusBarMessage(msg,true);
|
||||
}
|
||||
@@ -549,6 +549,7 @@ cl_program btOpenCLUtils_compileCLProgramFromString(cl_context clContext, cl_dev
|
||||
strippedName = strip2(clFileNameForCaching,"\\");
|
||||
strippedName = strip2(strippedName,"/");
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
sprintf_s(binaryFileName,BT_MAX_STRING_LENGTH,"cache/%s.%s.%s.bin",strippedName, deviceName,driverVersion );
|
||||
#else
|
||||
|
||||
@@ -17,7 +17,7 @@ subject to the following restrictions:
|
||||
#include "Solver.h"
|
||||
|
||||
///useNewBatchingKernel is a rewritten kernel using just a single thread of the warp, for experiments
|
||||
bool useNewBatchingKernel = false;
|
||||
bool useNewBatchingKernel = true;
|
||||
|
||||
#define SOLVER_SETUP_KERNEL_PATH "opencl/gpu_rigidbody/kernels/solverSetup.cl"
|
||||
#define SOLVER_SETUP2_KERNEL_PATH "opencl/gpu_rigidbody/kernels/solverSetup2.cl"
|
||||
|
||||
@@ -18,7 +18,7 @@ struct btConfig
|
||||
int m_maxTriConvexPairCapacity;
|
||||
|
||||
btConfig()
|
||||
:m_maxConvexBodies(128*1024),
|
||||
:m_maxConvexBodies(32*1024),
|
||||
m_maxConvexShapes(8192),
|
||||
m_maxVerticesPerFace(64),
|
||||
m_maxFacesPerShape(64),
|
||||
|
||||
@@ -66,7 +66,7 @@ btGpuJacobiSolver::btGpuJacobiSolver(cl_context ctx, cl_device_id device, cl_com
|
||||
const char* additionalMacros="";
|
||||
const char* solverUtilsSource = solverUtilsCL;
|
||||
{
|
||||
cl_program solverUtilsProg= btOpenCLUtils::compileCLProgramFromString( ctx, device, 0, &pErrNum,additionalMacros, SOLVER_UTILS_KERNEL_PATH,true);
|
||||
cl_program solverUtilsProg= btOpenCLUtils::compileCLProgramFromString( ctx, device, solverUtilsSource, &pErrNum,additionalMacros, SOLVER_UTILS_KERNEL_PATH);
|
||||
btAssert(solverUtilsProg);
|
||||
m_data->m_countBodiesKernel = btOpenCLUtils::compileCLKernelFromString( ctx, device, solverUtilsSource, "CountBodiesKernel", &pErrNum, solverUtilsProg,additionalMacros );
|
||||
btAssert(m_data->m_countBodiesKernel);
|
||||
|
||||
@@ -113,8 +113,8 @@ m_totalContactsOut(m_context, m_queue)
|
||||
if (1)
|
||||
{
|
||||
const char* srcBvh = bvhTraversalKernelCL;
|
||||
//cl_program bvhTraversalProg = btOpenCLUtils::compileCLProgramFromString(m_context,m_device,srcBvh,&errNum,"","opencl/gpu_sat/kernels/bvhTraversal.cl");
|
||||
cl_program bvhTraversalProg = btOpenCLUtils::compileCLProgramFromString(m_context,m_device,0,&errNum,"","opencl/gpu_sat/kernels/bvhTraversal.cl", true);
|
||||
cl_program bvhTraversalProg = btOpenCLUtils::compileCLProgramFromString(m_context,m_device,srcBvh,&errNum,"","opencl/gpu_sat/kernels/bvhTraversal.cl");
|
||||
//cl_program bvhTraversalProg = btOpenCLUtils::compileCLProgramFromString(m_context,m_device,0,&errNum,"","opencl/gpu_sat/kernels/bvhTraversal.cl", true);
|
||||
btAssert(errNum==CL_SUCCESS);
|
||||
|
||||
m_bvhTraversalKernel = btOpenCLUtils::compileCLKernelFromString(m_context, m_device,srcBvh, "bvhTraversalKernel",&errNum,bvhTraversalProg,"-g");
|
||||
|
||||
Reference in New Issue
Block a user