The work/function of this DLL is to Create a new voice-log which mixes audio(conversation) of various users connected to my VoIP software into a MP3 file.
Below are my codes, Please go through it and help.
Thanks in advance.
For VoiceLog.h(C/C++ Header)
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the VOICELOG_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// VOICELOG_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef VOICELOG_EXPORTS
#define VOICELOG_API __declspec(dllexport)
#else
#define VOICELOG_API __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/// Create a new voice-log which mixes audio into a MP3 file.
/// @param szTempDir The directory to store temporary files (.wav files)
/// @param szMP3FileName The output path of the MP3 file, e.g.
/// C:\conversation.mp3
/// @param nSecFlushInterval The number of seconds between each time
/// the temporary .wav files are mixed and encoded into MP3-format.
/// @see VL_CloseVoiceLog
VOICELOG_API BOOL VL_CreateVoiceLog(IN LPCSTR szTempDir,
IN LPCSTR szMP3FileName,
IN INT32 nSecFlushInterval);
/// Close the voice-log and finish encoding into the MP3 file.
/// @param bAbort Abort the voice-log and skip final encoding to
/// the MP3 file.
/// @see VL_CreateVoiceLog
VOICELOG_API BOOL VL_CloseVoiceLog(IN BOOL bAbort);
/// Check if voice-logging is currently active.
VOICELOG_API BOOL VL_IsVoiceLogging();
/// Add audio data to the voice-log. Make sure to add the audio
/// data to the voice-log when the person is actually starting
/// to talk since the time of when the audio is added is used as
/// offset. When the person is finished talking call VL_EndStream(.)
/// so the voice-logger knows the person has stopped talking. If
/// VL_EndStream(.) is not called the voice-logger will think the
/// person is constantly talking without pauses.
///
/// @param nStreamID The ID of the stream, e.g. the user's ID.
/// @param nSampleRate The sample rate of the stream being added
/// @param lpStreamData The audio buffer of raw audio data.
/// @param nSampleCount The number of samples in the audio buffer.
/// @see VL_EndStream
VOICELOG_API BOOL VL_AddStreamData(IN INT32 nStreamID,
IN INT32 nSampleRate,
IN CONST SHORT* lpStreamData,
IN INT32 nSampleCount);
/// Stop writing to a specific stream since the person is no longer
/// talking.
///
/// @param nStreamID The ID of the stream, e.g. the user's ID.
/// @see VL_AddStreamData
VOICELOG_API BOOL VL_EndStream(IN INT32 nStreamID);
#ifdef __cplusplus
};
#endif
Calling the function from VB this was what I did.
I placed the code below in the general declaration
Option Explicit Private Declare Function VL_CreateVoiceLog Lib "VoiceLog.dll" (ByVal szTempDir As String, ByVal szMP3FileName As String, ByVal nSecFlushInterval As Integer) As Long
I placed the code below in a commandbox; say CmdRecordConversation. This method "Receive callbacks of audio which has been played" and it will invoke an event.
Private Sub CmdRecordConversation_Click() evoclient1.RegisterTalkingCallback End Sub
Below is the code in the event and this is where I get error message.
Private Sub evoclient1_OnUserAudioData(ByVal nUserID As Long, ByVal nSampleRate As Long, pRawAudio() As Integer, ByVal nSamples As Long)
Dim szTempDir, szMP3FileName As String
Dim FileCountExist As Long
Dim nSecFlushInterval As Integer
nSecFlushInterval = 10
szTempDir = GetSetting(App.EXEName, App.EXEName, "Default Path") & "\"
FileCountExist = filecount(szTempDir) + 1
szMP3FileName = szTempDir & "Conversation.mp3"
If FExists(szMP3FileName) Then
szMP3FileName = szTempDir & "Conversation_" & FileCountExist & ".mp3"
'Start creating mp3 file
VL_CreateVoiceLog szTempDir, szMP3FileName, nSecFlushInterval
Else
VL_CreateVoiceLog szTempDir, szMP3FileName, nSecFlushInterval
End If
End Sub
Attached File(s)
-
VoiceLog.zip (397.47K)
Number of downloads: 146
This post has been edited by GunnerInc: 31 July 2012 - 05:44 PM
Reason for edit:: Removed bigish font size

New Topic/Question
Reply



MultiQuote








|