Einzelnen Beitrag anzeigen

Horst0815

Registriert seit: 23. Mai 2011
Ort: Görlitz
150 Beiträge
 
Delphi XE Starter
 
#1

*.lib Dateien in Delphi nutzen

  Alt 22. Okt 2015, 13:41
Delphi-Version: XE8
Da ich zur zeit mit kaputten Bein mein Tag auf dem Sofa friste wollte ich mich mal an einen Player für v2m-Module versuchen.

Cpp obj liegen vor (aus Lib extrahiert)

verwendet werden die in Cpp so
Code:
  /*************************************************************************************/
  /**                                                                                 **/
  /** DirectSound output code                                                        **/
  /**                                                                                 **/
  /*************************************************************************************/

  // your rendering callback function has to look this way:
  // parm: pointer you specified with dsInit
  // buf: pointer to interleved stereo float destination buffer (1.0=0dB)
  // len: length of buffer in samples (!)
  typedef void (__stdcall DSIOCALLBACK)(void *parm, float *buf, unsigned long len);

  // initializes DirectSound output.
  // callback: your render callback function
  // parm: a pointer that'll be supplied to the function on every call
  // hWnd: window handle of your application (GetForegroundWindow() works quite well :)
  unsigned long __stdcall dsInit(DSIOCALLBACK *callback, void *parm, void *hWnd);

  // shuts down DirectSound output
  void __stdcall dsClose();

  // gets sample-exact and latency compensated current play position
  signed long __stdcall dsGetCurSmp();

  // sets player volume (default is 1.0)
  void __stdcall dsSetVolume(float vol);

  // forces rendering thread to update. On single-core CPUs it's a good idea to
  // call this once per frame (improves A/V sync and reduces any stuttering),
  // with more than one CPU it's pretty much useless.
  void __stdcall dsTick();

  // lock and unlock the sound thread's thread sync lock. If you want to modify
  // any of your sound variables outside the render thread, encapsulate that part
  // of code in between these two functions.
  void __stdcall dsLock();
  void __stdcall dsUnlock();

  /*************************************************************************************/
  /**                                                                                 **/
  /** Synthesizer interface                                                          **/
  /**                                                                                 **/
  /*************************************************************************************/

  // returns size of work memory in bytes. Per synthesizer instance reserve at least
  // this amount of memory and supply it as the "pthis" parameter of all other functions
  // Note: If you need only one static instance, 3 Megabytes are a good bet.
  unsigned int __stdcall synthGetSize();

  // inits synthesizer instance.
  // pthis    : pointer to work mem
  // patchmap : pointer to patch data
  // samplerate: output sample rate (44100-192000 Hz), use 44100 when playing with dsio
  void __stdcall synthInit(void *pthis, const void *patchmap, int samplerate=44100);

  // inits global parameters
  // pthis: pointer to work mem
  // ptr : pointer to global parameters
  void __stdcall synthSetGlobals(void *pthis, const void *ptr);

  // inits speech synthesizer texts
  // pthis: pointer to work mem
  // ptr : pointer to text array
  void __stdcall synthSetLyrics(void *pthis, const char **ptr);

  // renders synth output to destination buffer
  // pthis: pointer to work mem
  // buf : pointer to interleaved float stereo out buffer
  // smp : number of samples to render
  // buf2 : if this is specified, the synth will render the left and right channel into
  //        two mono float buffers at buf and buf2 instead of one interleaved buffer
  // add : if this is specified, the synth will add its output to the destination
  //        buffer instead of replacing its contents
  void __stdcall synthRender(void *pthis, void *buf, int smp, void *buf2=0, int add=0);

  // pipes a stream of MIDI commands to the synthesizer
  // pthis: pointer to work mem
  // ptr : pointer to buffer with MIDI data to process.
  //        NOTE: The buffer MUST end with a 0xfd byte
  void __stdcall synthProcessMIDI(void *pthis, const void *ptr);

  // sets operation mode of VU meters
  // pthis: pointer to work mem
  // mode : 0 for peak meters, 1 for RMS meters
  void __stdcall synthSetVUMode(void *pthis, int mode); // 0: peak, 1: rms

  // retrieves VU meter data for a channel
  // pthis: pointer to work mem
  // ch  : channel to retrieve (0..15)
  // l   : pointer to float variable where left VU is stored
  // r   : pointer to float variable where right VU is stored
  void __stdcall synthGetChannelVU(void *pthis, int ch, float *l, float *r); // ch: 0..15

  // retrieves master VU meter
  // pthis: pointer to work mem
  // l   : pointer to float variable where left VU is stored
  // r   : pointer to float variable where right VU is stored
  void __stdcall synthGetMainVU(void *pthis, float *l, float *r);

