Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 6f36d51

Browse files
kaustukmakseq
andauthored
Changed the audio cursor width and color to blue (#347)
* changed the audio cursor width and color to blue * changes for configuring cursorwidth and cursorcolor from config.xml Co-authored-by: Max Tkachenko <[email protected]>
1 parent 05afcb9 commit 6f36d51

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

examples/audio_classification/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<View>
22
<Header value="Listen the audio:"></Header>
3-
<Audio name="audio" value="$url"></Audio>
3+
<Audio name="audio" value="$url" cursorcolor="#FF0000" cursorwidth="4"></Audio>
44
<Header value="Select its topic:"></Header>
55
<Choices name="label" toName="audio" choice="single-radio" showInline="true">
66
<Choice value="Politics"></Choice>

examples/audio_regions/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<Choice value="Pop" />
1414
</Choices>
1515
<Header value="Listen the audio:"></Header>
16-
<AudioPlus name="audio" value="$url"></AudioPlus>
16+
<AudioPlus name="audio" value="$url" cursorcolor="#FF0000" cursorwidth="4"/>
1717
<Header>How many instruments in this audio?</Header>
1818
<Number name="overall" toName="audio" defaultValue="2" />
1919
<View visibleWhen="region-selected">

src/components/Waveform/Waveform.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ export default class Waveform extends React.Component {
285285
progressColor: this.state.colors.progressColor,
286286

287287
splitChannels: true,
288+
cursorWidth: this.props.cursorWidth,
289+
cursorColor: this.props.cursorColor,
288290
barHeight: 1,
289291
};
290292

src/tags/object/Audio.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Registry from "../../core/Registry";
1010
import Waveform from "../../components/Waveform/Waveform";
1111
import { ErrorMessage } from "../../components/ErrorMessage/ErrorMessage";
1212
import { AnnotationMixin } from "../../mixins/AnnotationMixin";
13+
import { customTypes } from "../../core/CustomTypes";
1314

1415
/**
1516
* The Audio tag plays a simple audio file. Use this tag for basic audio annotation tasks such as classification or transcription.
@@ -42,6 +43,8 @@ import { AnnotationMixin } from "../../mixins/AnnotationMixin";
4243
* @param {string} name Name of the element
4344
* @param {string} value Data field containing path or a URL to the audio
4445
* @param {string} hotkey Hotkey used to play or pause audio
46+
* @param {string} [cursorwidth=1] - Audio pane cursor width. it's Measured in pixels.
47+
* @param {string} [cursorcolor=#333] - Audio pane cursor color. Color should be specify in hex decimal string
4548
*/
4649

4750
const TagAttrs = types.model({
@@ -51,6 +54,8 @@ const TagAttrs = types.model({
5154
volume: types.optional(types.boolean, false),
5255
speed: types.optional(types.boolean, false),
5356
hotkey: types.maybeNull(types.string),
57+
cursorwidth: types.optional(types.string, "1"),
58+
cursorcolor: types.optional(customTypes.color, "#333"),
5459
});
5560

5661
const Model = types
@@ -118,6 +123,8 @@ const HtxAudioView = ({ store, item }) => {
118123
volume={item.volume}
119124
regions={false}
120125
height={item.height}
126+
cursorColor={item.cursorcolor}
127+
cursorWidth={item.cursorwidth}
121128
/>
122129
<AudioControls item={item} store={store} />
123130
</ObjectTag>

src/tags/object/AudioPlus.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { guidGenerator, restoreNewsnapshot } from "../../core/Helpers";
1414
import { ErrorMessage } from "../../components/ErrorMessage/ErrorMessage";
1515
import { AnnotationMixin } from "../../mixins/AnnotationMixin";
1616
import { SyncMixin } from "../../mixins/SyncMixin";
17+
import { customTypes } from "../../core/CustomTypes";
1718
import { useRef } from "react";
1819
import { useEffect } from "react";
1920
import { isDefined } from "../../utils/utilities";
@@ -42,6 +43,8 @@ import { isDefined } from "../../utils/utilities";
4243
* @param {boolean} [zoom=true] - Whether to show the zoom slider
4344
* @param {string} [hotkey] - Hotkey used to play or pause audio
4445
* @param {string} [sync] object name to sync with
46+
* @param {string} [cursorwidth=1] - Audio pane cursor width. it's Measured in pixels.
47+
* @param {string} [cursorcolor=#333] - Audio pane cursor color. Color should be specify in hex decimal string
4548
*/
4649
const TagAttrs = types.model({
4750
name: types.identifier,
@@ -53,6 +56,8 @@ const TagAttrs = types.model({
5356
showlabels: types.optional(types.boolean, false),
5457
showscores: types.optional(types.boolean, false),
5558
height: types.optional(types.string, "128"),
59+
cursorwidth: types.optional(types.string, "1"),
60+
cursorcolor: types.optional(customTypes.color, "#333"),
5661
});
5762

5863
const Model = types
@@ -321,6 +326,8 @@ const HtxAudioView = ({ store, item }) => {
321326
volume={item.volume}
322327
regions={true}
323328
height={item.height}
329+
cursorColor={item.cursorcolor}
330+
cursorWidth={item.cursorwidth}
324331
/>
325332

326333
<AudioControls item={item} store={store} />

0 commit comments

Comments
 (0)