SeregaZ wrote:
can you help me too? project was in Visual Basic 6. it have some nice library for sound - OPN_DLL.dll
http://mnp.tut.su/file/OPN_DLL.dllbut i am not understand how to convert notes to this format. it have some strange "And", "Or" command when it is not "If" command. and "\" and "^"... it is a little confuse me.

I think it should be something like this
Code:
Enumeration
#Window
#Do
#Re
#Mi
#Fa
#Sol
#Lya
#Sii
EndEnumeration
;Private Declare Function OpenOPNDriver Lib "OPN_DLL" (ByVal Chips As Byte) As Byte
;Private Declare Sub CloseOPNDriver Lib "OPN_DLL" ()
;Private Declare Sub OPN_Write Lib "OPN_DLL" (ByVal ChipID As Byte, ByVal Register As Integer, _
; ByVal Data As Byte)
;Private Declare Sub OPN_Mute Lib "OPN_DLL" (ByVal ChipID As Byte, ByVal MuteMask As Byte)
OPNhdll = OpenLibrary(0, "OPN_DLL.dll")
If OPNhdll
Prototype OpenDriver(int.i)
Prototype CloseDriver()
Prototype OPNWrite(int.i,int2.i,int3.i)
Global OpenOPNDriver.OpenDriver = GetFunction(0, "OpenOPNDriver")
Global CloseOPNDriver.CloseDriver = GetFunction(0, "CloseOPNDriver")
Global OPN_Write.OPNWrite = GetFunction(0, "OPN_Write")
EndIf
;{ setup
OpenOPNDriver(1)
OPN_Write(0, $30, $74)
OPN_Write(0, $34, $72)
OPN_Write(0, $38, $74)
OPN_Write(0, $3C, $71)
OPN_Write(0, $40, $23)
OPN_Write(0, $44, $26)
OPN_Write(0, $48, $2A)
OPN_Write(0, $4C, $00)
OPN_Write(0, $50, $1F)
OPN_Write(0, $54, $1F)
OPN_Write(0, $58, $19)
OPN_Write(0, $5C, $12)
OPN_Write(0, $60, $00)
OPN_Write(0, $64, $00)
OPN_Write(0, $68, $0E)
OPN_Write(0, $6C, $07)
OPN_Write(0, $70, $00)
OPN_Write(0, $74, $00)
OPN_Write(0, $78, $00)
OPN_Write(0, $7C, $00)
OPN_Write(0, $80, $07)
OPN_Write(0, $84, $08)
OPN_Write(0, $88, $24)
OPN_Write(0, $8C, $18)
OPN_Write(0, $90, $00)
OPN_Write(0, $94, $00)
OPN_Write(0, $98, $00)
OPN_Write(0, $9C, $00)
OPN_Write(0, $B0, $3B)
OPN_Write(0, $B4, $04)
OPN_Write(0, $B4, $C0)
;}
Procedure.i GetOPNNote(Note.i, Pitch.i)
Protected.d FreqHz, CurNote
Protected.i BlkNum, FNum
CurNote = Note + Pitch / 128
FreqHz = 440 * Pow(2, (CurNote - 69) / 12)
BlkNum = Note / 12 - 1
If BlkNum < 0
BlkNum = 0
ElseIf BlkNum > 7
BlkNum = 7
EndIf
FNum = Round((144 * FreqHz / 7670454) * Pow(2, 21 - BlkNum), #PB_Round_Nearest)
If FNum < 0
FNum = 0
ElseIf FNum > $7FF
FNum = $7FF
EndIf
ProcedureReturn FNum | (BlkNum * $800)
EndProcedure
If OpenWindow(#Window, 100, 100, 430, 160, "piano", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
ButtonGadget(#Do, 20, 50, 30, 70, "Do")
ButtonGadget(#Re, 80, 50, 30, 70, "Re")
ButtonGadget(#Mi, 140, 50, 30, 70, "Mi")
ButtonGadget(#Fa, 200, 50, 30, 70, "Fa")
ButtonGadget(#Sol, 260, 50, 30, 70, "Sol")
ButtonGadget(#Lya, 320, 50, 30, 70, "Lya")
ButtonGadget(#Sii, 380, 50, 30, 70, "Si")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #Do ; 90 for example
;FNum = GetOPNNote(PreviewOctave * 12 + PreviewNote, 0)
;Call OPN_Write(&H0, &HA4, (FNum And &H7F00) / &H100)
;Call OPN_Write(&H0, &HA0, FNum And &HFF)
; set note
FNum = GetOPNNote(PreviewOctave * 12 + 90, 0)
OPN_Write(0, $A4, FNum >> 8)
OPN_Write(0, $A0, FNum & $FF)
; play, pause, stop
OPN_Write(0, $28, $F0)
Delay(500)
OPN_Write(0, $28, $00)
EndSelect
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
CloseOPNDriver()
CloseLibrary(0)
EndIf