#ifdef __cplusplus
}
#endif

#endif
was ich so übersetzt hab

Delphi-Quellcode:

var
  Form1: TForm1;
{$L dsio.obj}
// DirectSound output code **/
  // your rendering callback function has to look this way:
  // parm: pointer you specified with dsInit
  // buf: pointer to interleved stereo float destination buffer (1.0=0dB)
  // len: length of buffer in samples (!)
type
  TDSIOCALLBACK = Procedure(parm : Pointer; buf : PExtended; len : Cardinal);

// initializes DirectSound output. **/
  // callback: your render callback function
  // parm: a pointer that'll be supplied to the function on every call
  // hWnd: window handle of your application (GetForegroundWindow() works quite well :)
Function dsInit(Callback : TDSIOCALLBACK; parm: Pointer;Wnd : HWnd): Cardinal; cdecl; external;
  // shuts down DirectSound output
Procedure dsClose; stdcall; external;
  // gets sample-exact and latency compensated current play position
Function dsGetCurSmp: Integer; stdcall; external;
  // sets player volume (default is 1.0)
Procedure dsSetVolume(vol: Extended); stdcall; external;
  // forces rendering thread to update. On single-core CPUs it's a good idea to
  // call this once per frame (improves A/V sync and reduces any stuttering),
  // with more than one CPU it's pretty much useless.
Procedure dsTick; stdcall; external;
  // lock and unlock the sound thread's thread sync lock. If you want to modify
  // any of your sound variables outside the render thread, encapsulate that part
  // of code in between these two functions.
Procedure dsLock; stdcall; external;
Procedure dsUnlock; stdcall; external;

{$L ronan.obj}
Procedure ronanCBInit; stdcall; external;
Procedure ronanCBTick; stdcall; external;
Procedure ronanCBNoteOn; stdcall; external;
Procedure ronanCBNoteOff; stdcall; external;
Procedure ronanCBSetCtl; stdcall; external;
Procedure ronanCBProcess; stdcall; external;
Procedure ronanCBSetCtl; stdcall; external;
{$L synth2.obj}
// Synthesizer interface **/
  // returns size of work memory in bytes. Per synthesizer instance reserve at least
  // this amount of memory and supply it as the "pthis" parameter of all other functions
  // Note: If you need only one static instance, 3 Megabytes are a good bet.
  Function synthGetSizene: Word; external;
  // inits synthesizer instance.
  // pthis : pointer to work mem
  // patchmap : pointer to patch data
  // samplerate: output sample rate (44100-192000 Hz), use 44100 when playing with dsio
  Procedure synthInitneu(pthis: Pointer; Const patchmap: Pointer; samplerate: Integer = 44100); external;
  // inits global parameters
  // pthis: pointer to work mem
  // ptr : pointer to global parameters
  Procedure synthSetGlobalsne(pthis: Pointer; Const ptr: Pointer); external;
  // inits speech synthesizer texts
  // pthis: pointer to work mem
  // ptr : pointer to text array
  Procedure synthSetLyrics(pthis: Pointer; Const ptr: PChar); external;
// // renders synth output to destination buffer
// // pthis: pointer to work mem
// // buf : pointer to interleaved float stereo out buffer
// // smp : number of samples to render
// // buf2 : if this is specified, the synth will render the left and right channel into
// // two mono float buffers at buf and buf2 instead of one interleaved buffer
// // add : if this is specified, the synth will add its output to the destination
// // buffer instead of replacing its contents
  Procedure synthRenderneu(pthis, buf: Pointer; smp: Integer; buf2: Pointer = nil; add: Integer = 0); external;
  // pipes a stream of MIDI commands to the synthesizer
  // pthis: pointer to work mem
  // ptr : pointer to buffer with MIDI data to process.
  // NOTE: The buffer MUST end with a 0xfd byte
  Procedure synthProcessMIDIne(pthis: Pointer; Const ptr: Pointer); external;
  // sets operation mode of VU meters
  // pthis: pointer to work mem
  // mode : 0 for peak meters, 1 for RMS meters
  Procedure synthSetVUModene(pthis: Pointer; mode: Integer); external;// 0: peak, 1: rms
  // retrieves VU meter data for a channel
  // pthis: pointer to work mem
  // ch : channel to retrieve (0..15)
  // l : pointer to float variable where left VU is stored
  // r : pointer to float variable where right VU is stored
  Procedure synthGetChannelVUneu(pthis: Pointer;ch : Integer; l,r: PExtended); external;// ch: 0..15
  // retrieves master VU meter
  // pthis: pointer to work mem
  // l : pointer to float variable where left VU is stored
  // r : pointer to float variable where right VU is stored
  Procedure _synthGetMainVU(pthis: Pointer; l,r: PExtended); external;

