Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Library] MCI v1.1 - Play/Control media files


  • Please log in to reply
71 replies to this topic
vlcek
  • Members
  • 341 posts
  • Last active: Apr 03 2014 01:27 PM
  • Joined: 19 Feb 2007
Can you please help with this?
Gui, 7:+owner1  
; Make the main window (Gui #1) the owner of the "about box" (Gui #2).
Gui +Disabled  
; Disable main window.
suspend
Gui, 7:-SysMenu
Loop %A_ScriptDir%\media\*.*
{
   mp3List .= A_LoopFilename . "|"
}
StringTrimRight mp3List, mp3List, 1
Gui 7:Add, Listbox, w200 h300 vhMedia, %mp3List%
Gui 7:Add, Button, w100 xm+50 g7Play Default, %play%
Gui, 7:Add, button, w4 gback, %back%
Gui, 7:Show, w850 h580 x50 y100,%fav%
return
7play:
   Gui, 7:Submit, NoHide
hMedia:=MCI_Stop(hMedia)
hMedia:=MCI_Close(hMedia)
hMedia:=MCI_Open(hMedia)
if Not hMedia
    {
    msgBox, 0, Error, Error opening media file %hmedia%
    return
    }

Open:=true
MCI_SetVolume(hMedia,curvolume) ;-- Sets the volume to max for the device
MCI_SetBass(hMedia,curbass) ;-- Sets the bass to max for the device
length:=MCI_Length(hMedia)
gosub, play
return

back:
7GuiClose:
7GuiEscape:
Gui, 1:-Disabled  
Gui Destroy  
suspend
Return

Thanks.

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

Can you please help with this?

I'll PM you with a follow up.

ribbet.1
  • Members
  • 198 posts
  • Last active: Feb 07 2012 01:21 AM
  • Joined: 20 Feb 2007
Hi, very interesting thread. Thanks for all your good work!

I just dl'd the lib and examples. Running MCI -- record example.ahk I get this error code -- same for MCI -- Standard Example.ahk too:

---------------------------
MCI -- Record Example.ahk
---------------------------
Error at line 713 in #include file "D:\Documents and Settings\ribbet.1\Desktop\MCI.ahk".

Line Text: %s_Callback%
Error: Dynamic function calls are not supported.

The program will exit.
---------------------------
OK
---------------------------


Can you please enlighten me, anybody?

skwire
  • Moderators
  • 279 posts
  • Last active: Aug 12 2014 05:16 PM
  • Joined: 18 Jan 2006

Can you please enlighten me, anybody?

Update to the latest version of AutoHotkey.

ribbet.1
  • Members
  • 198 posts
  • Last active: Feb 07 2012 01:21 AM
  • Joined: 20 Feb 2007
Well I shall do that since 1.0.48 is now out it seems. But I had 1.0.47 already.

ribbet.1
  • Members
  • 198 posts
  • Last active: Feb 07 2012 01:21 AM
  • Joined: 20 Feb 2007
OK, now works! Thanks very much!

ribbet.1
  • Members
  • 198 posts
  • Last active: Feb 07 2012 01:21 AM
  • Joined: 20 Feb 2007
Is there an easy way to get these MCI functions to go to a specific time in a recording? If you can just point me in the right direction I'll see what I can do with it. -- Scratch that, I'll look it up at MSDN. But if anybody wants to share an example, that's OK! :-)

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

Is there an easy way to get these MCI functions to go to a specific time in a recording? If you can just point me in the right direction I'll see what I can do with it. -- Scratch that, I'll look it up at MSDN. But if anybody wants to share an example, that's OK! :-)

The "Record Example" script included the MCI package (see the 1st post for the link) includes examples of how to jump around in a recording. I hope this helps.

ribbet.1
  • Members
  • 198 posts
  • Last active: Feb 07 2012 01:21 AM
  • Joined: 20 Feb 2007

Is there an easy way to get these MCI functions to go to a specific time in a recording? If you can just point me in the right direction I'll see what I can do with it. -- Scratch that, I'll look it up at MSDN. But if anybody wants to share an example, that's OK! :-)

The "Record Example" script included the MCI package (see the 1st post for the link) includes examples of how to jump around in a recording. I hope this helps.


Thanks and I apologize for not having noticed this. I have only played around with it a couple of times.

I am looking to create a 4-track playback tool for transcription. Looking at MSDN, I see there is a "mixer" thing. If I were just making a script that used 4 instances of your MCI library simultaneously, would I need to incorporate some kind of virtual mixer, or would Windows automatically mix them? I want to keep this as simple as possible, at least for starters. That is to say, if each individual instance has its own volume level setting, would I really need to incorporate a mixer? I can figure it out faster if I don't need that.

Cheers, Ribbet

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

I am looking to create a 4-track playback tool for transcription. Looking at MSDN, I see there is a "mixer" thing. If I were just making a script that used 4 instances of your MCI library simultaneously, would I need to incorporate some kind of virtual mixer, or would Windows automatically mix them? I want to keep this as simple as possible, at least for starters. That is to say, if each individual instance has its own volume level setting, would I really need to incorporate a mixer? I can figure it out faster if I don't need that.

This one is definitely out of my scope of knowledge...

I did a little research and found that the MCI protocol does support a "mixer" device but only if the sound card manufacturer supports it AND if they provide the device driver. But and however, I couldn't find any MCI commands or flags that support 4-channel recording. I admit, I didn't look that hard.

I thought about telling about opening 4 separate recording sessions using 4 unique values for the p_lpszDeviceID parameter but the more I thought about it, the more I was convinced that it wouldn't work. Of course you can record each channel one at a time but I wouldn't have a clue as to how to merge the information back together again.

I suspect that MCI library is probably not robust enough to solve your problem. I haven't looked but there are probably quite a few free or inexpensive tools out there that would be better suited to solve your problem.

I'm sorry I couldn't be more helpful. Good luck!

ribbet.1
  • Members
  • 198 posts
  • Last active: Feb 07 2012 01:21 AM
  • Joined: 20 Feb 2007

I'm sorry I couldn't be more helpful. Good luck!


You have been VERY helpful. Thanks for getting back to me!

vlcek
  • Members
  • 341 posts
  • Last active: Apr 03 2014 01:27 PM
  • Joined: 19 Feb 2007
Good morning.
Can you help me with problem with playi file from the internet?
;Program pro přehrávání rádia Melody;
;Tento program je opensource, lze jej upravovat, ale za souhlasu autora, nebo generálního ředitele rádia Melody.;
setworkingdir %A_ScriptDir%
#include mci.ahk
iniread, w, opt.ini, main, w
iniread, x, opt.ini, main, x
iniread, y, opt.ini, main, y
iniread, h, opt.ini, main, h
gui,add,button,gplay,hrát
gui,add,button,gstop,stop
gui,show,%w% %h% %x% %y%,Radio_Melody_player
return
play:
        hMedia:=MCI_Open("http://sc1.ipip.cz:8000/")
        if not hMedia
{
            MsgBox 16, Chyba!, Nemohu se připojit k serveru`,` nebo přehrát soubor.
            return
}
else
gosub, start
return
start:
if Open
    {
    Status:=MCI_Status(hMedia)
    if Status=stopped
{
MCI_SetVolume(hMedia,curvolume) ;-- Sets the volume to max for the device
MCI_SetBass(hMedia,curbass) ;-- Sets the bass to max for the device
        MCI_Play(hMedia)
}
     else        
if Status=paused
{
MCI_SetVolume(hMedia,curvolume) ;-- Sets the volume to max for the device
MCI_SetBass(hMedia,curbass) ;-- Sets the bass to max for the device
            MCI_Resume(hMedia)
}
    }
return
stop:
        MCI_Stop(hMedia) 
exitapp
return
msgbox16 is error, when player can't play file from this address.
Why this not function?
Thanks.

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

Can you help me with problem with playi file from the internet?

Unfortunatelly, the MCI protocol doesn't support streaming audio. Although I haven't tried it myself (yet), the BASS library is supposed to be able to support streaming audio. You might want to take a look/see. Here's the link:
http://www.autohotke...pic.php?t=37092

Good luck!

Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008
Thanks for this library :)

The problem about codec has already been reported, yet there is a link:
<!-- m -->http://www.autohotke...pic.php?t=54682<!-- m -->

If you don't want to use registry you can add TYPE MYTYPE at OPEN

TheAllmighty
  • Guests
  • Last active:
  • Joined: --
a simple example showing the input-level of the current recording device (e.g. the microphone or line-in):
hMedia:=MCI_Open("new","","type waveaudio")

l_CmdString:="status " . hMedia . " level"

OnExit, ExitSub

Progress, R0-128 B  ,Press Escape to Exit, Microphone Audio Level, Microphone Audio Level,

loop

{

error := MCI_SendString(l_CmdString,l_lpszReturnString)

Progress, %l_lpszReturnString%

}

Esc::ExitApp   

ExitSub:

MCI_Close(hMedia)

ExitApp



;#include MCI.ahk ; uncomment if MCI is not in your std-lib