Archive: Play MIDI files


Play MIDI files
Hi :)
I have searched around because I want my installer to play a *.midi-file... I have tryed many diffrent functions.. but I can't get this to work! Here is something I tryed..:


;--------------------------------
;common

!define APP_NAME "PlaySound"
!define SND_NAME "C:\Documents and Settings\User\Desktop\Song.midi"

Name "${APP_NAME}"
OutFile "${APP_NAME}.exe"
InstallDir "$PROGRAMFILES\${APP_NAME}"

;--------------------------------
;Pages, Interface Settings, Languages

SetCompressor lzma

!include "MUI.nsh"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!define MUI_ABORTWARNING


;--------------------------------
;Installer Functions

Function .onInit

InitPluginsDir
SetOutPath "C:\Documents and Settings\User\Desktop\"
File "${SND_NAME}"
; no-loop or loop
; System::Call 'winmm.dll::PlaySoundA(t "$PLUGINSDIR\${SND_NAME}", i 0, i 0x00020003) i .R0'
System::Call 'winmm.dll::PlaySoundA(t "$PLUGINSDIR\${SND_NAME}", i 0, i 0x0002000b) i .R0'

FunctionEnd


;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

; to stop sound at the end of INSTALL page - optional
System::Call 'winmm.dll::PlaySoundA(i 0, i 0, i 0) i .R0'

SectionEnd


Can someone please help me?
Thanks!

I recommend something like:


!define SND_NAME "C:\Documents and Settings\User\Desktop\Song.midi"

;..
File /oname=$PLIGINSDIR\song.midi ${SND_NAME}
System::Call 'winmm.dll::PlaySoundA(t "$PLUGINSDIR\song.midi", i 0, i 0x0002000b) i .R0'
;..

Attached script can also play mp3 ;)


PlaySound works with wavetable (wav) files. With mci please note, that "play repeat" may be not supported, so better use
...
SendMessage $0 0x0465 0 "STR:play"


Note the

STR:play
:D

-Stu

Thanks all!

But I still can't play midi files :(
All I try I get error messages that it can't find the file or some error with something else... Does theese codes work for you?
BTW: I have also tryed whit the full path (C:\something\NSIS\Plugins\ instead of just $PLUGINSDIR) and rename my midi-file to *.mid...

Tnx!:)


this work even on Win98 ;)
Package includes midi file


Is it possible to play tracker files (mod, xm) in installer (maybe after install of http://download.dsp-worx.de/MODSourc..._Installer.zip)?

Is it possible to set playback volume for midi music (for example to set system volume to middle value before starting playback)? In many cases all system volume may be at max. value, and when I launch installer - it's to loud...


The msvfw32.dll::MCIWndCreate is logging some info into file $EXEPATH.log. I tried to delete the log in .onGUIEnd, but it can't be deleted until installer exits. I'd like to have no logging.
How to get rid of logging? There is nothing about it in MSDN :(