当前位置: 首页>>代码示例>>C++>>正文


C++ Alg_seq_ptr::set_real_dur方法代码示例

本文整理汇总了C++中Alg_seq_ptr::set_real_dur方法的典型用法代码示例。如果您正苦于以下问题:C++ Alg_seq_ptr::set_real_dur方法的具体用法?C++ Alg_seq_ptr::set_real_dur怎么用?C++ Alg_seq_ptr::set_real_dur使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Alg_seq_ptr的用法示例。


在下文中一共展示了Alg_seq_ptr::set_real_dur方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parse

bool Alg_midifile_reader::parse()
{
    channel_offset = 0;
    seq->convert_to_beats();
    midifile();
    seq->set_real_dur(seq->get_time_map()->beat_to_time(seq->get_beat_dur()));
    return midifile_error != 0;
}
开发者ID:amitkumar3968,项目名称:csound,代码行数:8,代码来源:allegrosmfrd.cpp

示例2: parse


//.........这里部分代码省略.........
                }
            }
            // a case analysis:
            // Key < 128 implies pitch unless pitch is explicitly given
            // Pitch implies Key unless key is explicitly given,
            // Pitch is rounded to nearest integer to determine the Key
            //    if necessary, so MIDI files will lose the pitch fraction
            // A-G is a Pitch specification (therefore it implies Key)
            //   K60 P60 -- both are specified, use 'em
            //   K60 P60 C4 -- overconstrained, an error
            //   K60 C4 -- OK, but K60 is already implied by C4
            //   K60 -- OK, pitch is 60
            //   C4 P60 -- over constrained
            //   P60 -- OK, key is 60
            //   P60.1 -- OK, key is 60
            //   C4 -- OK, key is 60, pitch is 60
            //   <nothing> -- OK, key and pitch from before
            //   K200 P60 -- ok, pitch is 60
            //   K200 with neither P60 nor C4 uses 
            //       pitch from before

            // figure out what the key/instance is:
            if (new_key_flag) { // it was directly specified
                key = new_key;
            } else if (new_pitch_flag) {
                // pitch was specified, but key was not; get key from pitch
                key = (int) (new_pitch + 0.5); // round to integer key number
            }
            if (new_pitch_flag) {
                pitch = new_pitch;
            } else if (key < 128 && new_key_flag) {
                // no explicit pitch, but key < 128, so it implies pitch
                pitch = key;
                new_pitch_flag = true;
            }
            // now we've acquired new parameters
            // if (it is a note, then enter the note
            if (valid) {
                // change tempo or beat
                attributes = process_attributes(attributes, time);
                // if there's a duration or pitch, make a note:
                if (new_pitch_flag || dur_flag) {
                    Alg_note_ptr note_ptr = new Alg_note;
                    note_ptr->chan = voice;
                    note_ptr->time = time;
                    note_ptr->dur = dur;
                    note_ptr->set_identifier(key);
                    note_ptr->pitch = (float) pitch;
                    note_ptr->loud = (float) loud;
                    note_ptr->parameters = attributes;
                    seq->add_event(note_ptr, track_num); // sort later
                    if (seq->get_real_dur() < (time + dur)) seq->set_real_dur(time + dur);
                } else {
                    int update_key = -1;
                    // key must appear explicitly; otherwise
                    //    update applies to channel
                    if (new_key_flag) {
                        update_key = key;
                    }
                    if (loud_flag) {
                        Alg_update_ptr new_upd = new Alg_update;
                        new_upd->chan = voice;
                        new_upd->time = time;
                        new_upd->set_identifier(update_key);
                        new_upd->parameter.set_attr(symbol_table.insert_string("loudr"));
                        new_upd->parameter.r = pitch;
                        seq->add_event(new_upd, track_num);
                        if (seq->get_real_dur() < time) seq->set_real_dur(time);
                    }
                    if (attributes) {
                        while (attributes) {
                            Alg_update_ptr new_upd = new Alg_update;
                            new_upd->chan = voice;
                            new_upd->time = time;
                            new_upd->set_identifier(update_key);
                            new_upd->parameter = attributes->parm;
                            seq->add_event(new_upd, track_num);
                            Alg_parameters_ptr p = attributes;
                            attributes = attributes->next;
                            p->parm.s = NULL; // so we don't delete the string
                            delete p;
                        }
                    }
                }
                if (next_flag) {
                    time = time + next;
                } else if (dur_flag || new_pitch_flag) { // a note: incr by dur
                    time = time + dur;
                }
            }
        }
        readline();
    }
    if (!error_flag) { // why not convert even if there was an error? -RBD
        seq->convert_to_seconds(); // make sure format is correct
    }
    // real_dur is valid, translate to beat_dur
    seq->set_beat_dur((seq->get_time_map())->time_to_beat(seq->get_real_dur()));
    return error_flag;
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:101,代码来源:allegrord.cpp

