Jump to content

Media UDF


svennie
 Share

Recommended Posts

  • 4 weeks later...
  • Replies 47
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I'm having a hard time figuring out this repeat below. Can you give a sample of how to repeat a .mp3 file?

Thanks!

;===============================================================================

;

; Function Name: _MediaPlay()

; Description: Plays a opened media file.

; Parameter(s): $i_MediaId - Media ID returned by _MediaOpen()/MediaCreate()

; [optional] $i_From - Sets time in seconds where to begin playing

; [optional] $i_To - Sets time in seconds where to bstop playing

; [optional] $i_Speed - Sets the speed to play with

; [optional] $f_Fast - When 1 it will play faster then normal

; [optional] $f_Slow - When 1 it will play slower then normal

; [optional] $f_Fullscreen - When 1 movies will play fullscreen

; [optional] $f_Repeat - When 1 it will keep repeating

; [optional] $f_Reverse - When 1 the movie will been played reversed

; [optional] $f_Scan - When 1 plays as fast as possible

; The default value of all the optional parameters is 0.

; Some file formats dont understand some of the optional functions

; Experimate with it.

; Requirement(s): AutoIt

; Return Value(s): On Success - Returns 1

; On Failure - Returns 0 and sets @ERROR = 1

; Author(s): svennie

;

;===============================================================================

Link to comment
Share on other sites

Very nicely done. I have one question though; how would you reverse a video file (or clip)? Not just play in reverse, but actually be in reverse? Thanks! :P

Link to comment
Share on other sites

@svennie:

Thanks for posting the Media UDF scripts.

There seems to be a problem with the DLL call in the Func _MediaSave. When I run the sample record script you supplied, everything seems to work except that no file is saved. I added a message box to Func _MediaSave and confirmed that file name was being sent correctly to it, but the DLL does not seem to save the file. I have version 5.1.2600.1106 of winmm.dll. I am using Media UDF 1.2.

I think it would be good to put the version number in the Media UDF script.

Link to comment
Share on other sites

  • 2 months later...

svennie,

I am trying to understand your UDF (which seems very useful) but I have difficulties. Is there any detailed documentation ? What I am looking now is how to record a file (or part of a file) which is embedded in and played by another application.

I will much appreciate your advice,

Thank you

Tuk

Link to comment
Share on other sites

I love your udf but i am also having so trouble, the play for example i dont understand how the parameters work. how would you play in fullscreen. The record does not seem to save the file at all. And is there any way to compare one file to another, wav to wav, vocals anything, that would help so much. it might start a voice recognition...

Thanks again

zero

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Ok, I`ve put this <Media.au3> into C:\Program Files\AutoIt3\beta\Include

Tried the record example (made a test folder to save the test.wav file to) and the example does everything as it should (no errors).

But when I look in the folder its empty.

This would be brilliant if I could get it to work...

Thanks!

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

Ok, I`ve put this <Media.au3> into C:\Program Files\AutoIt3\beta\Include

Tried the record example (made a test folder to save the test.wav file to) and the example does everything as it should (no errors).

But when I look in the folder its empty.

This would be brilliant if I could get it to work...

My (Experimental) Code...

#include <Media.au3>

#include <GUIConstants.au3>
; == GUI generated with Koda ==);
$recorder = GUICreate("Recorder", 336, 174, 192, 129)

$Start = GUICtrlCreateButton("Start", 16, 112, 113, 49, 0)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")

$Stop = GUICtrlCreateButton("Stop", 200, 112, 113, 49, 0)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")

;$Progress1 = GUICtrlCreateProgress(153, 16, 23, 145)
;GUICtrlSetColor(-1, 0x0A246A)

GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()

    Select
    case $msg = $Start
        $Media=_MediaCreate(6)
        MsgBox(64,"Media UDF by Svennie (sound record example)","Media ID is: " &$Media)
        If @error Then
            _Error()
            Exit
        EndIf

        _MediaRecord($Media)
        If @error Then
            _Error()
            Exit
        EndIf

    Case $msg = $Stop
        _MediaStop($Media)
        $File=FileSaveDialog("","","Wave files (*.wav)")&".wav"

        _MediaSave($Media,$File)
        If @error Then
            _Error()
            Exit
        EndIf

        _MediaClose($Media)
        If @error Then
            _Error()
            Exit
        EndIf
    EndSelect
    Select 
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd

Func _Error()
If @error Then
    Beep(500)
    _MediaClose($Media)
    Exit
EndIF
EndFunc

Someone else was having the same (record) problem.

The Include file is in the right place, because it plays a wav file no problem.

Should this post be in the Support Forum??

Thanks!

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

yeah, it did't work for me either.

whats up with that

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

I just changed the MediaSave function to get it working for me.

Func _MediaSave($i_MediaId,$s_Location)
    DllCall("winmm.dll","int","mciSendString","str","save media"&$i_MediaId&" " & '"'&FileGetShortName($s_Location)&'"',"str","","int",65534,"hwnd",0)
    If @error Then
        SetError(1)
        Return 0
    Else
        Return 1
    EndIf
EndFunc

That should work now.

Link to comment
Share on other sites

  • 5 weeks later...

I could not use Media.au3 too. It wont save. So I made the change as suggested above by Emperor and it works.

Now I want to ask how can I record a playing sound (palyed by another application) ?

Thanks

Tuk

Edited by Tukata
Link to comment
Share on other sites

I just changed the MediaSave function to get it working for me.

Func _MediaSave($i_MediaId,$s_Location)
    DllCall("winmm.dll","int","mciSendString","str","save media"&$i_MediaId&" " & '"'&FileGetShortName($s_Location)&'"',"str","","int",65534,"hwnd",0)
    If @error Then
        SetError(1)
        Return 0
    Else
        Return 1
    EndIf
EndFunc

That should work now.

WOW, thanks man, it works great, now I can use this

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Very well done! My only suggestion would be to add a way (parameter) to define the song that is to be played after the current one has ended / set a certain variable to 1 when it repeats a previously playes file, so you can tell when a file has reached it's end.

Regards

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • 3 months later...

I would really like to get this UDF to work for me, as it would make me jump for joy.

1. I can't get any of the functions to work, tho. I have the Media.au3 in the include directory, and it's getting "included" ok, but I can't get it to work properly. For instance:

#include <Media.au3>

$vid = _MediaOpen("d:\temp\au\testing.avi")
_MediaPlay($vid,0,120,0,0,0,0,0,0,0)

So, according to this code, it should find the testing.avi file, open it, and then play it for 2 minutes. But, all it does is flash a little gui box on the screen and exits.

2. I don't know if the Media.au3 is version 1.2 or not. It's not commented. I downloaded it from the author's sig at the start of this thread. Is that the most recent version, or is 1.2 somewhere else?

TIA, Please advise.

BUMP!

Edited by J_Y_C
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...