Das deutsche QBasic- und FreeBASIC-Forum Foren-Übersicht Das deutsche QBasic- und FreeBASIC-Forum
Für euch erreichbar unter qb-forum.de, fb-forum.de und freebasic-forum.de!
 
FAQFAQ   SuchenSuchen   MitgliederlisteMitgliederliste   BenutzergruppenBenutzergruppen  RegistrierenRegistrieren
ProfilProfil   Einloggen, um private Nachrichten zu lesenEinloggen, um private Nachrichten zu lesen   LoginLogin
Zur Begleitseite des Forums / Chat / Impressum
Aktueller Forenpartner:

lame_enc.dll

 
Neues Thema eröffnen   Neue Antwort erstellen    Das deutsche QBasic- und FreeBASIC-Forum Foren-Übersicht -> Allgemeine Fragen zu FreeBASIC.
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen  
Autor Nachricht
Tom42



Anmeldungsdatum: 09.02.2005
Beiträge: 21
Wohnort: Wolfsburg

BeitragVerfasst am: 09.12.2007, 18:45    Titel: lame_enc.dll Antworten mit Zitat

Hallo Forum,

was mache falsch um an dies VersionsInfo der Lame_Enc.dll
zu Kommen.
CODE:

'beVersion,beInitStream
Dim LameEncDll As Any Ptr
Dim beVersion As Function (Byval Version As Integer ) As Integer

LameEncDll = dylibload( "lame_enc.dll" )
if(LameEncDll = 0 ) then
print "Cannot load the DLL aborting program..."
Sleep
end
end If
Print "Lame_Enc.dll ADR:";LameEncDll

beVersion = dylibsymbol(LameEncDll,"beVersion")
If beVersion = 0 Then
Print "Error!"
Sleep
End
EndIf
Print "beVersion ADR:";beVersion

Sleep

END CODE
Wie kann ich Funktionen diese DLL ansprechen ?

Über hilfe und Beispiel würde ich mich Freuen

Gruß Tom
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden Website dieses Benutzers besuchen
volta



Anmeldungsdatum: 04.05.2005
Beiträge: 1876
Wohnort: D59192

BeitragVerfasst am: 10.12.2007, 16:54    Titel: Antworten mit Zitat

Hi,
beVersion ist eine Sub, die einen Zeiger auf ein UDT (BE_VERSION) übergibt.
Code:
Type BE_VERSION
  ' BladeEnc DLL Version number
  As UByte   byDLLMajorVersion
  As UByte   byDLLMinorVersion
  ' BladeEnc Engine Version Number
  As UByte   byMajorVersion
  As UByte   byMinorVersion
  ' DLL Release date
  As UByte   byDay
  As UByte   byMonth
  As UShort   wYear
  ' BladeEnc   Homepage URL
  As ZString*129   zHomepage
  As UByte   byAlphaLevel
  As UByte   byBetaLevel
  As UByte   byMMXEnabled
  As UByte   btReserved(125-1)
End Type

Dim version As BE_VERSION
Dim PBE_VERSION As Any Ptr = @VERSION

Screen 18,32

'beVersion,beInitStream
Dim LameEncDll As Any Ptr
Dim beVersion As Sub (ByVal PBE_VERSION As Any Ptr )

LameEncDll = DylibLoad( "lame_enc.dll" )
If (LameEncDll = 0 ) Then
  Print "Cannot load the DLL aborting program..."
  Sleep
  End
End If

beVersion = DyLibSymbol(LameEncDll,"beVersion")
If beVersion = 0 Then
  Print "Error!"
  Sleep
  End
EndIf

beversion (PBE_VERSION)
With Version
  ?   .byDLLMajorVersion;".";
  ?   .byDLLMinorVersion
  ?   .byMajorVersion;".";
  ?   .byMinorVersion
  ?   .byDay;".";
  ?   .byMonth;".";
  ?   .wYear
  ?   .zHomepage
End With
Sleep

_________________
Warnung an Choleriker:
Dieser Beitrag kann Spuren von Ironie & Sarkasmus enthalten.
Zu Risiken & Nebenwirkungen fragen Sie Ihren Therapeuten oder Psychiater.


