add function to get number of tempos found in SMF tempo map
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 16 Dec 2016 10:43:41 +0000 (10:43 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 16 Dec 2016 10:43:41 +0000 (10:43 +0000)
libs/evoral/src/libsmf/smf.h
libs/evoral/src/libsmf/smf_tempo.c

index 2be80a571cfb455dfee3691b795d6f8ab409f1a1..82647779e8e5fb45d33a6dc5b8193e03d1ce0db3 100644 (file)
@@ -404,6 +404,7 @@ int smf_save(smf_t *smf, FILE *file) WARN_UNUSED_RESULT;
 /* Routines for manipulating smf_tempo_t. */
 smf_tempo_t *smf_get_tempo_by_pulses(const smf_t *smf, size_t pulses) WARN_UNUSED_RESULT;
 smf_tempo_t *smf_get_tempo_by_seconds(const smf_t *smf, double seconds) WARN_UNUSED_RESULT;
+int          smf_get_tempo_count (const smf_t *smf) WARN_UNUSED_RESULT;
 smf_tempo_t *smf_get_tempo_by_number(const smf_t *smf, size_t number) WARN_UNUSED_RESULT;
 smf_tempo_t *smf_get_last_tempo(const smf_t *smf) WARN_UNUSED_RESULT;
 
index c172314815249188f95d7ce7fd27458e01e86230..b2549d55111a874abaec7c9338a16ae6fe87ab23 100644 (file)
@@ -253,6 +253,16 @@ smf_create_tempo_map_and_compute_seconds(smf_t *smf)
        /* Not reached. */
 }
 
+int
+smf_get_tempo_count (const smf_t *smf)
+{
+       if (!smf->tempo_array) {
+               return 0;
+       }
+
+       return smf->tempo_array->len;
+}
+
 smf_tempo_t *
 smf_get_tempo_by_number(const smf_t *smf, size_t number)
 {