Win32::MCI::CD - Play and control audio cd's via MCI API
|
Win32::MCI::CD - Play and control audio cd's via MCI API
use Win32::MCI::CD;
my $cd = new Win32::MCI::CD(-aliasname => 'our_cd', -drive => 'f:');
$cd->cd_opendevice();
$cd->cd_mode_tmsf();
$cd->cd_play(3);
$cd->cd_closedevice();
With this module you can play and control audio cd's via the MCI API.
- new Win32::MCI::CD(-aliasname => $aliasname, -drive => $drive)
-
Constructor for a new object. The option -aliasname is a reference for
the MCI API. Since the module opens devices shareable you may create more
constructors, as long as you use unique alias names. Use sensible
characters for $aliasname, no spaces. The option -drive gives you the
possibility to select your cd-rom. The variable $drive is DOS formatted,
e.g. ``f:''.
cd_opendevice()
-
First open the device before you do anything. Returns 1 if the operation
was a success, 0 if the operation failed.
cd_closedevice()
-
Closes the device. Always use this method if you stop using the
device. Notice that this method doesn't stop the cd playing. Returns 1
if the operation was a succes, 0 if the operation failed.
cd_getlasterror()
-
If a method returns 0 you can use this method to get the last
error. This method returns an array with two elements. The first
element is the MCI error number. The second element is the MCI error
description. Notice that the description is in the language of your OS.
cd_mode_milliseconds()
-
You can use two time formats. If you call this method before you call
a time related method, e.g. cd_getcurrentpos, the time format is in
milliseconds. Returns 1 if the operation was a success, 0 if the operation
failed.
cd_mode_tmsf()
-
If you call this method before you call a time related method the time
format is ``TT:MM:SS:FF''. Track, minutes, seconds, frames. Returns 1 if
the operation was a success, 0 if the operation failed.
cd_play($pos)
-
This method starts playing the cd at the given position $pos. The position
format depends on the time format. If you have called cd_mode_tmsf before,
the format of $pos may be ``1'' for track one or ``01:02'' for track one at two
minutes. The variable $pos must be in milliseconds if you have called
cd_mode_milliseconds before. You may omit the position argument.
cd_stop()
-
This method stops playing the cd. Returns 1 if the operation was a success,
0 if the operation failed.
cd_pause()
-
This method pauses the currently playing cd. Returns 1 if the operation was
a success, 0 if the operation failed. To start playing again use cd_play
without an argument.
cd_status()
-
This method returns the status. Returns ``playing'' if the cd is playing,
``stopped'' if the cd has stopped and 0 if the operation failed. There may
be more values, but this is what I got back.
cd_currentpos()
-
This method returns the current position of the playing cd. The format of the
returned value is ``TT:MM:SS:FF'' if the method cd_mode_tmsf was called before.
If method cd_mode_milliseconds was called before, the returned value is the
current position in milliseconds. The method returns 0 if the operation
failed.
cd_tracklength($track)
-
This method returns the length of the given track. The returned value has the
format ``MM:SS:FF'' if method cd_mode_tmsf was called before. If method
cd_mode_milliseconds was called before the returned value is the track length
in milliseconds. The method returns 0 if the operation failed.
cd_length()
-
This method returns the total length of the cd. The returned value has the
format ``MM:SS:FF'' if method cd_mode_tmsf was called before. If method
cd_mode_milliseconds was called before, the returned value is the cd length
in milliseconds. The method returns 0 if the operation failed.
cd_tracks()
-
This method returns the number of tracks. The returned value is 0 if the
operation failed.
cd_opentray()
-
This method opens the cd-rom tray. Some cd-rom players don't support this
feature. Returns 1 if the operation was a success, 0 if the operation
failed.
cd_closetray()
-
This method closes the cd-rom tray. Some cd-rom players don't support this
feature. Returns 1 if the operation was a success, 0 if the operation
failed.
cd_present()
-
This method returns ``true'' (as a string!) if there is a cd in the player,
``false'' if there isn't a cd in the player. Returns 0 if the operation
failed.
cd_seek($pos)
-
This method points the laser at the given position. Use this method when
your cd is not playing. The method cd_play without an argument starts
playing from the given position. See method cd_play for the position format.
To install this module type the following:
perl Makefile.PL
make
make test
make install
Win32::API
Win32::MCI::Basic
, fire MCI commands directly.
Win32::DriveInfo
, check if a drive is a cd-rom player.
Lennert Ouwerkerk <lennert@kabelfoon.nl>
Copyright (C) 2002 Lennert Ouwerkerk. All rights reserved.
This package is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Win32::MCI::CD - Play and control audio cd's via MCI API
|