AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Library] MCI v1.1 - Play/Control media files
Goto page Previous  1, 2, 3, 4, 5  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
vlcek



Joined: 19 Feb 2007
Posts: 338
Location: Czech Republic

PostPosted: Sat Mar 21, 2009 8:42 am    Post subject: Reply with quote

Can you please help with this?
Code:

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.
Back to top
View user's profile Send private message Visit poster's website
jballi



Joined: 01 Oct 2005
Posts: 748
Location: Texas, USA

PostPosted: Sat Mar 21, 2009 9:05 am    Post subject: Reply with quote

vlcek wrote:
Can you please help with this?

I'll PM you with a follow up.
Back to top
View user's profile Send private message Send e-mail
ribbet.1



Joined: 20 Feb 2007
Posts: 197
Location: D.C.

PostPosted: Mon Mar 23, 2009 8:07 am    Post subject: Reply with quote

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:

Quote:
---------------------------
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?
Back to top
View user's profile Send private message
skwire



Joined: 18 Jan 2006
Posts: 273
Location: Conway, Arkansas

PostPosted: Mon Mar 23, 2009 8:10 am    Post subject: Reply with quote

ribbet.1 wrote:
Can you please enlighten me, anybody?

Update to the latest version of AutoHotkey.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
ribbet.1



Joined: 20 Feb 2007
Posts: 197
Location: D.C.

PostPosted: Mon Mar 23, 2009 1:20 pm    Post subject: Reply with quote

Well I shall do that since 1.0.48 is now out it seems. But I had 1.0.47 already.
Back to top
View user's profile Send private message
ribbet.1



Joined: 20 Feb 2007
Posts: 197
Location: D.C.

PostPosted: Mon Mar 23, 2009 1:25 pm    Post subject: Reply with quote

OK, now works! Thanks very much!
Back to top
View user's profile Send private message
ribbet.1



Joined: 20 Feb 2007
Posts: 197
Location: D.C.

PostPosted: Sun May 03, 2009 4:30 pm    Post subject: Reply with quote

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! Smile
Back to top
View user's profile Send private message
jballi



Joined: 01 Oct 2005
Posts: 748
Location: Texas, USA

PostPosted: Mon May 04, 2009 2:13 am    Post subject: Reply with quote

ribbet.1 wrote:
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! Smile

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.
Back to top
View user's profile Send private message Send e-mail
ribbet.1



Joined: 20 Feb 2007
Posts: 197
Location: D.C.

PostPosted: Mon May 04, 2009 2:41 am    Post subject: Reply with quote

jballi wrote:
ribbet.1 wrote:
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! Smile

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
Back to top
View user's profile Send private message
jballi



Joined: 01 Oct 2005
Posts: 748
Location: Texas, USA

PostPosted: Mon May 04, 2009 5:17 am    Post subject: Reply with quote

ribbet.1 wrote:
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!
Back to top
View user's profile Send private message Send e-mail
ribbet.1



Joined: 20 Feb 2007
Posts: 197
Location: D.C.

PostPosted: Mon May 04, 2009 6:55 am    Post subject: Reply with quote

jballi wrote:


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


You have been VERY helpful. Thanks for getting back to me!
Back to top
View user's profile Send private message
vlcek



Joined: 19 Feb 2007
Posts: 338
Location: Czech Republic

PostPosted: Fri May 08, 2009 6:16 am    Post subject: Reply with quote

Good morning.
Can you help me with problem with playi file from the internet?
Code:

;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.
Back to top
View user's profile Send private message Visit poster's website
jballi



Joined: 01 Oct 2005
Posts: 748
Location: Texas, USA

PostPosted: Fri May 08, 2009 7:26 am    Post subject: Reply with quote

vlcek wrote:
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.autohotkey.com/forum/viewtopic.php?t=37092

Good luck!
Back to top
View user's profile Send private message Send e-mail
Zaelia



Joined: 31 Oct 2008
Posts: 604
Location: France

PostPosted: Sat Feb 20, 2010 4:16 am    Post subject: Reply with quote

Thanks for this library Smile

The problem about codec has already been reported, yet there is a link:
http://www.autohotkey.com/forum/viewtopic.php?t=54682

If you don't want to use registry you can add TYPE MYTYPE at OPEN
Back to top
View user's profile Send private message Send e-mail
TheAllmighty
Guest





PostPosted: Sat Aug 14, 2010 10:44 am    Post subject: Reply with quote

a simple example showing the input-level of the current recording device (e.g. the microphone or line-in):
Code:
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
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group