Zuletzt bearbeitet von volta am 12.12.2007, 09:54, insgesamt einmal bearbeitet
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden Website dieses Benutzers besuchen
Tom42



Anmeldungsdatum: 09.02.2005
Beiträge: 21
Wohnort: Wolfsburg

BeitragVerfasst am: 11.12.2007, 16:51    Titel: lame_enc.dll Antworten mit Zitat

Hi volta und reader,

erst mal Danke für Deine hilfe. Da ich im Englischen Forum
auch gefragt habe ich ich jetzt zwei möglichenkeiten auf lame_enc.dll
Dynamisch oder Statisch zuzugreifen.
Ich Stelle hier mal das Beispiel von cHaOs mit ins Forum

Lame.bi
Code:
/'
 ' Blade Type of DLL Interface for Lame encoder
 '
 ' Translated to FreeBASIC by cha0s
 '
 ' Copyright (c) 1999-2002 A.L. Faber
 ' Based on bladedll.h version 1.0 written by Jukka Poikolainen
 '
 ' This library is free software; you can redistribute it and/or
 ' modify it under the terms of the GNU Lesser General Public
 ' License as published by the Free Software Foundation; either
 ' version 2 of the License, or (at your option) any later version.
 '
 ' This library is distributed in the hope that it will be useful,
 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ' Lesser General Public License for more details.
 '
 ' You should have received a copy of the GNU Lesser General Public
 ' License along with this library; if not, write to the
 ' Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ' Boston, MA  02111-1307, USA.
 '/

'' NOTICE: This file is part of the FreeBASIC Compiler package and can't
''         be included in other distributions without authorization.
''

#pragma once

Extern "C"

/' encoding formats '/

#define                BE_CONFIG_MP3                        0                                                                               
#define                BE_CONFIG_LAME                        256               

/' type definitions '/

Type HBE_STREAM  As Unsigned Long
Type PHBE_STREAM As HBE_STREAM Ptr
Type BE_ERR      As Unsigned Long

/' error codes '/

#define                BE_ERR_SUCCESSFUL                                        &h00000000
#define                BE_ERR_INVALID_FORMAT                                &h00000001
#define                BE_ERR_INVALID_FORMAT_PARAMETERS        &h00000002
#define                BE_ERR_NO_MORE_HANDLES                                &h00000003
#define                BE_ERR_INVALID_HANDLE                                &h00000004
#define                BE_ERR_BUFFER_TOO_SMALL                                &h00000005

/' other constants '/

#define                BE_MAX_HOMEPAGE                        128

/' format specific variables '/

#define                BE_MP3_MODE_STEREO                0
#define                BE_MP3_MODE_JSTEREO                1
#define                BE_MP3_MODE_DUALCHANNEL        2
#define                BE_MP3_MODE_MONO                3



#define                MPEG1        1
#define                MPEG2        0

Type FLOAT As Single

#define CURRENT_STRUCT_VERSION 1
#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG)        '' is currently 331 bytes


enum VBRMETHOD
        VBR_METHOD_NONE                        = -1
        VBR_METHOD_DEFAULT                =  0
        VBR_METHOD_OLD                        =  1
        VBR_METHOD_NEW                        =  2
        VBR_METHOD_MTRH                        =  3
        VBR_METHOD_ABR                        =  4
End enum

enum LAME_QUALITY_PRESET
       
        LQP_NOPRESET                        = -1

        '' QUALITY PRESETS
        LQP_NORMAL_QUALITY                = 0
        LQP_LOW_QUALITY                        = 1
        LQP_HIGH_QUALITY                = 2
        LQP_VOICE_QUALITY                = 3
        LQP_R3MIX                                = 4
        LQP_VERYHIGH_QUALITY        = 5
        LQP_STANDARD                        = 6
        LQP_FAST_STANDARD                = 7
        LQP_EXTRemE                                = 8
        LQP_FAST_EXTRemE                = 9
        LQP_INSANE                                = 10
        LQP_ABR                                        = 11
        LQP_CBR                                        = 12
        LQP_MEDIUM                                = 13
        LQP_FAST_MEDIUM                        = 14

        '' NEW PRESET VALUES
        LQP_PHONE        =1000
        LQP_SW                =2000
        LQP_AM                =3000
        LQP_FM                =4000
        LQP_VOICE        =5000
        LQP_RADIO        =6000
        LQP_TAPE        =7000
        LQP_HIFI        =8000
        LQP_CD                =9000
        LQP_STUDIO        =10000
       