//Unused
//Procedure synthProcessMIDI(pthis: Pointer; Const ptr: Pointer); external;
//// extern void __stdcall synthSetSampler(void *pthis, const void *bankinfo, const void *samples);
//Procedure synthGetPoly(pthis, dest: Pointer); external;
//Procedure synthGetPgm(pthis, dest: Pointer); external;
////   extern void __stdcall synthGetLD(void *pthis, float *l, float *r);
was zu
Zitat:

[dcc32 Warnung] main.pas(68): W1011 Text hinter dem abschließenden 'END.' - wird vom Compiler ignoriert
[dcc32 Fehler] main.pas(28): E2065 Ungenügende Forward- oder External-Deklaration: 'dsInit'
[dcc32 Fehler] main.pas(29): E2065 Ungenügende Forward- oder External-Deklaration: 'dsClose'
[dcc32 Fehler] main.pas(30): E2065 Ungenügende Forward- oder External-Deklaration: 'dsGetCurSmp'
[dcc32 Fehler] main.pas(31): E2065 Ungenügende Forward- oder External-Deklaration: 'dsSetVolume'
[dcc32 Fehler] main.pas(32): E2065 Ungenügende Forward- oder External-Deklaration: 'dsTick'
[dcc32 Fehler] main.pas(33): E2065 Ungenügende Forward- oder External-Deklaration: 'dsLock'
[dcc32 Fehler] main.pas(34): E2065 Ungenügende Forward- oder External-Deklaration: 'dsUnlock'
[dcc32 Fehler] main.pas(39): E2065 Ungenügende Forward- oder External-Deklaration: 'synthGetSize'
[dcc32 Fehler] main.pas(40): E2065 Ungenügende Forward- oder External-Deklaration: 'synthIn'
[dcc32 Fehler] main.pas(41): E2065 Ungenügende Forward- oder External-Deklaration: 'synthRender'
[dcc32 Fehler] main.pas(42): E2065 Ungenügende Forward- oder External-Deklaration: 'synthProcessMIDI'
[dcc32 Fehler] main.pas(43): E2065 Ungenügende Forward- oder External-Deklaration: 'synthSetGlobals'
[dcc32 Fehler] main.pas(54): E2065 Ungenügende Forward- oder External-Deklaration: 'synthGetPoly'
[dcc32 Fehler] main.pas(55): E2065 Ungenügende Forward- oder External-Deklaration: 'synthGetPgm'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_CreateThread@24'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_WaitForSingleObject@8'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_SetThreadPriority@8'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_InitializeCriticalSection@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_EnterCriticalSection@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_LeaveCriticalSection@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_DeleteCriticalSection@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_DirectSoundCreate@12'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_CreateEventA@16'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_CloseHandle@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_SetEvent@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_ronanCBInit@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_ronanCBTick@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_ronanCBNoteOn@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_ronanCBNoteOff@4'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_ronanCBSetCtl@12'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_ronanCBProcess@12'
[dcc32 Fehler] main.pas(174): E2065 Ungenügende Forward- oder External-Deklaration: '_ronanCBSetSR@8'
[dcc32 Fataler Fehler] Play.dpr(5): F2063 Verwendete Unit 'main.pas' kann nicht compiliert werden
Misslungen
Verstrichene Zeit: 00:00:00.2
wandel ich die lib mit Coff2OMF um erhalte ich
Zitat:
[dcc32 Fehler] main.pas(59): E2045 Falsches Objektdateiformat: 'C:\Users\Harry Pothead\Desktop\libv2_1.5\dsio.obj'
somit sollte das Format ja erstmal stimmen

Edit: die Umgewandelt lib ist leer also scheint coff2lib hier fehler zu machen

Hat jemand eine Idee?

Geändert von Horst0815 (22. Okt 2015 um 22:18 Uhr)
  Mit Zitat antworten Zitat