source: branches/mediafolder/prog_tutorial/mediafldrprog.ipf

Last change on this file was 168, checked in by gyoung, 17 months ago

Add new and missing ini keys to hidden features in mediafldr.inf.

File size: 15.3 KB
Line 
1:userdoc.
2
3:docprof.
4
5:title.Programming tutorial for Multimedia classes
6
7:h1 res=100.Introduction
8:p.
9The Media-Folder offers two interfaces for controlling and programming. You
10may use :link reftype=hd res=200.setup strings:elink. for basic tasks like starting and stopping the playing
11or a :link reftype=hd res=300.REXX interface:elink. with access to internal class methods.
12:p.
13For use of the REXX interface
14:p.
15WPS-Wizard V0.2.0 (http&colon.//www.os2world.com/cdwriting)
16:p.
17or above must be installed.
18
19:h1 res=200
20x=left y=bottom width=50%.Setup strings
21:p.
22The following additional setup strings are supported with every media folder.
23
24:ul.
25:li.:link reftype=hd res=210.MEDIAFLDRNEXT:elink. Play the next track in the folder
26:li.:link reftype=hd res=211.MEDIAFLDRPLAY:elink. Start playing
27:li.:link reftype=hd res=215.MEDIAFLDRPLAYFIRST:elink. Start first track
28:li.:link reftype=hd res=212.MEDIAFLDRPREV:elink. Skip to previous track
29:li.:link reftype=hd res=216.MEDIAFLDRREPEAT:elink. Set repeat
30:li.:link reftype=hd res=213.MEDIAFLDRSTOP:elink. Stop playing
31:li.:link reftype=hd res=214.MEDIAFLDRVOLUME:elink. Set volume
32:eul.
33:p.
34The folder must be open for these setup strings to work.
35:p.
36The MM audio classes support the following strings:
37:ul.
38:li.:link reftype=hd res=220.MMAUDIOTRACKNAME:elink. Set the track name of the audio file.
39:li.:link reftype=hd res=221.MMAUDIOARTIST:elink. Set the artist name for the audio file.
40:li.:link reftype=hd res=222.MMAUDIOALBUM:elink. Set the album name.
41:li.:link reftype=hd res=223.MMAUDIOCOMMENT:elink. Set the comment for the audio file.
42:li.:link reftype=hd res=224.MMAUDIOYEAR:elink. Set the year of the audio file.
43:li.:link reftype=hd res=225.MMAUDIOGENRE:elink. Set the audio file genre.
44:li.:link reftype=hd res=226.MMREFRESH:elink. Reread the infos of the audio file.
45:li.:link reftype=hd res=227.MMAUDIOCOPYTAGTO:elink. Copy all tags of the audio file.
46
47:eul.
48
49
50:h2 res=210
51x=50% width=50%
52group=2
53.MEDIAFLDRNEXT
54:p.
55Skip to next track while playing. If not yet playing the first track will be started.
56:xmp.
57/* REXX - This command skips to the next track */
58
59rc=SysSetObjectData('x&colon.\path_to_folder','MEDIAFLDRNEXT=1')
60:exmp.
61
62:h2 res=211
63x=50% width=50%
64group=2
65.MEDIAFLDRPLAY
66:p.
67Start playing with the first track. If any track is selected playing will start with the first selected track.
68:xmp.
69/* REXX - This command starts playing */
70
71rc=SysSetObjectData('x&colon.\path_to_folder','MEDIAFLDRPLAY=1')
72:exmp.
73
74:h2 res=215
75x=50% width=50%
76group=2
77.MEDIAFLDRPLAYFIRST
78:p.
79Start playing with the first track no matter if any other track is selected.
80
81:xmp.
82/* REXX - This command starts playing */
83
84rc=SysSetObjectData('x&colon.\path_to_folder','MEDIAFLDRPLAYFIRST=1')
85:exmp.
86
87
88:h2 res=212
89x=50% width=50%
90group=2
91.MEDIAFLDRPREV
92:p.
93Skip to the previous track while playing.
94:xmp.
95/* REXX - This command skips to the previous track */
96
97rc=SysSetObjectData('x&colon.\path_to_folder','MEDIAFLDRPREV=1')
98:exmp.
99
100:h2 res=216
101x=50% width=50%
102group=2
103.MEDIAFLDRREPEAT
104:p.
105Set the repeat attribute. If set to 1 the tracks in the folder are
106repeated. If set to 0 repeating is disabled.
107:xmp.
108/* REXX - This command sets repeat to yes */
109
110rc=SysSetObjectData('x&colon.\path_to_folder','MEDIAFLDRREPEAT=1')
111:exmp.
112
113:h2 res=213
114x=50% width=50%
115group=2
116.MEDIAFLDRSTOP
117:p.
118Stop playing.
119:xmp.
120/* REXX - This command stops playing */
121
122rc=SysSetObjectData('x&colon.\path_to_folder','MEDIAFLDRSTOP=1')
123:exmp.
124
125:h2 res=214
126x=50% width=50%
127group=2
128.MEDIAFLDRVOLUME
129:p.
130Change the volume between 0 and 100%.
131:xmp.
132/* REXX - This command sets the volume to 35% */
133
134rc=SysSetObjectData('x&colon.\path_to_folder','MEDIAFLDRVOLUME=35')
135:exmp.
136
137.********************************************
138
139:h2 res=220
140x=50% width=50%
141group=2
142.MMAUDIOTRACKNAME
143:p.
144Set the track name of the audio file. This information is saved in the EA of the file. For
145MP3 files this information is also saved in the ID3 tag.
146:xmp.
147/* REXX - This command adds the track name to the audio file */
148
149rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMAUDIOTRACKNAME=The track name')
150:exmp.
151
152:h2 res=221
153x=50% width=50%
154group=2
155.MMAUDIOARTIST
156:p.
157Set the artist name of the audio file. This information is saved in the EA of the file. For
158MP3 files this information is also saved in the ID3 tag.
159:xmp.
160/* REXX - This command adds the artist name to the audio file */
161
162rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMAUDIOARTIST=Artist name')
163:exmp.
164
165:h2 res=222
166x=50% width=50%
167group=2
168.MMAUDIOALBUM
169:p.
170Set the album name of the audio file. This information is saved in the EA of the file. For
171MP3 files this information is also saved in the ID3 tag.
172:xmp.
173/* REXX - This command adds the album name to the audio file */
174
175rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMAUDIOALBUM=Album name')
176:exmp.
177
178:h2 res=223
179x=50% width=50%
180group=2
181.MMAUDIOCOMMENT
182:p.
183Set the comment of the audio file. This information is saved in the EA of the file. For
184MP3 files this information is also saved in the ID3 tag.
185:xmp.
186/* REXX - This command adds a comment to the audio file */
187
188rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMAUDIOCOMMENT=Track comment')
189:exmp.
190
191:h2 res=224
192x=50% width=50%
193group=2
194.MMAUDIOYEAR
195:p.
196Set the year of the audio file. This information is saved in the EA of the file. For
197MP3 files this information is also saved in the ID3 tag.
198:xmp.
199/* REXX - This command adds the year to the audio file */
200
201rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMAUDIOYEAR=2003')
202:exmp.
203
204:h2 res=225
205x=50% width=50%
206group=2
207.MMAUDIOGENRE
208:p.
209Set the genre of the audio file. This information is saved in the EA of the file. For
210MP3 files this information is also saved in the ID3 tag.
211:xmp.
212/* REXX - This command adds the genre of the audio file */
213
214rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMAUDIOGENRE=Blues')
215:exmp.
216
217:h2 res=226
218x=50% width=50%
219group=2
220.MMREFRESH
221:p.
222Reread the audio information from the file and update internal object data.
223:xmp.
224/* REXX - This command rereads the information of the audio file */
225
226rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMREFRESH=1')
227:exmp.
228
229:h2 res=227
230x=50% width=50%
231group=2
232.MMAUDIOCOPYTAGTO
233
234Read the audio information from the file tag and copies it to another file.
235
236:xmp.
237/* REXX - This command copies the file tag information to another audio file */
238
239rc=SysSetObjectData('x&colon.\path_to_folder\audio_file.ext','MMAUDIOCOPYTAGTO=x&colon.\path_to_folder\another_file.ext')
240:exmp.
241
242
243.********************************************
244
245:h1 res=300.REXX interface
246:p.
247When using the REXX interface skripts have access to the class methods of the media folder.
248Support for the most important methods of the WPS, helper functions and some PM window functions is provided by
249WPS-Wizard.
250
251:p.
252The media folder methods are called using a wrapper function.
253
254:table cols='20 35'.
255:row.
256:c.:link reftype=hd res=320.MFldrCallFunc:elink.
257:c.Call one of the methods introduced by the media folder.
258:etable.
259:p.
260Methods introduced by the multimedia classes are called using the following function.
261:table cols='20 35'.
262:row.
263:c.:link reftype=hd res=330.MMCallFunc:elink.
264:c.Call one of the methods introduced by multimedia classes (CWAudio, CWMP3, CWOGG).
265:etable.
266
267:p.
268The skript runs in the context of the WPS which is a PM program on a separate thread. You may
269use additional REXX dlls available. The name of the REXX skript does not matter but the file
270must as usual start with a comment.
271
272.*************************************
273
274.***********************************************
275
276:h2 res=320
277width=30%
278.MFldrCallFunc
279:link reftype=hd res=321
280auto dependent group=2.
281:p.
282Use this function to call one of the new media folder methods or a
283helper method.
284:p.
285:link reftype=hd res=321 dependent.Syntax:elink.
286.*.br
287.*:link reftype=hd res=322.Parameters:elink.
288.br
289:link reftype=hd res=323 dependent.Returns:elink.
290.br
291:link reftype=hd res=324 dependent.Remarks:elink.
292.*.br
293.*:link reftype=hd res=325.Usage:elink.
294.br
295:link reftype=hd res=326.Example:elink.
296
297:h2 res=321
298x=30%
299width=70%
300group=2
301hide
302.MFldrCallFunc - Syntax
303:xmp.
304/* Call a method from REXX */
305
306methodName /* The name of a method */
307Object /* Object on which the method is invoked */
308param1 /* First method parameter */
309param2 /* Second method parameter */
310:p.
311rc=MFldrCallFunc(methodName, Object,
312 param1, param2, ...);
313:exmp.
314
315
316:h2 res=322
317x=30%
318width=70%
319group=2
320hide
321.MFldrCallFunc - Parameters
322:p.
323
324:h2 res=323
325x=30%
326width=70% height=35%
327group=3
328hide
329.MFldrCallFunc - Return value
330:p.
331The return value depends on the method being called. It may be a string or a
332numeric value. See the method description for more info.
333:p.
334If the method can't be found the string :hp2.ERROR_METHOD&colon.:ehp2. is returned.
335
336:h2 res=324
337x=30%
338width=70%
339group=2
340hide
341.MFldrCallFunc - Remarks
342:p.
343The method to be called must be a member of the object :hp2.Object:ehp2. An error occurs if
344the object does not support the requested method. For example a CWMediaFolder object does
345not support the same methods as a CWAudio object.
346
347:h2 res=325
348x=30%
349width=70%
350group=2
351hide
352.MFldrCallFunc - Usage
353:p.
354
355:h2 res=326
356x=30%
357width=70%
358group=2
359hide
360.MFldrCallFunc - Example
361:xmp.
362/* This example queries the first object in */
363/* a CWMediaFolder, gets the linked file and */
364/* queries the name of the artist from the */
365/* ID3 tag. */
366
367/* Get the first object of folder theFolder */
368theObject=MFldrCallWPSFunc("wpQueryContent", theFolder, 0, QC_FIRST)
369
370/* Get the linked file system object from the shadow.
371 cwGetFileSystemObject is a member of the
372 CWMediaFolder class. */
373theFileObj=MFldrCallFunc("cwGetFileSystemObject", theFolder, theObject)
374
375/* Get the artist name. cwmmQueryTrackInfo is a member of the
376 CWAudio class. Every object in the CWMediaFolder is usually
377 a shadow to an object instance of a subclass of CWAudio */
378theName=MFldrCallFunc("cwmmQueryTrackInfo", theFileObj, 2)
379
380/* Display the name */
381rc=RxMessageBox("The artist name : "||theName)
382:exmp.
383
384.*********************************************
385.***********************************************
386
387:h2 res=330
388width=30%
389.MMCallFunc
390:link reftype=hd res=331
391auto dependent group=2.
392:p.
393Use this function to call one of the new multi media class methods introduced with :hp2.CWAudio/MMAudio:ehp2..
394:p.
395:link reftype=hd res=331 dependent.Syntax:elink.
396.*.br
397.*:link reftype=hd res=332.Parameters:elink.
398.br
399:link reftype=hd res=333 dependent.Returns:elink.
400.br
401:link reftype=hd res=334 dependent.Remarks:elink.
402.*.br
403.*:link reftype=hd res=335.Usage:elink.
404.br
405:link reftype=hd res=336.Example:elink.
406
407:h2 res=331
408x=30%
409width=70%
410group=2
411hide
412.MMCallFunc - Syntax
413:xmp.
414/* Call a method from REXX */
415
416methodName /* The name of a method */
417Object /* Object on which the method is invoked */
418param1 /* First method parameter */
419param2 /* Second method parameter */
420:p.
421rc=MMCallFunc(methodName, Object,
422 param1, param2, ...);
423:exmp.
424
425
426:h2 res=332
427x=30%
428width=70%
429group=2
430hide
431.MMCallFunc - Parameters
432:p.
433
434:h2 res=333
435x=30%
436width=70% height=35%
437group=3
438hide
439.MMCallFunc - Return value
440:p.
441The return value depends on the method being called. It may be a string or a
442numeric value. See the method description for more info.
443:p.
444If the method can't be found the string :hp2.ERROR_METHOD&colon.:ehp2. is returned.
445
446:h2 res=334
447x=30%
448width=70%
449group=2
450hide
451.MMCallFunc - Remarks
452:p.
453The method to be called must be a member of the object :hp2.Object:ehp2. An error occurs if
454the object does not support the requested method. For example a CWMediaFolder object does
455not support the same methods as a CWAudio object.
456:p.
457In previous releases of the classes this function had the name :hp2.MMClsCallFunc:ehp2.. This
458name is still supported but depracted.
459
460:h2 res=335
461x=30%
462width=70%
463group=2
464hide
465.MMCallFunc - Usage
466:p.
467
468:h2 res=336
469x=30%
470width=70%
471group=2
472hide
473.MMCallFunc - Example
474:xmp.
475/* This example queries the first object in */
476/* a CWMediaFolder, gets the linked file and */
477/* queries the name of the artist from the */
478/* ID3 tag. */
479
480/* Get the first object of folder theFolder */
481theObject=WPSWizCallWPSFunc("wpQueryContent", theFolder, 0, QC_FIRST)
482
483/* Get the linked file system object from the shadow.
484 cwGetFileSystemObject is a member of the
485 CWMediaFolder class. */
486theFileObj=MFldrCallFunc("cwGetFileSystemObject", theFolder, theObject)
487
488/* Get the artist name. cwmmQueryTrackInfo is a member of the
489 CWAudio class. Every object in the CWMediaFolder is usually
490 a shadow to an object instance of a subclass of CWAudio */
491theName=MMCallFunc("cwmmQueryTrackInfo", theFileObj, 2)
492
493/* Display the name */
494rc=RxMessageBox("The artist name : "||theName)
495:exmp.
496
497
498.im wpsmethods.inc
499
500:h1 res=400
501x=left y=bottom width=50%.Hidden features
502:p.
503The following features of the CW-multimedia classes may be enabled by setting values in :hp2.OS2.INI:ehp2..
504:ul.
505:li.:link reftype=hd res=410.Replace audio player:elink.
506:li.:link reftype=hd res=425.Replace audio converter:elink.
507:li.:link reftype=hd res=411.Replace audio editor:elink.
508:li.:link reftype=hd res=412.Replace AVI player:elink.
509:li.:link reftype=hd res=413.Replace MPG player:elink.
510:li.:link reftype=hd res=419.Replace MP3 player:elink.
511:li.:link reftype=hd res=427.Add modern video player:elink.
512:li.:link reftype=hd res=428.No modern video player:elink.
513:li.:link reftype=hd res=414.Replace image editor:elink.
514:li.:link reftype=hd res=426.Replace image converter:elink.
515:li.:link reftype=hd res=415.Enable details for images on CD:elink.
516:li.:link reftype=hd res=416.Disable time display in icon titles:elink.
517:li.:link reftype=hd res=417.Disable blinking of play controls (PLAY, PAUSE):elink.
518:li.:link reftype=hd res=418.Disable creating of a shadow to the Media Player template:elink.
519:li.:link reftype=hd res=420.Disable audio file checking:elink.
520:li.:link reftype=hd res=421.Disable ID3 tag reading:elink.
521:li.:link reftype=hd res=422.Replace M3U editor:elink.
522:li.:link reftype=hd res=423.Replace M3U player:elink.
523:eul.
524
525.im hiddenfeatures.inc
526
527:h1 res=500.Extended attributes
528:p.
529Information about audio files is stored in the extended attributes of the file for use by other
530programs or REXX. The following EAs are currently defined.
531
532:table cols='20 35'.
533:row.
534:c.MMALBUM
535:c.The album this track belongs to
536:row.
537:c.MMARTIST
538:c.Name of the artist
539:row.
540:c.MMBPS
541:c.Bits per sample
542:row.
543:c.MMCHANNELS
544:c.Number of channels
545:row.
546:c.MMCOMMENT
547:c.The comment for this file
548:row.
549:c.MMGENRE
550:c.The genre of this audio file
551:row.
552:c.MMNUMAUDIOBYTES
553:c.The number of audio bytes in this audio file
554:row.
555:c.MMPLAYTIME
556:c.Playtime in seconds
557:row.
558:c.MMPLAYTIMEMS
559:c.Playtime in milliseconds
560:row.
561:c.MMSAMPLERATE
562:c.Samplerate
563:row.
564:c.MMTRACKNAME
565:c.Name of the track
566:row.
567:c.MMYEAR
568:c.Year
569:etable.
570
571:nt.
572The information is stored in ASCII format.
573:ent.
574:euserdoc.
575
576
577
578
579
580
581
582
Note: See TracBrowser for help on using the repository browser.