End enum

#if Not defined(BOOL)
        #define BOOL Integer
#endif

Type BE_CONFIG_MP3_ Field = 1

        As Integer dwSampleRate                '' 48000, 44100 and 32000 allowed
        As Byte byMode                        '' BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
        As Ushort wBitrate                '' 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
        As BOOL bPrivate               
        As BOOL bCRC
        As BOOL bCopyright
        As BOOL bOriginal

End Type

Type BE_CONFIG_LHV1_ Field = 1
       
        '' STRUCTURE INFORMATION
        As Integer                 dwStructVersion       
        As Integer                 dwStructSize

        '' BASIC ENCODER SETTINGS
        As Integer                 dwSampleRate                '' SAMPLERATE OF INPUT FILE
        As Integer                 dwReSampleRate                '' DOWNSAMPLERATE, 0=ENCODER DECIDES 
        As Long                 nMode                                '' BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
        As Integer                 dwBitrate                        '' CBR bitrate, VBR min bitrate
        As Integer                 dwMaxBitrate                '' CBR ignored, VBR Max bitrate
        As Long                        nPreset                        '' Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
        As Integer                 dwMpegVersion                '' FUTURE USE, MPEG-1 OR MPEG-2
        As Integer                 dwPsyModel                        '' FUTURE USE, SET TO 0
        As Integer                 dwEmphasis                        '' FUTURE USE, SET TO 0

        '' BIT STREAM SETTINGS
        As BOOL                 bPrivate                        '' Set Private Bit (TRUE/FALSE)
        As BOOL                 bCRC                                '' Insert CRC (TRUE/FALSE)
        As BOOL                 bCopyright                        '' Set Copyright Bit (TRUE/FALSE)
        As BOOL                 bOriginal                        '' Set Original Bit (TRUE/FALSE)
       
        '' VBR STUFF
        As BOOL                 bWriteVBRHeader        '' WRITE XING VBR HEADER (TRUE/FALSE)
        As BOOL                 bEnableVBR                        '' USE VBR ENCODING (TRUE/FALSE)
        As Integer                 nVBRQuality                '' VBR QUALITY 0..9
        As Integer                 dwVbrAbr_bps                '' Use ABR in stead of nVBRQuality
        As VBRMETHOD        nVbrMethod
        As BOOL                 bNoRes                                '' Disable Bit resorvoir (TRUE/FALSE)

        '' MISC SETTINGS
        As BOOL                 bStrictIso                        '' Use strict ISO encoding rules (TRUE/FALSE)
        As Ushort                 nQuality                        '' Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5

        '' FUTURE USE, SET TO 0, align strucutre to 331 bytes
        As Byte                 btReserved((255-4*sizeof(Integer) - sizeof( Ushort ))-1)
       
End Type

Type BE_CONFIG_AAC_ Field = 1

        As Integer dwSampleRate
        As Byte byMode
        As Ushort wBitrate
        As Byte byEncodingMethod

End Type

Type BE_CONFIG Field = 1
        As Integer dwConfig                        '' BE_CONFIG_XXXXX
                                                                '' Currently only BE_CONFIG_MP3 is supported
        Union
                As BE_CONFIG_MP3_  mp3
                As BE_CONFIG_LHV1_ lhv1
                As BE_CONFIG_aac_  aac
        End Union
               
End Type


Type BE_VERSION Field = 1

        '' BladeEnc DLL Version number

        As Byte byDLLMajorVersion
        As Byte byDLLMinorVersion

        '' BladeEnc Engine Version Number

        As Byte byMajorVersion
        As Byte byMinorVersion

        '' DLL Release date

        As Byte byDay
        As Byte byMonth
        As Ushort wYear

        '' BladeEnc        Homepage URL

        As String * BE_MAX_HOMEPAGE zHomepage

        As Byte byAlphaLevel
        As Byte byBetaLevel
        As Byte byMMXEnabled

        As Byte btReserved(125-1)

