Old 30th December 2004, 23:35   #1
jonnebonne
Junior Member
 
Join Date: Nov 2004
Location: Oslo, Norway
Posts: 12
Question 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..:
code:

;--------------------------------
;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!
jonnebonne is offline   Reply With Quote
Old 31st December 2004, 00:06   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
I recommend something like:
code:

!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'
;..



* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 31st December 2004, 08:16   #3
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Attached script can also play mp3
Attached Files
File Type: nsi mci.sound.nsi (1.3 KB, 318 views)
Takhir is offline   Reply With Quote
Old 31st December 2004, 09:05   #4
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
PlaySound works with wavetable (wav) files. With mci please note, that "play repeat" may be not supported, so better use
...
SendMessage $0 0x0465 0 "STRlay"
Takhir is offline   Reply With Quote
Old 31st December 2004, 09:59   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Note the
code:
STRlay


-Stu
Afrow UK is offline   Reply With Quote
Old 31st December 2004, 10:36   #6
jonnebonne
Junior Member
 
Join Date: Nov 2004
Location: Oslo, Norway
Posts: 12
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!
jonnebonne is offline   Reply With Quote
Old 31st December 2004, 11:55   #7
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
this work even on Win98
Package includes midi file
Attached Files
File Type: zip midi.zip (11.7 KB, 328 views)
Takhir is offline   Reply With Quote
Old 1st January 2005, 12:31   #8
Dkom
Junior Member
 
Join Date: Nov 2004
Location: Russia Kursk-city
Posts: 47
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...
Dkom is offline   Reply With Quote
Old 9th May 2008, 07:41   #9
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
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
pospec is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump