Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 133 → Rev 134

/programs/media/midamp/trunk/midamp.txt
0,0 → 1,247
MIDAMP for Menuet v1.0 July 29, 2005
Written in pure assembler by Ivushkin Andrey aka Willow
 
Monophonic MIDI player
 
Vivat assembler et MENUETOS!
MenuetOS still has a poor sound capabilities. Drivers are written for a few
soundcard models. Till recently I considered MEOS to be as voiceless as an
oyster. But then an alternative appeared; dear VaStaNi wrote kernel support of
PC speaker. Old good times of Pascal and MS-DOS came to me again. About 5 years
ago I wrote a Pascal application that parsed and played a note string in QBasic
syntax.
 
Now MeOS gets the simplest, speaker-driven sound scheme in Mario79's distro,
but the first melody in Menuet I heard was from the my program MIDAMP in
December, 2004. On technical reasons its release takes place only now.
 
So, MIDAMP is the simplest single-voiced MIDI player. It cannot do much though
it resembles the famous WinAmp. All it can do is to beep MIDI files.
There are no equalizer, balance and fader, and they won't appear. Moreover,
I may guarantee the correct sound only for files having a single track, one
instrument channel and within technological range of notes :-(
 
#########
System requirements:
1. Kernel having following function implemented:
55/55 - PC speaker interface (critical!)
67 - window shading;
66/3 - for extended mouse selection in playlist.
2. SYSXTREE version not below 52 - opening files and directories (critical!)
3. RAM amount for application - about 150 Kbytes.
#########
 
MIDAMP still uses a single playlist - /HD/1/PLAYLIST.TXT by default. Persons
interested can change the PLAYLIST_PATH constant value in MIDAMP.ASM. Playlist
is a simple text file having filenames to be played in each line. It is NOT
RECOMMENDED to edit the playlist by hand - bugs may appear while loading MIDAMP.
 
When started, MIDAMP creates a new thread whose job is actually playing. Early
versions had main thread that processed everything, therefore unpleasant sound
delays appeared when managing the playlist. Threads communicate intensively
through IPC, although I think it's an excess in such a case. But it works not
bad.
 
MIDAMP is able to shade to window header by pressing the proper button. I tried
to perform complete minimization through mcall 18,10 (new feature of Kolibri4),
but ran into the problem while restoring of window when PANEL button pressed.
That function possibly does not support windows type II ?
 
Hotkeys - almost like in WinAmp:
 
Del - delete the selected tracks;
z - previous track;
x, Enter, double click - play selected file;
c, Space - pause;
v - stop;
b - next track;
 
Esc - close the program;
m - sound on/off;
PgUp, PgDn - swap 2 tracks (not completed!);
BackSpace - rewind track;
Home/End - increase/decrease melody notes offset and play track from beginning
(it is shown near 'tone>' text).
In the case of polyphonic MIDI, if an intelligent melody isn't heard, you may
try to choose another track 'trk' or instrument channel 'chnl', pressing '[' or
']' accordingly and then a number key from '0' to '9'. The file will be played
from the beginning. To reset track and channel to the default value, press '\' .
 
Explaining some interface buttons:
Shuffle toggles random playback on/off. Repeat - current track will loop again
and again. An icon in the top left corner outputs a brief info about the
program to the Debug Board. Clicking the time toggles its view - from beginning
or from the end of file.
 
Mouse click on playlist when holding Shift or Ctrl button works like in WinAmp.
 
Remarks to bottom buttons:
'Add URL' not implemented, on clear reasons;
'Add Dir' - specify any file in the directory desired. *.MID and *.KAR files of
that directory will be added to the list;
'Misc' submenu is not implemented;
'New List' does nothing. MIDAMP still uses a fixed playlist.
 
One of the following flags may precede a filename in the commandline:
 
W - to load a file and wait (default);
P - to play a file;
H - to start shaded and close after playback.
 
To-Do list:
 
1. Increase playlist size (40 items for now).
2. Add dialog to select tracks of polyphonic melodies including analysis on
notes.
3. Reading text in Karaoke files.
4. Playlist select.
5. Note editor, as in Ringtone Editor.
6. Add comments to source.
7. Correct bugs to be found.
 
Special thanks to:
 
VaStaNi - there would be no need of MIDAMP w/o his code
Standard MIDI Files 0.06 March 1, 1988
MIDI 1.0 Specification
General MIDI Level Spec
MIDI SAMPLE DUMP STANDARD
Standard MIDI File Format by Dustin Caldwell
Files format of MIDI
The USENET MIDI Primer by Bob McQueer
Pavlushin Evgeny for his splendid SYSXTREE (DLGS.INC is the opendialog macro
of ASCL library edited to meet MIDAMP specific needs)
 
Send the wishes and bug reports to wil_low@hotbox.ru or to the meos.sysbin.com
forum.
 
See you later!
 
 
****************************************
****************************************
 
MIDAMP ¤«ï Menuet v1.0 29 ¨î«ï 2005 £.
 ¯¨á ­  ­  ç¨á⮬  áᥬ¡«¥à¥ ˆ¢ã誨­ë¬ €­¤à¥¥¬ (Willow)
 
Œ®­®ä®­¨ç¥áª¨© MIDI-¯«¥¥à
 
Vivat assembler et MENUETOS!
‘® §¢ãª®¬ ¢ MenuetOS â㣮 ¤® á¨å ¯®à. „à ©¢¥à  ­ ¯¨á ­ë ¤«ï ®£à ­¨ç¥­­®£® ªà㣠
§¢ãª®¢ëå ª àâ. „® ­¥¤ ¢­¥£® ¢à¥¬¥­¨ MeOS ¡ë«  ¤«ï ¬¥­ï ­¥¬ , ª ª àë¡ . ® ¯®â®¬
¯®ï¢¨« áì  «ìâ¥à­ â¨¢  - 㢠¦ ¥¬ë© VaStaNi ­ ¯¨á « ¯®¤¤¥à¦ªã PC ᯨª¥à . Œ­¥
áࠧ㠢ᯮ¬­¨«¨áì áâ àë¥ ¤®¡àë¥ ¢à¥¬¥­   áª «ï ¨ MS-DOS. ‹¥â 5 ­ § ¤ ­ ¯¨á «
­   áª «¥ ¯à®£à ¬¬ªã, ª®â®à ï ¯ àᨫ ,   ¯®â®¬ ¢®á¯à®¨§¢®¤¨«  áâப㠭®â ¢
ᨭ⠪á¨á¥ QBasic.
 
‘¥©ç á MeOS ¢ ¤¨áâਡã⨢¥ Mario79 ®¡à¥â ¥â ¯à®á⥩èãî §¢ãª®¢ãî á奬ã á ¯®¬®éìî
ᯨª¥à , ­® ¯¥à¢ãî ¬¥«®¤¨î ¢ Menuet ï ãá«ëè « ¢á¥-â ª¨ ®â ᢮¥© ¯à®£à ¬¬ë -
MIDAMP ¢ ¤¥ª ¡à¥ 2004 £®¤ . ® â¥å­¨ç¥áª¨¬ ¯à¨ç¨­ ¬ ¥¥ ५¨§ ¯à®¨á室¨â ⮫쪮
ᥩç á.
 
ˆâ ª, MIDAMP - ¯à®á⥩訩 ®¤­®£®«®áë© MIDI-¯à®¨£à뢠⥫ì. Ž­ ­¥ ¯à¥â¥­¤ã¥â ­ 
¬­®£®¥, å®âì ¨ ¯®å®¦ ­  WinAmp. ‚á¥, çâ® ®­ 㬥¥â, íâ® ¯¨«¨ª âì MIDI-ä ©«ë.
ª¢ « ©§¥à , ¡ « ­á  ¨ ॣã«ïâ®à  £à®¬ª®á⨠­¥â ¨ ­¥ ¯à¥¤¢¨¤¨âáï. ®«¥¥ ⮣®,
ª®à४⭮¥ §¢ãç ­¨¥ ¬®£ã £ à ­â¨à®¢ âì «¨èì ¤«ï ä ©«®¢ á 1 â४®¬, 1 ª ­ «®¬
¨­áâà㬥­â  ¨ ¢ ¯à¥¤¥« å â¥å­®«®£¨ç¥áª®£® ¤¨ ¯ §®­  ­®â :-(
 
#########
‘¨á⥬­ë¥ âॡ®¢ ­¨ï:
1. Ÿ¤à® á ॠ«¨§ æ¨¥© á«¥¤ãîé¨å á¨á⥬­ëå ä㭪権:
55/55 - ¨­â¥à䥩á PC ᯨª¥à  (­¥®¡å®¤¨¬®!);
67 - ᢮à ç¨¢ ­¨¥ ®ª­  ¢ § £®«®¢®ª;
66/3 - ¤«ï ०¨¬®¢ ¢ë¤¥«¥­¨ï â४®¢ ¬ëèìî.
2. SYSXTREE ¢¥àᨨ ­¥ ­¨¦¥ 52 - ®âªàë⨥ ä ©«®¢ ¨ ª â «®£®¢ (­¥®¡å®¤¨¬®!)
3. Ž¡ê¥¬ ¯ ¬ï⨠¤«ï ¯à®£à ¬¬ë - ®ª®«® 150 Š¡.
#########
 
®ª  çâ® MIDAMP ¨á¯®«ì§ã¥â ¥¤¨­á⢥­­ë© ¯«¥©«¨áâ - ¯® 㬮«ç ­¨î
/HD/1/PLAYLIST.TXT. †¥« î騥 ¬®£ãâ ¨§¬¥­¨âì §­ ç¥­¨¥ ª®­áâ ­âë PLAYLIST_PATH ¢
ä ©«¥ MIDAMP.ASM. «¥©«¨áâ - ®¡ëç­ë© ⥪áâ®¢ë© ä ©«, ¢ ª ¦¤®© áâப¥ ª®â®à®£®
­ å®¤¨âáï ¨¬ï ä ©«  ¤«ï ¢®á¯à®¨§¢¥¤¥­¨ï. …£® … …ŠŽŒ…„“…’‘Ÿ ¯à ¢¨âì ¢àãç­ãî -
¢®§¬®¦­ë ¡ £¨ ¯à¨ ¯®á«¥¤ãî饩 § £à㧪¥ ¥£® ¯à¨«®¦¥­¨¥¬.
 
à¨ § ¯ã᪥ MIDAMP ᮧ¤ ¥â ­®¢ë© ¯®â®ª, § ¤ ç¥© ª®â®à®£® ï¥âáï ᮡá⢥­­®
®§¢ã窠. ‚ à ­­¨å ¢¥àá¨ïå ¢á¥ ¤¥« « £« ¢­ë© ¯®â®ª, ¯®í⮬㠢®§­¨ª «¨ ­¥¯à¨ïâ­ë¥
§ ¤¥à¦ª¨ ¢ §¢ãç ­¨¨ ¢® ¢à¥¬ï ã¯à ¢«¥­¨ï ¯«¥©«¨á⮬. ®â®ª¨ ¨­â¥­á¨¢­® ®¡é îâáï
¬¥¦¤ã ᮡ®© ç¥à¥§ IPC, å®âï ï ᪫®­ïîáì ª ⮬ã, çâ® ¢ ¤ ­­®¬ á«ãç ¥ íâ®
¨§«¨è¥á⢮. ® à ¡®â ¥â ­¥¯«®å®.
 
MIDAMP 㬥¥â ᢮à ç¨¢ âìáï ¢ áâப㠧 £®«®¢ª  ­ ¦ â¨¥¬ ᮮ⢥âáâ¢ãî饩 ª­®¯ª¨.
Ÿ ¯ëâ «áï ᤥ« âì ¯®«­®¥ ᢮à ç¨¢ ­¨¥ ç¥à¥§ mcall 18,10 (­®¢ ï ä¨ç  Kolibri4),
­® á⮫ª­ã«áï á ¯à®¡«¥¬®© ¢®ááâ ­®¢«¥­¨ï ®ª­  ­ ¦ â¨¥¬ ª­®¯ª¨ PANEL. ‚®§¬®¦­®,
äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥â ®ª­  ⨯  II ?
 
ƒ®àï稥 ª« ¢¨è¨ - ¯®ç⨠ª ª ¢ WinAmp:
 
Del - 㤠«¨âì ¢ë¤¥«¥­­ë¥ â४¨;
z - ¯à¥¤ë¤ã騩 â४;
x, Enter, ¤¢®©­®© 饫箪 ­  ä ©«¥ - ¢®á¯à®¨§¢¥¤¥­¨¥;
c, Space - ¯ ã§ ;
v - á⮯;
b - á«¥¤ãî騩 â४;
 
Esc - § ªàëâì ¯à®£à ¬¬ã;
m - ¢ª«îç¨âì/¢ëª«îç¨âì §¢ãª;
PgUp, PgDn - ¯®¬¥­ïâì ¬¥áâ ¬¨ 2 á®á¥¤­¨å â४  (­¥ § ª®­ç¥­®!);
BackSpace - ¯¥à¥¬®âª  â४  ¢ ­ ç «®;
Home/End - 㢥«¨ç¨âì/㬥­ìè¨âì â®­ «ì­®áâì ¬¥«®¤¨¨ ¨ ¯à®¨£à âì ¥¥ á ­ ç « 
(®â®¡à ¦ ¥âáï à冷¬ á ­ ¤¯¨áìî 'tone>').
‚ á«ãç ¥ ¯®«¨ä®­¨ç¥áª¨å MIDI, ¥á«¨ ®á¬ëá«¥­­®© ¬¥«®¤¨¨ ­¥ ¯®«ãç ¥âáï, ¬®¦­®
¯®¯à®¡®¢ âì ¢ë¡à âì ¤à㣮© â४ 'trk' ¨«¨ ª ­ « ¨­áâà㬥­â  'chnl', ­ ¦ ¢
ᮮ⢥âá⢥­­® '[' ¨«¨ ']' ¨ § â¥¬ ª« ¢¨èã á ­®¬¥à®¬ ®â 0 ¤® 9. ” ©« ¡ã¤¥â
¢®á¯à®¨§¢¥¤¥­ á á ¬®£® ­ ç « . ‘¡à®á ¤®à®¦ª¨ ¨ ª ­ «  ¢ §­ ç¥­¨¥ ¯® 㬮«ç ­¨î -
­ ¦ â¨¥¬ '\' .
 
 §­ ç¥­¨¥ ­¥ª®â®àëå ª­®¯®ª ¨­â¥à䥩á :
Shuffle - á«ãç ©­ë© ¯®à冷ª ¯à®¨£à뢠­¨ï â४®¢. Repeat - ⥪ã騩 â४ ¡ã¤¥â
¯à®¨£à뢠âìáï á­®¢  ¨ á­®¢ . ‡­ ç®ª ¢ «¥¢®¬ ¢¥àå­¥¬ 㣫㠢뢮¤¨â ªà âªãî
¨­ä®à¬ æ¨î ® ¯à®£à ¬¬¥ ­  ¤®áªã ®â« ¤ª¨. ™¥«ç®ª ­  ¢à¥¬¥­­®© ¬¥âª¥ ¬¥­ï¥â
ᯮᮡ ¥¥ ®â®¡à ¦¥­¨ï - á ­ ç «  ¨«¨ á ª®­æ  ä ©« .
 
™¥«ç®ª ¬ëèìî ­  ¯«¥©«¨áâ¥ á ­ ¦ âë¬ Shift ¨«¨ Ctrl à ¡®â ¥â  ­ «®£¨ç­® WinAmp.
 
‡ ¬¥ç ­¨ï ®â­®á¨â¥«ì­® ª­®¯®ª ¢­¨§ã:
'Add URL' ­¥ ॠ«¨§®¢ ­® ¯® ¯®­ïâ­ë¬ ¯à¨ç¨­ ¬;
'Add Dir' - 㪠¦¨â¥ «î¡®© ä ©« ¢ ¦¥« ¥¬®¬ ª â «®£¥. ” ©«ë *.MID ¨ *.KAR í⮣®
ª â «®£  ¡ã¤ãâ ¤®¡ ¢«¥­ë ¢ ᯨ᮪;
'Misc' ¯®¤¬¥­î ­¥ ॠ«¨§®¢ ­®;
'New List' ­¨ç¥£® ­¥ ¤¥« ¥â. ®ª  ¨á¯®«ì§ã¥âáï 䨪á¨à®¢ ­­ë© ¯«¥©«¨áâ.
 
‚ ª®¬ ­¤­®© áâப¥ ¯¥à¥¤ ¨¬¥­¥¬ ä ©«  ¤«ï ¢®á¯à®¨§¢¥¤¥­¨ï ¬®¦¥â áâ®ïâì ®¤¨­ ¨§
ä« £®¢:
 
W - ¯à®áâ® § £à㧨âì ä ©« (¯® 㬮«ç ­¨î);
P - ¢®á¯à®¨§¢¥á⨠䠩«;
H - áâ à⮢ âì ᢥà­ãâë¬ ¢ § £®«®¢®ª, § ªàëâìáï ¯®á«¥ ¢®á¯à®¨§¢¥¤¥­¨ï.
 
—â® ¥é¥ ­ã¦­® ᤥ« âì:
 
1. “¢¥«¨ç¨âì à §¬¥àë ¯«¥©«¨áâ  (ᥩç á 40 ¯®§¨æ¨©).
2. „®¡ ¢¨âì ¤¨ «®£ ¢ë¡®à  â४®¢ ¯®«¨ä®­¨ç¥áª¨å ¬¥«®¤¨© á ¨å  ­ «¨§®¬ ¯®
­ «¨ç¨î ­®â.
3. —⥭¨¥ ⥪áâ  ¢ ª à ®ª¥-ä ©« å.
4. ‚ë¡®à ¯«¥©«¨áâ .
5. ®â­ë© । ªâ®à, ª ª ¢ Ringtone Editor.
6. Žâª®¬¬¥­â¨à®¢ âì ª®¤ (ª ª ¢á¥£¤ , «¥­ì).
7. ˆá¯à ¢¨âì ¡ £¨, ª®â®àë¥, ­¥á®¬­¥­­®, ­ ©¤ãâáï ;-)
 
Žá®¡ë¥ ¡« £®¤ à­®áâ¨:
 
VaStaNi - ¡¥§ ¥£® ª®¤  ­ ¯¨á ­¨¥ MIDAMP ­¥ ¨¬¥«® ¡ë á¬ëá« 
Standard MIDI Files 0.06 March 1, 1988
MIDI 1.0 Specification
General MIDI Level Spec
MIDI SAMPLE DUMP STANDARD
Standard MIDI File Format by Dustin Caldwell
”®à¬ â ä ©«®¢ MIDI
The USENET MIDI Primer by Bob McQueer
 ¢«îè¨­ã …¢£¥­¨î §  ­¥¯à¥¢§®©¤¥­­ë© SYSXTREE (DLGS.INC - ¯¥à¥à ¡®â ­­ë© á
ãç¥â®¬ ᯥæ¨ä¨ª¨ MIDAMP'a ¬ ªà®á opendialog ¡¨¡«¨®â¥ª¨ ASCL)
 
®¦¥« ­¨ï ¨ á®®¡é¥­¨ï ®¡ ®è¨¡ª å ­ ¯à ¢«ï©â¥ ­  wil_low@hotbox.ru ¨«¨ ­  ä®àã¬
meos.sysbin.com.
 
„® ­®¢ëå ¢áâà¥ç!