aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-01-17 14:02:42 -0800
committerJosh Blum <josh@joshknows.com>2011-01-17 14:02:42 -0800
commit81dc70a6217f3d35dcf477a44c0151a6bc56e5a9 (patch)
tree1b06beefb97cb2cf58dba2baed7a1f8e47c4c6cd /host/examples
parent07710a5f68f0b313f4257551dd469d7ccf938213 (diff)
downloaduhd-81dc70a6217f3d35dcf477a44c0151a6bc56e5a9.tar.gz
uhd-81dc70a6217f3d35dcf477a44c0151a6bc56e5a9.tar.bz2
uhd-81dc70a6217f3d35dcf477a44c0151a6bc56e5a9.zip
examples: init metadata with time before loop begins
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/tx_timed_samples.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp
index 074b13e81..6d6aa7010 100644
--- a/host/examples/tx_timed_samples.cpp
+++ b/host/examples/tx_timed_samples.cpp
@@ -84,15 +84,17 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//allocate data to send
std::vector<std::complex<float> > buff(samps_per_packet, std::complex<float>(ampl, ampl));
+ uhd::tx_metadata_t md;
+ md.time_spec = uhd::time_spec_t(seconds_in_future);
+
//send the data in multiple packets
size_t num_packets = (total_num_samps+samps_per_packet-1)/samps_per_packet;
for (size_t i = 0; i < num_packets; i++){
- //setup the metadata flags and time spec
- uhd::tx_metadata_t md;
+
+ //setup the metadata flags per fragment
md.start_of_burst = (i == 0); //only first packet has SOB
md.end_of_burst = (i == num_packets-1); //only last packet has EOB
md.has_time_spec = (i == 0); //only first packet has time
- md.time_spec = uhd::time_spec_t(seconds_in_future);
size_t samps_to_send = std::min(total_num_samps - samps_per_packet*i, samps_per_packet);