示例3: readline


//.........这里部分代码省略.........
                }
            }
            // a case analysis:
            // Key < 128 counts as both key and pitch
            // A-G implies pitch AND key unless key given too
            //   K60 P60 -- both are specified, use 'em
            //   K60 P60 C4 -- overconstrained, an error
            //   K60 C4 -- overconstrained
            //   K60 -- OK, pitch is 60
            //   C4 P60 -- over constrained
            //   P60 -- OK, key is from before, pitch is 60
            //   C4 -- OK, key is 60, pitch is 60
            //   <nothing> -- OK, key and pitch from before
            //   K200 with P60 ok, pitch is 60
            //   K200 with neither P60 nor C4 uses 
            //       pitch from before
            // figure out what the key/instance is:
            if (new_key_flag) { // it was directly specified
                key = new_key;
                if (key < 128 && new_note_flag) {
                    parse_error("", 0, "Pitch specified twice");
                }
            } else if (new_note_flag) { // "A"-"G" used
                key = new_note;
            }
            if (new_pitch_flag) {
                pitch = new_pitch;
            } else if (key < 128) {
                pitch = key;
            }
            // now we've acquired new parameters
            // if (it is a note, then enter the note
            if (valid) {
                // change tempo or beat
                attributes = process_attributes(attributes, time);
                // if there's a duration or pitch, make a note:
                if (new_pitch_flag || dur_flag || new_note_flag) {
                    new_key_flag = false;
                    new_pitch_flag = false;
                    Alg_note_ptr note_ptr = new Alg_note;
                    note_ptr->chan = voice;
                    note_ptr->time = time;
                    note_ptr->dur = dur;
                    note_ptr->set_identifier(key);
                    note_ptr->pitch = pitch;
                    note_ptr->loud = loud;
                    note_ptr->parameters = attributes;
                    seq->add_event(note_ptr, track_num); // sort later
                    if (seq->get_real_dur() < (time + dur)) seq->set_real_dur(time + dur);
                } else {
                    int update_key = -1;
                    // key or pitch must appear explicitly; otherwise
                    //    update applies to channel
                    if (new_key_flag || new_pitch_flag) {
                        update_key = key;
                    }
                    if (loud_flag) {
                        Alg_update_ptr new_upd = new Alg_update;
                        new_upd->chan = voice;
                        new_upd->time = time;
                        new_upd->set_identifier(update_key);
                        new_upd->parameter.set_attr(symbol_table.insert_string("loudr"));
                        new_upd->parameter.r = pitch;
                        seq->add_event(new_upd, track_num);
                        if (seq->get_real_dur() < time) seq->set_real_dur(time);
                    }
                    if (attributes) {
                        while (attributes) {
                            Alg_update_ptr new_upd = new Alg_update;
                            new_upd->chan = voice;
                            new_upd->time = time;
                            new_upd->set_identifier(update_key);
                            new_upd->parameter = attributes->parm;
                            seq->add_event(new_upd, track_num);
                            Alg_parameters_ptr p = attributes;
                            attributes = attributes->next;
                            p->parm.s = NULL; // so we don't delete the string
                            delete p;
                        }
                    }
                }
                if (next_flag) {
                    time = time + next;
                } else if (dur_flag) {
                    time = time + dur;
                }
            }
        }
        readline();
    }
    //print "Finished reading score"
    if (!error_flag) {
        seq->convert_to_seconds(); // make sure format is correct
        // seq->notes.sort('event_greater_than');
    }
    // real_dur is valid, translate to beat_dur
    seq->set_beat_dur((seq->get_time_map())->time_to_beat(seq->get_real_dur()));
    // print "parse returns error_flag", error_flag
    return error_flag;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,代码来源:allegrord.cpp


注:本文中的Alg_seq_ptr::set_real_dur方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。