本文整理汇总了C++中DmxBuffer::Blackout方法的典型用法代码示例。如果您正苦于以下问题:C++ DmxBuffer::Blackout方法的具体用法?C++ DmxBuffer::Blackout怎么用?C++ DmxBuffer::Blackout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DmxBuffer
的用法示例。
在下文中一共展示了DmxBuffer::Blackout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void *ThreadedUsbReceiver::Run() {
DmxBuffer buffer;
buffer.Blackout();
if (!m_usb_handle) {
return NULL;
}
while (1) {
{
ola::thread::MutexLocker locker(&m_term_mutex);
if (m_term) {
break;
}
}
bool buffer_updated = false;
if (!ReceiveBuffer(m_usb_handle, &buffer, &buffer_updated)) {
OLA_WARN << "Receive failed, stopping thread...";
break;
}
if (buffer_updated) {
{
ola::thread::MutexLocker locker(&m_data_mutex);
m_buffer.Set(buffer);
}
if (m_receive_callback.get()) {
m_plugin_adaptor->Execute(m_receive_callback.get());
}
}
}
libusb_release_interface(m_usb_handle, m_interface_number);
libusb_close(m_usb_handle);
return NULL;
}
示例2: testBlackout
/*
* Test that Blackout() works
*/
void DmxBufferTest::testBlackout() {
DmxBuffer buffer;
OLA_ASSERT_TRUE(buffer.Blackout());
uint8_t *result = new uint8_t[DMX_UNIVERSE_SIZE];
uint8_t *zero = new uint8_t[DMX_UNIVERSE_SIZE];
unsigned int result_length = DMX_UNIVERSE_SIZE;
memset(zero, 0, DMX_UNIVERSE_SIZE);
buffer.Get(result, &result_length);
OLA_ASSERT_EQ((unsigned int) DMX_UNIVERSE_SIZE, result_length);
OLA_ASSERT_EQ(0, memcmp(zero, result, result_length));
delete[] result;
delete[] zero;
buffer.Reset();
OLA_ASSERT_EQ(0u, buffer.Size());
}
示例3: main
int main(int argc, char* argv[]) {
ola::AppInit(&argc, argv, "", "Run the E1.31 load test.");
if (FLAGS_universes == 0 || FLAGS_fps == 0)
return -1;
unsigned int fps = min(1000u, static_cast<unsigned int>(FLAGS_fps));
uint16_t universes = FLAGS_universes;
DmxBuffer output;
output.Blackout();
Interface iface;
{
auto_ptr<InterfacePicker> picker(InterfacePicker::NewPicker());
if (!picker->ChooseInterface(&iface, FLAGS_interface.str())) {
return -1;
}
}
ArtNetNodeOptions options;
options.always_broadcast = true;
SelectServer ss;
ArtNetNode node(iface, &ss, options);
for (uint16_t i = 0; i < universes; i++) {
if (!node.SetInputPortUniverse(i, i)) {
OLA_WARN << "Failed to set port";
}
}
if (!node.Start())
return -1;
ss.RegisterRepeatingTimeout(
1000 / fps,
NewCallback(&SendFrames, &node, &output, universes));
cout << "Starting loadtester: " << universes << " universe(s), " << fps
<< " fps" << endl;
ss.Run();
}
示例4: Init
/*
* Setup the monitoring console
*/
bool DmxMonitor::Init() {
/* set up ola connection */
if (!m_client.Setup()) {
printf("error: %s", strerror(errno));
return false;
}
OlaCallbackClient *client = m_client.GetClient();
client->SetDmxCallback(ola::NewCallback(this, &DmxMonitor::NewDmx));
client->RegisterUniverse(
m_universe,
ola::REGISTER,
ola::NewSingleCallback(this, &DmxMonitor::RegisterComplete));
/* init curses */
m_window = initscr();
if (!m_window) {
printf("unable to open main-screen\n");
return false;
}
savetty();
start_color();
noecho();
raw();
keypad(m_window, TRUE);
m_client.GetSelectServer()->AddReadDescriptor(&m_stdin_descriptor);
m_stdin_descriptor.SetOnData(
ola::NewCallback(this, &DmxMonitor::StdinReady));
m_client.GetSelectServer()->RegisterRepeatingTimeout(
500,
ola::NewCallback(this, &DmxMonitor::CheckDataLoss));
CalcScreenGeometry();
ChangePalette(m_palette_number);
m_buffer.Blackout();
timerclear(&m_last_data);
DrawScreen();
return true;
}