File_path 1
Group_change_req 1
Head_column 1
-Idealspacing 0
+Idealspacing 1
Ineq_constrained_qp 1
-Input_translator 0
+Input_translator 1
Item 1
Key_item 1
Lookup 1
+Line_spacer 1
Melodic_req 0
Midi_def 1
Mixed_qp 1
-Music 0
+Music 1
Music_iterator 1
My_lily_lexer 1
Note_head 1
-Note_performer 0
+Note_performer 1
Note_req 0
-PCol 0
+PCol 1
PScore 1
Paper_def 1
Paperdef 1
-Performer 0
-Request 0
+Performer 1
+Performer_group_performer 1
+Request 1
Request_iterator 1
Rest_collision 1
Rest_collision_engraver 1
Rest_req 1
Rhythmic_req 0
Score 1
-Score_column 0
+Score_column 1
Score_elem 1
-Score_engraver 0
-Score_performer 0
-Script_column 0
-Script_def 0
-Script_req 0
+Score_engraver 1
+Score_performer 1
+Script_column 1
+Script_def 1
+Script_req 1
Slur 1
Spacing_problem 1
Spanner 1
+Spring_spacer 1
Staff 1
Staff_commands 1
Stem 1
Stem_req 1
Symtable 1
Symtables 1
-Text_def 0
-Text_req 0
+Text_def 1
+Text_req 1
Time_description 1
-Voice 0
-Voice_element 0
+Voice 1
+Voice_element 1
Voice_element_iterator 1
Voice_iterator 1
Word_wrap 1
+pl 0.1.1.jcn1
+ - Audio{column,score,item,...}, more generic audio
+ - bf: Makefiles
+ - added empty flower/aclocal.m4?
+ - bf: mi2mu mudela version
+
pl 0.1.1
- {Horizontal, Vertical}_group. A score_element may be in at most one.
- This means Horizontal_group_item and Vertical_group_spanner need special support.
TOPLEVEL_PATCH_LEVEL = 1
# use to send patches, always empty for released version:
-TOPLEVEL_MY_PATCH_LEVEL =
+TOPLEVEL_MY_PATCH_LEVEL = .jcn1
#
SCRIPTS =
README_FILES = ONEWS NEWS README TODO
-EXTRA_DISTFILES= configure config.hh.in configure.in VERSION $(README_FILES) $(SCRIPTS) Flower-flags.make.in
+EXTRA_DISTFILES= configure config.hh.in configure.in aclocal.m4 VERSION $(README_FILES) $(SCRIPTS) Flower-flags.make.in
#
depth = ..
#
+# identify module:
+#
NAME = lilypond
+#
# generic variables:
#
include VERSION
#
-# identify module:
-#
-
-#
-
# descent order into subdirectories:
#
SUBDIRS = include
--- /dev/null
+/*
+ audio-column.cc -- implement Audio_column
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
+#include "audio-column.hh"
+#include "audio-item.hh"
+#include "audio-score.hh"
+
+#include "debug.hh"
+
+Audio_column::Audio_column( Moment at_mom )
+{
+ at_mom_ = at_mom;
+ audio_score_l_ = 0;
+}
+
+void
+Audio_column::add( Audio_item* l )
+{
+ audio_item_l_list_.bottom().add( l );
+ l->audio_column_l_ = this;
+}
+
+Moment
+Audio_column::at_mom() const
+{
+ return at_mom_;
+}
+
+void
+Audio_column::print() const
+{
+#ifndef NPRINT
+ mtor << "Audio_column {";
+ mtor << "at: " << at_mom_ << "\n";
+ mtor << "}\n";
+#endif
+}
+
--- /dev/null
+/*
+ audio-item.cc -- implement Audio items.
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+#include "audio-item.hh"
+#include "midi-item.hh"
+
+#if 0
+Audio_instrument::Audio_instrument( String instrument_str )
+ : Audio_item( 0 )
+{
+}
+#endif
+
+Audio_item::Audio_item( Request* req_l )
+{
+ audio_column_l_ = 0;
+ req_l_ = req_l;
+}
+
+Audio_key::Audio_key( Request* req_l )
+ : Audio_item( req_l )
+{
+}
+
+Midi_item*
+Audio_key::midi_item_p()
+{
+ return new Midi_key( this );
+}
+
+
+Audio_note::Audio_note( Request* req_l, bool on_b )
+ : Audio_item( req_l )
+{
+ on_b_ = on_b;
+}
+
+Midi_item*
+Audio_note::midi_item_p()
+{
+ return new Midi_note( this );
+}
+
+Audio_tempo::Audio_tempo( int per_minute_4_i )
+ : Audio_item( 0 )
+{
+ per_minute_4_i_ = per_minute_4_i;
+}
+
+Midi_item*
+Audio_tempo::midi_item_p()
+{
+ return new Midi_tempo( this );
+}
+
+Audio_meter::Audio_meter( Request* req_l )
+ : Audio_item( req_l )
+{
+}
+
+Midi_item*
+Audio_meter::midi_item_p()
+{
+ return new Midi_meter( this );
+}
+
+Audio_text::Audio_text( Audio_text::Type type, String text_str )
+ : Audio_item( 0 )
+{
+ text_str_ = text_str;
+ type_ = type;
+}
+
+Midi_item*
+Audio_text::midi_item_p()
+{
+ return new Midi_text( this );
+}
+
--- /dev/null
+/*
+ audio-score.cc -- implement Audio_score
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+*/
+
+#include "debug.hh"
+#include "midi-def.hh"
+#include "audio-column.hh"
+#include "audio-score.hh"
+
+Audio_score::Audio_score( Midi_def* l )
+{
+ midi_l_ = l;
+}
+
+void
+Audio_score::play( Audio_item* i, Audio_column* c )
+{
+ assert( c );
+ assert( i );
+
+ c->add( i );
+// typeset_element( i );
+}
+
+void
+Audio_score::add( Audio_column* p )
+{
+ p->audio_score_l_ = this;
+ audio_column_p_list_.bottom().add(p);
+}
+
+#if 0
+void
+Audio_score::output(Tex_stream &ts)
+{
+ ts << "\n "<< midi_l_->lookup_l()->texsetting << "%(Tex id)\n";
+ ts<< super_elem_l_->TeX_string();
+ ts << "\n\\EndLilyPondOutput";
+}
+#endif
+
+void
+Audio_score::print() const
+{
+#ifndef NPRINT
+ mtor << "Audio_score { ";
+ midi_l_->print();
+ mtor << "\ncolumns: ";
+ for ( PCursor<Audio_column*> i( audio_column_p_list_ ); i.ok(); i++ )
+ i->print();
+ mtor << "}\n";
+#endif
+}
+
+void
+Audio_score::process()
+{
+#if 0
+ clean_cols();
+ print();
+ *mlog << "Preprocessing elements... " <<flush;
+ preprocess();
+ *mlog << "\nCalculating column positions ... " <<flush;
+ calc_breaking();
+ *mlog << "\nPostprocessing elements..." << endl;
+ postprocess();
+#endif
+}
+
/*
- global-translators.cc -- implement
+ global-performers.cc -- implement
source file of the GNU LilyPond music typesetter
--- /dev/null
+/*
+ audio-column.hh -- declare Audio_column
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
+#ifndef AUDIO_COLUMN_HH
+#define AUDIO_COLUMN_HH
+
+#include "proto.hh"
+#include "plist.hh"
+#include "lily-proto.hh"
+#include "moment.hh"
+
+
+/**
+ generic audio grouped vertically.
+ */
+
+class Audio_column {
+public:
+ Audio_column( Moment at_mom );
+
+ void add( Audio_item* i_l );
+ Moment at_mom() const;
+ void print() const;
+
+ Link_list<Audio_item *> audio_item_l_list_;
+ Audio_score * audio_score_l_;
+
+private:
+ Audio_column( Audio_column const& );
+
+ Moment at_mom_;
+};
+
+
+#endif // AUDIO_COLUMN_HH
--- /dev/null
+/*
+ audio-item.hh -- declare Audio_items
+
+ (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
+#ifndef AUDIO_ITEM_HH
+#define AUDIO_ITEM_HH
+
+#include "lily-proto.hh"
+#include "string.hh"
+
+/**
+ Any piece of audio information.
+ We need virtual constructors,
+ let's try decentralised factory for specific audio implemenations.
+ */
+struct Audio_item {
+ Audio_item( Request* req_l );
+
+ /// Create a midi-item from myself.
+ virtual Midi_item* midi_item_p() = 0;
+
+#if 0
+ /// Not implemented. Anyone?
+ virtual Niff_item* niff_item_p() = 0;
+
+ /// Not implemented. Anyone?
+ virtual Cscore_item* score_item_p() = 0;
+#endif
+
+ Audio_column* audio_column_l_;
+ Request* req_l_;
+
+private:
+ Audio_item( Audio_item const& );
+ Audio_item& operator=( Audio_item const& );
+};
+
+struct Audio_key : public Audio_item {
+ Audio_key( Request* req_l );
+
+ virtual Midi_item* midi_item_p();
+};
+
+#if 0
+struct Audio_instrument : public Audio_item {
+ Audio_instrument( Request* req_l );
+};
+#endif
+
+struct Audio_note : public Audio_item {
+ Audio_note( Request* req_l, bool on_b );
+ virtual Midi_item* midi_item_p();
+ bool on_b_;
+};
+
+struct Audio_text : Audio_item {
+ enum Type {
+ TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
+ MARKER, CUE_POINT
+ };
+
+ Audio_text( Audio_text::Type type, String text_str );
+ virtual Midi_item* midi_item_p();
+
+ Type type_;
+ String text_str_;
+};
+
+struct Audio_tempo : Audio_item {
+ Audio_tempo( int per_minute_4_i );
+ virtual Midi_item* midi_item_p();
+
+ int per_minute_4_i_;
+};
+
+struct Audio_meter : Audio_item {
+ Audio_meter( Request* req_l );
+ virtual Midi_item* midi_item_p();
+};
+
+#endif // AUDIO_ITEM_HH
+
--- /dev/null
+/*
+ audio-score.hh -- declare Audio_score
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
+#ifndef AUDIO_SCORE_HH
+#define AUDIO_SCORE_HH
+
+#include "proto.hh"
+#include "parray.hh"
+#include "plist.hh"
+
+/** all stuff which goes onto midi. notes, signs, symbols in a score
+ #Audio_score# contains the items, the columns.
+
+ */
+
+class Audio_score {
+public:
+ Audio_score( Midi_def* );
+
+ void add( Audio_column* );
+
+// void output(Tex_stream &ts);
+
+ void play( Audio_item* i, Audio_column* c );
+ void print() const;
+ void process();
+
+ Pointer_list<Audio_column*> audio_column_p_list_;
+ Midi_def *midi_l_;
+};
+
+#endif // AUDIO_SCORE_HH
struct My_lily_lexer;
struct Absolute_dynamic_req;
struct Translator;
+struct Audio_column;
+struct Audio_item;
+struct Audio_key;
+struct Audio_meter;
+struct Audio_note;
+struct Audio_score;
+struct Audio_tempo;
struct Atom;
struct Bar;
struct Bar_engraver;
struct Midi_duration;
struct Midi_header;
struct Midi_item;
+struct Midi_key;
+struct Midi_meter;
+struct Midi_note;
struct Midi_output;
-struct Midi_pitch;
struct Midi_score;
struct Midi_stream;
+struct Midi_tempo;
struct Midi_track;
struct Mixed_qp;
struct Molecule;
-//
-// midiitem.hh -- part of GNU LilyPond
-//
-// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+/*
+ midi-item.hh -- declare Midi items
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
#ifndef MIDI_ITEM_HH
#define MIDI_ITEM_HH
#include "string.hh"
#include "lily-proto.hh"
-#include "virtual-methods.hh"
/**
Any piece of midi information.
Maybe use base classes for RIFF files?
*/
struct Midi_item {
- Midi_item() { }
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Midi_item( Audio_item* audio_item_l );
static String i2varint_str( int i );
- virtual void output_midi( Midi_stream& midi_stream_r ) const;
+ void output( Midi_stream* midi_stream_l ) const;
virtual String str() const = 0;
+
+ Audio_item* audio_item_l_;
+ int channel_i_;
+
private:
- Midi_item(Midi_item const&){}
- void operator=(Midi_item const&){}
+ Midi_item( Midi_item const& );
+ Midi_item& operator =( Midi_item const& );
};
struct Midi_key : public Midi_item {
- Midi_key( int accidentals_i, int minor_i );
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Midi_key( Audio_item* audio_item_l );
virtual String str() const;
- /* *************** */
- int accidentals_i_;
- int minor_i_;
};
/**
*/
struct Midi_instrument : public Midi_item {
Midi_instrument( int channel_i, String instrument_str );
- DECLARE_MY_RUNTIME_TYPEINFO;
virtual String str() const;
-
- int channel_i_;
- Byte program_byte_;
+ String instrument_str_;
};
struct Midi_note : public Midi_item {
@param #melreq_l# is the pitch.
*/
- Midi_note( Melodic_req* melreq_l, int channel_i, bool on_b );
- DECLARE_MY_RUNTIME_TYPEINFO;
+ Midi_note( Audio_item* audio_item_l );
virtual String str() const;
/* *************** */
int const c0_pitch_i_c_ = 60;
+ bool on_b_;
Byte dynamic_byte_;
-
- int channel_i_;
- int on_b_;
- int pitch_i_;
};
struct Midi_duration : public Midi_item {
Midi_duration( Real seconds_f );
- DECLARE_MY_RUNTIME_TYPEINFO;
virtual String str() const;
/* *************** */
struct Midi_chunk : Midi_item {
Midi_chunk();
- DECLARE_MY_RUNTIME_TYPEINFO;
void add( String str );
void set( String header_str, String data_str, String footer_str );
struct Midi_header : Midi_chunk {
/* *************** */
Midi_header( int format_i, int tracks_i, int clocks_per_4_i );
- DECLARE_MY_RUNTIME_TYPEINFO;
};
struct Midi_text : Midi_item {
-
enum Type {
TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC,
MARKER, CUE_POINT
};
+
+ Midi_text( Audio_item* audio_item_l );
Midi_text( Midi_text::Type type, String text_str );
- DECLARE_MY_RUNTIME_TYPEINFO;
virtual String str() const;
- /* *************** */
+
Type type_;
String text_str_;
-
};
struct Midi_tempo : Midi_item {
+ Midi_tempo( Audio_item* audio_item_l );
Midi_tempo( int per_minute_4_i );
- DECLARE_MY_RUNTIME_TYPEINFO;
virtual String str() const;
- /* *************** */
int per_minute_4_i_;
};
-struct Midi_time : Midi_item {
-
- Midi_time( int num_i, int den_i, int clocks_per_1_i );
- DECLARE_MY_RUNTIME_TYPEINFO;
+struct Midi_meter : Midi_item {
+ Midi_meter( Audio_item* audio_item_l );
virtual String str() const;
-
- /* *************** */
- int num_i_;
- int den_i_;
int clocks_per_1_i_;
};
int number_i_;
/* *************** */
Midi_track();
- DECLARE_MY_RUNTIME_TYPEINFO;
void add( int delta_time_i, String event );
void add( Moment delta_time_moment, Midi_item* mitem_l );
};
-#endif // MIDI_ITEM_HH //
-
+#endif // MIDI_ITEM_HH
virtual void do_removal_processing();
void creation_processing();
+
protected:
virtual void do_creation_processing();
virtual int get_tempo_i() const;
virtual void do_print() const;
virtual Moment get_mom() const;
- virtual void play_event( Midi_item* l );
-
+ virtual void play( Audio_item* p );
+ virtual void play( Midi_item* l );
};
#include "global-performers.hh"
virtual void set_score( Score* score_l );
virtual void start();
virtual int get_tempo_i() const;
- virtual void play_event(Midi_item*);
+ virtual void play(Audio_item*);
+ virtual void play(Midi_item*);
+
private:
void header(Midi_stream&);
Moment prev_mom_;
Moment now_mom_;
+ Audio_column* audio_column_l_;
- Link_array<Midi_item> midi_item_p_arr_;
+ Link_array<Midi_item> midi_item_l_arr_;
};
#endif // SCORE_PERFORMER_HH
Midi_def *midi_p_;
Music * music_p_;
PScore *pscore_p_;
+ Audio_score* audio_score_p_;
int errorlevel_i_;
/// construction
Score();
+ Score(Score const&);
~Score();
/// do everything except outputting to file
void print() const;
- Score(Score const&);
private:
-
-
-
void run_translator(Global_translator*);
void midi_output();
void paper_output();
String instrument_str();
protected:
- virtual void play_event( Midi_item* l );
+ virtual void play( Midi_item* l );
+ virtual void play( Audio_item* l );
virtual void do_removal_processing();
virtual void do_creation_processing();
// <ugh>
Moment midi_mom_;
Midi_track* midi_track_p_;
-
+ Pointer_list<Audio_item*> audio_item_p_list_;
int track_i_;
};
#include "key-performer.hh"
#include "command-request.hh"
-#include "midi-item.hh"
+#include "audio-item.hh"
void
Key_performer::process_requests()
{
- if ( key_req_l_ ) {
- int sharps_i = key_req_l_->sharps_i();
- int flats_i = key_req_l_->flats_i();
- // midi cannot handle non-conventional keys
- if ( !( flats_i && sharps_i ) ) {
- Midi_key k( sharps_i - flats_i, key_req_l_->minor_b() );
- play_event( &k );
- }
- key_req_l_ = 0;
- }
+ if ( key_req_l_ )
+ play( new Audio_key( key_req_l_ ) );
+ key_req_l_ = 0;
}
bool
#include "lyric-performer.hh"
#include "text-def.hh"
#include "musical-request.hh"
-#include "midi-item.hh"
+#include "audio-item.hh"
void
Lyric_performer::process_requests()
{
- if ( lreq_arr_.size() ) {
- Midi_text t( Midi_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_ );
- play_event( &t );
- }
-
+ if ( lreq_arr_.size() )
+ play( new Audio_text( Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_ ) );
lreq_arr_.clear();
}
#include "meter-performer.hh"
#include "command-request.hh"
-#include "midi-item.hh"
+#include "audio-item.hh"
IMPLEMENT_IS_TYPE_B1(Meter_performer,Performer);
ADD_THIS_PERFORMER(Meter_performer);
void
Meter_performer::process_requests()
{
- if ( meter_req_l_ ) {
- Midi_time m( meter_req_l_->beats_i_, meter_req_l_->one_beat_i_, 18 );
- play_event( &m );
- meter_req_l_ = 0;
- }
+ if ( meter_req_l_ )
+ play( new Audio_meter( meter_req_l_ ) );
+ meter_req_l_ = 0;
}
bool
/*
- midi-item.cc -- implement various midi items.
+ midi-item.cc -- implement Midi items.
source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
-#include <limits.h>
#include "proto.hh"
#include "plist.hh"
-#include "p-col.hh"
#include "debug.hh"
#include "misc.hh"
#include "string.hh"
#include "string-convert.hh"
-#include "request.hh"
+#include "command-request.hh"
#include "musical-request.hh"
-#include "music-list.hh"
#include "midi-item.hh"
#include "midi-stream.hh"
-
-
-IMPLEMENT_IS_TYPE_B(Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_key,Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_note, Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_duration, Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_chunk, Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_header, Midi_chunk);
-IMPLEMENT_IS_TYPE_B1(Midi_instrument, Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_tempo, Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_text, Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_time, Midi_item);
-IMPLEMENT_IS_TYPE_B1(Midi_track, Midi_chunk);
+#include "audio-item.hh"
Midi_chunk::Midi_chunk()
+ : Midi_item( 0 )
{
}
}
Midi_duration::Midi_duration( Real seconds_f )
+ : Midi_item( 0 )
{
seconds_f_ = seconds_f;
}
}
Midi_header::Midi_header( int format_i, int tracks_i, int clocks_per_4_i )
+ : Midi_chunk()
{
String str;
};
Midi_instrument::Midi_instrument( int channel_i, String instrument_str )
+ : Midi_item( 0 )
{
+ instrument_str_ = instrument_str;
+ instrument_str_.to_lower();
channel_i_ = channel_i;
- instrument_str.to_lower();
- for ( int i = 0; instrument_name_sz_a_[i]; i++ )
- if ( instrument_str == String(instrument_name_sz_a_[ i ] )) {
- program_byte_ = (Byte)i;
- break;
- }
}
String
Midi_instrument::str() const
{
- if ( program_byte_ ) {
+ // ugh, does not work...
+ return String( "" );
+ Byte program_byte = 0;
+ for ( int i = 0; instrument_name_sz_a_[i]; i++ )
+ if ( instrument_str_ == String(instrument_name_sz_a_[ i ] )) {
+ program_byte = (Byte)i;
+ break;
+ }
+ if ( program_byte ) {
String str = String( (char)( 0xc0 + channel_i_ ) );
- str += String( (char)program_byte_ );
+ str += String( (char)program_byte );
return str;
}
return String( "" );
}
+Midi_item::Midi_item( Audio_item* audio_item_l )
+{
+ audio_item_l_ = audio_item_l;
+ channel_i_ = 0;
+}
+
+void
+Midi_item::output( Midi_stream* midi_stream_l ) const
+{
+ *midi_stream_l << str();
+}
+
String
Midi_item::i2varint_str( int i )
{
return str;
}
-void
-Midi_item::output_midi( Midi_stream& midi_stream_r ) const
+Midi_key::Midi_key( Audio_item* audio_item_l )
+ : Midi_item( audio_item_l )
{
- midi_stream_r << str();
-}
-
-Midi_key::Midi_key( int accidentals_i, int minor_i )
-{
- accidentals_i_ = accidentals_i;
- minor_i_ = minor_i;
}
String
Midi_key::str() const
{
+ Key_change_req* k = audio_item_l_->req_l_->command()->keychange();
+ int sharps_i = k->sharps_i();
+ int flats_i = k->flats_i();
+
+ // midi cannot handle non-conventional keys
+ if ( flats_i && sharps_i )
+ return "";
+ int accidentals_i = sharps_i - flats_i;
+
String str = "ff5902";
- str += String_convert::i2hex_str( accidentals_i_, 2, '0' );
- str += String_convert::i2hex_str( minor_i_, 2, '0' );
+ str += String_convert::i2hex_str( accidentals_i, 2, '0' );
+ int minor_i = k->minor_b();
+ str += String_convert::i2hex_str( minor_i, 2, '0' );
return String_convert::hex2bin_str( str );
}
-Midi_note::Midi_note( Melodic_req* melreq_l, int channel_i, bool on_bo )
+Midi_note::Midi_note( Audio_item* audio_item_l )
+ : Midi_item( audio_item_l )
{
- assert(melreq_l);
- pitch_i_ = melreq_l->pitch() + c0_pitch_i_c_;
- channel_i_ = channel_i;
-
- on_b_ = on_bo;
-
+ // ugh
dynamic_byte_ = 0x64;
+ on_b_ = ( (Audio_note*)audio_item_l_ )->on_b_;
if ( on_b_ ) // poor man-s staff dynamics:
dynamic_byte_ -= 0x10 * channel_i_;
else
String
Midi_note::str() const
{
- if ( pitch_i_ != INT_MAX ) {
+ Note_req* n = audio_item_l_->req_l_->musical()->melodic()->note();
+ int pitch_i = n->pitch() + c0_pitch_i_c_;
+ if ( pitch_i != INT_MAX ) {
Byte status_byte = ( on_b_ ? 0x90 : 0x80 ) + channel_i_;
String str = String( (char)status_byte );
- str += (char)pitch_i_;
+ str += (char)pitch_i;
// poor man-s staff dynamics:
str += (char)dynamic_byte_;
return str;
return String( "" );
}
+Midi_tempo::Midi_tempo( Audio_item* audio_item_l )
+ : Midi_item( audio_item_l )
+{
+ per_minute_4_i_ = ( (Audio_tempo*)audio_item_l_ )->per_minute_4_i_;
+}
+
Midi_tempo::Midi_tempo( int per_minute_4_i )
+ : Midi_item( 0 )
{
per_minute_4_i_ = per_minute_4_i;
}
return String_convert::hex2bin_str( str );
}
-Midi_time::Midi_time( int num_i, int den_i, int clocks_per_1_i )
+Midi_meter::Midi_meter( Audio_item* audio_item_l )
+ : Midi_item( audio_item_l )
{
- num_i_ = num_i;
- den_i_ = den_i;
- clocks_per_1_i_ = clocks_per_1_i;
+ clocks_per_1_i_ = 18;
}
String
-Midi_time::str() const
+Midi_meter::str() const
+{
+ Meter_change_req* m = audio_item_l_->req_l_->command()->meterchange();
+ int num_i = m->beats_i_;
+ int den_i = m->one_beat_i_;
+
+ String str = "ff5804";
+ str += String_convert::i2hex_str( num_i, 2, '0' );
+ str += String_convert::i2hex_str( intlog2( den_i ) , 2, '0' );
+ str += String_convert::i2hex_str( clocks_per_1_i_, 2, '0' );
+ str += String_convert::i2hex_str( 8, 2, '0' );
+ return String_convert::hex2bin_str( str );
+}
+
+Midi_text::Midi_text( Audio_item* audio_item_l )
+ : Midi_item( audio_item_l )
{
- String str = "ff5804";
- str += String_convert::i2hex_str( num_i_, 2, '0' );
- str += String_convert::i2hex_str( intlog2( den_i_ ) , 2, '0' );
- str += String_convert::i2hex_str( clocks_per_1_i_, 2, '0' );
- str += String_convert::i2hex_str( 8, 2, '0' );
- return String_convert::hex2bin_str( str );
+ text_str_ = ( (Audio_text*)audio_item_l_ )->text_str_;
+ type_ = (Type)( (Audio_text*)audio_item_l_ )->type_;
}
Midi_text::Midi_text( Midi_text::Type type, String text_str )
+ : Midi_item( 0 )
{
- type_ = type;
- text_str_ = text_str;
+ text_str_ = text_str;
+ type_ = type;
}
String
Midi_text::str() const
{
- String str = "ff" + String_convert::i2hex_str( type_, 2, '0' );
- str = String_convert::hex2bin_str( str );
- str += i2varint_str( text_str_.length_i() );
- str += text_str_;
- return str;
+ String str = "ff" + String_convert::i2hex_str( type_, 2, '0' );
+ str = String_convert::hex2bin_str( str );
+ str += i2varint_str( text_str_.length_i() );
+ str += text_str_;
+ return str;
}
-Midi_track::Midi_track( )
+Midi_track::Midi_track()
+ : Midi_chunk()
{
// 4D 54 72 6B MTrk
// 00 00 00 3B chunk length (59)
str = String_convert::bin2hex_str( str );
*os_p_ << str;
+
+ if ( check_debug )
+ *os_p_ << "\n";
+
return *this;
}
Midi_stream&
Midi_stream::operator <<( Midi_item const& mitem_c_r )
{
- mitem_c_r.output_midi( *this );
+// *this << mitem_c_r.str();
+ mitem_c_r.output( this );
if ( check_debug )
*os_p_ << "\n";
return *this;
/*
note-performer.cc -- implement Note_performer
+ source file of the GNU LilyPond music typesetter
+
(c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
*/
#include "translator.hh"
#include "input-translator.hh"
#include "musical-request.hh"
-#include "midi-item.hh"
+#include "audio-item.hh"
#include "debug.hh"
IMPLEMENT_IS_TYPE_B1(Note_performer,Performer);
Note_performer::do_print() const
{
#ifndef NPRINT
- if ( note_req_l_ )
+ if ( note_req_l_ ) {
note_req_l_->print();
+ mtor << ( off_mom_ ? "on" : "off" ) << "\n";
+ }
#endif
}
void
Note_performer::process_requests()
{
-// if ( when() == off_mom_ )
-// play_event( Note_event( current_l_->pitch() ) );
-
-//Midi_note( Melodic_req* melreq_l, int channel_i, bool on_bo )
-
// this is _really_ braindead, but it generates some output
if ( !note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic() )
return;
- // ugh, need to know channel (===track===staff) too
- int channel_i = get_track_i();
+ // ugh! Midi specific
Moment mom = get_mom();
if ( !off_mom_ ) { // start note
off_mom_ = mom + note_req_l_->duration();
- Midi_note n( note_req_l_->melodic(), channel_i, true );
- play_event( &n );
+ play( new Audio_note( note_req_l_, true ) );
}
- else if ( mom == off_mom_ ) {
- Midi_note n( note_req_l_->melodic(), channel_i, false );
- play_event( &n );
+ else if ( mom == off_mom_ ) { // stop note
+ play( new Audio_note( note_req_l_, false ) );
note_req_l_ = 0;
off_mom_ = 0;
}
return true;
}
-
/*
performer-group-performer.cc -- implement Performer_group_performer
+ source file of the GNU LilyPond music typesetter
+
(c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
Jan Nieuwenhuizen <jan@digicash.com>
*/
/*
- performer.cc -- declare Performer
+ performer.cc -- implement Performer
+
+ source file of the GNU LilyPond music typesetter
(c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
Jan Nieuwenhuizen <jan@digicash.com>
}
void
-Performer::play_event( Midi_item* l )
+Performer::play( Audio_item* p )
+{
+ daddy_perf_l_->play( p );
+}
+
+void
+Performer::play( Midi_item* l )
{
- daddy_perf_l_->play_event( l );
+ daddy_perf_l_->play( l );
}
int
/*
score-performer.cc -- implement Score_performer
+ source file of the GNU LilyPond music typesetter
+
(c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
*/
#include "score-performer.hh"
#include "input-translator.hh"
#include "midi-def.hh"
+#include "audio-item.hh"
+#include "audio-column.hh"
+#include "audio-score.hh"
#include "midi-item.hh"
#include "midi-stream.hh"
#include "string-convert.hh"
Performer_group_performer::do_removal_processing();
- Midi_stream output_stream( midi_l_->outfile_str_, midi_item_p_arr_.size() + 1, 384 );
+ Midi_stream output_stream( midi_l_->outfile_str_, midi_item_l_arr_.size() + 1, 384 );
*mlog << "MIDI output to " << midi_l_->outfile_str_ << " ..." << endl;
header( output_stream);
- int track_i = 1;
- for (int i=0; i< midi_item_p_arr_.size(); i++) {
- Midi_item * it_p = midi_item_p_arr_[i];
+// int track_i = 1;
+ for (int i=0; i< midi_item_l_arr_.size(); i++) {
+ Midi_item * it_p = midi_item_l_arr_[i];
- if ( it_p->is_type_b( Midi_track::static_name()))
- ((Midi_track*)it_p )->number_i_ = track_i ++;
+// if ( it_p->is_type_b( Midi_track::static_name()))
+// ((Midi_track*)it_p )->number_i_ = track_i ++;
output_stream<< *it_p;
}
*output_stream.os_p_ << flush;
}
void
-Score_performer::play_event(Midi_item*m)
+Score_performer::play( Audio_item* l )
+{
+ l->audio_column_l_ = audio_column_l_;
+ audio_column_l_->add( l );
+}
+
+void
+Score_performer::play( Midi_item* l )
{
- midi_item_p_arr_.push(m);
+ midi_item_l_arr_.push( l );
}
Moment
+ String_convert::i2dec_str( 0, 0, '0' ) );
midi_track.add( Moment( 0 ), &track_name );
- Midi_tempo tempo ( get_tempo_i());
+ Midi_tempo tempo ( get_tempo_i() );
midi_track.add( Moment(0), &tempo);
output_stream << midi_track;
Score_performer::prepare( Moment m )
{
now_mom_ = m;
+ audio_column_l_ = new Audio_column( m );
+
+ score_l_->audio_score_p_->add( audio_column_l_ );
}
void
#include "source-file.hh"
#include "midi-output.hh"
#include "midi-def.hh"
+#include "audio-score.hh"
#include "p-col.hh"
#include "music-iterator.hh"
#include "music.hh"
Score::Score()
{
pscore_p_=0;
+ audio_score_p_ = 0;
paper_p_ = 0;
midi_p_ = 0;
errorlevel_i_ = 0;
{
delete music_p_;
delete pscore_p_;
+ delete audio_score_p_;
delete paper_p_;
delete midi_p_;
}
return;
*mlog << "\nCreating MIDI elements ..." << flush;
+ audio_score_p_ = new Audio_score( midi_p_ );
Global_translator* score_trans= midi_p_->get_global_translator_p();
run_translator( score_trans );
/*
staff-performer.cc -- implement Staff_performer
- (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
*/
#include "input-translator.hh"
#include "debug.hh"
#include "midi-def.hh"
+#include "audio-column.hh"
+#include "audio-item.hh"
#include "midi-item.hh"
#include "midi-stream.hh"
#include "string.hh"
Staff_performer::Staff_performer()
{
- midi_mom_ = 0;
midi_track_p_ = new Midi_track;
}
+
+Staff_performer::~Staff_performer()
+{
+ delete midi_track_p_;
+}
+
void
Staff_performer::do_creation_processing()
{
- header();
}
void
Staff_performer::do_removal_processing()
{
- Performer::play_event( midi_track_p_);
-}
+ header();
-Staff_performer::~Staff_performer()
-{
- delete midi_track_p_;
+ Moment midi_mom = 0;
+ for ( PCursor<Audio_item*> i( audio_item_p_list_ ); i.ok(); i++ ) {
+ Audio_item* l = *i;
+ Moment mom = l->audio_column_l_->at_mom();
+ Moment delta_t = mom - midi_mom_ ;
+ midi_mom_ += delta_t;
+ Midi_item* p = l->midi_item_p();
+ p->channel_i_ = track_i_;
+ midi_track_p_->add( delta_t, p );
+ delete p;
+ }
+
+ Performer::play( midi_track_p_ );
}
void
Staff_performer::header()
{
// set track name
- Midi_text track_name( Midi_text::TRACK_NAME, instrument_str());
+ Midi_text track_name( Midi_text::TRACK_NAME, instrument_str() );
midi_track_p_->add( Moment( 0 ), &track_name );
// set instrument description
Midi_instrument instrument( channel_i, instrument_str() );
midi_track_p_->add( Moment( 0 ), &instrument );
- Midi_tempo midi_tempo( get_tempo_i( ) );
+ Midi_tempo midi_tempo( get_tempo_i() );
midi_track_p_->add( Moment( 0 ), &midi_tempo );
}
}
void
-Staff_performer::play_event( Midi_item* l )
+Staff_performer::play( Audio_item* p )
+{
+ audio_item_p_list_.bottom().add( p );
+ Performer::play( p );
+}
+
+// huh?
+void
+Staff_performer::play( Midi_item* p )
{
- Moment mom = get_mom();
- Moment delta_t = mom - midi_mom_ ;
- midi_mom_ += delta_t;
- midi_track_p_->add( delta_t, l);
+ Performer::play( p );
}
+/*
+ template8.cc -- instantiate audio List classes
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
#include "proto.hh"
#include "plist.hh"
-#include "plist.tcc"
+#include "audio-column.hh"
+#include "audio-item.hh"
+#include "cursor.tcc"
+#include "list.tcc"
#include "pcursor.tcc"
+#include "plist.tcc"
+
+
+IPL_instantiate(Audio_item);
+IPL_instantiate(Audio_column);
+
depth = ..
#
+# identify module:
+#
+NAME = mi2mu
+MODULE_NAME = mi2mu
+#
+
# generic variables:
#
include ./$(depth)/make/Variables.make
include ./$(depth)/make/Files.make
#
-# identify module:
+# versioning
#
-NAME = mi2mu
-MODULE_NAME = mi2mu
include $(mi2mu-dir)/VERSION
build = $(mi2mu-dir)/$(outdir)/.build
#
*os_p_ << midi_parser_l_g->filename_str_;
*os_p_ << "\n\n";
// ugh
- *os_p_ << "\\version \"0.0.61\";\n";
+ *os_p_ << "\\version \"0.1.0\";\n";
}
/*
snapnie: dit kan toch automaties? Zie ook dstream.