End Type

Declare Function beInitStream            ( pbeConfig As BE_CONFIG Ptr, dwSamples As Integer Ptr, dwBufferSize As Integer Ptr, phbeStream As PHBE_STREAM ) As BE_ERR
Declare Function beEncodeChunk           ( hbeStream As HBE_STREAM, nSamples As Integer, pSamples As Short Ptr, pOutput As Byte Ptr, pdwOutput As Integer Ptr ) As BE_ERR

'' added for floating point audio  -- DSPguru, jd
Declare Function beEncodeChunkFloatS16NI ( hbeStream As HBE_STREAM, nSamples As Integer, buffer_l As Single Ptr, buffer_r As Single Ptr, pOutput As Byte Ptr, pdwOutput As Integer Ptr ) As BE_ERR
Declare Function beDeinitStream          ( hbeStream As HBE_STREAM, pOutput As Byte Ptr, pdwOutput As Integer Ptr ) As BE_ERR
Declare Function beCloseStream           ( hbeStream As HBE_STREAM ) As BE_ERR
Declare Sub      beVersion               ( pbeVersion As BE_VERSION Ptr )
Declare Function beWriteVBRHeader        ( lpszFileName As Zstring Ptr ) As BE_ERR
Declare Function beFlushNoGap            ( hbeStream As HBE_STREAM, pOutput As Byte Ptr, pdwOutput As Integer Ptr ) As BE_ERR
Declare Function beWriteInfoTag          ( hbeStream As HBE_STREAM, lpszFileName As Zstring Ptr ) As BE_ERR

End Extern
 


Beispiel
Code:
#include "lame.bi"

Dim As BE_VERSION ver_struct
beVersion( @ver_struct )

With ver_struct
        ? "lame_enc.dll version " & .byDLLMajorVersion & "." & .byDLLMinorVersion;
        ? " (" & .byDay & "/" & .byMonth & "/" & .wYear & ")"
        ?"lame_enc Engine " & .byMajorVersion & "." & .byMinorVersion
        ?"lame_enc homepage at " & .zHomepage
        ?       
End With       

Sleep       

#inclib "lame_enc"
 


und die liblame_enc.dll.a
http://cha0s.freebasic.net/fbc/liblame_enc.dll.a

Viel Spass
und Gruß an alle
Tom
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden Website dieses Benutzers besuchen
volta



Anmeldungsdatum: 04.05.2005
Beiträge: 1876
Wohnort: D59192

BeitragVerfasst am: 12.12.2007, 09:53    Titel: Antworten mit Zitat

Hi,
ich bin sicher das in der Type BE_VERSION definition von cha0s
Code:
As String * BE_MAX_HOMEPAGE zHomepage
durch
Code:
As ZString * BE_MAX_HOMEPAGE+1 zHomepage
ersetzt werden muss, da sonst die nachfolgenden Werte byBetaLevel und byMMXEnabled falsch gesetzt werden.

Auch habe ich etwas übersehen
Code:
As UByte btReserved(125-1)
ist besser.
_________________
Warnung an Choleriker:
Dieser Beitrag kann Spuren von Ironie & Sarkasmus enthalten.
Zu Risiken & Nebenwirkungen fragen Sie Ihren Therapeuten oder Psychiater.
Nach oben
Benutzer-Profile anzeigen Private Nachricht senden Website dieses Benutzers besuchen
Beiträge der letzten Zeit anzeigen:   
Neues Thema eröffnen   Neue Antwort erstellen    Das deutsche QBasic- und FreeBASIC-Forum Foren-Übersicht -> Allgemeine Fragen zu FreeBASIC. Alle Zeiten sind GMT + 1 Stunde
Seite 1 von 1

 
Gehe zu:  
Du kannst keine Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum nicht antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.

 Impressum :: Datenschutz