From: <ju...@us...> - 2006-08-08 11:47:06
|
Revision: 828 Author: julienq Date: 2006-08-08 04:46:44 -0700 (Tue, 08 Aug 2006) ViewCVS: http://svn.sourceforge.net/urakawa/?rev=828&view=rev Log Message: ----------- Updated Record dialog to work with newer version of asset manager. Added phrase events for recording. Modified Paths: -------------- trunk/urakawa/application/Obi/Obi/Assets/AudioMediaAsset.cs trunk/urakawa/application/Obi/Obi/Dialogs/Record.cs trunk/urakawa/application/Obi/Obi/Obi.csproj trunk/urakawa/application/Obi/Obi/messages.Designer.cs trunk/urakawa/application/Obi/Obi/messages.resx Added Paths: ----------- trunk/urakawa/application/Obi/Obi/Events/Audio/Recorder/PhraseEventArgs.cs Modified: trunk/urakawa/application/Obi/Obi/Assets/AudioMediaAsset.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Assets/AudioMediaAsset.cs 2006-08-08 10:48:17 UTC (rev 827) +++ trunk/urakawa/application/Obi/Obi/Assets/AudioMediaAsset.cs 2006-08-08 11:46:44 UTC (rev 828) @@ -93,6 +93,7 @@ m_SamplingRate = sampleRate; m_FrameSize = (m_BitDepth / 8) * m_Channels; mMediaType = MediaType.Audio; + mClips = new List<AudioClip>(); } else throw new Exception("Audio media of this format is not supported"); Modified: trunk/urakawa/application/Obi/Obi/Dialogs/Record.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Dialogs/Record.cs 2006-08-08 10:48:17 UTC (rev 827) +++ trunk/urakawa/application/Obi/Obi/Dialogs/Record.cs 2006-08-08 11:46:44 UTC (rev 828) @@ -27,6 +27,10 @@ private List<Assets.AudioMediaAsset> mAssets; // the list of assets created while recording + public event Events.Audio.Recorder.StartingPhraseHandler StartingPhrase; + public event Events.Audio.Recorder.ContinuingPhraseHandler ContinuingPhrase; + public event Events.Audio.Recorder.FinishingPhraseHandler FinishingPhrase; + /// <summary> /// The list of assets created. /// </summary> @@ -68,38 +72,40 @@ //phrase marker and volume control are incomplete ArrayList arDevices = new ArrayList(); arDevices = Audio.AudioRecorder.Instance.GetInputDevices(); - - Audio.AudioRecorder.Instance.InitDirectSound(1); - mRecordButton.Text = Localizer.Message("&Recorde"); -// mRecordButton.Text = "&Pause"; - ob_VuMeter.ScaleFactor = 2; - ob_VuMeter.SampleTimeLength = 2000; - ob_VuMeter.UpperThreshold = 150; - ob_VuMeter.LowerThreshold = 100; - Audio.AudioRecorder.Instance.VuMeterObject = ob_VuMeter; - ob_VuMeter.ShowForm(); - Assets.AudioMediaAsset mAudioAsset = new Assets.AudioMediaAsset(mChannels, mBitDepth, mSampleRate); - mAssManager.AddAsset(mAudioAsset); + + Audio.AudioRecorder.Instance.InitDirectSound(1); + mRecordButton.Text = Localizer.Message("record"); + // mRecordButton.Text = "&Pause"; + ob_VuMeter.ScaleFactor = 2; + ob_VuMeter.SampleTimeLength = 2000; + ob_VuMeter.UpperThreshold = 150; + ob_VuMeter.LowerThreshold = 100; + Audio.AudioRecorder.Instance.VuMeterObject = ob_VuMeter; + ob_VuMeter.ShowForm(); + // Assets.AudioMediaAsset mAudioAsset = new Assets.AudioMediaAsset(mChannels, mBitDepth, mSampleRate); + // mAssManager.AddAsset(mAudioAsset); + Assets.AudioMediaAsset mAudioAsset = mAssManager.NewAudioMediaAsset(mChannels, mBitDepth, mSampleRate); Audio.AudioRecorder.Instance.StartListening(mAudioAsset); - timer1.Enabled = true; - } + timer1.Enabled = true; + } private void btnRecordAndPause_Click(object sender, EventArgs e) - { + { // AudioRecorder.Instance.InitDirectSound(mIndex); - Assets.AudioMediaAsset mRecordAsset = new Assets.AudioMediaAsset(mChannels, mBitDepth, mSampleRate); - mAssManager.AddAsset(mRecordAsset); + // Assets.AudioMediaAsset mRecordAsset = new Assets.AudioMediaAsset(mChannels, mBitDepth, mSampleRate); + // mAssManager.AddAsset(mRecordAsset); + Assets.AudioMediaAsset mRecordAsset = mAssManager.NewAudioMediaAsset(mChannels, mBitDepth, mSampleRate); Audio.AudioRecorder.Instance.StopRecording(); timer1.Enabled = false; - //mRecordButton.Text = Localizer.Message("&Record"); + mRecordButton.Text = Localizer.Message("record"); if (Audio.AudioRecorder.Instance.State.Equals(Audio.AudioRecorderState.Idle)) { timer1.Enabled = true; - mRecordButton.Text = Localizer.Message("&Pause"); + mRecordButton.Text = Localizer.Message("pause"); Audio.AudioRecorder.Instance.StartRecording(mRecordAsset); - } + } } private void btnStop_Click(object sender, EventArgs e) @@ -114,10 +120,10 @@ this.Close(); } - - + + private void timer1_Tick(object sender, EventArgs e) { double dMiliSeconds = Audio.AudioRecorder.Instance.CurrentTime; @@ -146,8 +152,8 @@ string sDisplayTime = sHours + ":" + sMinutes + ":" + sSeconds; - mTimeTextBox.Text = sDisplayTime; - + mTimeTextBox.Text = sDisplayTime; + } } } \ No newline at end of file Added: trunk/urakawa/application/Obi/Obi/Events/Audio/Recorder/PhraseEventArgs.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/Events/Audio/Recorder/PhraseEventArgs.cs (rev 0) +++ trunk/urakawa/application/Obi/Obi/Events/Audio/Recorder/PhraseEventArgs.cs 2006-08-08 11:46:44 UTC (rev 828) @@ -0,0 +1,37 @@ +using System; + +namespace Obi.Events.Audio.Recorder +{ + /// <summary> + /// A new phrase is being recorded. Time myst be 0. + /// </summary> + public delegate void StartingPhraseHandler(object sender, PhraseEventArgs e); + + /// <summary> + /// The latest phrase being recorded is updated. Time is the current length of the phrase. + /// </summary> + public delegate void ContinuingPhraseHandler(object sender, PhraseEventArgs e); + + /// <summary> + /// The latest phrase is done. Time is the total length of the phrase. + /// </summary> + public delegate void FinishingPhraseHandler(object sender, PhraseEventArgs e); + + /// <summary> + /// A new phrase to be created. + /// </summary> + class PhraseEventArgs: EventArgs + { + private double mTime; // time of the asset so far + + public double Time + { + get { return mTime; } + } + + public PhraseEventArgs(double time) + { + mTime = time; + } + } +} Modified: trunk/urakawa/application/Obi/Obi/Obi.csproj =================================================================== --- trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-08-08 10:48:17 UTC (rev 827) +++ trunk/urakawa/application/Obi/Obi/Obi.csproj 2006-08-08 11:46:44 UTC (rev 828) @@ -147,6 +147,7 @@ <Compile Include="Events\Project\CommandCreatedEventArgs.cs" /> <Compile Include="Events\Project\StateChangedEventArgs.cs" /> <Compile Include="Events\Strip\ImportAssetEventArgs.cs" /> + <Compile Include="Events\Audio\Recorder\PhraseEventArgs.cs" /> <Compile Include="Events\Strip\SelectedEventArgs.cs" /> <Compile Include="Events\Node\AddedSectionNodeEventArgs.cs" /> <Compile Include="IOUtils.cs" /> Modified: trunk/urakawa/application/Obi/Obi/messages.Designer.cs =================================================================== --- trunk/urakawa/application/Obi/Obi/messages.Designer.cs 2006-08-08 10:48:17 UTC (rev 827) +++ trunk/urakawa/application/Obi/Obi/messages.Designer.cs 2006-08-08 11:46:44 UTC (rev 828) @@ -455,9 +455,9 @@ /// <summary> /// Looks up a localized string similar to &Record. /// </summary> - internal static string Record { + internal static string record { get { - return ResourceManager.GetString("Record", resourceCulture); + return ResourceManager.GetString("record", resourceCulture); } } Modified: trunk/urakawa/application/Obi/Obi/messages.resx =================================================================== --- trunk/urakawa/application/Obi/Obi/messages.resx 2006-08-08 10:48:17 UTC (rev 827) +++ trunk/urakawa/application/Obi/Obi/messages.resx 2006-08-08 11:46:44 UTC (rev 828) @@ -284,7 +284,7 @@ <value>Could not find path to asset directory.</value> <comment>JQ</comment> </data> - <data name="Record" xml:space="preserve"> + <data name="record" xml:space="preserve"> <value>&Record</value> <comment>RecordButtonLabel</comment> </data> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |