// ---------------------------------------------------------------- subupdate -- void SPECTEQ2::subupdate() { // NB: update EQ table, so that live table draw will work double p[15]; update(p, 15, 1 << 3 | 1 << 8 | 1 << 9 | 1 << 10 | 1 << 12 | 1 << 14); set_oamp(p[3]); set_freqrange(p[9], p[10], "EQ"); set_wet(bool(p[12]) ? 0.0f : 1.0f); if (_nargs > 14) set_pan(p[14]); }
int SPECTEQ2::getargs(double p[], int n_args) { if (n_args < 9) return usage(); set_fftlen(int(p[4])); set_window_len(int(p[5])); set_window_pfield_index(6); set_overlap(int(p[7])); set_inchan(int(p[13])); set_pan(0.5f); // default, maybe overridden in doupdate return 0; }
int SPECTACLE2::getargs(double p[], int n_args) { if (n_args < 13) return usage(); set_iamp_pfield_index(4); set_fftlen(int(p[6])); set_window_len(int(p[7])); set_window_pfield_index(8); set_overlap(int(p[9])); set_wet(1.0f); // default, maybe overridden in doupdate set_inchan(int(p[19])); set_pan(0.5f); // default, maybe overridden in doupdate return 0; }
void Channel::play(SoundData * data, int loop) { stop(); id = data->id; data->load(&sound); if (sound == NULL) { std::cout << "Ignored play" << std::endl; return; } set_volume(volume); set_pan(pan); if (frequency != 0) set_frequency(frequency); sound->set_loop(loop == 0); if (loop > 1) std::cout << "Invalid number of loops (" << loop << ")" << std::endl; sound->play(); }
// ---------------------------------------------------------------- subupdate -- void SPECTACLE2::subupdate() { // NB: update EQ, deltime, fdback tables, so that live table draw will work, // and so that we can retrieve changing monolithic values instead of tables. // NB: input amp is updated in base class. double p[21]; update(p, 21, 1 << 3 | 1 << 10 | 1 << 11 | 1 << 12 | 1 << 13 | 1 << 14 | 1 << 15 | 1 << 16 | 1 << 18 | 1 << 20); set_oamp(p[3]); set_eq_freqrange(p[13], p[14]); set_freqrange(p[15], p[16]); if (_nargs > 18) set_wet(p[18]); if (_nargs > 20) set_pan(p[20]); if (_eqtable == NULL) _eqconst = p[10]; if (_deltimetable == NULL) _deltimeconst = p[11]; if (_feedbacktable == NULL) _feedbackconst = p[12]; }
int TSend::set_state( const QDomNode & node ) { Project* project = pm().get_project(); if (!project) { printf("TSend::set_state: Oh boy, no project?? Can't restore state without a project running!!\n"); return -1; } QDomElement e = node.toElement(); m_id = e.attribute("id", "0").toLongLong(); qint64 busId = e.attribute("bus", "0").toLongLong(); QString type = e.attribute("type", ""); QString busName = e.attribute("busname", "No Busname in Project file"); set_gain(e.attribute("gain", "1.0").toFloat()); set_pan(e.attribute("pan", "0.00").toFloat()); if (type == "post") { m_type = POSTSEND; } else if (type == "pre") { m_type = PRESEND; } else { // default to post send if no type was stored m_type = POSTSEND; } m_bus = project->get_audio_bus(busId); if (!m_bus) { printf("TSend::set_state: Project didn't return my Bus (%s)!\n", busName.toAscii().data()); return -1; } return 1; }
int main( int argc, char *argv[]) { char cmdstr[80]; int status, i; xbee_serial_t XBEE_SERPORT; target_t *target = NULL; memset( target_list, 0, sizeof target_list); parse_serial_arguments( argc, argv, &XBEE_SERPORT); // initialize the serial and device layer for this XBee device if (xbee_dev_init( &my_xbee, &XBEE_SERPORT, NULL, NULL)) { printf( "Failed to initialize device.\n"); return 0; } // replace ZDO cluster table with one that intercepts Device Annce messages sample_endpoints.zdo.cluster_table = zdo_clusters; // Initialize the WPAN layer of the XBee device driver. This layer enables // endpoints and clusters, and is required for all ZigBee layers. xbee_wpan_init( &my_xbee, &sample_endpoints.zdo); // Initialize the AT Command layer for this XBee device and have the // driver query it for basic information (hardware version, firmware version, // serial number, IEEE address, etc.) xbee_cmd_init_device( &my_xbee); printf( "Waiting for driver to query the XBee device...\n"); do { xbee_dev_tick( &my_xbee); status = xbee_cmd_query_status( &my_xbee); } while (status == -EBUSY); if (status) { printf( "Error %d waiting for query to complete.\n", status); } // report on the settings xbee_dev_dump_settings( &my_xbee, XBEE_DEV_DUMP_FLAG_DEFAULT); // set Profile ID for our Basic Client Cluster endpoint sample_endpoints.zcl.profile_id = profile_id; print_help(); puts( "searching for Commissioning Servers"); find_devices(); while (1) { while (xbee_readline( cmdstr, sizeof cmdstr) == -EAGAIN) { wpan_tick( &my_xbee.wpan_dev); } if (! strcmpi( cmdstr, "quit")) { return 0; } else if (! strcmpi( cmdstr, "help") || ! strcmp( cmdstr, "?")) { print_help(); } else if (! strncmpi( cmdstr, "profile ", 8)) { profile_id = strtoul( &cmdstr[8], NULL, 16); printf( "Profile ID set to 0x%04x\n", profile_id); sample_endpoints.zcl.profile_id = profile_id; } else if (! strcmpi( cmdstr, "find")) { find_devices(); } else if (! strcmpi( cmdstr, "target")) { puts( " #: --IEEE Address--- Ver. --------Application Name--------" " ---Date Code----"); for (i = 0; i < target_index; ++i) { print_target( i); } puts( "End of List"); } else if (! strncmpi( cmdstr, "target ", 7)) { i = (int) strtoul( &cmdstr[7], NULL, 10); if (target_index == 0) { printf( "error, no targets in list, starting search now...\n"); find_devices(); } else if (i < 0 || i >= target_index) { printf( "error, index %d is invalid (must be 0 to %u)\n", i, target_index - 1); } else { target = &target_list[i]; puts( "set target to:"); print_target( i); } } else if (! strcmpi( cmdstr, "save")) { restart_target( target, TRUE); } else if (! strcmpi( cmdstr, "cancel")) { restart_target( target, FALSE); } else if (! strcmpi( cmdstr, "default")) { default_target( target); } else if (! strcmpi( cmdstr, "deploy")) { set_pan( target, &network_deploy); } else if (! strncmpi( cmdstr, "deploy ", 7)) { if (cmdstr[7] == 'r') { puts( "deploy as router"); network_deploy.startup_control = ZCL_COMM_STARTUP_JOINED; } else if (cmdstr[7] == 'c') { puts( "deploy as coordinator"); network_deploy.startup_control = ZCL_COMM_STARTUP_COORDINATOR; } set_pan( target, &network_deploy); } else if (! strcmpi( cmdstr, "comm")) { set_pan( target, &network_comm); } else if (! strncmpi( cmdstr, "AT", 2)) { process_command( &my_xbee, &cmdstr[2]); } else { printf( "unknown command: '%s'\n", cmdstr); } } }
/* * @brief The main thread run, receiving and processing messages in an infinite * loop */ static void *run(void *arg) { (void) arg; msg_init_queue(msg_buffer, TRANSCEIVER_MSG_BUFFER_SIZE); while (1) { DEBUG("transceiver: Waiting for next message\n"); msg_t m; msg_receive(&m); /* only makes sense for messages for upper layers */ transceiver_command_t *cmd = (transceiver_command_t *) m.content.ptr; DEBUG("transceiver: Transceiver: Message received, type: %02X\n", m.type); switch (m.type) { case RCV_PKT_CC1020: case RCV_PKT_CC1100: case RCV_PKT_CC2420: case RCV_PKT_MC1322X: case RCV_PKT_NATIVE: case RCV_PKT_AT86RF231: receive_packet(m.type, m.content.value); break; case SND_PKT: response = send_packet(cmd->transceivers, cmd->data); m.content.value = response; msg_reply(&m, &m); break; case GET_CHANNEL: *((int32_t *) cmd->data) = get_channel(cmd->transceivers); msg_reply(&m, &m); break; case SET_CHANNEL: *((int32_t *) cmd->data) = set_channel(cmd->transceivers, cmd->data); msg_reply(&m, &m); break; case GET_ADDRESS: *((radio_address_t *) cmd->data) = get_address(cmd->transceivers); msg_reply(&m, &m); break; case SET_ADDRESS: *((radio_address_t *) cmd->data) = set_address(cmd->transceivers, cmd->data); msg_reply(&m, &m); break; case GET_LONG_ADDR: *((transceiver_eui64_t *) cmd->data) = get_long_addr(cmd->transceivers); msg_reply(&m, &m); break; case SET_LONG_ADDR: *((transceiver_eui64_t *) cmd->data) = set_long_addr(cmd->transceivers, cmd->data); msg_reply(&m, &m); break; case SET_MONITOR: set_monitor(cmd->transceivers, cmd->data); break; case POWERDOWN: powerdown(cmd->transceivers); break; case SWITCH_RX: switch_to_rx(cmd->transceivers); break; case GET_PAN: *((int32_t *) cmd->data) = get_pan(cmd->transceivers); msg_reply(&m, &m); break; case SET_PAN: *((int32_t *) cmd->data) = set_pan(cmd->transceivers, cmd->data); msg_reply(&m, &m); break; #ifdef DBG_IGNORE case DBG_IGN: *((int16_t *) cmd->data) = ignore_add(cmd->transceivers, cmd->data); msg_reply(&m, &m); break; #endif default: DEBUG("transceiver: Unknown message received\n"); break; } } return NULL; }