本文整理汇总了C++中RtMidiIn::getError方法的典型用法代码示例。如果您正苦于以下问题:C++ RtMidiIn::getError方法的具体用法?C++ RtMidiIn::getError怎么用?C++ RtMidiIn::getError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RtMidiIn
的用法示例。
在下文中一共展示了RtMidiIn::getError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rtmidi_in_cancel_callback
void rtmidi_in_cancel_callback (RtMidiInPtr device)
{
#if defined(__NO_EXCEPTIONS__)
RtMidiIn* rtm = (RtMidiIn*) device->ptr;
rtm->resetError();
rtm->cancelCallback ();
if (rtm->isError()) {
device->ok = false;
device->msg = rtm->getError().what ();
}
else {
delete (CallbackProxyUserData*) device->data;
device->data = 0;
}
#else
try {
((RtMidiIn*) device->ptr)->cancelCallback ();
delete (CallbackProxyUserData*) device->data;
device->data = 0;
} catch (const RtMidiError & err) {
device->ok = false;
device->msg = err.what ();
}
#endif
}
示例2: rtmidi_in_get_message
double rtmidi_in_get_message (RtMidiInPtr device,
unsigned char *message,
size_t *size)
{
#if defined(__NO_EXCEPTIONS__)
// FIXME: use allocator to achieve efficient buffering
std::vector<unsigned char> v;
RtMidiIn* rtm = (RtMidiIn*) device->ptr;
rtm->resetError();
double ret = rtm->getMessage (&v);
if (rtm->isError()) {
device->ok = false;
device->msg = rtm->getError().what ();
return -1;
}
if (v.size () > 0 && v.size() <= *size) {
memcpy (message, v.data (), (int) v.size ());
}
*size = v.size();
return ret;
#else
try {
// FIXME: use allocator to achieve efficient buffering
std::vector<unsigned char> v;
double ret = ((RtMidiIn*) device->ptr)->getMessage (&v);
if (v.size () > 0 && v.size() <= *size) {
memcpy (message, v.data (), (int) v.size ());
}
*size = v.size();
return ret;
}
catch (const RtMidiError & err) {
device->ok = false;
device->msg = err.what ();
return -1;
}
catch (...) {
device->ok = false;
device->msg = "Unknown error";
return -1;
}
#endif
}
示例3: rtmidi_in_create
RtMidiInPtr rtmidi_in_create (enum RtMidiApi api, const char *clientName, unsigned int queueSizeLimit)
{
std::string name = clientName;
RtMidiWrapper* wrp = new RtMidiWrapper;
#if defined(__NO_EXCEPTIONS__)
RtMidiIn* rIn = new RtMidiIn ((RtMidi::Api) api, name, queueSizeLimit);
if (rIn->isError()) {
wrp->ptr = 0;
wrp->data = 0;
wrp->ok = false;
wrp->msg = rIn->getError().what ();
}
else {
wrp->ptr = (void*) rIn;
wrp->data = 0;
wrp->ok = true;
wrp->msg = "";
}
#else
try {
RtMidiIn* rIn = new RtMidiIn ((RtMidi::Api) api, name, queueSizeLimit);
wrp->ptr = (void*) rIn;
wrp->data = 0;
wrp->ok = true;
wrp->msg = "";
} catch (const RtMidiError & err) {
wrp->ptr = 0;
wrp->data = 0;
wrp->ok = false;
wrp->msg = err.what ();
}
#endif
return wrp;
}
示例4: rtmidi_in_create_default
/* RtMidiIn API */
RtMidiInPtr rtmidi_in_create_default ()
{
RtMidiWrapper* wrp = new RtMidiWrapper;
#if defined(__NO_EXCEPTIONS__)
RtMidiIn* rIn = new RtMidiIn ();
if (rIn->isError()) {
wrp->ptr = 0;
wrp->data = 0;
wrp->ok = false;
wrp->msg = rIn->getError().what ();
}
else {
wrp->ptr = (void*) rIn;
wrp->data = 0;
wrp->ok = true;
wrp->msg = "";
}
#else
try {
RtMidiIn* rIn = new RtMidiIn ();
wrp->ptr = (void*) rIn;
wrp->data = 0;
wrp->ok = true;
wrp->msg = "";
} catch (const RtMidiError & err) {
wrp->ptr = 0;
wrp->data = 0;
wrp->ok = false;
wrp->msg = err.what ();
}
#endif
return wrp;
}
示例5: rtmidi_in_set_callback
void rtmidi_in_set_callback (RtMidiInPtr device, RtMidiCCallback callback, void *userData)
{
device->data = (void*) new CallbackProxyUserData (callback, userData);
#if defined(__NO_EXCEPTIONS__)
RtMidiIn* rtm = (RtMidiIn*) device->ptr;
rtm->resetError();
rtm->setCallback (callback_proxy, device->data);
if (rtm->isError()) {
device->ok = false;
device->msg = rtm->getError().what ();
delete (CallbackProxyUserData*) device->data;
device->data = 0;
}
#else
try {
((RtMidiIn*) device->ptr)->setCallback (callback_proxy, device->data);
} catch (const RtMidiError & err) {
device->ok = false;
device->msg = err.what ();
delete (CallbackProxyUserData*) device->data;
device->data = 0;
}
#endif
}
示例6: rtmidi_in_get_current_api
enum RtMidiApi rtmidi_in_get_current_api (RtMidiPtr device)
{
#if defined(__NO_EXCEPTIONS__)
RtMidiIn* rtm = (RtMidiIn*) device->ptr;
rtm->resetError();
RtMidiApi curApi = (RtMidiApi) rtm->getCurrentApi ();
if (rtm->isError()) {
device->ok = false;
device->msg = rtm->getError().what ();
return RT_MIDI_API_UNSPECIFIED;
}
return curApi;
#else
try {
return (RtMidiApi) ((RtMidiIn*) device->ptr)->getCurrentApi ();
} catch (const RtMidiError & err) {
device->ok = false;
device->msg = err.what ();
return RT_MIDI_API_UNSPECIFIED;
}
#endif
}